mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-05 08:23:59 +01:00
fix(pr-wait): keep the result codes in lib/result-codes-release.ts so fixtures that copy the module list keep working
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
57c5b91444
commit
2d95239f93
5 files changed
+14
-25
No files matched your search
+1
-1
@@ -5,7 +5,7 @@
|
||||
### Added
|
||||
- **`bin/gstack-pr-wait`, `lib/pr-wait.ts`, `lib/pr-wait-github.ts`**: an event-driven pull-request watcher (design ported from tstack's pr-wait, MIT, Theo Browne; NOTICE.md, `licenses/MIT-tstack.txt`). `gstack-pr-wait <pr> [--repo owner/name] [--until green|ready|any-change] [--interval SECONDS]` prints one stdout line per real event, prefixed `#<pr>`, and progress on stderr: a required check failed (name and link), all checks finished on the head, a comment, review, thread or reply from someone other than the PR author or the gh user, a review bot finished on the head or a gating bot's summary changed, the base branch moved and its new commits touch this PR's files, merge state BEHIND or DIRTY, merged or closed. Required checks are read from the base branch's rulesets and classic branch protection, so a required check that has not started is pending rather than green by omission; two identical polls confirm the check set before `green`. Exit 0 when the condition is met or the PR merged, 1 when it needs action (`PR_WAIT_BLOCKED`), 2 on bad input, an unreadable PR or a second watcher for the same PR (`PR_WAIT_REFUSED`; a lock whose pid is dead is taken over). State lives under `<state root>/pr-wait/` (lib/state-root.ts chain), and a baseline older than 6 hours is discarded. Transient gh failures (5xx, 429, network) retry with backoff; ten failed polls in a row end the watch as blocked.
|
||||
- **`gstack-config` keys `pr_wait_gating_bots` (default `greptile,macroscope`) and `pr_wait_advisory_bots` (default `coderabbit`)**: which review bots `--until ready` waits for and which it only reports; comma-separated names matched against bot logins and check names, `none` empties a list, anything else is rejected with the value kept.
|
||||
- **Result codes `PR_WAIT_BLOCKED` and `PR_WAIT_REFUSED`** (`lib/result-codes-pr-wait.ts`) with their [troubleshooting anchors](docs/troubleshooting.md#gstack-pr-wait); a `gstack-pr-wait` row in docs/standalone-binaries.md.
|
||||
- **Result codes `PR_WAIT_BLOCKED` and `PR_WAIT_REFUSED`** (`lib/result-codes-release.ts`) with their [troubleshooting anchors](docs/troubleshooting.md#gstack-pr-wait); a `gstack-pr-wait` row in docs/standalone-binaries.md.
|
||||
|
||||
### Changed
|
||||
- **`/land-and-deploy` Step 3**: the 4-minute `gstack-ci-gate --wait 240` polling rounds with a 15-minute cap and a wait-more/exclude/stop question are replaced by one `gstack-pr-wait "$PR_NUMBER" --repo "$REPO" --until green` call; exit 0 reruns Step 2's gate on the pinned head, exit 1 stops with the watcher's lines (a red `required=n` check stays the one case Step 3.5 may approve), exit 2 shows the refusal. The Important Rules line about polling intervals names the watcher. The generated skill is the same size on every pinned host, so no pin moved.
|
||||
|
||||
@@ -295,6 +295,8 @@ gstack_result_anchor() {
|
||||
REVIEW_SCOPE_RANGE) printf '%s' 'review-scope-range' ;;
|
||||
RECEIPT_CARRY_REFUSED) printf '%s' 'receipt-carry-refused' ;;
|
||||
RECEIPT_CARRY_PRODUCT_CHANGED) printf '%s' 'receipt-carry-product-changed' ;;
|
||||
PR_WAIT_BLOCKED) printf '%s' 'pr-wait-blocked' ;;
|
||||
PR_WAIT_REFUSED) printf '%s' 'pr-wait-refused' ;;
|
||||
APPROVAL_RECORD_INVALID) printf '%s' 'approval-record-invalid' ;;
|
||||
APPROVAL_RECORD_SECRET) printf '%s' 'approval-record-secret' ;;
|
||||
APPROVAL_RECORD_NO_BRANCH) printf '%s' 'approval-record-no-branch' ;;
|
||||
@@ -307,8 +309,6 @@ gstack_result_anchor() {
|
||||
PR_SHOTS_IDENTICAL) printf '%s' 'pr-shots-identical' ;;
|
||||
PR_SHOTS_RENDER_FAILED) printf '%s' 'pr-shots-render-failed' ;;
|
||||
LAUNCH_FILE_UNWRITABLE) printf '%s' 'capy-install-launch-file-unwritable' ;;
|
||||
PR_WAIT_BLOCKED) printf '%s' 'pr-wait-blocked' ;;
|
||||
PR_WAIT_REFUSED) printf '%s' 'pr-wait-refused' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Result codes for gstack-pr-wait (lib/pr-wait.ts). Kept beside
|
||||
* lib/result-codes.ts, which spreads this table into RESULT_CODES, so the owner
|
||||
* module stays within the module-size ratchet; the same rules apply: one stable
|
||||
* docs/troubleshooting.md anchor, a summary and a fix clause each.
|
||||
*/
|
||||
import type { ResultCode } from './result-codes';
|
||||
|
||||
export const PR_WAIT_RESULT_CODES = {
|
||||
PR_WAIT_BLOCKED: {
|
||||
anchor: 'pr-wait-blocked',
|
||||
summary: 'the --until condition cannot be met without action: a required check failed, the branch conflicts with its base, the PR closed, ready is blocked by unresolved threads or a BEHIND branch, or GitHub stayed unreachable',
|
||||
fix: 'act on the event lines above it (fix the check, update or rebase the branch, resolve the threads), push, and start gstack-pr-wait again',
|
||||
},
|
||||
PR_WAIT_REFUSED: {
|
||||
anchor: 'pr-wait-refused',
|
||||
summary: 'the watcher did not start',
|
||||
fix: 'pass a PR number or URL the current gh login can read (--repo owner/name when the checkout is not that repository), or stop the watcher the line names before starting another for the same PR',
|
||||
},
|
||||
} as const satisfies Record<string, ResultCode>;
|
||||
@@ -229,4 +229,15 @@ export const RELEASE_RESULT_CODES = {
|
||||
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 or release metadata), 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 or the base merge and the product patch-id is unchanged',
|
||||
},
|
||||
// gstack-pr-wait (lib/pr-wait.ts): the landing-path PR watcher's two terminal codes.
|
||||
PR_WAIT_BLOCKED: {
|
||||
anchor: 'pr-wait-blocked',
|
||||
summary: 'the --until condition cannot be met without action: a required check failed, the branch conflicts with its base, the PR closed, ready is blocked by unresolved threads or a BEHIND branch, or GitHub stayed unreachable',
|
||||
fix: 'act on the event lines above it (fix the check, update or rebase the branch, resolve the threads), push, and start gstack-pr-wait again',
|
||||
},
|
||||
PR_WAIT_REFUSED: {
|
||||
anchor: 'pr-wait-refused',
|
||||
summary: 'the watcher did not start',
|
||||
fix: 'pass a PR number or URL the current gh login can read (--repo owner/name when the checkout is not that repository), or stop the watcher the line names before starting another for the same PR',
|
||||
},
|
||||
} as const satisfies Record<string, ResultCode>;
|
||||
@@ -12,7 +12,6 @@
|
||||
*/
|
||||
import { RELEASE_RESULT_CODES } from './result-codes-release';
|
||||
import { CAPY_RESULT_CODES } from './result-codes-capy';
|
||||
import { PR_WAIT_RESULT_CODES } from './result-codes-pr-wait';
|
||||
|
||||
export interface ResultCode {
|
||||
/** Stable `<a id>` in docs/troubleshooting.md. */
|
||||
@@ -771,7 +770,6 @@ export const RESULT_CODES = {
|
||||
},
|
||||
...RELEASE_RESULT_CODES,
|
||||
...CAPY_RESULT_CODES,
|
||||
...PR_WAIT_RESULT_CODES,
|
||||
} as const satisfies Record<string, ResultCode>;
|
||||
|
||||
export type ResultCodeName = keyof typeof RESULT_CODES;
|
||||
|
||||
Reference in new issue
Block a user