Skip to content

gstack-approvals says which --owner-ref check failed and stops pointing every refusal at add (#4718) - #4720

Closed
Barack-zero-to-one wants to merge 1 commit into
garrytan:mainfrom
Barack-zero-to-one:fix/issue-4718-owner-ref-refusal
Closed

Barack-zero-to-one wants to merge 1 commit into
garrytan:mainfrom
Barack-zero-to-one:fix/issue-4718-owner-ref-refusal

Conversation

@Barack-zero-to-one

Copy link
Copy Markdown
Contributor

gstack-approvals rule and round-grant now say which --owner-ref check failed and what shape the ref needs.
Why: one shared sentence covered a bad ref, a missing --words and a missing --by, and its fix line pointed at gstack-approvals add.
Nothing to do; refs that were accepted before are still accepted, and every refusal still exits 2.

Root cause

In bin/gstack-approvals, rule tested the OWNER_REF match, a non empty --words and a non empty --by in one condition and printed one sentence for all three, and round-grant did the same for the ref and --words. Neither sentence stated the shape OWNER_REF in lib/ruled-notes.ts requires, so ship-161:… or SHIPD1:… failed with no hint why. Every APPROVAL_RECORD_INVALID line also ends with the one fix clause of lib/result-codes-capy.ts, which named add and its flags (--ask, --words, --scope, --by), so rule, round-grant, lane-exception, gate and the locate() refusals of the read commands all sent the user to a different subcommand.

Fix

lib/ruled-notes.ts exports OWNER_REF_SHAPE, the regex in words next to it. rule now runs three checks in order. A ref outside OWNER_REF is refused with the ref quoted and OWNER_REF_SHAPE, then a missing --words and a missing --by each get a line naming only that flag; round-grant gets the same shape check and its own --words check. The help states the shape through the same constant. The fix clause of APPROVAL_RECORD_INVALID is now neutral. It says to rerun the command the line names with the flag its detail names, and gstack-approvals --help lists each command's flags. OWNER_REF, exit codes, the anchor, resultLine and fail() are unchanged. docs/troubleshooting.md#approval-record-invalid describes the two --owner-ref refusals, and changelog.d/fix-issue-4718-owner-ref-refusal.md carries the entry. Closes #4718.

Tests

Five tests at the end of test/approval-record.test.ts split stderr at ; fix: so the refusal and the fix clause are checked apart. They cover the issue's own command (the ref is quoted, the shape is stated, neither --words nor --by is named, and SHIP-161:… still records), a missing --words, a missing --by, a bad round-grant ref, and a fix clause free of add, --ask and --scope on rule, round-grant, lane-exception and gate. All five failed on the old code for those reasons before the source changed.

On Windows 11 with bun 1.4.5, test/approval-record.test.ts gives 41 pass and 13 fail; the 13 are the same tests by name on untouched main, all using a fake gh shell script or symlinks. test/troubleshooting-anchors.test.ts, round-cap-granted-stop, ship-finish-ruled-notes, ship-run-record, security-finding-redaction and fix-check-clearing give the same failures by name as main, except two anchor walks that timed out at 5 seconds under load and pass when the file runs alone (423 pass, twice). bun run typecheck reports no error, bun run typecheck:test no new diagnostic, and the doc link check, the credential scan and prose lint on the added lines pass. The full free suite was not run on this Windows machine, so full validation relies on the Linux CI in free-tests.yml.

Out of scope

docs/ship-policy.md and docs/review-policy.md still give the ref only as <thread code>:<message id or timestamp>; the refusal, the help and the troubleshooting entry now state the shape.

…ng every refusal at add (garrytan#4718)

rule refused a bad --owner-ref, a missing --words and a missing --by with
one sentence that never stated the shape OWNER_REF requires, round-grant
merged the ref and --words checks the same way, and the APPROVAL_RECORD_INVALID
fix clause told every subcommand to rerun add with add's flags. Each check
now prints its own line, the shape refusal quotes the ref and states
OWNER_REF_SHAPE, the help reuses that constant, and the fix clause is
neutral. OWNER_REF, exit codes and the troubleshooting anchor are unchanged.
@trunk-io

trunk-io Bot commented Nov 22, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Thank you, this is a clean fix, and the tests pin each message. We're picking it up for our next batch of small fixes (tracking thread GSTA-36).

Every outside change gets a line-by-line safety read before anything runs, so the batch will either keep your commits as they are or rebuild the change on current main with you credited as co-author. Either way we'll link the result here and close this PR when it lands. Nothing more is needed from you.

@capy-ai capy-ai Bot added the S3 Severity 3: everything else label Nov 23, 2026
@capy-ai

capy-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Owner: Capy thread GSTA-827 is fixing this as part of today's small-fix wave and will link the wave PR here when it lands.

capy-ai Bot added a commit that referenced this pull request Nov 23, 2026
… bisect case names (#4748)

/ship now tells you to fix your commit email when GitHub refuses a push
with GH007, instead of sending you into a pointless merge;
`gstack-approvals` says which `--owner-ref` check failed; and the merge
queue's bisect accepts a red judge case whose name has a space.

Why: three small, plainly correct fixes from outside reports (#4738,
#4718 with #4720, #4724 for #3580), taken as one batch.

Nothing to do.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: Barack-zero-to-one <[email protected]>
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/adversarial-native#1 reader=adversarial-native
Review-Finding: p1/adversarial-native#3 reader=adversarial-native
Review-Finding: p1/specialist-batched#1 reader=testing
@capy-ai

capy-ai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Thanks @Barack-zero-to-one. This landed in #4748 (merged as 100e109), rebuilt on our main with you credited as co-author. The one change from your version: the shape refusal doesn't repeat the rejected ref, because that text could hold anything and it skipped the secret scanner. Closing this PR in favor of #4748.

@capy-ai capy-ai Bot closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S3 Severity 3: everything else

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gstack-approvals rule: a refused --owner-ref does not say which check failed or what the thread code must look like, and its fix line names add's flags

1 participant