From 1f7b003fbaf41bac4e100aa896a2aef25e8d21d1 Mon Sep 17 00:00:00 2001 From: garrytan Date: Thu, 15 Oct 2026 01:16:56 +0000 Subject: [PATCH] fix(pregate): clear validates the remote gate receipt; test_backend run URLs are attested `gstack-pregate clear` accepted any --run-url for a small machine's obligation. A pregate.json/remote_gate obligation now clears only with --receipt holding the gate's PREGATE_REMOTE: line, validated as --remote validates it (tree equals the tested tree, tests > 0, failed = 0; shared parseRemoteReport/remoteReportProblem); a run URL is usage (exit 2) and a bad receipt is PREGATE_RECEIPT_INVALID (exit 1, obligation unchanged). A test_backend/ obligation has no machine-checkable receipt: its --run-url is recorded as attested: and the output says attested, not validated. Platform lanes are unchanged. Hints name the right clear form. New code PREGATE_RECEIPT_INVALID: result-codes row, troubleshooting anchor, installer-form error line, regenerated doctor components. Files (G2): lib/pregate/index.ts, lib/pregate/checks/lanes.ts, bin/gstack-pregate, lib/result-codes.ts, bin/gstack-doctor-components.sh (generated), docs/pregate.md, docs/troubleshooting.md, test/pregate-remote.test.ts. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- bin/gstack-doctor-components.sh | 1 + bin/gstack-pregate | 28 ++++++++++++-------- docs/pregate.md | 6 ++++- docs/troubleshooting.md | 14 ++++++++++ lib/pregate/checks/lanes.ts | 37 ++++++++++++++++++-------- lib/pregate/index.ts | 40 ++++++++++++++++++++++++++-- lib/result-codes.ts | 5 ++++ test/pregate-remote.test.ts | 47 +++++++++++++++++++++++++++------ 8 files changed, 145 insertions(+), 33 deletions(-) diff --git a/bin/gstack-doctor-components.sh b/bin/gstack-doctor-components.sh index cdff473ed..ce5109884 100644 --- a/bin/gstack-doctor-components.sh +++ b/bin/gstack-doctor-components.sh @@ -162,6 +162,7 @@ gstack_result_anchor() { PREGATE_LANE_FAILED) printf '%s' 'pregate-lane-failed' ;; PREGATE_INCOMPLETE) printf '%s' 'pregate-incomplete' ;; PREGATE_STALLED) printf '%s' 'pregate-stalled' ;; + PREGATE_RECEIPT_INVALID) printf '%s' 'pregate-receipt-invalid' ;; PREGATE_STALE) printf '%s' 'pregate-stale' ;; PREGATE_REMOTE_UNCLEARED) printf '%s' 'pregate-remote-uncleared' ;; ISSUE_UNREADABLE) printf '%s' 'issue-unreadable' ;; diff --git a/bin/gstack-pregate b/bin/gstack-pregate index afc5e42a2..fed93616d 100755 --- a/bin/gstack-pregate +++ b/bin/gstack-pregate @@ -6,7 +6,7 @@ * [--allow-repo-commands] [--policy-from base|head] [--out ] * [--timeout ] [--stall-timeout ] [--remote --spend-cap ] [--run ] [--explain] [--json] * gstack-pregate verify [--out ] [--json] publication check: current tree, no fail/incomplete, obligations cleared - * gstack-pregate clear --remote --run-url | --bundle-lane