Repository navigation
refactor(ci): move PR E2E gate polling and download into the controller - #6995
Conversation
The coordinate job embedded a run-state polling loop and an evidence download wrapper in shell. Both now run as dedicated `--mode wait` and `--mode download` controller entrypoints, leaving the workflow responsible for triggers, permissions, artifact upload, step conditions, and always-run finalization. Behaviour is unchanged: the same active and terminal run states, the 105-minute wait budget that defers to finalization, a 10-minute bounded evidence download into the private workspace, and check finalization on every failure or cancellation path. Signed-off-by: Tinson Lai <[email protected]>
…wait-download-modes
📝 WalkthroughWalkthroughThe PR moves PR E2E child-run polling and evidence downloading from workflow shell scripts into ChangesPR E2E gate coordination
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Workflow as pr-e2e-gate.yaml
participant Controller as pr-e2e-gate.mts
participant GitHubAPI as GitHub Actions API
participant GHCLI as gh run download
Workflow->>Controller: invoke wait with controller run_id
Controller->>GitHubAPI: poll child run status
GitHubAPI-->>Controller: return status and conclusion
Workflow->>Controller: invoke download with run_id and work_dir
Controller->>GHCLI: download evidence
GHCLI-->>Controller: return completion or exit status
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage remains at 96%, unchanged from the TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most impacted files.
Updated |
PR Review Advisor — InformationalAdvisor assessment: Informational / high confidence Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/pr-e2e-gate-workflow.test.ts (1)
650-662: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the required relative ordering, not the entire step inventory.
This exact eleven-element array makes unrelated setup-step additions or renames break the security contract test. Locate the relevant steps and assert
wait < evidence < finish < abandon < cleanup, leaving the existingalways()assertions to enforce finalization.As per path instructions, prefer observable outcomes through the public boundary over implementation lock-in.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/pr-e2e-gate-workflow.test.ts` around lines 650 - 662, Replace the exact full-array assertion in the coordinate step test with assertions that locate the relevant steps by name and verify the required relative ordering: “Wait for E2E run” before “Download evidence,” then “Verify evidence,” “Close incomplete check,” and “Remove private workspace.” Preserve the existing always() assertions for finalization and avoid asserting unrelated step inventory or exact names beyond these contract steps.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/pr-e2e-gate-run-wait.test.ts`:
- Around line 147-166: Update the timeout and non-zero evidence-download tests
around downloadChildRunEvidence to exercise the real process lifecycle rather
than mocking its final run result. Inject or mock the underlying spawn/process
runner while preserving timeout, SIGTERM/SIGKILL escalation, spawn-error,
close-event, and timer-cleanup behavior, and assert the relevant lifecycle
actions and non-zero closure.
In `@tools/e2e/pr-e2e-gate.mts`:
- Around line 1756-1764: Update the status request in the child-run polling flow
around githubApi and childRunId so each request receives an abort signal or
timeout capped by the remaining 105-minute deadline (deadline minus the current
time). Ensure a stalled fetch is aborted when the budget expires while
preserving the existing controllerErrorMessage handling for request failures.
---
Nitpick comments:
In `@test/pr-e2e-gate-workflow.test.ts`:
- Around line 650-662: Replace the exact full-array assertion in the coordinate
step test with assertions that locate the relevant steps by name and verify the
required relative ordering: “Wait for E2E run” before “Download evidence,” then
“Verify evidence,” “Close incomplete check,” and “Remove private workspace.”
Preserve the existing always() assertions for finalization and avoid asserting
unrelated step inventory or exact names beyond these contract steps.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0387a8d3-b05a-4a47-80c3-229714ec545f
📒 Files selected for processing (6)
.github/workflows/pr-e2e-gate.yamlci/source-shape-test-budget.jsontest/pr-e2e-gate-command.test.tstest/pr-e2e-gate-run-wait.test.tstest/pr-e2e-gate-workflow.test.tstools/e2e/pr-e2e-gate.mts
…wait-download-modes
Bounds each child-run status request to the remaining wait budget via an abort signal instead of letting a stalled fetch outlive the controller deadline. Exercises the evidence download's real SIGTERM/SIGKILL timeout escalation, timer cleanup, and spawn-error handling in tests instead of stubbing the process runner outright. Replaces a substring URL check in the wait-budget test with an exact log-line match to avoid an incomplete-URL-sanitization pattern. Signed-off-by: Tinson Lai <[email protected]>
Signed-off-by: Carlos Villela <[email protected]>
Signed-off-by: Carlos Villela <[email protected]>
Signed-off-by: Carlos Villela <[email protected]>
cv
left a comment
There was a problem hiding this comment.
Approved at exact head 71a7a33600e7ad093e22a061cd0320ddc6ce83b2 against base c1bda8069d95a84a9e16b0d292a5fe20ce7cea7d. All 51 current checks are green; exact credentialed E2E controller run 29482793330 and child run 29482821192 succeeded; DCO and all seven commits are GitHub Verified; security review and focused controller/E2E-support tests found no blocking issue. The final empty commit only refreshed evidence and has the same tree as its parent.
Summary
The PR E2E gate controller workflow still ran a run-state polling loop and an evidence download wrapper as inline shell in its
coordinatejob. Both move into the already-testable controller as--mode waitand--mode downloadentrypoints, following the#6952effort to keep executable logic out of Actions YAML. The workflow keeps triggers, permissions, concurrency, artifact upload, step conditions, and always-run finalization. Behaviour is preserved end to end.Related Issue
Resolves #6960
Part of #6952
Changes
tools/e2e/pr-e2e-gate.mts: add--mode wait, which polls the child run through the existing REST client, logs each state change once, reports the child-run URL, treats the nine terminal conclusions as completion, fails closed on an unknown state or query error, and returns after a 105-minute budget so finalization cancels and reports. Add--mode download, which runsgh run downloadinto the private evidence workspace under a Node-enforced 10-minute timeout (SIGTERM then SIGKILL), failing when the download times out or exits non-zero. Both parse and dispatch through the existing command model; the timeout and destination are the current requirement carried over from the shell steps, covered by the direct controller tests below..github/workflows/pr-e2e-gate.yaml: replace the inline polling loop and download wrapper with the two controller invocations. Workspace creation, risk-plan upload, evidence verification, incomplete-check finalization, and workspace removal stay in YAML.pr-e2e-gate.test.ts; wait/download parsing inpr-e2e-gate-command.test.ts; a step-ordering and always-run finalization contract inpr-e2e-gate-workflow.test.ts(registered in the source-shape budget).Type of Change
Quality Gates
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx vitest runon the pr-e2e-gate command/controller/workflow/lifecycle/shards and source-shape-scanner suites → 110 passed;npm run typecheck:cli→ pass;node find-source-shape-tests.mts --check→ pass; Biome check → clean (Node 22.22).npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm run docsbuilds without warnings (doc changes only)Signed-off-by: Tinson Lai [email protected]
Summary by CodeRabbit
Signed-off-by: Carlos Villela [email protected]