mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 00:51:31 +01:00
A used review grant can no longer be claimed again, plus two /ship finish fixes (GST-3560) (#4722)
A grant for one follow-up review of a fix can no longer be claimed again once that review ran, so one grant still buys one round. /ship finish no longer calls the docs audit stale for a file a clean follow-up review read, and the CI-record timeout no longer counts local test runs. Nothing to do: the merge checks only get stricter, and the timeout setting keeps its name and default. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: pass1/outside-voice#1 reader=outside-voice Review-Finding: pass1/outside-voice#2 reader=outside-voice Review-Finding: pass1/outside-voice#3 reader=outside-voice Review-Finding: pass2/outside-voice#2 reader=outside-voice
This commit is contained in:
1 parent
79f3052f35
commit
ccd80de8eb
15 files changed
+198
-36
No files matched your search
+6
-1
@@ -76,7 +76,10 @@
|
||||
* whose inventory command refuses HEAD's tree (inventory_failed) is recorded
|
||||
* as source "remote_gate" when the cleared pregate.json/remote_gate verifies
|
||||
* for that exact tree (lib/remote-gate-stand-in.ts, GST-1688); `carried`
|
||||
* never lists it, since no CI run carried it.
|
||||
* never lists it, since no CI run carried it. Before it runs any file here (a
|
||||
* per_file remainder of CI-skipped files, or a test-lane exception's preflight),
|
||||
* it prints CI_RECORD_PHASE: local, which ends the ci_record_timeout_s bound
|
||||
* gstack-ship-release and gstack-ship-preflight hold it to (GST-3560).
|
||||
*
|
||||
* MACHINE-LOCAL by design: neither the ledger nor the logs are brain-synced.
|
||||
* A synced record citing an unsynced log would grade FRESH on a machine where
|
||||
@@ -821,6 +824,8 @@ async function cmdRecordCi(argv: string[]): Promise<number> {
|
||||
}
|
||||
let exception: BoundLaneException | undefined;
|
||||
const grant = atHead.find((g) => g.approval === v.exceptedBy);
|
||||
const local = (v.excepted?.length && grant ? v.excepted.length : 0) + (v.remainder?.length ?? 0);
|
||||
if (local) console.error(`CI_RECORD_PHASE: local files=${local} (the CI run is found and verified; ci_record_timeout_s does not bound these runs)`);
|
||||
if (v.excepted?.length && grant) {
|
||||
const preLabel = `${label}.excepted`;
|
||||
console.error(`gstack-evidence record-ci: test-lane exception ${grant.approval}: preflighting ${v.excepted.length} uncovered file(s) here at ${head.slice(0, 12)}, one at a time (label=${preLabel})`);
|
||||
|
||||
@@ -1062,17 +1062,24 @@ function cmdStop(rest: string[]): number {
|
||||
}
|
||||
|
||||
/** Before a granted round's first dispatch: this run spends the grant, so no other run can buy the same round with it. */
|
||||
function cmdClaim(rest: string[]): number {
|
||||
async function cmdClaim(rest: string[]): Promise<number> {
|
||||
const run = flag(rest, '--run'), id = flag(rest, '--grant');
|
||||
if (!run || !/^[\w.:-]{1,120}$/.test(run) || !id) { process.stderr.write('gstack-ship-receipt claim: --run <the /ship run id> and --grant <approval id> are required\n'); return EXIT.usage; }
|
||||
const repoRoot = git(['rev-parse', '--show-toplevel']);
|
||||
if (!repoRoot) { process.stderr.write('gstack-ship-receipt claim: run it inside the git checkout\n'); return EXIT.usage; }
|
||||
const read = readBody(rest);
|
||||
if (!read.ok) { process.stderr.write(`gstack-ship-receipt claim: ${read.why}; fix: ${read.fix}\n`); return EXIT.fail; }
|
||||
const g = readReviewRoundGrants(repoRoot).find(x => x.approval === id);
|
||||
const grants = readReviewRoundGrants(repoRoot), g = grants.find(x => x.approval === id);
|
||||
if (!g) { process.stderr.write(`${resultLine('gstack-ship-receipt claim', 'GRANT_UNKNOWN', `no approved fix-check or round grant ${id} (a gstack-approvals round-grant row, or an owner's review_loop_grant <head> row) in this branch's approval record`)}\n`); return EXIT.refused; }
|
||||
const other = receiptRuns(read.body).find(r => r.mark === 'grant' && r.grant === id && r.run !== run);
|
||||
if (other) { process.stderr.write(`${resultLine('gstack-ship-receipt claim', 'GRANT_SPENT', `grant ${id} was claimed by run ${other.run}: a grant buys one round; the lane or its Captain records a new one`)}\n`); return EXIT.refused; }
|
||||
const held = receiptRuns(read.body).some(r => r.mark === 'grant' && r.grant === id && r.run === run);
|
||||
if (!held && g.kind === 'fix-check') {
|
||||
const rows = reviewRows(repoRoot);
|
||||
if (!rows) { process.stderr.write(`gstack-ship-receipt claim: gstack-review-read failed, so whether a fix-check already spent grant ${id} is unknown; not claimed, so do not dispatch\n`); return EXIT.fail; }
|
||||
const { bindFixCheckRow, grantSpent } = await import('../lib/fix-check-clearing');
|
||||
if (grantSpent(rows, g, row => bindFixCheckRow(repoRoot, row, grants, { open: true }).ok)) { process.stderr.write(`${resultLine('gstack-ship-receipt claim', 'GRANT_SPENT', `a counted fix-check already read under grant ${id} (it carries the grant, or started after the grant was recorded): a grant buys one round; the lane or its Captain records a new one (docs/troubleshooting.md#pr-round-cap)`)}\n`); return EXIT.refused; }
|
||||
}
|
||||
const err = postBody(rest, read.pr, placeRunEntry(read.body, grantMarker({ head: g.head, run, grant: id })));
|
||||
if (err) { process.stderr.write(`gstack-ship-receipt claim: ${err}; not claimed, so do not dispatch\n`); return EXIT.fail; }
|
||||
const handedOff = !flag(rest, '--body') && hostPublishes();
|
||||
|
||||
Reference in new issue
Block a user