mirror of
https://github.com/garrytan/gstack.git
synced 2026-12-03 21:33:35 +01:00
Install gstack's shipping skill as /gstack-ship so Claude Code's own /ship stops hiding it (#4775) (#4819)
gstack's shipping skill now installs as `/gstack-ship`, because Claude Code keeps the name `/ship` for its own built-in and silently drops gstack's. Upgrading removes gstack's old `ship` entry and leaves your own `ship` skill alone. The resume command and most recovery messages now say `/gstack-ship`; nothing to do but upgrade. This replaces #4813, which ran out of budget before its last fixes. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p2/adversarial-native#1 reader=adversarial-native Review-Finding: p2/outside-voice#3 reader=outside-voice Review-Finding: p2/outside-voice#4 reader=outside-voice Review-Finding: p2/outside-voice#1 reader=outside-voice Review-Finding: p2/outside-voice#2 reader=outside-voice Review-Finding: p2/red-team#1 reader=red-team Review-Finding: p3/outside-voice#1 reader=outside-voice Review-Finding: p3/outside-voice#3 reader=outside-voice Review-Finding: p7/outside-voice#1 reader=outside-voice
This commit is contained in:
1 parent
9a550bca9c
commit
719b1f59f0
310 files changed
+1618
-1301
No files matched your search
+1
-1
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* A base-red /ship finishes its other steps, writes a pause record here and
|
||||
* ends with a conditional receipt; `wait` re-runs the cases on each new base
|
||||
* head and returns once they pass there, and `/ship --resume` re-runs Step 5.
|
||||
* head and returns once they pass there, and `/gstack-ship --resume` re-runs Step 5.
|
||||
*/
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
|
||||
@@ -129,7 +129,7 @@ export function recordGateDisposition(cwd: string, loc: StoreLocation, row: Appr
|
||||
if (!gateDispositions([signed], loc.branch).length) return { code: 'APPROVAL_RECORD_INVALID', message: 'the row would not count as a gate disposition (gstack-approvals dispositions would not list it: a 40-hex --head and one-line fields are required), so it would close nothing; nothing was written' };
|
||||
const held = withGateLock(cwd, () => {
|
||||
const open = openShipRunsOn(cwd, loc.branch);
|
||||
if (open.length) return { code: 'APPROVAL_RECORD_INVALID' as const, message: `/ship run ${open.map(o => o.text).join('; /ship run ')} (branch ${loc.branch}): a gate disposition is the owner's, never the lane's own runner's; record it from the owner's session once no /ship run is open on the branch (${open.map(o => o.detail).filter(Boolean).join('; ')})` };
|
||||
if (open.length) return { code: 'APPROVAL_RECORD_INVALID' as const, message: `/gstack-ship run ${open.map(o => o.text).join('; /gstack-ship run ')} (branch ${loc.branch}): a gate disposition is the owner's, never the lane's own runner's; record it from the owner's session once no /gstack-ship run is open on the branch (${open.map(o => o.detail).filter(Boolean).join('; ')})` };
|
||||
return appendRows(loc, [signed]);
|
||||
});
|
||||
return held;
|
||||
@@ -144,7 +144,7 @@ export type GateAcceptanceCode = Extract<ResultCodeName, 'QUEUE_GATE_DISPOSITION
|
||||
*/
|
||||
export function gateAcceptance(o: { cwd: string; branch: string; pin: string; body: string; receipt?: ShipReceipt; accepted?: readonly string[]; env?: Env; noted?: readonly ApprovalRow[] }):
|
||||
{ lines: string[]; applied: GateDisposition[]; noteRows?: ApprovalRow[]; failure?: { code: GateAcceptanceCode; message: string; fix: string } } {
|
||||
const fix = 'the lander reads each GATE_DISPOSITION line and reruns with --accept-gate-disposition <approval id> for each one it accepts; a receipt or body that differs from the store is rewritten by /ship at the pin (docs/troubleshooting.md#queue-gate-disposition)';
|
||||
const fix = 'the lander reads each GATE_DISPOSITION line and reruns with --accept-gate-disposition <approval id> for each one it accepts; a receipt or body that differs from the store is rewritten by /gstack-ship at the pin (docs/troubleshooting.md#queue-gate-disposition)';
|
||||
let got: ReturnType<typeof appliedGateDispositions>;
|
||||
try { got = appliedGateDispositions(o.cwd, o); }
|
||||
catch (e: any) { return { lines: [], applied: [], failure: { code: 'QUEUE_GATE_DISPOSITION', message: `the gate dispositions for ${o.branch} at the pin cannot be derived (${e.message}); an unreadable store or a git error refuses, never reads as none`, fix } }; }
|
||||
|
||||
@@ -46,7 +46,7 @@ export const POLL_SECONDS = MIN_POLL_MS / 1000;
|
||||
const CALL_BUDGET_SECONDS = 90;
|
||||
const COMMENT_WINDOW_DAYS = 90;
|
||||
const TRIGGER = "@greptileai";
|
||||
export const EARLY_BODY = "/ship opened this pull request early so Greptile can review it while /ship runs its own checks. /ship will replace this title and description, and marks it ready for review unless a draft was requested.\n";
|
||||
export const EARLY_BODY = "/gstack-ship opened this pull request early so Greptile can review it while /gstack-ship runs its own checks. /gstack-ship will replace this title and description, and marks it ready for review unless a draft was requested.\n";
|
||||
|
||||
const isGreptile = (login: unknown) => typeof login === "string" && /greptile/i.test(login);
|
||||
|
||||
@@ -149,7 +149,7 @@ function detect(env: EarlyEnv): number {
|
||||
line("GREPTILE_CONSENT", consent);
|
||||
if (consent === "declined") return off("you declined early pushes for this public repo");
|
||||
line("GREPTILE_EARLY", consent === "ask" ? "ask" : "on");
|
||||
env.out(`Greptile: found ${SIGNAL_TEXT[signal]}. /ship will push this branch and open a draft PR now so Greptile reviews while /ship runs, then wait up to ${WAIT_CAP_SECONDS / 60} minutes for that review at Step 10. Turn this off: ${config(env)} set ship_greptile_early false\n`);
|
||||
env.out(`Greptile: found ${SIGNAL_TEXT[signal]}. /gstack-ship will push this branch and open a draft PR now so Greptile reviews while /gstack-ship runs, then wait up to ${WAIT_CAP_SECONDS / 60} minutes for that review at Step 10. Turn this off: ${config(env)} set ship_greptile_early false\n`);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ export interface ShipReceipt {
|
||||
mechanical?: string[];
|
||||
/** The targeted pass on money, gate, auth and secret code (lib/review-targeted.ts), bound to the receipt's product_patch_id; `done` only with its output collected. */
|
||||
review_targeted?: { classes: string[]; rules: string; brief_sha: string; product_patch_id: string; status: 'done' | 'failed' | 'not-run'; findings: number; raised_by: string };
|
||||
/** Step 5 failures gstack-base-red proved are the base's own (lib/base-red.ts): a conditional receipt the queue refuses until /ship --resume rewrites it without this block. */
|
||||
/** Step 5 failures gstack-base-red proved are the base's own (lib/base-red.ts): a conditional receipt the queue refuses until /gstack-ship --resume rewrites it without this block. */
|
||||
base_red?: { cases: string[]; files: string[]; base: string; lane: string; expires_at: string };
|
||||
/** The pregate's owner-granted flaky exceptions (gstack-pregate clear --flaky-exception): pregate only, never a required CI check. */
|
||||
flaky_exception?: Array<{ lane: string; runs: string[]; cases: string[]; grant: string; by: string }>;
|
||||
|
||||
@@ -122,7 +122,7 @@ export function landMergedCi(ctx: QueueContext, o: { remote: string; tip: string
|
||||
const r = runMergedCi(deps, o);
|
||||
if (r.ok) return { line: r.line };
|
||||
const rerun = `gstack-ship-queue land --pr ${o.pr} --pin ${o.pin}`;
|
||||
if (r.red) return { failure: { code: 'QUEUE_LAND_MERGED_CHECKS', message: `${o.moved}; on the pin merged onto it, ${r.detail}`, fix: `read the failed job in that run; for a flaky case rerun the run once (gh run rerun ${r.run}), then rerun ${rerun}, which waits on its new attempt (a rerun of land alone finds the same red run and refuses again); a real failure goes back to the lane, which merges the base into the branch, fixes it, runs /ship and gstack-ship-queue ready --pr ${o.pr} at the new head` } };
|
||||
if (r.red) return { failure: { code: 'QUEUE_LAND_MERGED_CHECKS', message: `${o.moved}; on the pin merged onto it, ${r.detail}`, fix: `read the failed job in that run; for a flaky case rerun the run once (gh run rerun ${r.run}), then rerun ${rerun}, which waits on its new attempt (a rerun of land alone finds the same red run and refuses again); a real failure goes back to the lane, which merges the base into the branch, fixes it, runs /gstack-ship and gstack-ship-queue ready --pr ${o.pr} at the new head` } };
|
||||
if (r.run !== undefined) return { failure: { code: 'QUEUE_NOT_READY', message: `${o.moved}, and land.merged_ci timed out waiting for CI on the pin merged onto it: ${r.detail}; nothing merged`, fix: `rerun ${rerun} at any time: while origin/main stays at ${o.tip.slice(0, 12)} it waits up to 45 more minutes on run ${deps.url(r.run)} (or lands at once when it already passed) instead of dispatching a new one` } };
|
||||
return { failure: { code: 'QUEUE_NOT_READY', message: `${o.moved}, and land.merged_ci could not run or prove CI on the pin merged onto it: ${r.detail}; nothing merged`, fix: `fix what the message names, then rerun ${rerun}` } };
|
||||
}
|
||||
+24
-24
@@ -185,7 +185,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_BASE_RED_NO_TRAIN: {
|
||||
anchor: 'queue-base-red-no-train',
|
||||
summary: 'a conditional READY (ready --base-red) needs a train that gates every prefix, and the base policy has no train block with gates',
|
||||
fix: 'wait for the base to pass the cases and run /ship --resume (the normal READY follows), or turn on a train with gates on the base branch',
|
||||
fix: 'wait for the base to pass the cases and run /gstack-ship --resume (the normal READY follows), or turn on a train with gates on the base branch',
|
||||
},
|
||||
SHIP_BASE_RED_FIXER: {
|
||||
anchor: 'ship-base-red-fixer',
|
||||
@@ -237,27 +237,27 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_RECEIPT_MISSING: {
|
||||
anchor: 'queue-receipt-missing',
|
||||
summary: 'the PR body carries no valid /ship receipt, so the PR was never shipped through gstack and cannot be READY’d, admitted to a train or merged',
|
||||
fix: 'run /ship on the branch (unattended it writes the receipt into an open PR at HEAD with gstack-ship-receipt write --pr <n> --body …, else leaves it in .gstack/tmp/ship-receipt.md for the parent to post), then gstack-ship-queue ready again; there is no flag to skip this',
|
||||
fix: 'run /gstack-ship on the branch (unattended it writes the receipt into an open PR at HEAD with gstack-ship-receipt write --pr <n> --body …, else leaves it in .gstack/tmp/ship-receipt.md for the parent to post), then gstack-ship-queue ready again; there is no flag to skip this',
|
||||
},
|
||||
QUEUE_RECEIPT_STALE: {
|
||||
anchor: 'queue-receipt-stale',
|
||||
summary: 'the PR body’s /ship receipt is for another head than the one being READY’d or merged (a push after /ship, or a receipt copied from another PR)',
|
||||
fix: 'rerun /ship on the current head so the receipt names it, then gstack-ship-queue ready again; a slot’s stamp commit keeps the receipt written for its pinned head',
|
||||
fix: 'rerun /gstack-ship on the current head so the receipt names it, then gstack-ship-queue ready again; a slot’s stamp commit keeps the receipt written for its pinned head',
|
||||
},
|
||||
QUEUE_RECEIPT_CONDITIONAL: {
|
||||
anchor: 'queue-receipt-conditional',
|
||||
summary: 'the PR body’s /ship receipt is conditional: Step 5 failed on cases gstack-base-red proved are the base branch’s own, so /ship paused before READY',
|
||||
fix: 'wait for the base to pass those cases (gstack-base-red wait --pause <file>), then /ship --resume <record>, which re-runs Step 5 and rewrites the receipt without base_red; only ready --base-red --fixer <pr> READYs a conditional receipt, and it rides only a train with gates whose slot 1 is its fixer',
|
||||
fix: 'wait for the base to pass those cases (gstack-base-red wait --pause <file>), then /gstack-ship --resume <record>, which re-runs Step 5 and rewrites the receipt without base_red; only ready --base-red --fixer <pr> READYs a conditional receipt, and it rides only a train with gates whose slot 1 is its fixer',
|
||||
},
|
||||
QUEUE_RECEIPT_BASE_MISMATCH: {
|
||||
anchor: 'queue-receipt-base-mismatch',
|
||||
summary: 'the PR body’s /ship receipt was reviewed against another branch than the queue’s base (a #3570 stacked child retargeted before its parent landed), so it covers only the change since that branch',
|
||||
fix: 'land the parent first, merge the base into this branch and push, then gstack-ship-receipt carry --pr <n> --base <base> moves the receipt to the base (it carries only when the parent fully landed and the child is unchanged), else rerun /ship against the base; then gstack-ship-queue ready again',
|
||||
fix: 'land the parent first, merge the base into this branch and push, then gstack-ship-receipt carry --pr <n> --base <base> moves the receipt to the base (it carries only when the parent fully landed and the child is unchanged), else rerun /gstack-ship against the base; then gstack-ship-queue ready again',
|
||||
},
|
||||
BASE_RED_UNCONFIGURED: {
|
||||
anchor: 'base-red-unconfigured',
|
||||
summary: 'the base branch’s ship policy declares no base_red block, so gstack-base-red cannot reproduce a Step 5 failure there and every failure stays in-branch',
|
||||
fix: 'handle the failure with /ship’s usual triage; to let /ship pause on a red base, add base_red { setup, select, timeout_sec } to .gstack/ship-policy.json on the base branch',
|
||||
fix: 'handle the failure with /gstack-ship’s usual triage; to let /ship pause on a red base, add base_red { setup, select, timeout_sec } to .gstack/ship-policy.json on the base branch',
|
||||
},
|
||||
BASE_RED_UNNAMED: {
|
||||
anchor: 'base-red-unnamed',
|
||||
@@ -272,7 +272,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
BASE_RED_PAUSE_EXPIRED: {
|
||||
anchor: 'base-red-pause-expired',
|
||||
summary: 'the base-red pause is older than 24 hours, so its classification is stale',
|
||||
fix: 'report the paused PR to its Captain (or owner), then start /ship again on the current base; it classifies afresh',
|
||||
fix: 'report the paused PR to its Captain (or owner), then start /gstack-ship again on the current base; it classifies afresh',
|
||||
},
|
||||
BASE_RED_WAIT_TIMEOUT: {
|
||||
anchor: 'base-red-wait-timeout',
|
||||
@@ -287,17 +287,17 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_RECEIPT_DEPTH_RAISED: {
|
||||
anchor: 'queue-receipt-depth-raised',
|
||||
summary: 'the PR body’s /ship receipt records a review depth below the one its head needs (the queue recomputed it from git), or a current receipt records no review_depth at all',
|
||||
fix: 'run /ship on the head the READY names; the REVIEW_DEPTH line shows the receipt’s depth, the required depth, its reasons and inputs, and the receipt is left unchanged',
|
||||
fix: 'run /gstack-ship on the head the READY names; the REVIEW_DEPTH line shows the receipt’s depth, the required depth, its reasons and inputs, and the receipt is left unchanged',
|
||||
},
|
||||
QUEUE_RECEIPT_EXCEPTION_INVALID: {
|
||||
anchor: 'queue-receipt-exception-invalid',
|
||||
summary: 'the PR body’s /ship receipt records an owner exception (docs or review loop) that is malformed, lacks the fix-check it follows, or whose line the body no longer carries verbatim',
|
||||
fix: 'restore the exception line in the PR body word for word, or run /ship again and record the owner’s acceptance with --docs or --review-loop-exception',
|
||||
fix: 'restore the exception line in the PR body word for word, or run /gstack-ship again and record the owner’s acceptance with --docs or --review-loop-exception',
|
||||
},
|
||||
QUEUE_RECEIPT_TARGETED_MISSING: {
|
||||
anchor: 'queue-receipt-targeted-missing',
|
||||
summary: 'the head touches money, gate, auth or secret code that needs the targeted reader, and the PR body’s /ship receipt records no done targeted pass covering every required class (none recorded, failed, not run, or other classes)',
|
||||
fix: 'run /ship on the head the READY names so the targeted reader covers every class the REVIEW_TARGETED line lists as required; the receipt is left unchanged',
|
||||
fix: 'run /gstack-ship on the head the READY names so the targeted reader covers every class the REVIEW_TARGETED line lists as required; the receipt is left unchanged',
|
||||
},
|
||||
QUEUE_SCREEN_STALE_REF: {
|
||||
anchor: 'queue-screen-stale-ref',
|
||||
@@ -327,7 +327,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_SCREEN_RED: {
|
||||
anchor: 'queue-screen-red',
|
||||
summary: 'the PR head’s dispatched screen run finished RED (its gate binding says so; a case that failed twice is real), so the head is not READY and a train will not seat it',
|
||||
fix: 'read the SCREEN_VERDICT line (gstack-ship-queue verify --pr <n> --screen prints the red and flaky cases), repair, push a new head, run /ship and ready again; a red screen is never re-dispatched at the same merge SHA',
|
||||
fix: 'read the SCREEN_VERDICT line (gstack-ship-queue verify --pr <n> --screen prints the red and flaky cases), repair, push a new head, run /gstack-ship and ready again; a red screen is never re-dispatched at the same merge SHA',
|
||||
},
|
||||
READY_SCREEN_CHOICE_REQUIRED: {
|
||||
anchor: 'ready-screen-choice-required',
|
||||
@@ -408,7 +408,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
RECEIPT_CARRY_REFUSED: {
|
||||
anchor: 'receipt-carry-refused',
|
||||
summary: 'gstack-ship-receipt carry could not carry the /ship receipt to HEAD: the PR body has no receipt, the working tree has uncommitted changes, the receipt head is not an ancestor of HEAD and the receipt records no tree to compare, or the product diff could not be compared',
|
||||
fix: 'commit or stash working-tree changes and rerun carry; when history was rewritten and the receipt predates head_tree, run /ship on the new head (merge the base in instead of rebasing next time)',
|
||||
fix: 'commit or stash working-tree changes and rerun carry; when history was rewritten and the receipt predates head_tree, run /gstack-ship on the new head (merge the base in instead of rebasing next time)',
|
||||
},
|
||||
PROSE_LINT_FOUND: {
|
||||
anchor: 'prose-lint-found',
|
||||
@@ -418,7 +418,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
RECEIPT_BLOCKER_OPEN: {
|
||||
anchor: 'receipt-blocker-open',
|
||||
summary: 'the review loop stopped at this head with a blocking finding still open (a Step 9 or Step 11 finding, the second-model review included, whose newest review-log action is still open and no owner ruling closed), so no receipt is written',
|
||||
fix: 'fix the finding and run /ship again on the new head, or take the stop to the owner, whose ruled note or grant closes it; never write the receipt by hand or drop the finding from the review-log row',
|
||||
fix: 'fix the finding and run /gstack-ship again on the new head, or take the stop to the owner, whose ruled note or grant closes it; never write the receipt by hand or drop the finding from the review-log row',
|
||||
},
|
||||
REVIEW_LOOP_EXCEPTION_INVALID: {
|
||||
anchor: 'review-loop-exception-invalid',
|
||||
@@ -438,12 +438,12 @@ export const RELEASE_RESULT_CODES = {
|
||||
RECEIPT_CARRY_TREE_MISMATCH: {
|
||||
anchor: 'receipt-carry-tree-mismatch',
|
||||
summary: 'the branch was rebased or force-pushed since its /ship receipt, and HEAD\'s tree is not a tree the receipt covers, so no review saw this code',
|
||||
fix: 'run /ship on the new head; next time merge the base in instead of rebasing a reviewed branch (a rebase carries only onto a reviewed tree with the reviewed product diff)',
|
||||
fix: 'run /gstack-ship on the new head; next time merge the base in instead of rebasing a reviewed branch (a rebase carries only onto a reviewed tree with the reviewed product diff)',
|
||||
},
|
||||
RECEIPT_CARRY_PRODUCT_CHANGED: {
|
||||
anchor: 'receipt-carry-product-changed',
|
||||
summary: 'the product diff against the base changed between the receipt\'s head and HEAD (a product file differs beyond a base merge, a test-only fix, release metadata or a regenerated output), so the reviewed verdict does not cover HEAD',
|
||||
fix: 'run /ship on the new head; the receipt carries only when every changed path is a test, release metadata, a registered output the pregate regen check proved, or the base merge, and the product patch-id is unchanged; base context next to unchanged reviewed hunks carries as the base merge, and a hunk the base merge spliced is RECEIPT_CARRY_SCOPED_REVIEW instead (one scoped reader, no /ship)',
|
||||
fix: 'run /gstack-ship on the new head; the receipt carries only when every changed path is a test, release metadata, a registered output the pregate regen check proved, or the base merge, and the product patch-id is unchanged; base context next to unchanged reviewed hunks carries as the base merge, and a hunk the base merge spliced is RECEIPT_CARRY_SCOPED_REVIEW instead (one scoped reader, no /ship)',
|
||||
},
|
||||
STOP_UNBOUND: {
|
||||
anchor: 'stop-unbound',
|
||||
@@ -473,7 +473,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
RECEIPT_CARRY_SCOPED_REVIEW: {
|
||||
anchor: 'receipt-carry-scoped-review',
|
||||
summary: 'the base replaced the very lines one of the branch\'s hunks replaces and the merge kept both (GST-2975), so the branch\'s own lines are not the reviewed bytes; the receipt carries only after a scoped review of those hunks',
|
||||
fix: 'dispatch one fix-check reviewer on the packet the refusal names, write its clean verdict as { head, paths, reviewer, verdict } and rerun carry with --scoped-review <record.json>; a blocking finding means /ship on the new head',
|
||||
fix: 'dispatch one fix-check reviewer on the packet the refusal names, write its clean verdict as { head, paths, reviewer, verdict } and rerun carry with --scoped-review <record.json>; a blocking finding means /gstack-ship on the new head',
|
||||
},
|
||||
RECEIPT_DOCS_AUDIT_READ: {
|
||||
anchor: 'receipt-docs-audit-read',
|
||||
@@ -493,7 +493,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
RECEIPT_PROSE_MISMATCH: {
|
||||
anchor: 'receipt-prose-mismatch',
|
||||
summary: 'the PR body quotes a counter the ship receipt also records (review passes, deferred findings, gate case counts) with a different number, so the prose and the receipt disagree about the same run',
|
||||
fix: 'correct the body to the receipt\'s number (the PROSE: line names each field with both values); when the receipt is the stale one, rerun /ship so the receipt is rewritten from the run',
|
||||
fix: 'correct the body to the receipt\'s number (the PROSE: line names each field with both values); when the receipt is the stale one, rerun /gstack-ship so the receipt is rewritten from the run',
|
||||
},
|
||||
RECEIPT_CARRY_PREGATE_STALE: {
|
||||
anchor: 'receipt-carry-pregate-stale',
|
||||
@@ -503,7 +503,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
RECEIPT_GIT_TOO_OLD: {
|
||||
anchor: 'receipt-git-too-old',
|
||||
summary: 'gstack-ship-receipt carry needs git 2.39 or later for `git patch-id --verbatim`; the installed git is older, so the product diff could not be compared',
|
||||
fix: 'upgrade git to 2.39 or later (the refusal names the installed version), then rerun carry; otherwise run /ship on the new head',
|
||||
fix: 'upgrade git to 2.39 or later (the refusal names the installed version), then rerun carry; otherwise run /gstack-ship on the new head',
|
||||
},
|
||||
// Changelog fragments and the per-PR merge step (lib/changelog-fragments.ts, lib/ship-queue-land.ts).
|
||||
CHANGELOG_FRAGMENT_INVALID: {
|
||||
@@ -535,7 +535,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_LAND_CONFLICT: {
|
||||
anchor: 'queue-land-conflict',
|
||||
summary: 'the PR conflicts with the base branch in product files (or a release field cannot be resolved alone), so the merge step cannot stamp it',
|
||||
fix: 'the lane merges the base branch into the PR, resolves the named files, runs /ship and reports READY again',
|
||||
fix: 'the lane merges the base branch into the PR, resolves the named files, runs /gstack-ship and reports READY again',
|
||||
},
|
||||
QUEUE_LAND_DRIFT: {
|
||||
anchor: 'queue-land-drift',
|
||||
@@ -551,17 +551,17 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_LAND_STAMPED: {
|
||||
anchor: 'queue-land-stamped',
|
||||
summary: 'under merge: direct the PR changes VERSION, the package.json version or the CHANGELOG; versions and the CHANGELOG are set at release, so a PR carries only its changelog fragment',
|
||||
fix: 'put the named files back to the merge base (git checkout $(git merge-base origin/main HEAD) -- <files>), keep or add the changelog.d fragment, commit, then /ship and ready at the new head',
|
||||
fix: 'put the named files back to the merge base (git checkout $(git merge-base origin/main HEAD) -- <files>), keep or add the changelog.d fragment, commit, then /gstack-ship and ready at the new head',
|
||||
},
|
||||
QUEUE_LAND_PIN_MOVED: {
|
||||
anchor: 'queue-land-pin-moved',
|
||||
summary: 'the PR head is not the pin land was given, so the READY it was given does not describe what would merge',
|
||||
fix: 'the lane runs /ship and gstack-ship-queue ready --pr <n> --no-screen at the new head and reports READY with it; land that pin',
|
||||
fix: 'the lane runs /gstack-ship and gstack-ship-queue ready --pr <n> --no-screen at the new head and reports READY with it; land that pin',
|
||||
},
|
||||
QUEUE_GATE_DISPOSITION: {
|
||||
anchor: 'queue-gate-disposition',
|
||||
summary: 'the owner gate dispositions the approval store applies at the pin are not all accepted by the lander, an accepted id is not applied, or the receipt or PR body differs from the store',
|
||||
fix: 'read each GATE_DISPOSITION line, then rerun land (or verify) with --accept-gate-disposition <approval id> for each one you accept; when the receipt or body differs from the store, the lane reruns /ship and ready at the pin',
|
||||
fix: 'read each GATE_DISPOSITION line, then rerun land (or verify) with --accept-gate-disposition <approval id> for each one you accept; when the receipt or body differs from the store, the lane reruns /gstack-ship and ready at the pin',
|
||||
},
|
||||
QUEUE_LAND_CHECKS: {
|
||||
anchor: 'queue-land-checks',
|
||||
@@ -571,12 +571,12 @@ export const RELEASE_RESULT_CODES = {
|
||||
QUEUE_LAND_MERGED_CHECKS: {
|
||||
anchor: 'queue-land-merged-checks',
|
||||
summary: 'the base moved past the pin\'s merge base, and a land.merged_checks command failed on the pin merged onto the base tip (GST-1316: a stale-base PR pushed a budgeted file past its cap on main); nothing merged',
|
||||
fix: 'merge the base into the branch, fix what the failing command names, push, wait for the required checks, run /ship and gstack-ship-queue ready at the new head, then land it',
|
||||
fix: 'merge the base into the branch, fix what the failing command names, push, wait for the required checks, run /gstack-ship and gstack-ship-queue ready at the new head, then land it',
|
||||
},
|
||||
QUEUE_LAND_NOT_CLEAN: {
|
||||
anchor: 'queue-land-not-clean',
|
||||
summary: 'GitHub does not report the PR mergeable and clean (a conflict, a branch rule, or a state GitHub is still computing)',
|
||||
fix: 'CONFLICTING: the lane merges the base into the branch, resolves, runs /ship and ready at the new head; UNKNOWN: rerun land in a minute; BLOCKED or BEHIND: meet the branch rule it names',
|
||||
fix: 'CONFLICTING: the lane merges the base into the branch, resolves, runs /gstack-ship and ready at the new head; UNKNOWN: rerun land in a minute; BLOCKED or BEHIND: meet the branch rule it names',
|
||||
},
|
||||
QUEUE_LAND_UNVERIFIED: {
|
||||
anchor: 'queue-land-unverified',
|
||||
|
||||
@@ -120,10 +120,10 @@ export function stopLines(l: Ledger, f: { call: number | null; next: string; ste
|
||||
if (f.reason === 'budget_exhausted') {
|
||||
lines.push(`STOP: reason=budget_exhausted spent=${t.used} reserved=${t.reserved} unknown=${t.unknown} admission_cap=${l.cap} next=${f.next} projected=${f.projected}`,
|
||||
resultLine('gstack-ship-budget', 'BUDGET_CAP_REACHED', `next ${f.next} needs ${f.projected} + reserve ${p.reserve}`),
|
||||
`RECOVER: /ship --resume ${l.record ?? '<record>'} --token-cap ${t.used + t.reserved + t.unknown + tailCost}`);
|
||||
`RECOVER: /gstack-ship --resume ${l.record ?? '<record>'} --token-cap ${t.used + t.reserved + t.unknown + tailCost}`);
|
||||
} else {
|
||||
lines.push(`STOP: reason=context_threshold call=${f.call ?? 'unknown'} call_floor=${p.floor} above_floor=${aboveFloor(f.call, p.floor) ?? 'unknown'} threshold=${f.threshold ?? DELEGATE_SEGMENT_CALL} next=${f.next} (--delegate never)`,
|
||||
`RECOVER: /ship --resume ${l.record ?? '<record>'} in a fresh session`);
|
||||
`RECOVER: /gstack-ship --resume ${l.record ?? '<record>'} in a fresh session`);
|
||||
}
|
||||
lines.push(`GSTACK_RESULT: skill=ship status=incomplete run=${l.dir}`);
|
||||
if (l.role === 'child' && l.parent) writeReturnFile(l.parent.return_file, [`RETURN: handoff=${l.parent.handoff_sha} status=incomplete steps=${l.parent.from}-${l.parent.to} next=${f.next}`, ...lines]);
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ export const SEGMENTS: Record<string, string> = { '1': '22', '9': '11.5', '12':
|
||||
export const DEFAULT_TAIL = 2_000_000;
|
||||
/**
|
||||
* The cap an observe-mode /ship run metering its own counter (its thread's own jam, --reading-from own, or a task row) gets when it names none:
|
||||
* R70's stop-and-look line, 50M since Capy's token counts read about half from 2026-11-15 (it was 100M). Single-run /ship
|
||||
* R70's stop-and-look line, 50M since Capy's token counts read about half from 2026-11-15 (it was 100M). Single-run /gstack-ship
|
||||
* subagent rows on 2026-11-03, on the old count (GSTA crew and FOUN-4/14/71, n=9): p50 64M, p90 92M; the one past 100M
|
||||
* (485M) was a subagent reused for five runs.
|
||||
*/
|
||||
|
||||
+2
-4
@@ -23,7 +23,6 @@ import * as path from 'node:path';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { spawnSync } from './spawn-sync';
|
||||
import { resolveClaudeCommand } from './claude-bin';
|
||||
import { readConfigKey } from './state-root';
|
||||
import { wtreeFingerprint } from './script-invocation';
|
||||
import { resultLine } from './result-codes';
|
||||
import {
|
||||
@@ -108,7 +107,7 @@ function brief(l: Ledger, h: Omit<Handoff, 'sha'>, pins: Record<string, unknown>
|
||||
'## Start', '',
|
||||
`1. Run \`gstack-ship-budget verify-handoff --in <this file>\` before anything else, with no \`--reading\` on Capy: a subagent cannot read its own jam id, so the parent's handoff and reconcile readings measure you (\`METER: parent\`); never pass the parent's or the root's counter. On a refusal, return its lines and stop.`,
|
||||
block.trail ? `2. Run \`gstack-decision-trail start ${block.trail} <your run id>\` before any trail write.` : '2. No decision trail was named.',
|
||||
`3. Run /ship --continue <this file> for Steps ${h.from}-${h.to} only, under the printed child run: \`check\` at every boundary and before every dispatch batch, obeying \`verdict=\`. The context rule never stops you: \`verdict=delegate\` hands your remaining steps to a fresh child the same way (ship/sections/budget-handoff.md), and a \`CONTEXT_HIGH:\` note means continue. This run is at chain depth ${h.depth} of ${MAX_CHAIN_DEPTH}.`,
|
||||
`3. Run /gstack-ship --continue <this file> for Steps ${h.from}-${h.to} only, under the printed child run: \`check\` at every boundary and before every dispatch batch, obeying \`verdict=\`. The context rule never stops you: \`verdict=delegate\` hands your remaining steps to a fresh child the same way (ship/sections/budget-handoff.md), and a \`CONTEXT_HIGH:\` note means continue. This run is at chain depth ${h.depth} of ${MAX_CHAIN_DEPTH}.`,
|
||||
block.launch_file ? `4. Source the launch file \`${block.launch_file}\` in every shell that runs a gstack command (its path only; never print its values).` : '4. No GSTACK_LAUNCH_FILE was named.', '',
|
||||
'## Read', '',
|
||||
`Only ship/SKILL.md's step list and, under ship/sections/, ${[...segmentSections(h.from, h.to), 'budget-handoff'].map(s => s + '.md').join(', ')}; a conditional section only when its manifest.json trigger fires. Never read ship/sections/preamble.md in full or docs/ship-budget.md: budget-handoff.md is the whole budget procedure. Read only the \`READ:\` ranges below (\`path:first-last\`, from the gstack install root), in one parallel call.`, '', ...readRanges(h.from, h.to), '',
|
||||
@@ -302,8 +301,7 @@ export function cmdLaunch(argv: string[], ctx: Ctx): Outcome {
|
||||
const claude = resolveClaudeCommand(ctx.env);
|
||||
if (!claude) throw usageError('no claude binary resolves (PATH, GSTACK_CLAUDE_BIN); launch the child by hand or rerun with --delegate never');
|
||||
const session = crypto.randomUUID();
|
||||
const ship = readConfigKey('skill_prefix', ctx.env) === 'true' ? '/gstack-ship' : '/ship';
|
||||
const prompt = `${ship} --continue ${path.resolve(file)} Your Claude Code session id is ${session}. First run gstack-ship-budget verify-handoff --in ${path.resolve(file)} --session ${session}, then only the steps the brief names, then gstack-ship-budget return as its return contract says.`;
|
||||
const prompt = `/gstack-ship --continue ${path.resolve(file)} Your Claude Code session id is ${session}. First run gstack-ship-budget verify-handoff --in ${path.resolve(file)} --session ${session}, then only the steps the brief names, then gstack-ship-budget return as its return contract says.`;
|
||||
const log = path.join(path.dirname(block.return_file), `child-${session}.log`);
|
||||
joinMeter(block.parent_ledger, session, ctx.env);
|
||||
const out = fs.openSync(log, 'a', 0o600);
|
||||
|
||||
@@ -45,7 +45,7 @@ export interface DirectOptions { pr: string; pin: string; body?: string; dryRun?
|
||||
export function pinAcceptance(ctx: QueueContext, info: Pick<DirectPr, 'body' | 'headRefName'>, pr: string, pin: string, accepted: readonly string[]): { lines: string[]; failure?: QueueFailure } {
|
||||
const receipt = bindShippedReceipt(ctx.repoRoot, `origin/${ctx.base}`, info.body ?? '', pr, [pin]);
|
||||
const lines = [receipt.line, ...(receipt.depthLine ? [receipt.depthLine] : []), ...(receipt.targetedLine ? [receipt.targetedLine] : [])];
|
||||
if (!receipt.ok) return { lines, failure: { code: receipt.code, message: receipt.message, fix: `run /ship at the pin, then gstack-ship-queue ready --pr ${pr}` } };
|
||||
if (!receipt.ok) return { lines, failure: { code: receipt.code, message: receipt.message, fix: `run /gstack-ship at the pin, then gstack-ship-queue ready --pr ${pr}` } };
|
||||
const noted = loadReady(repoIdentity(ctx.repoRoot).keys, pr, pin)?.gate_dispositions;
|
||||
const gates = gateAcceptance({ cwd: ctx.repoRoot, branch: info.headRefName, pin, body: info.body ?? '', receipt: receipt.receipt, accepted, noted });
|
||||
return { lines: [...lines, ...gates.lines], ...(gates.failure ? { failure: gates.failure } : {}) };
|
||||
@@ -195,7 +195,7 @@ export function landDirect(ctx: QueueContext, o: DirectOptions): StepOutput {
|
||||
return { ...out, lines: [...out.lines, freed ? `LOCK: released the land lock an earlier run of this land left` : `LOCK: warn the land lock an earlier run of this land left is still held; rerun this land to release it`] };
|
||||
}
|
||||
if (info.state !== 'OPEN') return fail(lines, { code: 'QUEUE_NOT_READY', message: `#${o.pr} is ${info.state}` });
|
||||
if (info.headRefOid !== o.pin) return fail(lines, { code: 'QUEUE_LAND_PIN_MOVED', message: `#${o.pr}'s head is ${info.headRefOid.slice(0, 12)}, not the pin ${o.pin.slice(0, 12)}`, fix: `the lane runs /ship and gstack-ship-queue ready --pr ${o.pr} at the new head and reports READY with it` });
|
||||
if (info.headRefOid !== o.pin) return fail(lines, { code: 'QUEUE_LAND_PIN_MOVED', message: `#${o.pr}'s head is ${info.headRefOid.slice(0, 12)}, not the pin ${o.pin.slice(0, 12)}`, fix: `the lane runs /gstack-ship and gstack-ship-queue ready --pr ${o.pr} at the new head and reports READY with it` });
|
||||
|
||||
if (!havePin(root, o.pr, o.pin, info.headRefName)) return fail(lines, { code: 'QUEUE_NOT_READY', message: `cannot fetch the pin ${o.pin.slice(0, 12)} from ${info.headRefName} or refs/pull/${o.pr}/head`, fix: 'fix the fetch, then rerun land' });
|
||||
const mergeBase = git(root, ['merge-base', `origin/${ctx.base}`, o.pin]).out;
|
||||
@@ -235,7 +235,7 @@ export function landDirect(ctx: QueueContext, o: DirectOptions): StepOutput {
|
||||
const files = stamped.filter(f => f !== 'package.json version');
|
||||
const restore = files.length ? `git checkout $(git merge-base origin/${ctx.base} HEAD) -- ${files.join(' ')}` : '';
|
||||
const npm = stamped.includes('package.json version') ? 'set package.json "version" back to its merge base value' : '';
|
||||
return fail(lines, { code: 'QUEUE_LAND_STAMPED', message: `#${o.pr} changes ${stamped.join(', ')}; under merge: direct the release sets versions and the CHANGELOG, a PR carries only its changelog fragment`, fix: `${[restore, npm].filter(Boolean).join(' and ')}, keep (or add) the changelog.d fragment, commit, then /ship and ready at the new head` });
|
||||
return fail(lines, { code: 'QUEUE_LAND_STAMPED', message: `#${o.pr} changes ${stamped.join(', ')}; under merge: direct the release sets versions and the CHANGELOG, a PR carries only its changelog fragment`, fix: `${[restore, npm].filter(Boolean).join(' and ')}, keep (or add) the changelog.d fragment, commit, then /gstack-ship and ready at the new head` });
|
||||
}
|
||||
|
||||
const ci = ciAtHead(ctx, o.pin);
|
||||
@@ -244,7 +244,7 @@ export function landDirect(ctx: QueueContext, o: DirectOptions): StepOutput {
|
||||
const passed = new Set([...ci.checks.filter(c => c.conclusion === 'success').map(c => c.name), ...ci.contexts.filter(c => c.state === 'success').map(c => c.name)]);
|
||||
const missing = (policy.changelog_fragments?.required_checks ?? []).filter(n => !passed.has(n));
|
||||
if (missing.length) return fail(lines, { code: 'QUEUE_LAND_CHECKS', message: `required check(s) ${missing.join(', ')} did not pass at the pin ${o.pin.slice(0, 12)}`, fix: `dispatch them on the branch (gh workflow run <workflow> --ref ${info.headRefName}) and rerun land once they pass; a check that runs on pull_request_target (such as Plain title) cannot be dispatched, so edit the PR title or body to rerun it` });
|
||||
if (info.mergeable !== 'MERGEABLE' || info.mergeStateStatus !== 'CLEAN') return fail(lines, { code: 'QUEUE_LAND_NOT_CLEAN', message: `GitHub reports #${o.pr} mergeable=${info.mergeable ?? 'unknown'} mergeStateStatus=${info.mergeStateStatus ?? 'unknown'}`, fix: info.mergeable === 'CONFLICTING' ? `the lane merges origin/${ctx.base} into the branch, resolves, runs /ship and ready at the new head` : 'UNKNOWN means GitHub is still computing: rerun land in a minute; BLOCKED or BEHIND names the branch rule to meet first' });
|
||||
if (info.mergeable !== 'MERGEABLE' || info.mergeStateStatus !== 'CLEAN') return fail(lines, { code: 'QUEUE_LAND_NOT_CLEAN', message: `GitHub reports #${o.pr} mergeable=${info.mergeable ?? 'unknown'} mergeStateStatus=${info.mergeStateStatus ?? 'unknown'}`, fix: info.mergeable === 'CONFLICTING' ? `the lane merges origin/${ctx.base} into the branch, resolves, runs /gstack-ship and ready at the new head` : 'UNKNOWN means GitHub is still computing: rerun land in a minute; BLOCKED or BEHIND names the branch rule to meet first' });
|
||||
let held: HeldLandLock | undefined;
|
||||
if (!o.dryRun) {
|
||||
const got = takeLock();
|
||||
@@ -265,10 +265,10 @@ export function landDirect(ctx: QueueContext, o: DirectOptions): StepOutput {
|
||||
const moved = `origin/${ctx.base} moved to ${tip.slice(0, 12)} since the pin's merge base ${mergeBase.slice(0, 12)}, so the checks at the pin never ran on the tree that would land`;
|
||||
const ci = current.policy.land?.merged_ci;
|
||||
const refuse = (mc: Extract<MergedRun, { ok: false }>): StepOutput => {
|
||||
if (mc.setup) return fail(lines, { code: 'QUEUE_NOT_READY', message: `${moved}, and land could not run land.merged_checks on the pin merged onto it: ${mc.detail}; nothing merged`, fix: `if the checkout is the problem, fix it and rerun land; if the dependencies changed, the lane merges origin/${ctx.base} into the branch, waits for the required checks, runs /ship and ready at the new head` });
|
||||
if (mc.conflict) return fail(lines, { code: 'QUEUE_LAND_NOT_CLEAN', message: `${moved}: ${mc.detail}`, fix: `the lane merges origin/${ctx.base} into the branch, resolves, runs /ship and ready at the new head` });
|
||||
if (mc.setup) return fail(lines, { code: 'QUEUE_NOT_READY', message: `${moved}, and land could not run land.merged_checks on the pin merged onto it: ${mc.detail}; nothing merged`, fix: `if the checkout is the problem, fix it and rerun land; if the dependencies changed, the lane merges origin/${ctx.base} into the branch, waits for the required checks, runs /gstack-ship and ready at the new head` });
|
||||
if (mc.conflict) return fail(lines, { code: 'QUEUE_LAND_NOT_CLEAN', message: `${moved}: ${mc.detail}`, fix: `the lane merges origin/${ctx.base} into the branch, resolves, runs /gstack-ship and ready at the new head` });
|
||||
if (mc.tampered) return fail(lines, { code: 'QUEUE_LAND_MERGED_CHECKS', message: `${moved}; on the pin merged onto it, ${mc.detail}`, fix: 'hold and inspect: a person restores every path named from a trusted copy before any git command in this checkout and releases the land lock as the LOCK line says; nothing goes back to the lane until then, and the PR does not land until its checks are understood' });
|
||||
return fail(lines, { code: 'QUEUE_LAND_MERGED_CHECKS', message: `${moved}; on the pin merged onto it, ${mc.detail}`, fix: `merge the base into the branch (git merge origin/${ctx.base}), fix what the failing check names, push, wait for the required checks at the new head, run /ship and gstack-ship-queue ready --pr ${o.pr} there, then land the new pin` });
|
||||
return fail(lines, { code: 'QUEUE_LAND_MERGED_CHECKS', message: `${moved}; on the pin merged onto it, ${mc.detail}`, fix: `merge the base into the branch (git merge origin/${ctx.base}), fix what the failing check names, push, wait for the required checks at the new head, run /gstack-ship and gstack-ship-queue ready --pr ${o.pr} there, then land the new pin` });
|
||||
};
|
||||
if (!checks.length && !ci) lines.push(`STALE_BASE: warn ${moved}; no land.merged_checks configured, so land merges it untested`);
|
||||
else if (o.dryRun) {
|
||||
|
||||
@@ -273,7 +273,7 @@ function repair(ctx: QueueContext, policy: ShipPolicy, j: LandJournal | null, fi
|
||||
const root = ctx.repoRoot;
|
||||
if (!j || j.phase !== 'drift' || !j.drift_main || !j.base_sha) return fail([], { code: 'QUEUE_NOT_READY', message: `#${j?.pr ?? '?'} has no drift record; --repair runs only after QUEUE_LAND_DRIFT` }, run);
|
||||
const lines = [`REPAIR: #${j.pr} landed on ${j.drift_main.slice(0, 12)} beside a merge outside land`];
|
||||
if (j.repair_pr) return { ok: true, run, lines: [...lines, `REPAIR_PR: #${j.repair_pr} (already open)`, `NEXT: run /ship on #${j.repair_pr}, then gstack-ship-queue land --pr ${j.repair_pr}`] };
|
||||
if (j.repair_pr) return { ok: true, run, lines: [...lines, `REPAIR_PR: #${j.repair_pr} (already open)`, `NEXT: run /gstack-ship on #${j.repair_pr}, then gstack-ship-queue land --pr ${j.repair_pr}`] };
|
||||
const dir = policy.changelog_fragments?.dir?.replace(/\/+$/, '');
|
||||
if (!dir) return fail(lines, { code: 'QUEUE_NOT_READY', message: 'changelog_fragments is off: write the [Unreleased] entry for the outside merge by hand and land it' }, run);
|
||||
git(root, ['fetch', '-q', 'origin', ctx.base]);
|
||||
@@ -312,7 +312,7 @@ function repair(ctx: QueueContext, policy: ShipPolicy, j: LandJournal | null, fi
|
||||
j.repair_pr = n; writeJsonAtomic(file, j);
|
||||
const held = readLock(root);
|
||||
if (held.state === 'held' && !held.lock.train && held.lock.pr === j.pr && held.lock.phase === 'drift') writeLock(root, held.sha, { ...held.lock, repair_pr: n });
|
||||
return { ok: true, run, lines: [...lines, `REPAIR_PR: #${n} ${branch} ${pushed}`, `NEXT: run /ship on #${n}, then gstack-ship-queue land --pr ${n} (it takes over #${j.pr}'s drift lock and releases it)`] };
|
||||
return { ok: true, run, lines: [...lines, `REPAIR_PR: #${n} ${branch} ${pushed}`, `NEXT: run /gstack-ship on #${n}, then gstack-ship-queue land --pr ${n} (it takes over #${j.pr}'s drift lock and releases it)`] };
|
||||
} finally {
|
||||
git(root, ['worktree', 'remove', '--force', wt]);
|
||||
fs.rmSync(wt, { recursive: true, force: true });
|
||||
@@ -347,7 +347,7 @@ export function land(ctx: QueueContext, o: LandOptions): StepOutput {
|
||||
if (!git(root, ['fetch', '-q', 'origin', ctx.base]).ok) return fail(lines, { code: 'QUEUE_BASE_UNFETCHED', message: `cannot fetch origin/${ctx.base}; land checks the receipt against the current base, never a ref it did not refresh`, fix: `fix the fetch (git fetch origin ${ctx.base}), then rerun land` }, run);
|
||||
const receipt = bindShippedReceipt(root, `origin/${ctx.base}`, info.body ?? '', o.pr, [pin], mergedResume);
|
||||
lines.push(receipt.line, ...(receipt.depthLine ? [receipt.depthLine] : []), ...(receipt.targetedLine ? [receipt.targetedLine] : []));
|
||||
if (!receipt.ok) return fail(lines, { code: receipt.code, message: receipt.message, fix: 'run /ship at the pinned head first' }, run);
|
||||
if (!receipt.ok) return fail(lines, { code: receipt.code, message: receipt.message, fix: 'run /gstack-ship at the pinned head first' }, run);
|
||||
if (!policy.changelog_fragments) return fail(lines, { code: 'QUEUE_NOT_READY', message: 'the base policy has changelog_fragments off; land merges only under the key, where ready records the READY receipt it checks' }, run);
|
||||
const keys = repoIdentity(root).keys;
|
||||
if (!loadReady(keys, o.pr, pin)) rebuildFromNotes(root, ctx.remote ?? 'origin');
|
||||
|
||||
@@ -482,7 +482,7 @@ export function excludeMismatch(x: Exclusion, r: ShipReceipt, head: string, base
|
||||
const recorded = r.review_exclude?.digest ?? 'none';
|
||||
const source = x.state === 'active' ? x.record.source : r.review_exclude?.source ?? base;
|
||||
const h = head.slice(0, 12);
|
||||
return `field=review_exclude expected=${expected} recorded=${recorded} source=${source}: the receipt records another selection than ${base}'s review_exclude_paths gives ${h}, and the two give the PR's files different selections; the receipt is unchanged; fix: rerun /ship's review on ${h} (gstack-review-dispatch pass --base ${base.replace(/^(refs\/remotes\/)?origin\//, '')}), then gstack-ship-receipt write --pr <n> --review-exclude <d> --body <body> with the digest gstack-review-dispatch verify --ledger <ledger> prints on REVIEW_EXCLUDE_RECORD: (write checks the digest against the base policy and does not read the review ledger, so only the rerun shows the reviewers read this selection)`;
|
||||
return `field=review_exclude expected=${expected} recorded=${recorded} source=${source}: the receipt records another selection than ${base}'s review_exclude_paths gives ${h}, and the two give the PR's files different selections; the receipt is unchanged; fix: rerun /gstack-ship's review on ${h} (gstack-review-dispatch pass --base ${base.replace(/^(refs\/remotes\/)?origin\//, '')}), then gstack-ship-receipt write --pr <n> --review-exclude <d> --body <body> with the digest gstack-review-dispatch verify --ledger <ledger> prints on REVIEW_EXCLUDE_RECORD: (write checks the digest against the base policy and does not read the review ledger, so only the rerun shows the reviewers read this selection)`;
|
||||
}
|
||||
/** The receipt's recorded gate scan when it names this head; otherwise null (unavailable). */
|
||||
const boundScan = (r: ShipReceipt, head: string): number | null => {
|
||||
@@ -513,12 +513,12 @@ export function receiptDepthVerdict(root: string, baseRef: string, r: ShipReceip
|
||||
const fits = need.depth === 'light' && platformFits(need.class, c.paths, need.runtimeLines, scanNumbers(c.added));
|
||||
const ok = review.platform === 'on' && fits && !!pr && pr.head === head.toLowerCase();
|
||||
if (ok) return { ok: true, line: `${line} platform_review=${pr!.id}@${pr!.head.slice(0, 12)}` };
|
||||
return { ok: false, line, message: `the receipt records the platform depth, but ${review.platform !== 'on' ? `the base policy has review.platform ${review.platform}` : !fits ? `head ${head.slice(0, 12)} needs ${need.depth} review of a diff the platform depth does not cover` : `its platform review is not at head ${head.slice(0, 12)}`}; the receipt is unchanged; run /ship on ${head.slice(0, 12)}` };
|
||||
return { ok: false, line, message: `the receipt records the platform depth, but ${review.platform !== 'on' ? `the base policy has review.platform ${review.platform}` : !fits ? `head ${head.slice(0, 12)} needs ${need.depth} review of a diff the platform depth does not cover` : `its platform review is not at head ${head.slice(0, 12)}`}; the receipt is unchanged; run /gstack-ship on ${head.slice(0, 12)}` };
|
||||
}
|
||||
if (have && !depthBelow(have, need.depth)) return { ok: true, line };
|
||||
const why = have ? `was reviewed at ${have} depth` : 'records no review_depth though its writer records one';
|
||||
const errs = need.errors.map(e => `${e.code} (${e.input})`).join('; ');
|
||||
return { ok: false, line, message: `the receipt ${why}, but head ${head.slice(0, 12)} needs ${need.depth} (${need.reasons.join(', ')}${errs ? `; ${errs}` : ''}); the receipt is unchanged; run /ship on ${head.slice(0, 12)}` };
|
||||
return { ok: false, line, message: `the receipt ${why}, but head ${head.slice(0, 12)} needs ${need.depth} (${need.reasons.join(', ')}${errs ? `; ${errs}` : ''}); the receipt is unchanged; run /gstack-ship on ${head.slice(0, 12)}` };
|
||||
}
|
||||
|
||||
/** bindReceipt plus the owner exceptions, the review depth and the targeted pass: what READY, train build and land accept. A base that already contains the head refuses (BASE_CONTAINS_HEAD, GST-774) before any depth is computed, except for a PR GitHub already merged (`merged`: land resuming after a merge-only true merge), whose depth then reads the range with diff-scope's `--merged` and whose exclusion digest is not recomputed over that emptied range. */
|
||||
@@ -542,7 +542,7 @@ export function bindShippedReceipt(root: string, baseRef: string, body: string,
|
||||
const gateTagged = boundScan(b.receipt, b.head) ?? (gateScanNeeded(at.c.paths, at.c.root) ? null : 0);
|
||||
const t = receiptTargetedVerdict(targetedAt(at, gateTagged).classes, b.receipt);
|
||||
if (!d.ok) return { ok: false, code: 'QUEUE_RECEIPT_DEPTH_RAISED', message: d.message!, line: b.line, depthLine: d.line, targetedLine: t.line };
|
||||
if (!t.ok) return { ok: false, code: 'QUEUE_RECEIPT_TARGETED_MISSING', message: `${t.message}; the receipt is unchanged; run /ship on ${b.head.slice(0, 12)}`, line: b.line, depthLine: d.line, targetedLine: t.line };
|
||||
if (!t.ok) return { ok: false, code: 'QUEUE_RECEIPT_TARGETED_MISSING', message: `${t.message}; the receipt is unchanged; run /gstack-ship on ${b.head.slice(0, 12)}`, line: b.line, depthLine: d.line, targetedLine: t.line };
|
||||
return { ...b, depthLine: d.line, targetedLine: t.line };
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -115,8 +115,8 @@ export function bindReceipt(body: string, pr: string | undefined, accepted: read
|
||||
const [was, want] = [oneLine(r.base).slice(0, 120), branch(opts.base)];
|
||||
return { ok: false, code: 'QUEUE_RECEIPT_BASE_MISMATCH', message: `${subject} ship receipt was reviewed against ${was}, not ${want}, so it covers only the change since ${was}; land the parent (${was}) first, merge ${want} into this branch and push, then gstack-ship-receipt carry --pr ${pr ?? '<n>'} --base ${want} moves the receipt to ${want}`, line };
|
||||
}
|
||||
if (recheckCarried(r)) return { ok: false, code: 'QUEUE_RECEIPT_STALE', message: `${subject} ship receipt reached ${oneLine(r.head.slice(0, 12))} through a scoped re-check (carry: ${oneLine(r.carry!.reason).slice(0, 160)}), which is advice only, so the product code it covered never got a full review; run /ship on that head for its full review (GST-2673, docs/review-policy.md#rounds-per-pull-request)`, line };
|
||||
if (r.base_red && !opts.conditional) return { ok: false, code: 'QUEUE_RECEIPT_CONDITIONAL', message: `${subject} ship receipt is paused on a red base (${oneLine(r.base_red.cases.join(', ')).slice(0, 160)} fail at ${oneLine(r.base_red.base.slice(0, 12))}); /ship --resume rewrites it once the base passes them`, line };
|
||||
if (recheckCarried(r)) return { ok: false, code: 'QUEUE_RECEIPT_STALE', message: `${subject} ship receipt reached ${oneLine(r.head.slice(0, 12))} through a scoped re-check (carry: ${oneLine(r.carry!.reason).slice(0, 160)}), which is advice only, so the product code it covered never got a full review; run /gstack-ship on that head for its full review (GST-2673, docs/review-policy.md#rounds-per-pull-request)`, line };
|
||||
if (r.base_red && !opts.conditional) return { ok: false, code: 'QUEUE_RECEIPT_CONDITIONAL', message: `${subject} ship receipt is paused on a red base (${oneLine(r.base_red.cases.join(', ')).slice(0, 160)} fail at ${oneLine(r.base_red.base.slice(0, 12))}); /gstack-ship --resume rewrites it once the base passes them`, line };
|
||||
return { ok: true, receipt: r, head, line };
|
||||
}
|
||||
|
||||
@@ -479,10 +479,10 @@ export interface TreeCarryInput {
|
||||
*/
|
||||
export function planTreeCarry(input: TreeCarryInput): CarryPlan {
|
||||
if (!input.coveredTrees.includes(input.headTree)) {
|
||||
return { ok: false, code: 'RECEIPT_CARRY_TREE_MISMATCH', message: `the receipt's head ${input.from.slice(0, 12)} is not an ancestor of HEAD ${input.head.slice(0, 12)} (rebased or force-pushed), and HEAD's tree ${input.headTree.slice(0, 12)} is not a tree the receipt covers (${input.coveredTrees.map(t => t.slice(0, 12)).join(', ') || 'none recorded'}); the receipt is unchanged: run /ship on ${input.head.slice(0, 12)}` };
|
||||
return { ok: false, code: 'RECEIPT_CARRY_TREE_MISMATCH', message: `the receipt's head ${input.from.slice(0, 12)} is not an ancestor of HEAD ${input.head.slice(0, 12)} (rebased or force-pushed), and HEAD's tree ${input.headTree.slice(0, 12)} is not a tree the receipt covers (${input.coveredTrees.map(t => t.slice(0, 12)).join(', ') || 'none recorded'}); the receipt is unchanged: run /gstack-ship on ${input.head.slice(0, 12)}` };
|
||||
}
|
||||
if (input.productPatchId.recorded !== input.productPatchId.head) {
|
||||
return { ok: false, code: 'RECEIPT_CARRY_PRODUCT_CHANGED', message: `HEAD ${input.head.slice(0, 12)} has the reviewed tree, but its product diff against the current base differs from the one reviewed at ${input.from.slice(0, 12)} (the base itself moved under it); the receipt is unchanged: run /ship on ${input.head.slice(0, 12)}` };
|
||||
return { ok: false, code: 'RECEIPT_CARRY_PRODUCT_CHANGED', message: `HEAD ${input.head.slice(0, 12)} has the reviewed tree, but its product diff against the current base differs from the one reviewed at ${input.from.slice(0, 12)} (the base itself moved under it); the receipt is unchanged: run /gstack-ship on ${input.head.slice(0, 12)}` };
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
|
||||
Reference in new issue
Block a user