Skip to content

[Task] Restore unit-test budget headroom for the 300-selection and deep-scroll tests #76

Closed

Description

@DavidVFitzGerald

Delivery phase

Phase 1 - frontend with mock services (unit-test tooling; follow-up from #26 AC6). Delivered together with #87 in one PR (maintainer decision 2026-11-15): one engineer, one branch, PR body carries Refs #76 and Refs #87 (no closing keywords until QA passes).

Goal

Give the large-workload unit tests real headroom under the normal full parallel run, mainly by making them cheaper, so the unit suite is a stable gate for F5 and the backend PRs, without weakening what they verify or the scale coverage the specification and the F4 gate need.

Context and authority

Spec §9.2 (Vitest required on every PR; meaningful tests; hundreds of selected columns with windowed reads, item 18), §6.6/§6.8 via the covered tests, roadmap F4 gate (220 × 2,000+). AGENTS.md: do not raise limits or weaken gates to conceal failures.

Baseline evidence on main (docs/engineering/f4-verification.md, AC5/AC6 and the internal waitFor table; QA at #26 (comment) and #26 (comment)). 8-core host, start load 1.3-4.1, suite's own load 4-5, 405 tests, ~90-103 s:

Budget Limit Max measured %
flows-grid.test.tsx deep scroll, internal waitFor (:76) 10 s 10.06 s / 11.0 s (QA, passing on timer slack); timed out 3 of 6 runs at ba912b4 101-110 %
same test, whole 20 s 16.5 s 82 %
selection.test.tsx "bounds mounted list items for 300 selections" 30 s 26.8 s 84-89 %
flows-grid-hold.test.tsx hold waitFor 25 s 14.7 s 59 %
flows-grid-hold.test.tsx, whole 40 s 22.6 s 57 %
flows-grid-anchoring.test.tsx O9, whole 40 s 22.9 s 57 %
flows-grid-anchoring.test.tsx:184 default waitFor 1 s 0.69 s 69 %

Known cost drivers (leads, not conclusions): the mock flowRows rebuilds the represented-row union for the whole selection on every 100-row page (115-173 ms/page for 208 processes, f4-verification AC5); deep scroll pages 16 times at 20 ms latency; the 300-selection setup pages "Load more" six times and clicks 300 tree rows one by one; each large jsdom test holds ~100 MB heap; the large files run in parallel workers with the rest of the suite.

#27 (draft PR #88, feat/f5-indicator-tree) is adding tests concurrently and edits src/services/mock/test-harness.ts, src/App.tsx, src/App.test.tsx, src/app/session.test.tsx, docs/engineering/frontend-backlog.md, docs/engineering/roadmap.md. PR #89 edits docs/engineering/roadmap.md.

Requirements and constraints

  • Measure first. Baseline at the starting origin/main SHA before changing anything (AC1/AC2).
  • Preferred order of remedies: (1) remove redundant work (setup reads, repeated mock computation, repeated renders); (2) cheaper but equivalent setup or fixtures where the scenario's meaning is scale-independent; (3) splitting heavy files so they do not compete in one worker; (4) Vitest pool/worker/project settings only with before/after measurements; (5) a limit change only as a last resort under AC6.
  • Scale coverage that must stay (spec §9.2 item 18, F4 gate): jsdom 220 processes × ≥ 2,000 generated rows in "mounts only the viewport window…" and "deep scrolling pages rows…", the latter still jumping to row 1,500 with non-zero latency and the same bounds (all pages 100, ≤ 17 pages, ≤ 4 summaries, ≤ 8 cell reads after the first window, ≥ 1 aborted signal, ≤ 26 rows); the hold test's 220 selected / 12 removed / exactly 23 pages; 300 selections in the selected-list test with the mounted-item bound, single tab stop, End/ArrowUp/removal/Home focus checks; e2e/flows-grid.spec.ts:83 (220 × 2,000+ browser window) unchanged.
  • Mock adapter changes (e.g. caching in src/services/mock/comparison.ts) are allowed only if outputs, ordering, tokens, decimal strings, latency, cancellation and errors are unchanged, state is per mock instance (never shared across instances/accounts), and protected-data clearing on sign-out/account change still holds. Existing comparison*.test.ts, flow-summaries.test.ts and service-boundary tests must pass unchanged.
  • No retry, no global testTimeout/hookTimeout raise, no skipped/.todo tests, no assertion relaxed. npm run test:unit must still run every test file.
  • Avoid editing src/services/mock/test-harness.ts (conflicts with F5: add independent indicator tree and selection (#27) #88). If it is needed, merge origin/main after F5: add independent indicator tree and selection (#27) #88 lands first. Do not touch roadmap.md/frontend-backlog.md.
  • Host load rule: at most two container test suites run on this host at once (shared /tmp tmpfs quota and load caused false timeouts). The AC3 gate runs need the coordinator to confirm that no other container unit/e2e suite runs during them (F3: process tree pseudo-row ARIA positions and full browser storage check #52, [Task] F5 — Add the indicator tree and source-ordered selection state #27/F5: add independent indicator tree and selection (#27) #88, QA).
  • Final measurement at handoff SHA: if frontend commits (e.g. F5: add independent indicator tree and selection (#27) #88) land on main after the baseline, merge origin/main and redo the AC3 gate runs at the final SHA; their tests are in scope of AC3.

Acceptance criteria

  • AC1 Baseline. At the starting main SHA, three consecutive full runs record per-test durations for every test whose limit (own or describe) is ≥ 20 s and every test in src/services/mock/flows-grid*.test.tsx, selection.test.tsx, bulk-selection.test.tsx, flows-composition.test.tsx; plus elapsed vs. budget for every explicit internal budget ≥ 5 s in those tests (waitFor/findBy* timeouts, flows-grid-harness.ts settled/settledAt/selectAll/loadError) and the 1 s default waits in the flows-grid files, via a temporary, uncommitted wrapper (as in f4-verification). Record nproc, /proc/loadavg at start and end of each run, running container count, suite wall time.
  • AC2 Attribution. For the deep-scroll, 300-selection and hold tests, record where the time goes (setup vs. measured step; mock computation vs. latency vs. React/jsdom rendering) with numbers, and the remedy chosen per test with its measured effect.
  • AC3 Headroom targets. In three consecutive full parallel runs (npx vitest run) at the delivered SHA, each starting at 1-min load ≤ 2.0 with no other container test suite running:
    • every test with a limit ≥ 20 s uses ≤ 65 % of its limit;
    • every explicit internal budget ≥ 5 s in those tests uses ≤ 65 % of its budget, measured as wall-clock elapsed (passing on timer slack counts as > 100 %);
    • the 1 s default waits in the flows-grid files use ≤ 75 %;
    • 0 failures, 0 timeouts in all three runs.
  • AC4 Two-suite load. Two full runs started simultaneously in the container (two concurrent npx vitest run processes, emulating the two-suite host maximum) both pass with 0 failures; their maximum percentages are recorded, and any budget > 90 % is listed as residual risk.
  • AC5 Meaning unchanged. Every modified test keeps its assertions' meaning and the scale coverage listed above; the PR lists each modified test with a one-line before/after of what it asserts and the fixture size.
  • AC6 Limits. No limit or budget is raised unless, for that budget: a cost reduction was tried and measured first; the new value is ≥ 1.5 × the maximum observed and still satisfies AC3; the test carries a comment with the measurement; it is listed in the PR. No limit is raised for the deep-scroll internal wait or 300-selection test without the maintainer's explicit agreement in review.
  • AC7 Config. Any Vitest pool/worker/project/isolation change is justified by before/after numbers, keeps full-suite wall time ≤ 125 % of the AC1 median, and leaves npm run test:unit and the CI workflow running all tests.
  • AC8 Intermittent mixed-sign grid row/cell height assertion in frontend CI #87. Intermittent mixed-sign grid row/cell height assertion in frontend CI #87's acceptance criteria are met in the same PR.
  • AC9 Gates. In the container: npm ci (lockfile unchanged), format:check, lint, typecheck, build, @smoke pass; full e2e in both projects passes if any product or mock-adapter file changed. Hosted quality passes on the PR, plus one hosted workflow_dispatch full run.
  • AC10 Evidence. docs/engineering/unit-headroom-verification.md holds the baseline and after tables (AC1, AC3, AC4), loads, SHAs and commands; docs/engineering/f4-verification.md "Remaining risk ([Task] Restore unit-test budget headroom for the 300-selection and deep-scroll tests #76)" gets a one-line pointer to it (history otherwise unchanged). Issue handoff lists branch/SHA, criteria, results, residual risks.

Out of scope and follow-ups

Hold bounding (#26 O11, maintainer decision). Firefox workaround revert (#85). AuthDialog focus flake (#51, starts after this PR merges). Process-tree ARIA/storage (#52). Product performance changes: if a real product slowdown is found, open a Bug instead of fixing it here. Real-API performance belongs to I1/R2.

Verification plan

Host orchestration (worktree, project and port reserved for this issue; check the port is free first):

git -C /home/david/projects/LCA-diff fetch origin
git -C /home/david/projects/LCA-diff worktree add -b fix/76-87-unit-headroom /tmp/lca-diff-headroom origin/main
cd /tmp/lca-diff-headroom
ss -ltn | grep ':5221 ' && echo 'port 5221 busy - pick another and record it'
COMPOSE_PROJECT_NAME=lca-diff-headroom FRONTEND_PORT=5221 ./dev up
COMPOSE_PROJECT_NAME=lca-diff-headroom FRONTEND_PORT=5221 ./dev check
docker compose -p lca-diff-headroom exec -T workspace bash -lc 'cd apps/frontend && npm ci --no-audit --no-fund'

Baseline and gate runs (AC1/AC3; JSON lands in the ignored test-results/):

nproc; docker ps -q | wc -l
for i in 1 2 3; do cat /proc/loadavg; docker compose -p lca-diff-headroom exec -T workspace bash -lc "cd apps/frontend && npx vitest run --reporter=verbose --reporter=json --outputFile.json=test-results/headroom/run-$i.json"; cat /proc/loadavg; done

Two-suite load (AC4):

docker compose -p lca-diff-headroom exec -T workspace bash -lc 'cd apps/frontend && (npx vitest run > test-results/headroom/pair-a.log 2>&1 & npx vitest run > test-results/headroom/pair-b.log 2>&1; wait); tail -n 6 test-results/headroom/pair-*.log'

Gates (AC9):

docker compose -p lca-diff-headroom exec -T workspace bash -lc 'cd apps/frontend && npm run format:check && npm run lint && npm run typecheck && npm run build && npm run test:e2e -- --grep @smoke'
docker compose -p lca-diff-headroom exec -T workspace bash -lc 'cd apps/frontend && npm run test:e2e'   # if product/mock-adapter code changed
COMPOSE_PROJECT_NAME=lca-diff-headroom ./dev down

Dependencies and readiness

Dependencies met: #26 merged (PR #78, af5317d), baseline evidence on main. Groomed READY 2026-11-15 together with #87. Runs in parallel with #52 (separate worktree/project/port) subject to the two-suite host rule; #51 starts after this PR merges. Coordinate with #88 (shared test-harness.ts; new tests to include in the final measurement).

Likely files: apps/frontend/src/services/mock/flows-grid.test.tsx, flows-grid-harness.ts, flows-grid-hold.test.tsx, selection.test.tsx, possibly src/services/mock/comparison.ts, vite.config.ts, new split test files under src/services/mock/; for #87 possibly src/components/comparison/ComparisonGrid.tsx, useFlowGrid.ts, SignedValueCell.tsx, e2e/flows-grid.spec.ts; docs above.

Activity

  1. added
    task
    frontend
    on Nov 15, 2026
  2. added a commit that references this issue on Nov 15, 2026
  3. DavidVFitzGerald commented on Nov 15, 2026

    @DavidVFitzGerald
    OwnerAuthor

    PM: READY (together with #87)

    Hand-off: Software Engineer, then QA at the delivered SHA.

    🤖 Generated with Claude Code

  4. DavidVFitzGerald commented on Nov 15, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator: state → implementing (one PR for #76 + #87, maintainer decision 2026-11-15). Software Engineer assigned on fix/76-87-unit-headroom from af5317d, worktree /tmp/lca-diff-headroom, Compose project lca-diff-headroom, port 5221. #52 runs in parallel; AC3 gate runs need a quiet host and are coordinated with the coordinator.

    🤖 Generated with Claude Code

  5. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: READY FOR QA (#76, delivered with #87)

    Changes

    1. Frozen catalog. freezeComparisonCatalog (comparison.ts) lets a mock read a deep-frozen catalog without its defensive copy. The copy cost ~2 s per large-workload test. flows-grid-harness.ts freezes its catalog.
    2. Row-set cache. flowRows builds the sorted row set once per instance, by snapshot and process set, and bounds the cache like the tokens. A 100-row page now costs 11 ms of mock work instead of 151 ms.
    3. 300-selection setup. selection.test.tsx fills its 300-item list with one branch selection instead of 300 tree clicks. Every list assertion is unchanged.
    4. Worker cap. vite.config.ts sets maxWorkers: "50%" (AC7). Two concurrent suites at the default workers failed 4 + 3 tests. With the cap both pass, at 76 s each against 105 s.
    5. Hold comment. flows-grid-hold.test.tsx gets a comment update only.

    Criteria

    • AC1. Baseline at af5317d, three full runs at loads 4.2–5.8. The deep-scroll internal wait was at 107–114 % and timed out 3 of 3. The 300-selection test was at 92–95 %, the hold wait at 64 % and anchoring :183 at 82 %.
    • AC2. Attribution and remedies are in the doc. The deep scroll and the hold were dominated by the per-page mock union plus rendering under contention. The 300-selection test was 10 s of setup clicks out of ~11 s alone.
    • AC3. At decb56a, three runs at start loads 1.77, 1.80 and 1.82, with no other container above 50 % CPU. Each ran 411 tests with 0 failures in 43–44 s. The highest figures:
      • ≥ 20 s limits: 31 % (QA D4);
      • ≥ 5 s budgets: 31 % (harness settled/settledAt);
      • flows-grid 1 s waits: 34 % (anchoring :183).
    • AC4. Every attempt is recorded.
      • Attempts 1–2 at 0fb6ff8 with default workers failed (2 + 3 and 4 + 3 tests).
      • Attempt 3 was a trial at 0fb6ff8 with --maxWorkers=50%: 0 + 0.
      • Attempt 4 at decb56a: 0 + 1, the pre-existing D1/D2 race, now Bug Bug: deep-scroll focus test loses row 1310 under load (flows-grid D1/D2) #93.
      • Attempt 5 at decb56a: 0 + 0, start load 2.26, peak 9.3. Its maximum was 61 % (anchoring :183), with the deep-scroll wait at 43 %. Nothing was above 90 %.
    • AC5. The doc and the PR list every modified test with a before/after line. Scale coverage is kept:
      • 220 × 2,000+ in jsdom;
      • the jump to row 1,500 at 20 ms with the same bounds;
      • the hold's 220 / 12 / 23;
      • 300 selections;
      • e2e/flows-grid.spec.ts:83, unchanged.
    • AC6. No limit or budget was raised.
    • AC7. maxWorkers: "50%" came with before/after numbers. The single-run wall time is 41 % of the AC1 median. All 33 files and 411 tests still run.
    • AC8. Intermittent mixed-sign grid row/cell height assertion in frontend CI #87's criteria are met; see the Intermittent mixed-sign grid row/cell height assertion in frontend CI #87 handoff.
    • AC9.
      • In the container at decb56a: npm ci (lockfile unchanged), format:check, lint, typecheck and build pass, @smoke 14 passed, full e2e 68 passed in both projects.
      • Hosted quality on the PR passed: run 43781924606, unit 33/33 files in 49.8 s. Backend (43781924609) and ETL (43781924642) also passed.
      • The hosted workflow_dispatch full run passed: run 43781929921, unit in 48.9 s, browser 68 passed.
    • AC10. The evidence doc and the pointer in f4-verification.md are in the PR.

    Commands

    Container commands are listed in the doc's "Commands" section: project lca-diff-headroom, port 5221, worktree /tmp/lca-diff-headroom. The timing wrapper, the probes and the measurement config were temporary and are not committed. The worktree is clean apart from them, and they are removed after this handoff.

    Residual risk

    Next: QA, at delivered SHA 7e4e1c2.

    🤖 Generated with Claude Code

  6. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator state: QA. The Engineer handed off PR #94 at 7e4e1c2 (code at decb56a). Independent QA starts in a detached worktree at 7e4e1c2. Heavy runs wait for the #52 QA suite to go idle.

    🤖 Generated with Claude Code

  7. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: FAIL

    PR #94 is not ready to merge. AC4 failed. Every other #76 criterion passed, and #87 passed separately.

    What I reviewed

    • Branch fix/76-87-unit-headroom, delivered SHA 7e4e1c2a65b43c42cea04f2533e81178a9b276d0. The code SHA is decb56a, and the merge base is main f5769bb.

    • Mock mode only.

    • Environment: rootless workspace container, Compose project lca-diff-headroom-qa, port 5229. The worktree was detached at 7e4e1c2 and was still clean at the end. The host has 8 cores (nproc), with 28 containers up.

    • Timing method. I ran the timings in an uncommitted scratch copy of apps/frontend inside the container (/root/qa/inst). Its src/ is byte-identical to the worktree (diff -rq). It adds two things:

      • a setup file that wraps Testing Library's asyncWrapper and records the source-mapped call site, wall-clock time and outcome of every waitFor/findBy* call;
      • an afterEach that records each test's elapsed time and its task.timeout.

      It was loaded through mergeConfig(base, { test: { setupFiles: [...] } }). Each call site's budget comes from its source text: an explicit timeout, or the 1 s default. All budgets resolved. Per-test times agree with Vitest's JSON reporter.

    • Quiet-host rule. A run started only when no other container was above 50 % CPU in docker stats. The start load was read immediately before launch and had to be ≤ 2.0. I aborted my first attempt because its load was re-read at 2.17 at launch, and those results are not counted.

    Criteria

    AC Verdict Evidence
    AC1 Baseline PASS (inspection) The doc records three baseline runs at af5317d: per-test durations, budgets, loads, wall times and container count. I did not re-run the baseline.
    AC2 Attribution PASS (inspection) Setup vs. measured step and mock vs. latency vs. rendering are recorded, with a remedy and its effect for each test. That matches the code: the per-page row union and the catalog copy are gone, and the 300 tree clicks are replaced.
    AC3 Headroom PASS Details below.
    AC4 Two-suite load FAIL Details below.
    AC5 Meaning unchanged PASS Diff review below.
    AC6 Limits PASS No timeout changed anywhere in the diff. The deep-scroll internal wait is still { timeout: 10000 }, the test still 20000, and the 300-selection test still 30_000. There is no retry, skip or .todo, and no global testTimeout/hookTimeout.
    AC7 Config PASS, with a note Details below.
    AC8 #87 PASS See the QA comment on #87.
    AC9 Gates PASS Details below.
    AC10 Evidence PASS unit-headroom-verification.md is present. f4-verification.md changes only by the 2-line pointer. Its AC4 residual-risk figure (61–68 %) is now out of date (finding 2).

    AC3: three consecutive full runs at the delivered code

    Run Start load (1/5/15) End load Tests Failed Wall
    1 1.81 1.90 2.58 3.14 2.29 2.68 411 / 33 files 0 47.4 s
    2 1.90 2.12 2.59 4.76 2.81 2.81 411 0 42.4 s
    3 1.81 2.34 2.64 4.20 2.87 2.80 411 0 41.6 s

    No other container was above 50 % CPU before or after any run.

    Highest share of each limit or budget, maximum over the three runs:

    • Tests with a limit ≥ 20 s (37 tests): 29.7 %, QA D4 at 11.88 s of 40 s (target ≤ 65 %).
      • Composition, large workload: 19.1 %.
      • Deep-scroll test: 18.2 % (3.65 s of 20 s).
      • Hold test: 14.3 %.
      • 300-selection test: 0.7–1.0 % (0.24–0.30 s of 30 s).
    • Internal budgets ≥ 5 s: 31.8 %, harness settledAt at 4.77 s of 15 s (target ≤ 65 %).
      • Harness settled: 31.0 %.
      • Deep-scroll wait flows-grid.test.tsx:75: 22.7 % (2.27 s of 10 s).
      • Harness selectAll: 21.0 %.
      • Hold wait flows-grid-hold.test.tsx:52: 14.1 % (3.51 s of 25 s).
    • 1 s default waits in flows-grid files: 31.9 %, flows-grid-anchoring.test.tsx:183 at 0.319 s (target ≤ 75 %). The next highest was 9.0 %.
    • Failures and timeouts: none. No wait rejected in any run.

    AC4: two concurrent full runs, 3 pairs

    Each pair ran two instrumented npx vitest run processes at the same time in the container.

    Pair Start load 1-min peak A B Wall A / B Highest share (A / B): ≥ 20 s test, ≥ 5 s budget, flows-grid 1 s wait
    1 1.77 9.41 411 passed 411 passed 78 / 78 s 37.6 / 38.1 %, 41.8 / 38.7 %, 75.4 / 70.9 %
    2 1.83 9.74 411 passed 411 passed 75 / 76 s 37.3 / 35.3 %, 40.2 / 41.8 %, 55.1 / 72.9 %
    3 1.69 8.56 411 passed 1 failed, 410 passed 75 / 75 s 35.6 / 35.0 %, 43.1 / 45.4 %, 79.0 / 92.3 %

    The failure in pair 3, run B was src/services/mock/flows-grid.test.tsx > "keeps the same flows in view and focused when processes are removed or added while deep (QA D1, D2)":

    TypeError: Cannot read properties of null (reading 'focus')
     ❯ src/services/mock/flows-grid.test.tsx:253:27   act(() => at(1310, -1)!.focus());
    

    This is the Bug #93 signature.

    How often #93 fails.

    • In my pairs: 1 of 6 suite runs, 1 of 3 pairs.
    • At decb56a overall, with the Engineer's attempts 4 and 5: 2 of 10 suite runs, and 2 of 5 pairs.

    Did this PR make #93 worse? I ran a targeted stress test: two concurrent loops of 25 runs of -t "QA D1, D2" per variant, 50 runs each, at host load 3.5–4.

    Variant Failures
    delivered 0 of 50
    delivered with only the #87 product fix reverted (ComparisonGrid.tsx/FlowsGrid.tsx from main) 2 of 50, same TypeError at :253
    main f5769bb 0 of 50

    Verdict on AC4.

    • AC4 asks for two concurrent full runs that "both pass with 0 failures". At the delivered code that happened in 2 of my 3 pairs and 3 of the 5 pairs overall. 40 % of pairs failed, so the suite is not a stable gate under the two-suite load AC4 represents.
    • I can't count a pass that came only from repeating the pair until one succeeded. The AC text has no exclusion for an earlier-known race.
    • AC4 also requires listing any budget above 90 %. flows-grid-anchoring.test.tsx:183, a 1 s default waitFor, reached 92.3 % (0.923 s) in pair 3 B and 75–79 % in two other runs. The PR lists 61–68 % and "nothing above 90 %".

    AC5: diff review

    • Mock row-set cache (comparison.ts).
      • differences() and selected() validation still run before the cache lookup, so the same errors come first.
      • The cache lookup runs inside the request() callback, so latency and abort are unchanged. Every response still passes through copy() in runtime.ts.
      • rowPage does not mutate the cached array.
      • The key is the sorted snapshot refs plus the sorted process IDs. The row set is a sorted union, so process order cannot change it.
      • The cache is per instance, bounded by tokenLimit and FIFO-evicted. Nothing in the mock writes to the catalog, so a cached set cannot go stale.
      • The existing comparison*.test.ts, flow-summaries and service-boundary tests are unchanged and pass.
    • freezeComparisonCatalog.
      • It is opt-in, through a WeakSet of catalogs frozen by the function itself. Any other catalog is still copied.
      • The only caller is the module-level catalog in flows-grid-harness.ts. Each test still creates its own mock instance, and Vitest isolates modules per file.
      • A write to the frozen fixture throws in strict ESM, so it cannot leak silently between tests. The new test checks this, and checks that two instances share no tokens.
      • Minor: deepFreeze skips the children of an object that was already frozen. That doesn't apply to the generated fixtures.
    • 300-selection test.
      • The list assertions are unchanged: count 300, the mounted-item bound, a single tab stop, and End/ArrowUp/removal/Home focus (Leaf 0000 through 0299, then 298).
      • The fixture still has 300 leaves.
      • The removed getAllByRole(treeitem /^Leaf/).toHaveLength(300) was a setup check on how the tree was filled. Tree "Load more" paging is still covered in process-tree.test.tsx and selection.test.tsx:130.
      • There is no selection cap.
    • Scale coverage.
      • PROCESSES = 220 and GENERATED_ROWS = 2000 are unchanged.
      • The deep-scroll test still jumps to row 1,500 at 20 ms, with every bound unchanged.
      • The hold is still 220 / 12 / 23; only its comment changed.
      • e2e/flows-grid.spec.ts is unchanged.
    • Forbidden files and ADR. services/mock/test-harness.ts, roadmap.md and frontend-backlog.md are not in the diff. Nothing here deviates from the PRD or specification, so no ADR is needed.

    AC7: maxWorkers: "50%"

    • This is remedy 4, which needs before/after measurements; the Engineer recorded them.
    • Remedy 3, splitting files, does not address two suites oversubscribing the host, so skipping it is reasonable.
    • The "before" evidence is weaker than the "after":
      • default-worker attempt 1 started at load 3.38;
      • attempt 2 ran next to another agent's suite at 224 % CPU;
      • I did not run a default-worker pair myself.
    • Even so, the single-run wall time falls (50–54 s → 43–44 s; I measured 42–47 s, ≤ 125 % of the AC1 median). All 33 files and 411 tests still run, and hosted CI still runs everything. I accept it.

    AC9: gates, run in the container at 7e4e1c2

    Check Result
    npm ci --no-audit --no-fund pass, package-lock.json unchanged
    npm run format:check pass
    npm run lint pass
    npm run typecheck pass
    npm run build pass
    npm run test:e2e -- --grep @smoke 14 passed (1.0 min)
    npm run test:e2e, both projects 68 passed (3.6 min)
    Hosted CI at 7e4e1c2 all green: Frontend quality (43781924606), Backend (43781924609), ETL (43781924642), Frontend workflow_dispatch (43781929921)

    Commands

    cd /tmp/lca-diff-headroom-qa   # detached at 7e4e1c2
    COMPOSE_PROJECT_NAME=lca-diff-headroom-qa FRONTEND_PORT=5229 ./dev up && COMPOSE_PROJECT_NAME=lca-diff-headroom-qa FRONTEND_PORT=5229 ./dev check
    docker compose -p lca-diff-headroom-qa exec -T workspace bash -lc 'cd apps/frontend && npm ci --no-audit --no-fund && npm run format:check && npm run lint && npm run typecheck && npm run build'
    # AC3 (3x, quiet-host gate before each run), scratch copy /root/qa/inst with the timing setup:
    docker compose -p lca-diff-headroom-qa exec -T -e QA_RUN=ac3-$i workspace bash -lc 'cd /root/qa/inst && npx vitest run --config vitest.qa.config.ts --reporter=dot --reporter=json --outputFile.json=/root/qa/out/ac3-$i.json'
    # AC4 (3 pairs): the same command twice in one container shell, as `run a & run b & wait`
    # #93 stress, per variant (inst, prefix, main), two loops at once:
    npx vitest run src/services/mock/flows-grid.test.tsx -t 'QA D1, D2'   # 25x per loop
    docker compose -p lca-diff-headroom-qa exec -T workspace bash -lc 'cd apps/frontend && npm run test:e2e -- --grep @smoke && npm run test:e2e'
    

    Findings

    1. AC4 failed, blocking. The two-suite pair failed in 1 of 3 QA pairs (2 of 5 at decb56a), always on the Bug: deep-scroll focus test loses row 1310 under load (flows-grid D1/D2) #93 D1/D2 race. Bug: deep-scroll focus test loses row 1310 under load (flows-grid D1/D2) #93 is a test reliability defect that already exists at the base and is not caused by Intermittent mixed-sign grid row/cell height assertion in frontend CI #87's deferral. Until it is fixed, [Task] Restore unit-test budget headroom for the 300-selection and deep-scroll tests #76's two-suite gate is not reliable.
    2. AC4 residual risk is under-reported, non-blocking on its own. flows-grid-anchoring.test.tsx:183, the 1 s default wait, reached 92.3 % in a passing pair. It should be listed as above 90 % in the evidence doc and the PR.

    Next action

    🤖 Generated with Claude Code

  8. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator state: implementing (QA FAIL at 7e4e1c2).

    🤖 Generated with Claude Code

  9. added 2 commits that reference this issue on Nov 16, 2026
  10. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Engineering: READY FOR QA (after the AC4 FAIL)

    AC4 blocker fixed. The #93 D1/D2 race is fixed in product code (class B). The details are in the #93 handoff and the #93 section of docs/engineering/unit-headroom-verification.md.

    Re-measured at 9374bde, every attempt recorded

    • AC3. 3 quiet full runs (start loads 1.56, 1.95, 1.92): 412 tests each, 0 failures, 41–47 s.
      • Highest test share: 29.3 % (QA D4 at 40 s).
      • Highest internal budget: 31.9 % (harness settled at 15 s).
      • Highest flows-grid 1 s wait: 31.2 % (anchoring :183).
    • AC4. 4 of 4 two-suite pairs passed with 0 failures (start loads 0.49, 1.87, 1.77, 1.73; peaks 7.4–8.8). No attempt was aborted.
      • Highest test share: 34.9 %.
      • Highest internal budget: 36.2 %.
      • Anchoring :183: up to 66.4 %.
      • Nothing was above 90 %.
    • Residual risk corrected (finding 2). The doc and PR now record anchoring :183 at 92.3 % in QA pair 3 B at decb56a, in place of my "61–68 %, nothing above 90 %". It is listed as above 90 %, and its budget is not raised.
    • AC9 gates at 9374bde.
      • npm ci with the lockfile unchanged.
      • format:check, lint, typecheck and build pass.
      • @smoke 14 passed; full e2e 68 passed.
      • Hosted runs at 41de025 are green: Frontend quality 43801419338, Backend 43801419363, ETL 43801419357.

    Next: QA rechecks AC4 (and AC3/AC9 at the delivered SHA) at 41de025.

    🤖 Generated with Claude Code

  11. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    QA: PASS (recheck at 41de025)

    AC4 now passes and every other criterion still holds, so #76 passes. This supersedes my earlier QA FAIL at 7e4e1c2: the AC4 failure was the #93 race, which the PR now fixes.

    What I tested

    Criteria

    AC Verdict Evidence
    AC1, AC2 PASS Unchanged from my first report.
    AC3 Headroom PASS Details below.
    AC4 Two-suite load PASS Details below.
    AC5 Meaning PASS The only test change since 7e4e1c2 is the added #93 regression test. Every #76 scale bound is unchanged.
    AC6 Limits PASS No timeout or limit changed. The deep-scroll wait is still 10000 and the 300-selection limit still 30_000.
    AC7 Config PASS Unchanged. Single-run wall time is 40–47 s.
    AC8 #87 PASS The #87 regression test fails 3 of 3 with FlowsGrid.tsx from main and passes 3 of 3 at the delivered code.
    AC9 Gates PASS Details below.
    AC10 Evidence PASS The doc and PR body now record the 92.3 % figure for :183 at decb56a as residual risk, correcting "nothing above 90 %".

    AC3: three consecutive full runs at the delivered code

    Run Start load (1/5/15) End load Tests Failed Wall
    1 1.78 1.54 1.43 3.02 412 / 33 files 0 47.0 s
    2 1.70 1.74 1.52 4.00 412 0 40.8 s
    3 1.91 2.01 1.66 3.03 412 0 40.4 s

    No other container was above 50 % CPU before or after any run. The highest figures:

    Target Highest Where
    Tests with a limit ≥ 20 s: ≤ 65 % 29.4 % QA D4, 11.78 s of 40 s
    Internal budgets ≥ 5 s: ≤ 65 % 31.3 % harness settled, 4.69 s of 15 s
    flows-grid 1 s default waits: ≤ 75 % 34.1 % anchoring :183

    No wait rejected, and nothing timed out.

    AC4 (#93 AC6): three pairs, all recorded, none aborted

    Pair Start load 1-min peak A B Wall Highest (A / B): ≥ 20 s test, ≥ 5 s budget, flows-grid 1 s wait
    1 1.57 9.57 412 passed 412 passed 73 / 73 s 35.0 / 34.2 %, 35.8 / 35.5 %, 53.3 / 71.0 %
    2 1.95 8.28 412 passed 412 passed 72 / 72 s 35.9 / 35.2 %, 36.2 / 35.8 %, 64.2 / 65.8 %
    3 1.89 9.05 412 passed 412 passed 72 / 71 s 35.7 / 34.7 %, 37.0 / 36.5 %, 59.6 / 60.0 %
    • Highest values. QA D4 at 35.9 %, settledAt at 37.0 %, the deep-scroll wait at 33.9 %, and anchoring :183 at 71.0 %.
    • Nothing above 90 % at this SHA.
    • Residual risk. :183 remains the closest margin under two suites: 92.3 % once at decb56a, and 53–71 % here.

    AC9: gates at 41de025

    • In the container:
      • npm ci: pass, lockfile unchanged.
      • format:check, lint, typecheck and build: pass.
      • @smoke: 14 passed.
      • Full e2e in both projects: 68 passed (3.0 min).
    • Hosted CI at 41de025 is green:
      • Frontend quality: 43801419338.
      • Backend: 43801419363.
      • ETL: 43801419357.

    Commands

    These are listed in the #93 QA comment. For the AC3 and AC4 runs I used:

    npx vitest run --config vitest.qa.config.ts --reporter=dot --reporter=json --outputFile.json=/root/qa/out/<run>.json
    

    It ran in /root/qa/inst. For a pair, two of these ran at once in one container shell.

    Next: ready for review with PR #94, together with #87 (QA PASS) and #93 (QA PASS). No merge without the maintainer's approval.

    🤖 Generated with Claude Code

  12. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator state: ready for review.

    🤖 Generated with Claude Code

  13. DavidVFitzGerald commented on Nov 16, 2026

    @DavidVFitzGerald
    OwnerAuthor

    Coordinator: closed. PR #94 merged at eea972f after QA PASS and green hosted checks.

    🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendtask

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions