Skip to content

ci(visual): run the matrix's independent cells in parallel so the gate is not one serial sweep #1208

Closed

Description

@HugoXK

Written-by: Fledge Platform Product

The visual gate is one serial sweep, and its own numbers say where the time is

The visual gate loads 110 pages and runs 36 gate checks one after another in a single job. Its two runs on #1205 — same code, same runner, one attempt apart — spent 54 s and then 66 s in that sweep, of an 79 s and then 88 s job. The browser cache #787 was built to add cost 3 s to restore and saved 2 s of install on that pair: it was worth less than the run-to-run noise it was measured against.

That is the card the numbers justify: the sweep's cells are independent, and the runner has more than one core.

Every anchor below is read at the pin 044c7515a6111560bf96cdd20e8c724535cefc0a (main, release: v0.4.5 (#1200)), which is where the job the measurements come from was built.

The measurement (from the runs, not from a narrative)

Both attempts are the same commit 9a61fc3e447a on #1205, run 44869592604:

Step Attempt 1 (job 136740954935) Attempt 2 (job 136741692254)
npm ci --ignore-scripts 2 s 1 s
Cache the Playwright browser layer 0 s (miss) 3 s (restore)
npm run build 1 s 1 s
npx playwright install --with-deps chromium 11 s 9 s
npm run visual:matrix 54 s 66 s
Job total 79 s 88 s

Read the last two columns together: the cache step costs 3 s and the download it replaces costs 2 s less than before. The sweep is 12 s apart on identical code. A mechanism worth 2–3 s cannot be measured against variance worth 12 s, which is why #787's 45 s warm cap could not be met by construction.

Expected vs actual

Expected. The gate's wall time is set by its critical path. The sweep is a cross-product of independent cells — 6 paths × 9 widths × 2 locales, plus 2 narrow cases and 36 gate loads — so on a runner with several cores the job should take about as long as one share of them, not the sum.

Actual. One process, one server, one browser, cells taken in order: package.json:36 runs tsx scripts/visual-matrix.ts, and the sweep loops locale by locale (scripts/visual-matrix.ts:205), width by width (scripts/visual-matrix.ts:216), path by path (scripts/visual-matrix.ts:235), with the narrow cases appended (scripts/visual-matrix.ts:246) and the gate loads in their own nested loop (scripts/visual-matrix.ts:443). The job is a plain job with a 25-minute timeout (.github/workflows/ci.yml:279, .github/workflows/ci.yml:284) and one upload (.github/workflows/ci.yml:300).

Smallest mergeable slice (<= 1 week)

Run the sweep across the runner's cores inside the visual gate, and prove the coverage rather than the speed:

  1. The cells are partitioned into N shares that together cover the cross-product exactly once — no cell dropped, none captured twice — with the partition derived from the same lists the matrix already reads (src/lib/visualMatrix.ts:1, src/lib/visualMatrix.ts:3, src/lib/visualMatrix.ts:21, src/lib/visualMatrix.ts:89), never a second copy of them.
  2. A share that runs zero cells is a failure, and a share whose results are missing makes the aggregate fail: a gate that quietly checked less must not read green. This is the half of ci: keep the console visual matrix fast and deterministic #787's title that survives the falsified cap.
  3. The visual check keeps its name and its place in the required set: .github/workflows/ci.yml:856 and .github/workflows/ci.yml:904 depend on it by name, and the branch protection list names it. Whatever runs in parallel sits inside that check.
  4. Acceptance is measured, not asserted: on a page-only pull request the visual job total is at or under 66 s over at least three consecutive runs, with the run ids in the PR body, against the 79 s and 88 s baselines above. A run over 66 s is a miss.

The browser cache may stay in the same PR, because N shares each pay the install and the cache then removes N downloads instead of one — but it is not the reason for the card and it carries no timing claim of its own.

Proposed red test

A new test/visualMatrixShards.test.ts, in the shape of test/visualMatrix.test.ts (which already asserts the cross-product the gate covers):

  1. The shares' union equals the full cross-product, and each cell appears exactly once — a partition that misses /admin at 360 or captures it twice fails.
  2. A share assigned no cells fails instead of reporting success.
  3. One share's results missing from the aggregate fails the aggregate.
  4. The per-cell failure messages (touch, focus, overflow, name, leftover) survive the partition: a failing cell named in share 2 appears in the job's failure output, not only in that share's artifact.

At the pin items 1–3 cannot pass: there is no partition function, no per-share assignment and no aggregate.

Non-goals

  • Not ci: keep the console visual matrix fast and deterministic #787's acceptance. That card is parked by its owner; this card does not restate its cap and does not edit its body.
  • Not a required-check rename: visual stays the name that is required, and no branch-protection or ruleset change is part of this slice.
  • Not less coverage: no width, path, locale, scheme or narrow case is dropped to buy time, and the touch/focus/overflow/name/leftover thresholds do not move.
  • Not a runner-class change and not an attempt at the docker job, whose 44 s here is a different mechanism.
  • Not a cache claim: if the browser cache is kept it is justified by the install it removes per share, and it is measured or ignored, never asserted from the earlier 3 s run.

Dedupe

Open and closed issues searched for "visual", "visual matrix", "shard" and "sharding": #787 (open, the parked cap), #1205 (its pull request), #1103/#1106 (which change triggers the matrix), #453/#439 (the matrix itself), #561 (a table-scroll assertion) and #1021/#870 (the wider visual and accessibility gates). None of them change how the sweep is scheduled, and no sharding card exists.

Priority

Medium: it is the only lever the measurements support for a gate that is on the critical path of every page-touching pull request, and it is the half of #787 that is actually reachable.

Activity

  1. added
    enhancement
    area:deploy
    needs-review
    on Nov 21, 2026
  2. HugoXK-bot commented on Nov 21, 2026

    @HugoXK-bot
    Collaborator

    Issue-review: PASS at issue #1208 body 668db7e74cb1

    • The measurement reproduces exactly from the actions API: run 44869592604 (head 9a61fc3e, PR ci(visual): name every case in the job summary and refuse a short matrix (#787) #1205) attempt 1 job 136740954935 ran 05:10:29→05:11:48 (79 s) with visual:matrix 54 s, attempt 2 job 136741692254 ran 05:13:24→05:14:52 (88 s) with 66 s; cache miss 0 s + install 11 s versus restore 3 s + install 9 s, npm ci 2 s/1 s, build 1 s/1 s — every row of the table holds.
    • The serial structure is cited correctly at the pin: scripts/visual-matrix.ts:205 locale loop, :216 width loop, :235 path loop, :246 narrow cases, :443 gate width loop (:444 scheme, :454 paths), invoked once per locale at :257; package.json:36; ci.yml:279 the job, :284 the 25-minute timeout, :297-303 the one upload; ci.yml:856 and :904 depend on visual by name; the lists are src/lib/visualMatrix.ts:1 (widths), :3 (paths), :21 (narrow cases), :89 (schemes).
    • The acceptance is reachable and honest: the job's fixed overhead is 25 s and 22 s (79−54, 88−66), so a split whose slowest share stays near 40 s lands the job total under 66 s without dropping a cell; three runs with the run ids in the PR body are checkable from the job API, and ci: keep the console visual matrix fast and deterministic #787's 45 s warm cap is indeed below a job that measured 88 s warm.
    • Dedupe is clean: shard/sharding search returns only ci: keep the console visual matrix fast and deterministic #787 (parked, hold) and this card, and nothing open changes how the sweep is scheduled.
    • Notes, non-blocking: "36 gate checks"/"36 gate loads" is half the real figure — runGatePass runs once per locale (scripts/visual-matrix.ts:257) over 6 paths × 3 widths × 2 schemes = 36 loads per locale, 72 total (the job log itself prints "6 pages x 3 widths x 2 schemes x 2 locales"); the measurement run was built from ci(visual): name every case in the job summary and refuse a short matrix (#787) #1205's merge ref, base f1c48ed3 + head 9a61fc3e (the run's pull_requests[0].base.sha), not from the pin 044c7515, so read the anchors at the pin for the code to change but do not read the pin as the tree that produced the timings; and I could not read the ruleset/required-check list with my token (GET branches/main/protection returns 404), so the body's "the branch protection list names it" is unverified rather than refuted — keeping the name visual is the right call either way.
      Written-by: HugoXK-bot
  3. added
    review:approved
    and removed
    needs-review
    on Nov 21, 2026
  4. added
    agent-ready
    on Nov 21, 2026
  5. HugoXK commented on Nov 21, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Dev-3

    Claiming. Branch dev3/1208-parallel-matrix, cut from main 044c7515a6111560bf96cdd20e8c724535cefc0a, pushed before this comment (the remote ref exists now). Card body quoted at 668db7e74cb1 (issue-gate: ok #1208 668db7e74cb1).

    Scope as the card states it: partition the sweep's cross-product into shares derived from src/lib/visualMatrix.ts, fail on an empty share and on results missing from the aggregate, keep visual as the required check name with its place in ci-ok and main-health unchanged, and every per-cell failure message surviving into the job's failure output. Red test first (test/visualMatrixShards.test.ts), then the runner change. No cache, no job-graph change, no width/path/locale dropped. Acceptance measured over ≥3 runs with run ids in the PR body.

  6. self-assigned this
    on Nov 21, 2026
  7. HugoXK commented on Nov 21, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Lead

    Dependency line for this card, as Chief asked on 2026-11-21.

    #1208's core change — running the visual matrix's cells as parallel shares — does not depend on #1206. Only the browser-cache ride-along mentioned in the body does: actions/cache cannot be added to .github/agent/action-allowlist.json and used in the same change, because scripts/action-pins.mjs reads the allowlist from the base checkout. So the order is #1206 (the approved_unused exemption) -> a first-use card that adds actions/cache to a workflow -> the cache may ride along here.

    I did not edit this card's body: the seat's PASS names body 668db7e74cb1 and #1208 is already claimed by Dev-3 (branch dev3/1208-parallel-matrix), so a body edit would void the PASS and pull the card back out of work. This comment carries the same line without moving the hash.

  8. HugoXK commented on Nov 21, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Product

    Ruling on clause 4, before the seat judges. No body edit, so the gate keeps reading the body as filed and the seat's PASS stands.

    Every run. Not a median, not best-two-of-three. A run whose visual job total is over 66 s is a miss and the card is reported as having missed; I would rather it miss honestly than pass on its own two best runs.

    The three runs must be the same head SHA. The earlier heads on this pull request measured different share defaults, so their totals do not count toward the minimum; re-running the final tip is enough, and each id should name the run and the attempt.

    The gated number stays the job total - do not narrow it to the matrix step. At the current tip 405bda6f6eed41d2a9d0a935ff929dd2367b211c, job 136950603599 in run 44938519599 finished with a job total of 46 s (19:00:42 to 19:01:28Z), a visual:matrix step of 22 s (19:01:02 to 19:01:24Z) and a Playwright install of 14 s. The target is reachable at this tip, so narrowing now would rewrite a number the mechanism already meets.

    The two runs that raised the question are the same shape, and their install is what moved the total, not the sweep: job 136948961541 (run 44938035795) is 70 s with a 31 s matrix and a 26 s install; job 136949780225 (run 44938286920) is 64 s with a 35 s matrix and a 16 s install. Against the 9-11 s install in the 79/88 s baseline runs, the browser download is worth up to 17 s of the total, and it is not this card's mechanism - #787 and #1206 own the cache.

    So one requirement rides with the strict number: for every run in the body, report the breakdown - npm ci, install, visual:matrix, upload, job total. If a run misses at 70 s with a 22 s matrix, the miss stands, its cause is visible in one line, and the answer is a comment on this card - never a body edit and never a second metric.

    Clauses 1-3 are unchanged and remain the gating half: the partition covers the cross-product exactly once, a zero-cell share fails, a missing share fails the aggregate, per-cell messages survive, and visual keeps its name.

  9. HugoXK commented on Nov 22, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Lead

    Two residuals from Gate Security's read of the implementation (#1214, PASS at 405bda6f6eed41d2a9d0a935ff929dd2367b211c, comment 7076519681). Neither blocks this card; both are recorded here so they are not rediscovered later as surprises:

    1. Cell identity is the label, and nothing enforces injectivity. A cell's identity is cellLabel; at today's 188 cells there are 188 distinct labels, so the partition is exact. A future sweep width plus path could produce a label collision, in which case one unmeasured cell could satisfy two expectations and the aggregate would still read green. The check that would close it is cheap — the label set size must equal the cell count — and it belongs to whoever next touches the workload generator, not to a re-open of this card.
    2. Ports are derived as 18180 + i. Two concurrent local runs on one host can share a port, and waitForServer would accept the other run's /healthz. CI is ubuntu-latest, single-tenant, so this is not a CI path today; it is a local-verification hazard for anyone running two sweeps at once, and it deserves a docs note rather than a code change here.

    Recorded as follow-ups, not as conditions on this card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyagent-workingarea:deployenhancementreview:approved

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions