Repository navigation
Add Test and Parser Rules and Run Hub Scripts Through uv - #3409
Conversation
Implements Decision (ptr727, 2026-10-23) on #3391, follow-ups to item 1: "tests to tests and that should be consistent for the fleet to have tests and keep them in tests, no hand written parser when a field tested and maintained versions readily exists". CODESTYLE.md General gains "Parsing Structured Formats", and the Python section gains "Tests and Script Dependencies": tests live under tests/ with at most a smoke --selftest left in the script, and a hub-hosted standalone script declares a third-party dependency in PEP 723 inline metadata and runs as `uv run --script`. The python-codestyle skill carries the Python subsection as a generated include. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements Decision (ptr727, 2026-10-23) on #3391, follow-ups to item 1: "tests to tests and that should be consistent for the fleet to have tests and keep them in tests, no hand written parser when a field tested and maintained versions readily exists". Callers of spec/audit.py, the prose gate, and scripts/pr_review.py run them as `uv run --no-project --script`, so a later PEP 723 block in any of them needs no caller change. `--no-project` is required today: a script with no block run as plain `uv run --script` inside a checkout syncs the enclosing project, writing a uv.lock and a .venv. The prose-gate action sets up uv itself, the hub pre-commit hook reports a missing uv as the gate not running, the host menus gain a uv helper for the audit action, and the agent-safety installer allows the uv spelling of the review loop beside the python3 one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements Decision (ptr727, 2026-10-23) on #3391, follow-ups to item 1: "tests to tests and that should be consistent for the fleet to have tests and keep them in tests, no hand written parser when a field tested and maintained versions readily exists". The skills that print a scripts/pr_review.py or spec/audit.py command line print `uv run --no-project --script`, and name the matching installer allow rule. Command text only, mirrors regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-parsers-uv-script # Conflicts: # .claude-plugin/fleet-skills/.source-digests/pr-review-conduct
The prose-gate action reads its own path and pin before the nested setup-uv step, so neither can name that action instead. The rule text drops its history and counts and names a tests/ directory rather than the repository root's. The parser rule reaches the Python and shell skills as an include. GOVERNANCE.md, the agent-safety README, and the uv host-tool entry stop asserting what the switch made false, and the pre-commit hook test skips without uv and no longer copies the shim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The action's check step reads its path and pin from the locate step's outputs, so the harness runs the locate step first and feeds its outputs in, and skips where uv is absent. The hub pre-commit hook drops its uv probe, since the run itself is the check per CODESTYLE.md "Operations and Failure Messages". Two long sentences this branch edited are split. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 33 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🔵 Needs a closer look
The broad cross-platform execution and generated-skill changes, together with an unresolved documentation nit, warrant final human review.
No open issues 🎉
What changed in this PR
This pull request standardizes execution of hub-hosted scripts through uv run --no-project --script, adds coding rules for structured parsing, test placement, and script dependencies, and updates related CI, hooks, host tooling, documentation, permissions, tests, and generated skill distributions.
Changes:
- Adds parsing and Python test/dependency rules to
CODESTYLE.mdand generated skills. - Routes prose gates, audits, hooks, and review-loop commands through
uv. - Updates host menus, Claude permissions, host-tool metadata, tests, documentation, and generated skill digests.
| File | Reviewed change |
|---|---|
tests/test_prose_lint.py |
Tests the prose action’s locate-then-run flow and skips when uv is unavailable. |
tests/test_pre_commit_hook.py |
Updates hook fixtures for the uv-backed prose gate and skips without uv. |
spec/host-tools.json |
Documents uv as a runner for hub scripts. |
scripts/README.md |
Updates audit and review-loop commands to use uv. Nit (1 vote): the introductory pre-commit documentation still names the old python3 scripts/prose_lint.py entry point. |
RESYNC.md |
Updates audit and cleanup procedure commands. |
OPERATIONS.md |
Updates local audit commands and operational guidance. |
host-setup/menu.sh |
Adds the Linux uv script helper and uses it for audits. |
host-setup/menu.ps1 |
Adds the PowerShell uv script helper and uses it for audits. |
host-setup/agent-safety/claude/README.md |
Documents the additional review-script permission rule. |
host-setup/agent-safety/claude/install.py |
Installs the uv-based review-loop allow rule. |
GOVERNANCE.md |
Updates hook descriptions and pinned prose-gate reproduction commands. |
docs/host-setup.md |
Documents uv as a hub-script runner. |
CODESTYLE.md |
Adds structured parsing and test/script dependency rules. |
.husky/pre-commit |
Runs the hub prose gate through uv. |
.github/skills/shell-codestyle/SKILL.md |
Adds generated structured-format parsing guidance. |
.github/skills/resync-a-repo/SKILL.md |
Updates generated resync commands. |
.github/skills/repo-worktree/SKILL.md |
Updates generated cleanup commands. |
.github/skills/python-codestyle/SKILL.md |
Adds generated Python testing, dependency, and parsing guidance. |
.github/skills/pr-review-conduct/SKILL.md |
Updates generated post-merge cleanup commands. |
.github/skills/merge-and-release/SKILL.md |
Updates generated release cleanup commands and permissions. |
.github/skills/drive-pr/SKILL.md |
Updates generated pull-request cleanup commands and permissions. |
.github/skills/backlog-burndown/SKILL.md |
Updates generated backlog cleanup commands. |
.github/skills/audit-a-repo/SKILL.md |
Updates generated audit and cleanup commands. |
.github/actions/validate/action.yml |
Runs the unclassified-character report through uv. |
.github/actions/prose-gate/action.yml |
Locates the action before setup, installs uv, and runs the gate through it. |
.claude-plugin/fleet-skills/skills/shell-codestyle/SKILL.md |
Regenerates the Claude shell skill distribution. |
.claude-plugin/fleet-skills/skills/resync-a-repo/SKILL.md |
Regenerates the Claude resync skill distribution. |
.claude-plugin/fleet-skills/skills/repo-worktree/SKILL.md |
Regenerates the Claude worktree skill distribution. |
.claude-plugin/fleet-skills/skills/python-codestyle/SKILL.md |
Regenerates the Claude Python skill distribution. |
.claude-plugin/fleet-skills/skills/pr-review-conduct/SKILL.md |
Regenerates the Claude review-conduct skill distribution. |
.claude-plugin/fleet-skills/skills/merge-and-release/SKILL.md |
Regenerates the Claude release skill distribution. |
.claude-plugin/fleet-skills/skills/drive-pr/SKILL.md |
Regenerates the Claude drive-pr skill distribution. |
.claude-plugin/fleet-skills/skills/backlog-burndown/SKILL.md |
Regenerates the Claude backlog skill distribution. |
.claude-plugin/fleet-skills/skills/audit-a-repo/SKILL.md |
Regenerates the Claude audit skill distribution. |
.claude-plugin/fleet-skills/.source-digests/shell-codestyle |
Updates the generated shell skill digest. |
.claude-plugin/fleet-skills/.source-digests/resync-a-repo |
Updates the generated resync skill digest. |
.claude-plugin/fleet-skills/.source-digests/repo-worktree |
Updates the generated worktree skill digest. |
.claude-plugin/fleet-skills/.source-digests/python-codestyle |
Updates the generated Python skill digest. |
.claude-plugin/fleet-skills/.source-digests/pr-review-conduct |
Updates the generated review-conduct skill digest. |
.claude-plugin/fleet-skills/.source-digests/merge-and-release |
Updates the generated release skill digest. |
.claude-plugin/fleet-skills/.source-digests/drive-pr |
Updates the generated drive-pr skill digest. |
.claude-plugin/fleet-skills/.source-digests/backlog-burndown |
Updates the generated backlog skill digest. |
.claude-plugin/fleet-skills/.source-digests/audit-a-repo |
Updates the generated audit skill digest. |
.agents/skills/shell-codestyle/SKILL.md |
Updates the authored shell skill source with parser guidance. |
.agents/skills/resync-a-repo/SKILL.md |
Updates authored resync audit and cleanup commands. |
.agents/skills/repo-worktree/SKILL.md |
Updates authored cleanup commands. |
.agents/skills/python-codestyle/SKILL.md |
Adds authored Python testing, dependency, and parsing guidance. |
.agents/skills/pr-review-conduct/SKILL.md |
Updates authored post-merge cleanup commands. |
.agents/skills/merge-and-release/SKILL.md |
Updates authored release cleanup commands and permissions. |
.agents/skills/drive-pr/SKILL.md |
Updates authored pull-request cleanup commands and permissions. |
.agents/skills/backlog-burndown/SKILL.md |
Updates authored backlog cleanup commands. |
.agents/skills/audit-a-repo/SKILL.md |
Updates authored audit and cleanup commands. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3409 +/- ##
========================================
Coverage 81.61% 81.61%
========================================
Files 19 19
Lines 10235 10235
========================================
Hits 8353 8353
Misses 1882 1882
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The hub pre-commit hook runs the action's prose_lint.py through uv, so scripts/README.md names that command, and both it and the hook's comment carry the diff-scoped run's measured 0.15 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Answers to the Copilot round on
|
|
@coderabbitai review |
|
…#3417) ## Summary Promotes the pull requests merged into develop since release 2.0.1148. Each carries a maintainer decision of 2026-10-23 recorded on #3391. - [#3407](#3407): rewrites the write guard as a small lexer of 1,653 lines. It fails open under its stated threat model and fails closed only on requirement 4. A test holds it at 2,500 lines or fewer (item 1). - [#3409](#3409): adds CODESTYLE rules. Tests live in `tests/`, and a maintained parser replaces a hand-written one. A script declares its dependencies in PEP 723 metadata and runs as `uv run --no-project --script`. It switches the callers to that spelling and adds a managed allow rule to the agent-safety installer (item 1 follow-ups). - [#3410](#3410): splits `pr_review.py` into the gate, a Copilot adapter reading its vocabulary from JSON, and `pr_cleanup.py`. It collapses the exit codes and adds `tests/requirements.txt` and the CI runners. - [#3411](#3411): rebuilds the prose gate on Pygments and markdown-it-py, with its vocabulary and exemptions in `prose-gate.json` and a repo-local override. - [#3415](#3415): holds the Merge Gate on a part of a Copilot review body the tooling cannot place. The hold lasts until an owner acknowledges it with outcomes (item 4 follow-up). - [#3416](#3416): moves the audit self-test to `tests/` and reads YAML and Markdown with PyYAML and markdown-it-py. It adds the check registry `spec/checks.json` and splits out `spec/audit_markdown.py`. It shares `spec/carried_text.py` with carry, `build_dist`, and `canonical_review`. - [#3418](#3418): fixes the findings this promotion's first review round raised on the content above. It aligns the drive-pr escalation line with pr-review-conduct and names `tests/requirements.txt` where the prose said the tests need nothing installed. It also restores the `uvx` launcher in a release-guard assertion. - [#3419](#3419): fixes the finding the second review round raised. The Copilot adapter's prose path reads a coverage count longer than `COUNT_DIGITS` as `unknown`, sharing `count_state` with the marker path. - [#3420](#3420): fixes the finding the third review round raised, under the maintainer's ruling. `hub_fetch_run.py` falls back to `git ls-remote` where the API lookup of `main` fails, so the prose gate and its data are fetched at one commit. Where neither lookup resolves, the documented fail-open against `main` stays. - [#3421](#3421): fixes the findings the fourth review round raised. The Copilot adapter reads a finding count longer than `COUNT_DIGITS` as unknown rather than zero, through one length check and one None-aware sum. The host-setup gates-and-tests row says `uv` installs the test requirements. Closes #3408 ## Constituent coverage The Copilot rounds on this promotion ran at Lite effort and state no full coverage, so Merge Gate item 2 rests on the promotion case. Each change this promotion carries had full coverage on its own pull request into develop, at its merged head: | Pull request | Merged head | Coverage | | --- | --- | --- | | [#3407](#3407) | `9efc1002` | attested local pass, `coverage=local` | | [#3409](#3409) | `bcc7a9e1` | attested local pass, `coverage=local` | | [#3410](#3410) | `00cec726` | attested local pass, `coverage=local` | | [#3411](#3411) | `bd128136` | attested local pass, `coverage=local` | | [#3415](#3415) | `5be9db87` | attested local pass, `coverage=local` | | [#3416](#3416) | `b914f083` | attested local pass, `coverage=local` | | [#3418](#3418) | `3a86cb51` | attested local pass, and a Copilot table naming exactly the changed files, `coverage=table` | | [#3419](#3419) | `6e7b868d` | attested local pass, and a Copilot table naming exactly the changed files, `coverage=table` | | [#3420](#3420) | `9b492290` | attested local pass, and a Copilot table naming exactly the changed files, `coverage=table` | | [#3421](#3421) | `743010e6` | attested local pass, and a Copilot table naming exactly the changed files, `coverage=table` | 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Implements Decision (ptr727, 2026-10-23) on #3391, follow-ups to item 1. In the maintainer's words: "tests to tests and that should be consistent for the fleet to have tests and keep them in tests, no hand written parser when a field tested and maintained versions readily exists".
What Changes
Rules (CODESTYLE.md)
tests/directory, never inside the production file it tests. A script may keep a smoke--selftest.uv run --no-project --script <path>.Callers Switched to
uv run --no-project --script.github/actions/prose-gate/action.yml(carried, runs in every fleet repository):astral-sh/setup-uvstep, with the same SHA and version comment the other actions use.uses:cannot change what the check step reads..github/actions/validate/action.yml: the unclassified-character report..husky/pre-commit: the hub's prose gate.host-setup/menu.sh(hub_uv_script) andhost-setup/menu.ps1(Invoke-HubUvScript): the audit action.GOVERNANCE.md"Running the Linters Locally": the pinned-copy reproduction command. The section also no longer says the hub hook runsscripts/prose_lint.py.OPERATIONS.md,RESYNC.md,scripts/README.md: the audit and review-loop command lines.drive-pr,merge-and-release,repo-worktree,pr-review-conduct,resync-a-repo,backlog-burndown,audit-a-repo.host-setup/agent-safety/claude/install.pyand its README: a managed allow ruleBash(uv run --no-project --script scripts/pr_review.py:*), added beside the existingpython3rule. Without it,cleanup,reply, and the other subcommands the skills now print would lose the auto-mode allowance the skills cite.docs/host-setup.mdandspec/host-tools.json: uv's stated role now includes running hub scripts.tests/test_prose_lint.py: its action harness runs both steps in order. It andtests/test_pre_commit_hook.pyskip where uv is absent.The three scripts themselves are untouched. None gains a metadata block here.
Why
--no-projectThe brief assumed plain
uv run --scriptis safe on a script with no metadata block. Measured from this worktree with uv 0.13.5, it is not. Run inside a checkout that has apyproject.toml, it syncs the enclosing project: it wroteuv.lockand.venv/into the worktree, and in a downstream repository with a real[project]it would install that project. With--no-projectit writes nothing. Once a script carries a block, the flag is harmless. A constructed check outside the repository confirmed both cases.--helpfrom the worktree, first line of each:Not Switched, and Why
catalog/snippets/hub_fetch_run.pyand thescripts/prose_lint.pyshim runprose_lint.pyin-process throughrunpy, which ignores an inline block. Every downstream hook and VS Code prose task, and the shim's own callers, go through them.tests/test_cli_usage.pyrecordsuvas a forbidden--helpeffect, so a delegating shim fails there, as measured on this branch.prose_lint.pya dependency..github/actions/validate/action.ymluvx coverage@latest run ... spec/audit.py --selfteststays as is. The form that carries a script's dependencies into coverage,uvx --with-requirements <script> coverage run <script>, refuses a script with no metadata block (error: ... does not contain inline script metadata, measured). It can only be adopted together with the block.docs/reusable-workflows.mdrun records,docs/token-efficiency-plan.md, AUDIT.md's linkedspec/audit.pyreferences) andspec/audit.py's own usage docstring are left alone. The docstring belongs to the follow-up that edits that script.Windows
Verified:
menu.ps1parses with zero errors underpwshon Linux, and PSScriptAnalyzer throughscripts/docker_lint.pyis clean.Not verified: no run on a Windows host.
Invoke-HubUvScriptcallsuvdirectly rather than through thepylauncher, as the hooks' Windows path needs. The hub.husky/pre-commitcallsuvdirectly on every platform, so Git Bash on Windows reaches it the same way. The Windows unittest leg intest-pull-request.ymlalready sets up uv.Verification
Those four lines are wanted, so this pull request carries the
commentslabel:With the label's flag:
Other checks:
python3 scripts/docker_lint.py:RESULT success: 7 linter(s) completed, covering actionlint, markdownlint, cspell, shellcheck, shfmt, PSScriptAnalyzer, and editorconfig-checker. After the last action edit,--linter actionlint --linter shellcheckagain gaveRESULT success: 2 linter(s) completed.Ran 3090 tests ... OK (skipped=8). After the review fixes,test_prose_lint.py,test_pre_commit_hook.py, andtest_cli_usage.pywere re-run, eachOK.spec/audit.py --selftestPASS,spec/workflow_reuse.py --selftestOK, andgh-write-guard.py --selftestPASS.ruff check,ruff format --check, andmypy: clean.Local Review
Three
local-strict-reviewpasses, each recorded and covering this head. Pass one raised 12 findings and pass two raised 4. Both rounds were fixed in 754ba17 and 2f82ed9, apart from the items below. Pass three raised none.hub_uv_scriptwithhub_python.hub_pythondoes not do this job, and a launcher-parameterized helper would be no smaller.command -v uvandGet-Command uvprobes. They mirrorhub_pythonandInvoke-HubPythonin the same files. The class, every menu helper's probe, is its own change. The hub pre-commit hook's probe was removed instead, per CODESTYLE.md "Operations and Failure Messages".Pre-Existing Findings, Not Filed
OPERATIONS.md:7,scripts/README.md:243,GOVERNANCE.md:293,host-setup/agent-safety/claude/README.md:25,backlog-burndownSKILL.md:287,pr-review-conductSKILL.md:284, andresync-a-repoSKILL.md:34. They exceed the opt-in 25-wordsentence-lengthcap.spec/audit.py:24: the usage docstring still printspython3 spec/audit.py, which still runs.🤖 Generated with Claude Code