Skip to content

fix(cli): name --override-stale-lock on the top-level adopt help line - #194

Merged
arcaven merged 2 commits into
mainfrom
build/sideshow/95-adopt-usage-stale-lock
Oct 8, 2026
Merged

arcaven merged 2 commits into
mainfrom
build/sideshow/95-adopt-usage-stale-lock

Conversation

@arcaven

@arcaven arcaven commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

When adopt refuses on a recent burst log, its hint says to pass --override-stale-lock, but the top-level help line for adopt does not list that flag, so a user checking help cannot confirm it exists. Adding it to the line makes the help match what adopt accepts (cmd/sideshow/adopt.go:13) and what the top-level disable line and the per-verb enable help already show.

Item 3 of #95 only. Items 1 and 2 are out of scope: item 1 no longer reproduces, and item 2 (the layer-5 check) waits on a WARN or ERROR ruling. One-line text change; no behavior change.

Existing help tests pin the per-verb help for enable and disable and the top-level fallback, but nothing pinned the top-level adopt line, so this PR adds TestCLI_TopLevelHelpAdoptLineNamesTheStaleLockOverride. It was red on the parent commit (the line omitted the flag) and passes after the fix.

Acceptance:

  • Test red first (commit 8e2d363), green with the fix (07cbbdf).
  • Mutants, each killed by the new test: the flag misspelled on the line, and the flag removed from the line.
  • Gates, each run on its own: build, vet, go test -count=1 ./..., golangci-lint (0 issues), gofumpt -l (empty).
  • -count=1 matters for this test: it builds the binary itself, so a cached go test run does not notice a change to main.go.

Refs #95

The refusal hint tells the user to pass it and adopt accepts it, but the
help line listed only --repo, --rewrite-agent and --dry-run.

Refs #95

@arcavenai arcavenai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. When an adopt conversion refuses on a stale lock, its message tells the user to pass --override-stale-lock. The top-level help now lists that flag on the adopt line too, so a user who checks help can confirm it exists.

Spelling and placement agree.

  • adopt.go:67 parses --override-stale-lock and sets both opts.OverrideStaleLock and mig.OverrideStaleLock.
  • In the conversion mode it passes through to enable's guard, whose refusal reads "enable refused (pass --override-stale-lock to proceed past these)" (internal/enable/enable.go:126).
  • The flag is on the conversion line, so its placement is right.
  • adoptUsage (adopt.go:12-14) spells it the same way.
  • sideshow adopt --help prints the top-level text, so it now shows the same line as main.go:57.

Red and mutants, all with -count=1.

  • The new test fails 3 of 3 runs at 8e2d363, with "adopt line omits --override-stale-lock", and passes 3 of 3 at 07cbbdf. go test -count=1 ./... passes at head.
  • Both listed mutants fail the test: the flag misspelled (--overide-stale-lock) and the flag removed from the line.
  • So does one I added: the flag moved from the conversion line to the --finish line.

Nothing else changes. I diffed the output of --help, help, a bare sideshow, and <verb> --help for all 16 verbs between the main and head binaries. Every output differs in that one line and nothing else. The bare sideshow adopt usage error is identical on both. CI on 07cbbdf passes.

Non-blocking, outside item 3:

  • The top-level adopt lines still omit flags adopt accepts. The conversion line lacks <pack>[@<version>], --scope local|project and --allow-version-change. The --migrate-user-scope line lacks --commit-consent, and also --override-stale-lock, which that mode honors (internal/adopt/migrate.go:185) and names in its blocker text (migrate.go:186).
  • The body says the enable and disable lines already show the flag. That is true of their per-verb help, and of the top-level disable line. The top-level enable line (main.go:49) still omits --override-stale-lock.

Seat: reviewer / reviewer

@arcaven
arcaven marked this pull request as ready for review October 8, 2026 12:39
@arcaven
arcaven merged commit 59a83fd into main Oct 8, 2026
10 checks passed
@arcaven
arcaven deleted the build/sideshow/95-adopt-usage-stale-lock branch October 8, 2026 12:45
arcaven added a commit that referenced this pull request Oct 8, 2026
…in the drift (#198)

* refactor(cli): name each verb's usage string

The enable/disable and activate/deactivate pairs shared one string, so
disable advertised --scope and @<version>, and activate omitted --agent.
Each verb now has its own, matching its top-level help line and parser.

Refs #195

* test: pin the top-level help lines and the parsers to each verb's usage string

Refs #195

* fix(cli): bring the top-level adopt and enable help lines in line with their parsers

enable gains --override-stale-lock. The adopt conversion line gains
<pack>[@<ver>], --scope and --allow-version-change. The migrate line
gains --commit-consent and --override-stale-lock. The pin test now joins
wrapped help entries, and the stale-lock pin from #194 reads the new
conversion line.

Closes #195

* refactor(cli): reach each parser through the code its runner runs

activate and deactivate decide --agent from the verb, not from an
argument a caller supplies. enable, disable, activate and deactivate each
have a parser function their runner calls. coexist and project init gain
named usage strings.

Refs #195

* test: hold the parser pin to the code the runners run, and pin coexist and project init

Parse-only verbs must return no error for a flag their usage names. The
full-run commands fail when the error names the flag. Review of #198
found two mutants of the activate path that the old check let through.

Refs #195

* fix(cli): add --sideshow-active and the project init flags to the top-level help

coexist gains --sideshow-active; project init gains --user-name and
--dry-run, each named by its own usage string.

Refs #195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants