Repository navigation
park and resume refuse a flag given without its value in their own words, exit 2, instead of bash's ${2:?} message and exit 1 - #14
Conversation
…n words, exit 2, instead of bash's `${2:?}` message and exit 1
Every value-taking flag — park's --lane, --repo, --name/--project; resume's
--repo, --workspace, --org, --name/--project — used `${2:?…}`, which on a
missing value prints bash's message ("status: line 855: 2: --repo needs a
value") and exits 1. For park that reads like `make park`'s own exit; for
resume, whose non-zero exit means "something was refused", it is a refusal
with no line saying what. `status` already refuses these with exit 2 (its 1
means findings); the verbs now do the same, each message saying what the
value is. Nothing runs, clones or is written before the refusal.
Nine parametrized tests, one per flag per command: exit 2, the REFUSED line,
bash's message not leaked, the estate untouched, ~/.agents absent. Suite 240
-> 249. The shared resolver block is untouched.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 1 day and 15 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's GuideUpdates File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
There was a problem hiding this comment.
🟡 Changes recommended
Explicitly empty flag values must be rejected and covered by tests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR standardizes missing-value handling for park and resume, returning clear REFUSED: messages with exit status 2.
Changes:
- Add command-level validation for value-taking flags.
- Add parametrized tests for refusal output, status, and side effects.
File summaries
| File | Summary |
|---|---|
tests/test_park_resume_commands.py |
Adds missing-value coverage, but does not test explicitly empty values. Moderate finding (1 vote). |
resume |
Empty --repo, --workspace, --org, and --name/--project values remain accepted. Moderate finding (3 votes). |
park |
Empty --lane, --repo, and --name/--project values remain accepted. Moderate finding (3 votes). |
Review details
Suppressed comments (6)
park:894
- This count-only guard accepts
park --repo "", so the flag clearsREPO_SLUGand is treated as absent by the later resolver; from inside an estate this can park the current directory instead of reporting a missing value. Reject an empty$2as well as a missing argument.
[ $# -ge 2 ] || die "--repo needs a value: <owner>/<name>, or any url spelling of one."
park:902
- An explicitly empty value is accepted here, and
park --name ""leavesNAMEempty so control falls through to the no-name walk-up, potentially parking the estate around the current directory. The previous${2:?…}rejected this case; require$2to be non-empty before assigning it.
[ $# -ge 2 ] || die "$1 needs a value: one estate folder name under your projects directory."
resume:769
- This accepts
resume --workspace ""and silently treats the workspace flag as unset; when a config already exists, the run proceeds using that config instead of refusing the explicitly empty value. Preserve the old${2:?…}contract by checking that$2is non-empty before assigning it.
[ $# -ge 2 ] || die "--workspace needs a value: <owner>/<name> of your private workspace repository."
resume:772
- An explicit empty argument is accepted by this count-only guard, so
resume --org ""is indistinguishable from omitting--organd does not produce the promised missing-value refusal. Require a non-empty$2before settingORG_WANTED.
[ $# -ge 2 ] || die "--org needs a value: the organisation whose manifest to read."
resume:775
resume --name ""passes this arity-only check, leavesNAMEempty, and then enters the no-name path that resumes the estate around the current directory. That is a behavioral regression from${2:?…}and can act on an estate the caller did not name; reject an empty$2too.
[ $# -ge 2 ] || die "$1 needs a value: one estate folder name under your projects directory."
tests/test_park_resume_commands.py:1407
- The new parametrization only invokes each flag with no following argv entry. The replaced
${2:?…}also rejected an explicitly empty value, so add empty-string cases (and assertions for the same refusal) to catch the regression where these count-only guards accept""and may run or select an estate.
@pytest.mark.parametrize("command, flag", [
(PARK, "--lane"), (PARK, "--repo"), (PARK, "--name"), (PARK, "--project"),
(RESUME, "--repo"), (RESUME, "--workspace"), (RESUME, "--org"),
(RESUME, "--name"), (RESUME, "--project"),
], ids=lambda v: v.name if isinstance(v, Path) else v)
def test_a_flag_without_its_value_is_refused_in_the_commands_own_words(
home, command, flag):
"""`${2:?…}` was bash's message and bash's exit 1 — a status neither verb
means anything by, and one a wrapper reads as `make`'s. Now the refusal
is the command's own, exit 2, and it says what the value is; and nothing
ran, cloned or was placed before it was raised."""
probe_project(home / "projects", "Atlas")
result = run(command, flag, home=home)
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # its 1 is "findings"; here, a typo must not read like `make park`'s own | ||
| # exit). | ||
| --lane) | ||
| [ $# -ge 2 ] || die "--lane needs a value: the lane recorded in the WIP commit subject." |
| # that exits non-zero is read as "something was refused", so the refusal | ||
| # has to be one this command wrote and a person can act on. | ||
| --repo) | ||
| [ $# -ge 2 ] || die "--repo needs a value: <owner>/<name>, or any url spelling of one." |
… two arms Copilot's review of #14 never had in front of it — so `status --repo ""` no longer reports the estate around the cwd These two were never ${2:?…}: they have been [ $# -ge 2 ] since status's first commit (fbf6f11), so the review that caught the arity-only check in park and resume — where it had just replaced ${2:?…} — never saw this file, and it kept the hole the other two closed in 8320472. It is the same hole: an empty value is read further down as "was this given at all?", so status --repo "" exited 0 having fallen past the --repo branch of the resolver into the walk-up and reported the estate around the cwd as though the flag had never been typed. A read-only report of the wrong estate is worse than a refusal, not better — nothing was changed, so nobody looks twice. Both arms now ask [ $# -ge 2 ] && [ -n "$2" ] and refuse in the words they already used; the shared resolver and expand_home are untouched, byte for byte. Three more cases in test_refusals_read_nothing, one per flag spelling, run from INSIDE the estate so the walk-up is there to be fallen back to: exit 2, the command's own message, an empty stdout, and that test's own "a refusal read nothing" over all six results. PR #17. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…rds as one given none, so `--lane ""` no longer parks with the lane dropped and `--repo ""` no longer falls back to the walk-up The follow-up #14 owed to Copilot, whose review posted one minute after that PR merged: `${2:?…}` rejected an unset OR empty value, the `[ $# -ge 2 ]` that replaced it only checks that an argument slot exists, and an empty value was read further down as "was this given at all?", so `park --lane ""` ran `make park` with the lane silently gone from the WIP commit subject, `--repo ""` fell past the `--repo` branch of the resolver into the walk-up, and `resume --workspace ""` on a machine with a config skipped the never-silently-replaces-an-existing-config check. All nine value-taking arms across the three commands now ask `[ $# -ge 2 ] && [ -n "$2" ]` and refuse in the same words as before, exit 2 — `status`'s two were arity-only from its first commit rather than `${2:?}`, which is why no review had them in front of it, and `status --repo ""` reported the estate around the cwd. Twelve parametrized cases run from inside an estate so the walk-up is there to be fallen back to (against main, park's fail at exit 0 with `ARGS=[]`, resume's at exit 2 with the wrong refusal, status's at exit 0 with a report), and a hygiene test reads the three files as text and holds the whole guard within three lines above every line that takes `$2`, nine of them, so the arity-only arm cannot ship a third time. A caller passing an empty variable is refused now; `${LANE:+--lane "$LANE"}` is the spelling that passes the flag only with a value. A value beginning with `-` is still accepted, as under `${2:?}`, and is reported for a ruling, not fixed. Suite: 261 passed, 0 skipped. PR #17 Co-Authored-By: Claude Fable 5.1 <[email protected]>
… Atlas --lane --dry-run` no longer parks with the lane set to `--dry-run` — and `--flag=value` is the spelling that gives a `-`-led value back, read through one `flag_value` held byte-identical in `park`, `resume` and `status` Two commits, the second the fix round of this branch's independent review. The two halves of the first are ONE commit because neither is safe alone. THE HOLE, and what it cost. Every value-taking arm tested `[ $# -ge 2 ] && [ -n "$2" ]`, which asks whether a second argument EXISTS and whether it is non-empty and never what it HOLDS — so `park Atlas --lane --dry-run` ran a REAL park with the lane set to `--dry-run`: the flag a person typed was swallowed as a value, `--dry-run` itself never took effect, and the only sign was a WIP commit subject labelled with it. PR #17 named the hole and left it open; this is the ruling made against something concrete, and if it goes the other way the whole of it is one revert. Proved again on this base, in a temp estate with a probe Makefile, against origin/main's OWN three commands: `park Atlas --lane --dry-run` printed `make park ARGS='--lane --dry-run'` and RAN it, exit 0; `resume Atlas --org --dry-run` went past the rehearsal it was asked for and on to the workspace record, which on a machine that has one is a clone; `status --name --fetch` fetched nothing and refused about an estate named `--fetch`. After: each is `REFUSED: <flag> needs a value: …`, exit 2, from the argument loop with an EMPTY stdout, and the refusal's own sentence names the spelling that does take such a value. THE TWO HALVES ARE ONE COMMIT because refusing `-*` alone takes a value away with nowhere to put it, and the refusal's words name the `=` spelling as the exit, so the exit has to exist the moment the refusal does. All nine value-taking arms — `park`'s `--lane`, `--repo`, `--name | --project`; `resume`'s `--repo`, `--workspace`, `--org`, `--name | --project`; `status`'s `--repo`, `--name | --project`, none of them in the shared estate resolver — read their value through `flag_value`, a new function held BYTE-IDENTICAL in the three files the way `expand_home` already is, and OUTSIDE that block for the reason its own header gives: the resolver answers "which estate is this", and this answers "did this flag get a value". It asks the arity question #14 asked, the emptiness question #17 added, and one more: a next argument beginning with `-` is a flag, and nothing here swallows the next word whatever it is. Each arm keeps its own words and its own `die` at exit 2; the `-`-led refusal adds one sentence naming the spelling that does take such a value, asserted per flag so a hint cannot name the wrong one. `--flag=value` takes whatever follows the FIRST `=` and asks nothing about it, so `--lane=--weird` and `--repo=https://…` both arrive whole; `--flag=` is an empty value and is refused as #17 refuses `""`. `park Atlas --lane=--dry-run --dry-run` gives `ARGS='--dry-run --lane --dry-run'` — the rehearsal flag and the `-`-led lane both through — and `status --name=--fetch` is read as a NAME, refused as "no estate named '--fetch'" and not as a flag. THE STANDARD'S OWN PYTHON HAS ALWAYS DONE THIS: openRepoShape's `scripts/repo_shape.py` (`checked_value`, "ARGUMENT INJECTION IS THE THREAT … A value that begins with `-` is therefore refused outright") and `setup-project.py` refuse a `-`-led value, and their argparse entry points take `--flag=value` for free; the standard's bash front door, `openRepoShape --org`, does not yet — `ORG="${2:?--org needs a value}"`, no `=` arm, still so at the pinned `ba14e1d` — and that is a pull request THERE, then a pin bump here. Each `--help` gains one line for the `=` spelling and nothing else. Tests: eighteen parametrized command cases across `park` and `resume` (nine flags, a `-`-led value refused with nothing run, the `=` form byte-for-byte the same run as the spaced one, `--flag=` refused), plus `status`'s own three flags in both shapes, `park`'s lane case end to end, `resume --workspace=` / `--org=` doing the work those flags name rather than being echoed, and two hygiene tests. Suite at the branch tip, which adds no test after this commit: 571 passed, 0 skipped. The fix round of the independent REPORT-ONLY review of this branch (2026-09-11; 168 runs across the twelve flag spellings and fourteen forms, main against the branch: every accepted form byte-identical to the spaced one, every `-`-led value refused with an empty stdout, the `--` passthrough and the no-value flags unchanged; verdict MERGE AFTER FIXES), every finding taken. THE ONE THAT MATTERED: `test_every_value_taking_arm_reads_its_value_through_flag_value` counted only arms that read `$FLAG_VALUE`, so a TENTH arm written the old way — `X="$2"`, no emptiness test, no `-` test, no `=` spelling — would have left the count at nine and PASSED the suite, where the test it replaced had caught exactly that. It now names any `="$2"` outside `flag_value` itself, and the count is still nine and still hand-kept, so a tenth arm is read rather than silently passed; re-proved on THIS base by injecting such an arm into a scratch copy of `park` — `AssertionError: park: TENTH="$2"; shift 2 ;; takes $2 straight from the command line`. THE SECOND: for `--lane` the `=` spelling buys `park`'s own parsing and NOT the extension's — the recipe word-splits `$(ARGS)`, so `--lane=--dry-run` hands the extension the same two words the accident did — which the lane test's docstring now says instead of claiming the value "survived"; `park --help`'s example moves to `--repo=<owner/name>`, a value that never leaves the command, and `status --help`'s to `--project=<Name>`, the one value-taking flag its OPTIONS block lists. THE THIRD: `FLAG_VALUE`, `FLAG_SHIFT` and `FLAG_HINT` are declared beside the other globals in all three files, so a `die` that reached `$FLAG_HINT` before any arm had asked prints an empty hint under `set -u` rather than "unbound variable" at exit 1 — the one exit these arms must not produce; unreachable today, since every arm asks first, and cheap to keep that way. Suite: 571 passed, 0 skipped. BASED ON THE MAIN OF THE MOMENT. The branch was built on `a40cbb7` and rebased onto `8a36eb3` for this first push — 35 commits, in four steps as `main` moved under it, and NOT ONE CONFLICT at any of them: `park` and `resume` had not moved on `main` at all (both byte-identical to `a40cbb7`'s), and `status`'s growth from 2,619 lines to 5,767 lands BETWEEN the regions these commits edit — the globals at line 102 and the OPTIONS block at 222 above it, `flag_value` and the argument loop at 5,631 and 5,704 below it. Every number here is the re-measurement on that base, not one carried over. THE BITE: all 24 of these tests FAIL against origin/main's own `park`, `resume` and `status` — the 23 the first commit adds and `status`'s own `test_refusals_read_nothing`, which took the flag-shaped readings — measured in a scratch tree with main's three commands dropped in beside this branch's tests: `24 failed, 436 passed`. Suite on the branch: 571 passed, 0 skipped, against main's 549 collected; 23 test ids added, one renamed away (`test_every_value_taking_arm_refuses_an_empty_value`, which this replaces). INVARIANTS, each asserted by the suite and checked again by hand: the shared estate resolver byte-identical across the three AND byte-identical to main's, because this branch does not touch it; `expand_home` byte-identical in `status` and `resume`; `flag_value` byte-identical in all three, which is the new test; `bash -n` clean on all three; no `${x,,}`, `mapfile`, `declare -A` or `local -n`, so it parses under macOS bash 3.2; every `"${arr[@]}"` guard is main's own, since this branch adds no array. NO CAP MOVES: README.md and AGENTS.md are untouched and still sit exactly at their caps, 409 and 224. Ruling: "ruling (c): take dash-values as built, push and PR" — Brett Heap, 2026-09-14. Lane: openrepotools-3 (openRepoTools-3) PR #37 Co-Authored-By: Claude Fable 5.1 <[email protected]>



Follow-up noted in #12's and #13's reviews. Every value-taking flag in the two verbs used
${2:?…}, which on a missing value prints bash's message and exits 1 — forparkthat reads likemake park's own exit, and forresume, whose non-zero exit means something was refused, it is a refusal with no line saying what.statusalready refuses these with exit 2 in its own words (its 1 means findings); the verbs now do the same:park:--lane,--repo,--name/--project.resume:--repo,--workspace,--org,--name/--project. Each message says what the value is.REFUSED:line, bash's message not leaked, the estate untouched,~/.agentsabsent. Suite 240 -> 249. The shared resolver block is untouched;bash -nand shellcheck unchanged.Small enough that no review round was run.
🤖 Generated with Claude Code
Summary by Sourcery
Reject missing flag values before command execution with clear refusal messages and a consistent exit status.
Bug Fixes:
parkandresumereject missing values with command-specificREFUSED:messages and exit status 2 instead of leaking Bash errors and exiting 1.Tests:
parkandresumeflags, verifying refusal output, exit status, and that no work or filesystem changes occur.