Skip to content

test(tui): settle deferred rows before unmount compensation checks - #695

Merged
Kyzcreig merged 1 commit into
mainfrom
fix/ui-tui-unmount-compensation-determinism
Sep 14, 2026
Merged

Kyzcreig merged 1 commit into
mainfrom
fix/ui-tui-unmount-compensation-determinism

Conversation

@Kyzcreig

Copy link
Copy Markdown
Collaborator

Problem

ui-tui/src/__tests__/virtualHistoryOffsetCache.test.ts fails inside the GitHub merge queue, blocking every PR on main:

FAIL src/__tests__/virtualHistoryOffsetCache.test.ts > useVirtualHistory offset cache reuse
     > corrects and compensates a same-layout row measured at unmount
AssertionError: expected "adjustScrollTop" to be called once, but got 0 times
Tests  1 failed | 1726 passed (1727)

It is SKIPPED on normal PRs (path filter — most PRs touch no JS/TS) but runs in the merge group, so it only surfaces at merge time. Observed on CI runs 34830183258 and 34831579810.

Root cause

Test-determinism defect, not a production bug. The test raced React's deferred work: on a slower/delayed scheduler the outgoing row had not mounted before the same-layout compensation assertions ran, so adjustScrollTop had legitimately not fired yet.

Fix

Test-only. Drain React work with act and assert the outgoing row actually mounted before testing same-layout compensation and stale-width rejection.

  • useVirtualHistory.ts (the production hook) is unchanged.
  • 0 assertions removed, 3 added — the gate is stricter than before.

Verification

  • Repaired test: 17/17 pass.
  • Mutation-tested: neutralising the compensation call (s.adjustScrollTop(h - previousHeight) → void (...) at useVirtualHistory.ts:531) makes it FAIL at line 569 (1 failed / 16 passed). The test still gates the behavior rather than merely passing.
  • Pristine delayed-scheduler Linux control reproduces the exact line-544 failure; repaired pair passes. macOS/Linux TUI + Ink typechecks green.

Drain React work with act and assert the outgoing row mounted before testing same-layout compensation and stale-width rejection. Preserve all compensation assertions.

Verified pristine delayed-scheduler RED at line 544 and repaired GREEN on Linux Node 26.8.2. Unmount-only compensation mutation fails. macOS/Linux TUI checks and Ink typechecks pass with four Vitest workers.
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

૮ >ﻌ< ა ci review

ran on f55bca5 — test(tui): settle deferred rows before unmount compensation

⚠️ Warnings

CI timings · View report · View job

Wall time 14m4s vs 10m39s (+32.1%). 6 job(s) slower,

  • JS & TS checks / JS & TS checks: +131.0s
  • Detect affected areas: +71.0s
  • OSV scan / Scan lockfiles / osv-scan: +44.0s
  • OSV scan / Emit review status: +27.0s
  • Check no committed infographics / check-no-committed-infographics: +27.0s

OSV vulnerability scan · View job

80 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

@Kyzcreig

Copy link
Copy Markdown
Collaborator Author

FleetReview

Confidence: 4/5

No actionable findings.


FleetReview provenance · models: B=gpt-5.6-sol, C=claude-code-opus-5, F=gpt-5.6-sol, G=grok-4.6 · cost: $2.68 · duration: 8m 05s · rounds: 1 · files examined: 1

@Kyzcreig
Kyzcreig added this pull request to the merge queue Sep 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 14, 2026
@Kyzcreig
Kyzcreig added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit 1adc4ae Sep 14, 2026
30 checks passed
@Kyzcreig
Kyzcreig deleted the fix/ui-tui-unmount-compensation-determinism branch September 14, 2026 14:04
Kyzcreig added a commit that referenced this pull request Sep 25, 2026
…tream-695 branches

Rows #268/#272 -> audit/scripts_misc/revert-livesync @ b0c914c,
#116/#118 -> audit/scripts_misc/revert-mem0-bgr @ 9c09f9e,
#695 -> audit/scripts_misc/upstream-695 @ 830f68a (off upstream/main).
Notes carry the verify commands and real output. Nothing merged.
Kyzcreig added a commit that referenced this pull request Sep 27, 2026
Each row gets the measurement the lead lacked, then a README section 2 verdict:
DROP 10, KEEP 8, UPSTREAM 4, SUPERSEDED-BY-UPSTREAM 2.
14 slice cards were filed for the rows whose verdict changed.

Verified: probes on clean fork 858ee59 and upstream c15ebb1 worktrees
with a temp home, read-only state.db/kanban.db queries, log greps, a live CDP
repro on Chrome 154, and REST merge-queue job-log counts for #695.
Narrow fork tests via test-gate: 175 passed.
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.

1 participant