Skip to content

Stabilise the flaky transcript and layout tests - #351

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-5571-stabilise-tests
Aug 7, 2026
Merged

Stabilise the flaky transcript and layout tests#351
TheGreatAxios merged 4 commits into
mainfrom
cl-5571-stabilise-tests

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • shell.test.ts and transcript-layout.test.ts asserted not.toContain("agent") against a full rendered frame, which breaks in any checkout whose directory name contains that substring (the footer prints the workspace path). Both now check only the rows that actually carry a voice label.
  • markdown-rows.test.ts settled on a fixed 250ms sleep after appending a markdown row, racing the async highlight worker. Predicate-based call sites now poll for the settled frame shape (every block present, no raw markdown marker left) with a generous bound, returning as soon as it's true.
  • ripgrep-plugin.test.ts's timeout test raced a real spawned rg process against a 1ms timeout. ripgrepPlugin now accepts an injectable spawn function (mirroring the one runRg already exposed), so the test uses a stalled child that never closes — the timeout is the only path to settlement.
  • AGENTS.md now spells out that bun run test is the canonical scoped command; a bare bun test also scans vendor/, inflating counts by hundreds.

Verification

  • bun run typecheck, bun run build, bun run test all pass (3947 pass / 0 fail, post-rebase onto 0.2.91).
  • Ran bun run test twice from the same worktree in the suite's fixed default order: identical 3947 pass / 0 fail both times.
  • Ran the full suite in fixed order from a worktree path containing "agent" and from a very long path: both 3947 pass / 0 fail.
  • shell.test.ts and transcript-layout.test.ts pass standalone and as part of the full fixed-order run.
  • Cross-test ordering (bun test --randomize) was not investigated as part of this change — verification here covers fixed-order stability only. A separate ordering-dependence issue exists on main independent of this branch.

Closes CL-5571

@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown

CL-5571

Checking a rendered frame for the absence of "agent" anywhere breaks
in any checkout whose directory name contains that substring (the
footer prints the workspace path), including any path containing
"subagent". Scope the assertion to the rows that actually carry a
voice label instead.
@TheGreatAxios
TheGreatAxios force-pushed the cl-5571-stabilise-tests branch from 27d2b38 to 510b834 Compare August 7, 2026 06:51
Highlighting runs on a worker outside the render scheduler, so a
quiet renderer or a fixed 250ms sleep does not reliably mean the
highlighted frame has landed. Poll for the settled shape instead —
every block present and the raw markdown marker gone — so each test
returns as soon as it is true and tolerates slower runs instead of
racing a guessed duration.
The test raced a real spawned ripgrep process against a 1ms timeout,
so it depended on the process being slower than the clock rather than
on the timeout path itself. Thread the same stalled-child fake already
used at the runRg level through ripgrepPlugin so the timeout is the
only path to settlement.
A bare `bun test` also scans vendor/, inflating pass/fail counts by
hundreds and making the count meaningless to compare across
branches.
@TheGreatAxios
TheGreatAxios force-pushed the cl-5571-stabilise-tests branch from 510b834 to 12c027e Compare August 7, 2026 07:03
@TheGreatAxios
TheGreatAxios merged commit c423b91 into main Aug 7, 2026
2 checks 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