Skip to content

ci: optimize smart test routing and browser gates - #1789

Merged
BigSimmo merged 13 commits into
mainfrom
codex/ci-perfected-rollout-20260809
Aug 10, 2026
Merged

ci: optimize smart test routing and browser gates#1789
BigSimmo merged 13 commits into
mainfrom
codex/ci-perfected-rollout-20260809

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • rebalance the three required production-Chromium shards from the final hosted timings of PR Speed up site testing selection and CI Production UI shards #1686 and exclude @critical tests after the fail-fast job has proved them
  • remove the measured net-negative 1.09 GB cross-job Next cache transfer while retaining complete fallback coverage on main, scheduled, and manual runs
  • fail closed on container Chromium revision drift in the actual Playwright launch preflight, and route UI action, Lighthouse refresh, release-browser, workflow-contract, and dependency-lock checks by risk
  • keep verify:pr-local iteration-focused by selecting npm ci --dry-run --ignore-scripts for dependency manifests and avoiding a focused workflow-suite rerun when the full unit suite already owns those tests

RAG impact: no retrieval behaviour change — CI selection, test infrastructure, and process documentation only.

Verification

  • npm run verify:pr-local

    Partial local result on Windows: runtime, installed-lock parity, formatting, npm-ci dry-run, sitemap/docs/ledger checks, GitHub Actions/policy/scope/gate checks, Codex workflow guard, lint, and typecheck passed. The aggregate first stopped on shared-test contention, then reached the full unit suite. A standalone full unit run completed with 5,872 passed and 14 skipped, but 22 failures across 11 files: resource timeouts under heavy machine load plus the pre-existing Windows pr-handoff-stop POSIX-command failures. The production build produced no application error but exceeded the 15-minute outer command timeout. Hosted Linux CI remains the required arbiter for those two boundaries.

  • Focused CI and runner contracts: 5 files passed, 87 tests passed, 11 intentionally skipped

  • npm run check:rag:fixtures — 36 golden cases across 23 suites

  • npm run check:outstanding-issues, npm run check:branch-review-ledger, documentation checks, verification-plan self-test, action pins, CI scope, and gate manifest

  • npm run verify:ui — not run locally because no product UI behavior changed; this workflow diff deliberately triggers hosted Production UI

  • npm run verify:release — not run; this is a draft PR, not release evidence

Risk and rollout

  • Risk: required-check routing could omit a realistic regression class or move the UI critical path unexpectedly. Contract tests pin disjoint @critical coverage, full fallback paths, exact production-spec parity, duration balance, and fail-closed unknown scope.
  • Rollback: revert this PR to restore the previous shard/cache/release topology.
  • Provider or production effects: opening this draft starts ordinary GitHub CI and consumes runner time. No deployment, production data, Supabase, migration, or authenticated-provider mutation is included.

Clinical Governance Preflight

Not applicable: no ingestion, answer generation, retrieval/ranking, source rendering, document-access, privacy, production-environment, or clinical-output behavior changes.

Notes

  • Source review: merged PR Speed up site testing selection and CI Production UI shards #1686 and final hosted CI run 31285952061.
  • Expected speedup is evidence-based but not yet confirmed on this new head: the slowest shard test portion is estimated to fall from about 5.5 minutes to about 3.7 minutes, with additional savings from removing duplicate critical tests and cache transport.

Summary by CodeRabbit

  • Bug Fixes

    • Improved CI routing to avoid duplicate checks and redundant build setup.
    • Added fail-fast validation for browser revision mismatches.
    • Improved Playwright shard balancing and critical-test handling.
  • Testing

    • Expanded coverage for workflow safety, browser compatibility, dependency changes, and test-shard configuration.
    • Release browser testing now runs for relevant releases, schedules, and main-branch UI or performance changes.
  • Documentation

    • Updated testing, CI process, review ledger, and outstanding-issues documentation.
    • Added guidance for browser caching, session reuse, and CI execution paths.

@supabase

supabase Bot commented Aug 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

CI routing now distinguishes baseline refreshes, dependency changes, UI changes, and release-browser coverage. Playwright shards use duration profiles and critical-test exclusions. Chromium preflight validates container revisions. Local verification adds dependency dry runs and avoids duplicate checks.

Changes

CI hardening

Layer / File(s) Summary
Workflow routing and safety contracts
.github/workflows/ci.yml, scripts/ci-change-scope.mjs, tests/ci-cache-safety.test.ts, tests/test-runner-safety.test.ts, AGENTS.md, docs/process-hardening.md, docs/testing.md
CI routing, cache ownership, release-browser conditions, UI scope detection, and duplicate-check safeguards were updated.
Duration-aware Playwright shard execution
scripts/playwright-pr-shards.mjs, tests/playwright-pr-shards.test.ts, .github/workflows/ci.yml, docs/process-hardening.md
Shard profiles now track full and critical durations. PR and merge-group runs can exclude critical tests.
Chromium revision validation
scripts/playwright-browser-preflight.mjs, tests/playwright-browser-preflight.test.ts, docs/testing.md, docs/outstanding-issues.md
Container Chromium revision drift now fails closed with structured diagnostics.
Dependency-aware local verification
package.json, scripts/verify-pr-local.mjs, tests/verify-pr-local.test.ts, docs/scripts-index.md
Package and lockfile changes now select check:npm-ci-dry-run. Overlapping workflow checks are avoided.
Process and review records
docs/branch-review-ledger.md, docs/outstanding-issues.md
Review records, issue queues, and resolved issue archives were updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ChangedFiles
  participant ScopeClassifier
  participant LocalVerifier
  participant CIWorkflow
  participant PlaywrightShards
  ChangedFiles->>ScopeClassifier: classify workflow, UI, and dependency changes
  ChangedFiles->>LocalVerifier: detect changed manifests and scripts
  ScopeClassifier->>CIWorkflow: select CI coverage
  LocalVerifier->>CIWorkflow: select local verification scripts
  CIWorkflow->>PlaywrightShards: run shards with critical exclusions
Loading

Possibly related PRs

Suggested reviewers: claude, cursoragent

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes to CI test routing and browser gates.
Description check ✅ Passed The description includes the required summary, verification, risk, rollout, governance, and notes sections with clear status and reasons.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ci-perfected-rollout-20260809

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Comment @coderabbitai help to get the list of available commands.

@BigSimmo
BigSimmo marked this pull request as ready for review August 9, 2026 14:35
@BigSimmo
BigSimmo requested a lite review from Copilot August 9, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the repository’s CI/verification routing to reduce wasted work (duplicate UI coverage, net-negative cache transfers, redundant workflow-contract runs), while adding stricter fail-closed behavior around Playwright Chromium revision drift and earlier detection of dependency/lockfile install issues.

Changes:

  • Rebalances Production UI PR sharding using a per-file timing profile, and avoids rerunning @critical tests in the later shards once the fail-fast job has already proved them.
  • Removes cross-job Next.js cache transport (artifact-based) after evidence showed it increased wall time, and adjusts release-browser gating to avoid repeating production Chromium when already proven in-run.
  • Adds npm ci --dry-run --ignore-scripts to verify:pr-local selection when dependency manifests/lockfiles change, and avoids duplicating workflow-contract suites when the full unit/coverage suite already includes them.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/verify-pr-local.test.ts Adds contract tests for new PR-local selection behavior (npm-ci dry-run first; no duplicate workflow suite).
tests/test-runner-safety.test.ts Updates CI workflow invariants around removed Next cache transport and new shard args.
tests/playwright-pr-shards.test.ts Strengthens shard/parity tests (matcher alignment, balance check, exclude-critical behavior).
tests/playwright-browser-preflight.test.ts Adds drift fail-closed tests for designated container overrides.
tests/ci-cache-safety.test.ts Adds assertions for critical/shard disjointness, removed cache transport, and refined workflow/release routing.
scripts/verify-pr-local.mjs Adds dependency-manifest detection and routing to check:npm-ci-dry-run; avoids repeating workflow suite under heavy scope.
scripts/playwright-pr-shards.mjs Converts shard membership into a per-file timing profile; adds --exclude-critical wiring and estimated-duration helper.
scripts/playwright-browser-preflight.mjs Adds revision-drift enforcement in preflight and routes drift failures with a specific message before build/locks.
scripts/ci-change-scope.mjs Marks .github/actions/setup-ui-e2e/** as UI-scoped to ensure action changes exercise UI lanes.
package.json Adds check:npm-ci-dry-run script for fast install/lockfile integrity checking.
docs/testing.md Updates testing-speed guidance (exclude-critical rationale, cache transport evidence, revision-preflight behavior).
docs/scripts-index.md Updates script-surface count to reflect the new npm script entry.
docs/process-hardening.md Records measured shard imbalance and cache-transfer cost; documents the corrected routing approach.
docs/outstanding-issues.md Moves #167/#204/#255 into resolved with outcomes matching these changes.
docs/branch-review-ledger.md Appends a review/rollout reconciliation record referencing PR #1686 evidence.
AGENTS.md Adds an explicit rule about fast-fail subsets preceding broader gates only when the broader gate excludes them.
.github/workflows/ci.yml Implements refined CI routing: exclude-critical shards on PRs, removes cache transport, scopes release matrix and baseline refresh dispatch behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c81fe9c65b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
@BigSimmo

BigSimmo commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch codex/ci-perfected-rollout-20260809 at starting commit c81fe9c; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:codex/ci-perfected-rollout-20260809, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: c81fe9c65b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BigSimmo
BigSimmo enabled auto-merge (squash) August 10, 2026 09:47
cursoragent and others added 3 commits August 10, 2026 10:10
Unblock PR #1789 false-DIRTY (behind-but-clean merge-tree).

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Extend ci-change-scope so preflight, revision-pin, and PR-shard
helpers trip the browser gate and the post-merge release matrix.
Late sync for PR #1789 (behind-but-clean after #1793/#1794 landed on main).
@github-actions

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Production UI criticalneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #9571 (cancelled).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/verify-pr-local.test.ts (1)

65-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the dry-run in the mixed workflow/package case.

The test checks test and the absence of test:ci-workflows. It does not verify check:npm-ci-dry-run. Add that assertion and its ordering check so a regression in mixed routing cannot pass.

Proposed test assertion
   expect(output).toContain("- npm run test");
+  expect(output).toContain("- npm run check:npm-ci-dry-run");
+  expect(output.indexOf("- npm run check:npm-ci-dry-run")).toBeLessThan(
+    output.indexOf("- npm run lint"),
+  );
   expect(output).not.toContain("- npm run test:ci-workflows");
🤖 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 `@tests/verify-pr-local.test.ts` around lines 65 - 69, Update the mixed
workflow/package dry-run test in the focused test case to assert that
check:npm-ci-dry-run is included and appears in the required order relative to
the existing test command. Preserve the current assertion that test:ci-workflows
is absent.
🤖 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 `@scripts/playwright-browser-preflight.mjs`:
- Around line 179-190: Update the revision validation in the downloadsDisabled
flow of scripts/playwright-browser-preflight.mjs to validate the headless-shell
revision actually selected by the resolver, rather than only the general
Chromium revision; preserve the existing drift result when that selected
revision is invalid. Add a regression test in
tests/playwright-browser-preflight.test.ts covering coexistence of chromium-1234
and chromium_headless_shell-1194 and asserting that revision 1194 is rejected.

---

Nitpick comments:
In `@tests/verify-pr-local.test.ts`:
- Around line 65-69: Update the mixed workflow/package dry-run test in the
focused test case to assert that check:npm-ci-dry-run is included and appears in
the required order relative to the existing test command. Preserve the current
assertion that test:ci-workflows is absent.
🪄 Autofix

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: Pro

Run ID: 244f7bbe-2ce8-4666-b2d2-b6b471af2991

📥 Commits

Reviewing files that changed from the base of the PR and between f7a494b and fa054ec.

📒 Files selected for processing (17)
  • .github/workflows/ci.yml
  • AGENTS.md
  • docs/branch-review-ledger.md
  • docs/outstanding-issues.md
  • docs/process-hardening.md
  • docs/scripts-index.md
  • docs/testing.md
  • package.json
  • scripts/ci-change-scope.mjs
  • scripts/playwright-browser-preflight.mjs
  • scripts/playwright-pr-shards.mjs
  • scripts/verify-pr-local.mjs
  • tests/ci-cache-safety.test.ts
  • tests/playwright-browser-preflight.test.ts
  • tests/playwright-pr-shards.test.ts
  • tests/test-runner-safety.test.ts
  • tests/verify-pr-local.test.ts

Comment thread scripts/playwright-browser-preflight.mjs
@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Babysit summary (merging)

@BigSimmo
BigSimmo merged commit 1074c0d into main Aug 10, 2026
37 checks passed
@BigSimmo
BigSimmo deleted the codex/ci-perfected-rollout-20260809 branch August 10, 2026 11:33
cursor Bot pushed a commit that referenced this pull request Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants