Repository navigation
Tighten the CLI Usage Gate, Share Its Status Parser, and Fix the Windows Decode Probe - #2956
Conversation
Declare every entry point the gate runs without arguments in NO_REQUIRED_ARGUMENT, so an entry point declared nowhere fails instead of passing on a warning followed by a missing-argument stop. hub-fetch-run.py takes a required hub path but reads a leading flag first, so it is declared in REFUSES_A_LEADING_FLAG. Move the porcelain status parsing tree_state() carried into carry.py as git_status_records(), with an ignored option and (status, path) pairs, and keep git_status_paths() as a projection of it. State the gate's three stricter requirements in CODESTYLE.md's argument rule and regenerate the Skills that include it. Let the cp1252 probe in test_prose_lint.py see a decode error raised in subprocess's Windows reader thread, which it missed, skipping the whole UTF-8 decode class on Windows and printing an unhandled thread traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2956 +/- ##
===========================================
+ Coverage 59.96% 60.02% +0.06%
===========================================
Files 17 17
Lines 8778 8784 +6
===========================================
+ Hits 5264 5273 +9
+ Misses 3514 3511 -3
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:
|
There was a problem hiding this comment.
🟡 Changes recommended
The CLI gate can accept a refusal that names a different flag instead of the one it passed.
1 open finding
What changed in this PR
This PR tightens the CLI usage gate and its documented contract, shares Git status parsing with the gate, and fixes the Windows decode probe.
Changes:
- Declare how each CLI entry point handles an unknown flag.
- Share status parsing between
carry.pyand the gate, with parser tests. - Update the decode probe and regenerate the CLI rules in the distributed Skills.
| File | Description |
|---|---|
tests/test_prose_lint.py |
Captures reader-thread decode errors. |
tests/test_cli_usage.py |
Adds entry-point declarations and uses the shared parser. |
tests/test_carry.py |
Tests status records and parser failures. |
scripts/carry.py |
Exposes status records alongside paths. |
CODESTYLE.md |
Clarifies CLI help and refusal requirements. |
.github/skills/shell-codestyle/SKILL.md |
Updates generated shell guidance. |
.github/skills/python-codestyle/SKILL.md |
Updates generated Python guidance. |
.claude-plugin/fleet-skills/skills/shell-codestyle/SKILL.md |
Updates distributed shell guidance. |
.claude-plugin/fleet-skills/skills/python-codestyle/SKILL.md |
Updates distributed Python guidance. |
.claude-plugin/fleet-skills/.source-digests/shell-codestyle |
Refreshes the shell source digest. |
.claude-plugin/fleet-skills/.source-digests/python-codestyle |
Refreshes the Python source digest. |
.agents/skills/shell-codestyle/SKILL.md |
Updates source shell guidance. |
.agents/skills/python-codestyle/SKILL.md |
Updates source Python guidance. |
🧠 Review effort: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
…ps, and the Refusal Field Wording to Main (#2965) - #2963 makes `gh-write-guard` read each push refspec's own operation, so a `+src` forces and a `:dst` deletes only its own branch while `--force` and `--delete` reach every refspec, and every operation, force and delete included, is checked against `pull_request`. A git command under an `include.path` or `includeIf.<condition>.path` override whose subcommand is not a known git command now denies, since the included file may alias it to a push. A separator fused with a redirection (`;<`, `&&<`, `|<` and similar) is read both ways, so the next command's words no longer read as the push's refspecs. A differential against the previous guard found every allow flip in the intended per-refspec class and none under a rule set holding `pull_request`. The known new over-denials are listed in that pull request, and the fixed-prefix branch pattern case is #2964 - #2956 tightens the CLI usage gate: `tests/test_cli_usage.py` declares the entry points that need no argument and fails one declared nowhere, `CODESTYLE.md` "Command-Line Arguments" states the gate's stricter reading of help and unknown-argument refusals, `scripts/carry.py` shares one porcelain status parser with the gate, and the Windows UTF-8 decode probe in `tests/test_prose_lint.py` now sees the reader thread's exception - #2955 records the attached `-c<name>=<value>` / `-C<dir>` git option disproof in the Disproved Claims ledger and states in `scripts/README.md` when the digest's `refusal=` field and `wait`'s exit code differ Closes #2941 Closes #2946 Closes #2947 Closes #2948 Closes #2949 Closes #2951 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Summary
Four follow-ups to the CLI usage gate, for #2946, #2947, #2948, and #2949.
UnicodeDecodeErrorcomes fromlocale_patch_bites()intests/test_prose_lint.py, the probe whose call deliberately names no encoding, so addingencoding=was not the fix. On Windowscommunicate()decodes in a reader thread, so the error never reached the probe'sexcept. The probe returned False, and everyTestGitOutputDecodesAsUtf8case skipped on the one platform the class exists for. The probe now records the reader thread's exception throughthreading.excepthook, which also stops the unhandled traceback. Every other text-mode call undertests/already names an encoding, whichtests/test_tooling_encoding.pyenforces.scripts/carry.pygainsgit_status_records(root, *, ignored=False), which returns(status, path)pairs and refuses malformed or incomplete records as before.git_status_paths()is now a projection of it, and the CLI gate'stree_state()calls it.tests/test_carry.pycovers status pairing, the ignored option, rename order, and each refusal.tests/test_cli_usage.pydeclaresNO_REQUIRED_ARGUMENT. Each member was checked by reading its parser. The gate fails an entry point declared nowhere, and also a stale or duplicate declaration.catalog/snippets/hub-fetch-run.pytakes a required hub path but refuses a leading flag before reading it, so it fits neither set. It is declared in a one-entryREFUSES_A_LEADING_FLAGwith that reason. The module docstring now describes the declarations.CODESTYLE.md"Command-Line Arguments" states the gate's requirements: the same help text for-hand--helpon stdout, opening on a usage line that names the script, and a refusal that names the argument as an unknown or unrecognized option, argument, flag, or parameter. PowerShell's own binder refusal also counts. The gate'sREFUSED_AS_OPTIONnow accepts exactly that set. Before this change it accepted only "unrecognized argument/option". The python-codestyle and shell-codestyle Skills are regenerated.Verification
OPERATIONS.md"Local Verification", including the unit suite (2720 tests OK),spec/validate.py,build_dist.py --check,repo_gate.py --check eoland--check eol-coverage, both prose invocations, a--diffrun with and withoutsentence-length, anddocker_lint.py. All passed.local-strict-reviewpasses. The first raised five findings, all fixed in 1a8640c. The second raised none.🤖 Generated with Claude Code