mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-06 08:54:04 +01:00
* feat(ship): version-less repos, docs-audit record and caps, the frozen-scope paid case, and the review-loop follow-ups Follow-up to the review-loop convergence PR: Step 12 and the CHANGELOG step skip cleanly in a repository with no version source (receipt version "none"); the receipt records the docs audit outcome and the owner exception (DOCS_AUDIT_BLOCKED without one) and a policy may declare doc caps (gstack-ship-receipt docs-caps); docs/unattended.md names the READY evidence and the cross-family outside voice; the ship-frozen-scope-convergence behaviour case runs the generated Step 9.4 under review_scope frozen through the real binaries; carry probes git >= 2.39 (RECEIPT_GIT_TOO_OLD); defer passes the repository to gh repo view positionally and names its search limit; late defers count without being passes; reviewers diff from RANGE_BASE on pass 2+; the cap check runs before edits; --review-fanout batches specialists by free slots; read --check-prose compares quoted counters with the receipt (RECEIPT_PROSE_MISMATCH); checklist rule ids prereg-with-results and test-keyboard-count-loop; gstack-coauthor-trailers. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: repair the CI reds the retarget onto main surfaced (test-only) Seven test files, no product change. The pull_request run at2d73faddfailed 5 Linux shards and 4 Windows shards: - test/ship-frozen-scope-actor.test.ts imported only test code, so the test-of-test ratchet refused it; the first case now recomputes the loop summary with summarizeReviewLoop/reviewLoopLine from lib/review-scope and asserts the exact REVIEW_LOOP line. Its three cases replay the bash workflow through bash -c and the shebang bins, so they are POSIX-only. - test/codex-host.test.ts: the new gate case is Claude-specific (33 -> 34). - test/paid-retry-supervision.test.ts: the gate census fixture now carries a trial record for the one planned behavior-kind gate case, the way test/ci-paid-coordination.test.ts already does. - test/review-fix-range.test.ts asserted the pre-#3487 DIFF_BASE sentence; it now asserts the ${RANGE_BASE:-merge-base} clause that carries the same contract (every reviewer reads the range from pass 2 on). - test/gstack-coauthor-trailers.test.ts: the fixture sets its own git identity; a CI runner has none to auto-detect ("Committer identity unknown"). - test/review-scope-followups.test.ts and test/gstack-ship-receipt-docs.test.ts: the gh and old-git stand-ins are sh scripts on a colon-joined PATH, which CreateProcess cannot run, so those three cases skip on win32. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: pre-landing review fixes (pass 1) Twelve informational findings from the /ship pass-1 review, all below the blocking floor, fixed in place: - docs-caps reads docs.caps from origin/<base>'s policy (--base <ref>), never the branch's copy; an unavailable base policy refuses with POLICY_SOURCE_UNAVAILABLE instead of substituting DEFAULT_POLICY - receiptVersion returns "none" only when the stamp file is absent; other errors surface as undefined - checkReceiptProse groups counters by leaf key and uses word boundaries that cover hyphenated names, so shared leaf keys and hyphenated words no longer report RECEIPT_PROSE_MISMATCH - gstack-coauthor-trailers refuses a --range/--base starting with "-", prefixes origin/ when origin/<ref> resolves (slash-named branches), and passes --end-of-options to git log - REVIEW_SCOPE_KEY_VERSION and DOCS_CAPS_KEY_VERSION name the releases that first read their keys - the Step 11 late-defer row logs under skill review-late-defer so a tokenless review row never reads UNVERIFIED; summarizeReviewLoop counts both - the "already filed" literal is one constant shared by bin and renderer - receiptDocs (dead) removed - Step 14.5 clears .gstack/tmp/docs-audit.json on first entry - dispatched review prompts carry a literal diff-base sha (<diff-base>) instead of a shell variable the reviewer process never sees - the coauthor-trailers tests launch the bin through runScriptSync so the Windows lane can run them Tests extended for each change; SKILL.md, sections and goldens regenerated. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: cover the carry patch-id refusal (Step 7 coverage gap) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: derive the too-old review_scope minimum from the constant Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: keep co-author trailers in one trailer block gstack-coauthor-trailers --message appended the new Co-authored-by lines as a separate paragraph after existing trailers, so git interpret-trailers (and GitHub attribution) read only the last paragraph and the existing co-author lost credit. The new lines now join the existing trailer block; the test checks the result with git interpret-trailers --parse. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: let git place co-author trailers; name the docs key release gstack-coauthor-trailers --message now runs git interpret-trailers --in-place, so the appended lines join the existing trailer block whatever its shape (CRLF, comment lines, folded continuations) and the existing co-author keeps attribution; the interpret-trailers check in the test carries a timeout for the spawnSync tripwire. DOCS_CAPS_KEY_VERSION names the release after the newest CHANGELOG heading on main (1.91.258.0), and a test ties every unreleased policy key to that next release so a stamp elsewhere fails loudly. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: hold unreleased policy keys newer than any visible heading; pin trailer placement The CHANGELOG-heading test asked for the exact next release after the newest heading, which a depth-1 CI clone (no origin/main) computes from the branch alone, so it went red there. It now requires an unreleased key's version to be newer than every heading the checkout can see, which holds at depth 1, on the stamped train tree and on main; the ship-policy comment says who moves the constant when the stamp lands under another number. gstack-coauthor-trailers pins git interpret-trailers' placement on the command line (--no-divider so a --- body line is not a divider, --where end, --if-exists addIfDifferentNeighbor, trailer.separators=:, -- before the path) so a user's trailer.* config cannot replace or drop the existing co-author. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: describe the shipped contracts (Step 13 and 14.5) CHANGELOG [Unreleased]: docs-caps --base <base> reading origin/<base>'s policy, the review-late-defer row, the literal <diff-base> prompt rule, the coauthor-trailers placement and refusals, the policy key versions (review_scope 1.91.256.0 re-pin, docs.caps at the stamping release), the version-less conditions split between Step 12 and the receipt, and the carry refusal wording. docs/ship-policy.md, docs/review-policy.md and docs/unattended.md follow the code: docs-caps --base, the literal diff-base sha, the trailer block, the gstack-outside-voice run binding and the Step 11 row fields. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: scope the literal diff-base claim to the review-army prompts; name where the outside-voice cause lives Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(docsync): declare Step 14.5's own-tree commands to the fixture; exclude .gstack/tmp at the Entry The ship-docsync-completion and ship-docsync-current paid cases failed twice at775d9804: Step 14.5's continue path now runs gstack-ship-receipt docs-caps and writes .gstack/tmp/docs-audit.json, and the docsync fixture's closed interface declared neither, while its repository had no origin/main for docs-caps to read. The actor stopped correctly (blocked, no exception) and never reached the publication stand-in. - test/helpers/docsync-interface.ts: the three housekeeping commands (the shared exclude line, rm -f of the record, docs-caps --base main) and the record write are declared, byte for byte with the generated section; DOCS_AUDIT_RECORD_PATHS names what the kernel observer may see. - test/helpers/docsync-observer.ts: accepts exactly those commands and the record write; every neighbour (another base, --json, write --docs, another .gstack file) stays outside the interface. - test/helpers/docsync-fixture.ts: every scenario pushes main to the fixture remote, as Steps 0-14 would have. - ship/sections/documentation.md.tmpl: the Entry runs the shared .gstack/tmp exclude line before rm -f, so the record never surfaces as an untracked file when no earlier step added it; the caps paragraph tightened to hold the ship parity ratio at 1.7400. - test/docsync-command-grammar.test.ts: pins the literals against the generated section and the refusals around them. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(docsync): the receipt record is housekeeping for read-only audits and the fault cases too Pass 9's outside voice found two gaps in the fixture change (2524ec4): a read-only audit (ship-docsync-current) must still write .gstack/tmp/docs-audit.json, but docsToolFailures flagged every product write under readOnly before the record allowance; and the unseeded fault cases (missing-asset, legacy-completion) run the Entry too, so their kernel-write check saw .git/info/exclude as a forbidden write because only the lifecycle test named the housekeeping paths. - docsToolFailures: the record write is permitted under readOnly; the document and every other product file stay refused. - docsWriteFailures: DOCS_AUDIT_RECORD_PATHS are permitted for every caller, so the fault evaluator needs no per-scenario list; anything else under .git or .gstack stays forbidden. - test/docsync-command-grammar.test.ts pins both: the record under readOnly, the document refused there, the observed housekeeping paths accepted with an empty allowance and two neighbours refused. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(docsync): accept the cap gate's ~/.claude/skills/gstack form the section prints (pass 9 Red Team note) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(docsync): name the admitted composed line precisely (pass 9 maintainability note) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(docsync): install lib/ beside bin/ in the fixture so the declared cap gate can load (2524ec4rerun: module error, not a verdict) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(docsync): admit the Write tool's temp sibling of the receipt record (0230fc2rerun: both lifecycle cases red on it) The paid rerun at0230fc2cleared every earlier refusal and both cases then failed on one path: forbidden docs write: .gstack/tmp/docs-audit.json.tmp.<pid>.<12 hex>. Claude Code's Write and Edit tools land every file, new ones included, through that sibling plus fsync and rename, and the fixture's kernel observer proved such a landing for the document only (atomicTargets: [DOC_PATH]). The observer now treats the record's sibling as a transient file too, and docsWriteFailures admits it only as the cookie-paired MOVED_FROM source of a MOVED_TO on the record whose other events are create/modify/attrib/close_write and which is left in neither snapshot nor in changed. A lingering sibling, an unpaired move, a move onto another path or a sibling of the document moved onto the record stay forbidden (grammar test). A live check on this machine saw the second landing's create/modify/close_write/moved_from events admitted and a stray sibling refused. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
275 lines
16 KiB
Cheetah
275 lines
16 KiB
Cheetah
### Prepare the title (Step 18)
|
|
|
|
Prepare the title in a private file; Step 19 posts that file, never a shell string:
|
|
|
|
{{FREE_TEXT_FILE:TITLE_FILE=pr-title}}
|
|
|
|
1. For an existing open PR/MR (not Step 6.5's early PR, which takes item 2), fill the file from the platform, substituting the
|
|
printed name, the matched number and `NEW_VERSION`; no title text passes through you:
|
|
```bash
|
|
TITLE_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/<title-file-name>"
|
|
gh pr view <pr-number> --json title -q .title | ~/.claude/skills/gstack/bin/gstack-pr-title-rewrite.sh <new-version> --stdin > "$TITLE_FILE" || exit 1
|
|
```
|
|
GitLab reads `glab mr view <pr-number> --output json | jq -r .title` into the same pipe.
|
|
2. For a new PR/MR, write `v<NEW_VERSION> <type>: <summary>` into the file with your file-write tool.
|
|
3. Every created or updated title MUST start with `v$NEW_VERSION `; check the file with
|
|
`grep -Eq '^v<new-version>( |$)' "$TITLE_FILE"` and never publish an unprefixed title.
|
|
4. **NO_VERSION:** replaces items 1-3: keep an existing title (the platform title
|
|
piped straight into the file), or write `<type>: <summary>`; no version prefix.
|
|
|
|
Save the title file name for Step 19.
|
|
|
|
---
|
|
|
|
## Step 19: Create PR/MR
|
|
|
|
Recheck Step 18's PR/MR lookup and record it. Errors or ambiguous matches STOP publication.
|
|
If the open PR/MR or title changed, repeat Step 18's identity/title preparation,
|
|
then return here for a new lookup and a fresh body before publishing.
|
|
|
|
### Resolve Linked Spec before composing the body
|
|
|
|
1. Resolve the archive directory and branch:
|
|
```bash
|
|
GSTACK_STATE_ROOT=$(~/.claude/skills/gstack/bin/gstack-paths --get GSTACK_STATE_ROOT); : "${GSTACK_STATE_ROOT:?gstack-paths failed; reinstall with ./setup or /gstack-upgrade}"
|
|
SLUG=$(~/.claude/skills/gstack/bin/gstack-slug --get SLUG)
|
|
CURRENT_BRANCH=$(git branch --show-current)
|
|
SPEC_ARCHIVES="$GSTACK_STATE_ROOT/projects/$SLUG/specs"
|
|
```
|
|
2. Read archive frontmatter as data, never shell source. Select an exact
|
|
`spec_branch` match to `CURRENT_BRANCH`; among matches use the newest
|
|
`spec_filed_at`. Never infer an issue number from a branch name. If no readable
|
|
match or positive integer `spec_issue_number`, omit only `## Linked Spec` and
|
|
continue composing the PR. Resolve ambiguous matches before linking an issue.
|
|
3. Compare that spec's acceptance criteria with Step 8's results. Only fully
|
|
completed Step 8 plan scope permits `Closes #N`, with every spec criterion
|
|
verified. Partial, deferred, failed, dropped or unverified scope uses `Linked to #N`
|
|
and names the remaining work; never auto-close it. Include the archive filename
|
|
and `spec_filed_at`, not a private absolute path; `gstack-post` scans them with the body.
|
|
|
|
### Issue links
|
|
|
|
Run `~/.claude/skills/gstack/bin/gstack-issue-links --base <base> --out .gstack/tmp/issues.json`, adding
|
|
`--issue <n>` per issue the user named as fixed and `--ci-run <id>` per failing CI run. Interactive:
|
|
ask once about its `(promote: fix #N)` references (each `fix #<n>` reply adds `--issue <n>`), and add
|
|
`--supersedes <n>`/`--credit <n>` for a `Related:` PR only when the owner confirms; rerun after any change.
|
|
The completion message lists unpromoted candidates, `Related:` lines and any `ISSUE_LOOKUP_FAILED`.
|
|
|
|
### Capy
|
|
|
|
Run `[ "${GSTACK_CAPY:-}" = 1 ] && echo 'CAPY_PR: on' || echo 'CAPY_PR: off'`. On `CAPY_PR: on`, read
|
|
`~/.claude/skills/gstack/ship/sections/capy-pr.md` now: the body opens with its `## What changed`,
|
|
`## Why` and `## Approvals` before the sections below. On `CAPY_PR: off`, skip it.
|
|
|
|
The PR/MR body should contain these sections (never reuse a prior run's body):
|
|
|
|
```
|
|
## Summary
|
|
<Read `git log origin/<base>..HEAD --oneline`. Group every substantive commit by
|
|
theme, excluding VERSION/CHANGELOG bookkeeping. Do not paste the commit list.>
|
|
|
|
## Test Coverage
|
|
<coverage diagram from Step 7, or "All new code paths have test coverage.">
|
|
<If Step 7 ran: "Tests: {before} → {after} (+{delta} new)">
|
|
<If Step 7 ran: "Coverage: {X}% value-weighted ({Y}% including {W} weakly covered paths)">
|
|
<If Step 7 ran: "Test value: {K} tests written, {R} rejected by the authoring gate, {E} existing tests extended, {W} paths weakly covered (weak = ★, gate-failing or unrated)." Use the singular noun for a count of 1 ("1 test written", "1 existing test extended", "1 path weakly covered").>
|
|
<Weak paths and leftover gaps as proposed tests with value cards; each regression test's
|
|
"Regression proof — fails at HEAD · passes at base · passes after fix" line; Test value
|
|
details for cards whose file type has no known comment syntax.>
|
|
<One line per Step 5 lane: "Tests ran: <lane> N" from its receipt's `tests_ran`, or
|
|
"Tests ran: <lane> count unavailable" when the runner summary was not recognised. A
|
|
ZERO-RUN lane never reaches this body unresolved.>
|
|
|
|
## Pre-Landing Review
|
|
<findings from Step 9 code review, or "No issues found."; then Step 9.4's `REVIEW_LOOP:` line.>
|
|
<Gate edits: Step 9's latest `Gate edits:` line verbatim — `none detected (...)`,
|
|
`N listed, M read, K findings — J kept, R restored, O open`, `partial (...)` or
|
|
`UNAVAILABLE — ...`; never `none detected` for partial or UNAVAILABLE. Under it, each
|
|
kept finding's `gate`, path and `reason`, and each open finding's `gate` and path.
|
|
Identity and reason only; no hunk text.>
|
|
<Outside review: its verdict; `unverified` or `unavailable` is listed as missing coverage with its reason, never as passed.>
|
|
|
|
<Step 9.4's saved `## Deferred findings` and `## Review notes` sections, verbatim, as their own
|
|
sections here; omit each when empty. References only: never a closing keyword.>
|
|
|
|
## Exploratory QA
|
|
<Step 9's current surfaces/charters, reproducers, approved regressions and red/green
|
|
proof, fixes and blocked/inconclusive/not-run coverage. Never present stale or
|
|
unavailable results as passing.>
|
|
|
|
## Design Review
|
|
<If design review ran: "Design Review (lite): N findings — M auto-fixed, K skipped. AI Slop: clean/N issues.">
|
|
<Detector: "clean" | "N findings (rule-id, rule-id)" | "not installed" | "not cached" | "off" — the state the probe printed; rule ids and counts only, finding text and snippets never reach the PR body.>
|
|
<If no frontend files changed: "No frontend files changed — design review skipped.">
|
|
|
|
## Eval Results
|
|
<If evals ran: suite names, pass/fail counts, cost dashboard summary. If skipped: "No prompt-related files changed — evals skipped.">
|
|
|
|
## Greptile Review
|
|
<Step 10 complete: list comments with [FIXED] / [FALSE POSITIVE] / [ALREADY FIXED], or "No Greptile comments." for a successful empty fetch.>
|
|
<Step 10 unavailable: include `Greptile triage: UNAVAILABLE (dispatch failed)` and the actual reason.>
|
|
<Step 10 no_pr: omit this section.>
|
|
|
|
## Scope Drift
|
|
<If scope drift ran: "Scope Check: CLEAN" or list of drift/creep findings>
|
|
<If no scope drift: omit this section>
|
|
|
|
## Plan Completion
|
|
<If plan file found: completion checklist summary from Step 8>
|
|
<If Step 8 printed the not-run line: that line verbatim.>
|
|
<If plan items deferred: list deferred items>
|
|
|
|
## Linked Spec
|
|
<Closes #N only when the Linked Spec check above permits it; otherwise
|
|
"Linked to #N (partial delivery — not auto-closing)" with remaining work and
|
|
"Close #N manually after follow-up lands." Include archive filename and filed date.
|
|
Without a valid match, omit this entire section.>
|
|
|
|
## Issues
|
|
<Issue links stdout, verbatim; omit on ISSUE_LINKS: none.>
|
|
|
|
## Verification Results
|
|
<Step 8.1 obligations executed at Step 9: N PASS, M FAIL, K BLOCKED, J NOT RUN,
|
|
not-applicable reasons, unresolved obligations and accepted deferrals.
|
|
Unavailable/inconclusive is never PASS.>
|
|
|
|
## TODOS
|
|
<If items marked complete: bullet list of completed items with version>
|
|
<If no items completed: "No TODO items completed in this PR.">
|
|
<If TODOS.md created or reorganized: note that>
|
|
<If TODOS.md doesn't exist and user skipped: omit this section>
|
|
|
|
## Documentation
|
|
<Embed Step 14.5's vetted nonempty `documentation_section` for this invocation:
|
|
its saved section file, inserted unchanged by the compose block's `DOCS_SECTION_FILE` lines.
|
|
A blocked audit shipped under a user exception has no section file: state its
|
|
blocked status, scope and exception here and drop the block's `DOCS_SECTION_FILE` guard
|
|
and its `cat -- "$DOCS_SECTION_FILE" && echo &&` step. The exception is one line,
|
|
word for word as Step 14.5 saved it in `.gstack/tmp/docs-audit.json`:
|
|
`Documentation exception: accepted by <accepted_by> <date> via <via>: <reason>`;
|
|
the receipt write below refuses (`DOCS_AUDIT_BLOCKED`) when the body lacks it.>
|
|
<Always include the status and reviewed scope: updated, current, or blocked with the actual user's named risk exception. Never omit this section or reuse another invocation's audit.>
|
|
|
|
## Test plan
|
|
- [x] <Each executed test lane's command>: <observed passing summary>
|
|
|
|
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
```
|
|
|
|
#### Compose the body, then publish through gstack-post
|
|
|
|
The PR body is world-readable on a public repo. `gstack-post` scans the exact title
|
|
and body bytes it sends and passes them to `gh`/`glab` as arguments, so there is no
|
|
separate scan here. Wrap any Codex / Greptile / eval output sections in
|
|
tool-attributed fences (` ```codex-review ` / ` ```greptile `) so the scanner
|
|
WARN-degrades the example credentials those tools quote instead of blocking the PR
|
|
(a live-format credential inside the fence still blocks).
|
|
|
|
Write the body from above into two private files: the first through the
|
|
`## Documentation` heading line, the second from `## Test plan` on.
|
|
|
|
{{FREE_TEXT_FILE:BODY_TOP_FILE=pr-body-top:BODY_REST_FILE=pr-body-rest}}
|
|
|
|
In a new shell, restore Step 14.5's saved section file path as `DOCS_SECTION_FILE`
|
|
and substitute the printed names. The block deletes both drafts; to change the body,
|
|
write fresh ones.
|
|
|
|
```bash
|
|
: "${DOCS_SECTION_FILE:?Restore the saved Step 14.5 section file path before composing}"
|
|
PR_BODY_FILE=$(mktemp "${TMPDIR:-/tmp}/gstack-pr-body.XXXXXX") || { echo "ERROR: mktemp failed — cannot compose the PR body; refusing to publish." >&2; exit 1; }
|
|
BODY_TOP_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/<body-top-file-name>"
|
|
BODY_REST_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/<body-rest-file-name>"
|
|
[ -s "$BODY_TOP_FILE" ] && [ -s "$BODY_REST_FILE" ] || { echo "Not composed: $BODY_TOP_FILE or $BODY_REST_FILE is empty, so the body was never written. Write both, then rerun." >&2; exit 1; }
|
|
{ awk 1 "$BODY_TOP_FILE" && cat -- "$DOCS_SECTION_FILE" && echo && awk 1 "$BODY_REST_FILE"; } > "$PR_BODY_FILE" || exit 1
|
|
rm -f "$BODY_TOP_FILE" "$BODY_REST_FILE"
|
|
echo "PR_BODY_FILE: $PR_BODY_FILE"
|
|
```
|
|
|
|
Handoff record first (identifiers survive truncation). Write Step 16 stage 4's
|
|
per-lane counts (`{"<lane>":{"pass":N,"fail":N,"skip":N}}`) to
|
|
`.gstack/tmp/ship-gate.json` with your file-write tool, then:
|
|
|
|
```bash
|
|
rm -f .gstack/tmp/review-loop.json
|
|
~/.claude/skills/gstack/bin/gstack-review-scope summary --since "$REVIEW_SINCE" --out .gstack/tmp/review-loop.json &&
|
|
~/.claude/skills/gstack/bin/gstack-ship-receipt write --pr <pr-number> --base <base> --gate @.gstack/tmp/ship-gate.json --pregate .gstack/tmp/pregate.json --issues @.gstack/tmp/issues.json --review-loop @.gstack/tmp/review-loop.json --docs @.gstack/tmp/docs-audit.json --body "$PR_BODY_FILE"
|
|
```
|
|
|
|
`--docs` reads the record Step 14.5 saved (`{status, scope[, exception]}`): the
|
|
receipt carries it as `docs`, and a `blocked` status without the owner's exception,
|
|
or a body missing the exception line, is `DOCS_AUDIT_BLOCKED` with nothing written.
|
|
|
|
The summary reads this branch's review log for the invocation's passes (its
|
|
`REVIEW_LOOP:` line is the one the Pre-Landing Review section carries). The `&&`
|
|
matters: a summary that refuses (no pass matched `REVIEW_SINCE`) must not let `write`
|
|
record a stale or empty loop file.
|
|
|
|
Add `--receipt .gstack/tmp/tree-receipt.json` only when Step 16 wrote it (gate-ahead).
|
|
New PR/MR: omit `--pr`, then rerun with the number after creation and repost the body.
|
|
Its `SHIP_RECEIPT:` line opens the completion message. The posted receipt is what
|
|
`gstack-ship-queue ready`, `train build` and `verify --train` require (`QUEUE_RECEIPT_MISSING`,
|
|
`QUEUE_RECEIPT_STALE`, no flag around them), so /ship runs before every READY and after any
|
|
push. `RECEIPT_INVALID` names the bad
|
|
field: fix that input file and rerun; nothing was written. `ISSUE_LINKS_MISSING`: add
|
|
the named line under `## Issues` and rerun. `PREGATE_STALE` means rerun
|
|
`gstack-pregate` on the stamped tree; `PREGATE_REMOTE_UNCLEARED` needs
|
|
`gstack-pregate clear` with the run URL. Both stop publication.
|
|
|
|
In each block below, restore the literal `PR_BODY_FILE` path and substitute Step 18's
|
|
title file name; `gstack-post` detects GitHub or GitLab from the remote and the repo's
|
|
visibility (an unavailable lookup, including on GitLab, uses the scanner's
|
|
public-strict policy). Never re-render the body: every retry sends the same files.
|
|
|
|
**Existing open PR/MR** (`<pr-number>` from the recheck):
|
|
|
|
```bash
|
|
TITLE_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/<title-file-name>"
|
|
~/.claude/skills/gstack/bin/gstack-post pr-body <pr-number> --body-file "${PR_BODY_FILE:?restore the composed body path}" && \
|
|
~/.claude/skills/gstack/bin/gstack-post pr-title <pr-number> --title-file "$TITLE_FILE"
|
|
```
|
|
|
|
It updates the body, then the title, retries a retired-GraphQL edit through REST and
|
|
reads the title back. Then resolve the draft state from Step 9's gate findings:
|
|
|
|
1. Step 6.5 opened this PR as an early draft, the user did not ask for a draft, and no
|
|
gate finding is `open`: mark it ready now with `gh pr ready <pr-number>`.
|
|
2. Step 6.5 opened it as an early draft and any gate finding is `open`: leave it a
|
|
draft; print `Draft kept: Gate edits: N open` and the open findings' `gate` and path.
|
|
3. The PR was already ready (not a draft) and any gate finding is `open`: publish only
|
|
under Step 17's recorded human authorisation (option B there); the body already
|
|
carries the `Gate edits: N open` banner. Without that record, STOP here and report.
|
|
|
|
Print the existing URL and continue to Step 20; do not run the create command below.
|
|
|
|
**No open PR/MR:** add `--draft` when any gate finding is `open` (a later agent never
|
|
infers approval from the PR existing; the human marks it ready after dispositioning
|
|
the open items). Otherwise create it ready:
|
|
|
|
```bash
|
|
TITLE_FILE="$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.gstack/tmp/<title-file-name>"
|
|
~/.claude/skills/gstack/bin/gstack-post pr-create --base <base> --title-file "$TITLE_FILE" --body-file "${PR_BODY_FILE:?restore the composed body path}"
|
|
```
|
|
|
|
With open gate findings the same command carries `--draft` before `--title-file`.
|
|
|
|
Branch on the exit code of either block:
|
|
- **0** posted. Remove `$PR_BODY_FILE` and the title file.
|
|
- **1** HIGH finding: BLOCKED — do not publish. Rotate and redact at the source, then
|
|
compose fresh files.
|
|
- **2** MEDIUM findings, printed as `RULE:` lines with a `TOKEN:`. AskUserQuestion per
|
|
finding (sterner on public repos, no batch acknowledge). PII offers auto-redact:
|
|
write `~/.claude/skills/gstack/bin/gstack-redact --from-file "$PR_BODY_FILE" --auto-redact <ids>`
|
|
output back into the body file and rerun the block, which scans again. Only when the
|
|
user accepts the findings as they are, rerun the same block with
|
|
`--confirm <confirm-token>` added to the command that printed it; any edit needs a new token.
|
|
- **3** `gh`/`glab` failed, or **64** no usable remote or CLI: print the error, the
|
|
branch name, the remote URL and the block for posting by hand. Do not stop — the code
|
|
is pushed — but never report a PR that was not created. With open gate findings,
|
|
also say the gate edits were not disclosed and leave the Step 16 open-items report
|
|
in the invocation record; never report the disclosure as done.
|
|
- Any other exit is an error that blocks publication until its cause is fixed.
|
|
|
|
**Output the PR/MR URL** — then proceed to Step 20.
|
|
|
|
---
|