Skip to content

test: keep three slow repo-scan and fuzz tests clear of the 5 s timeout - #4885

Merged
thymikee merged 3 commits into
callstack:mainfrom
samanyudas:test/speed-up-slow-repo-guards
Nov 21, 2026
Merged

thymikee merged 3 commits into
callstack:mainfrom
samanyudas:test/speed-up-slow-repo-guards

Conversation

@samanyudas

@samanyudas samanyudas commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three unit tests ran close to the 5 s vitest timeout and failed full-unit runs on a loaded host, at base too. No timeout is raised.

  • Daemon fixture guard: parsed all 4,391 source files to follow imports from 5 seed files. It now parses only files that could import a family member. Its prefilter follows the guard's own resolver, and any file with a backslash counts.
  • Snapshot producer guard: 4 tests each parsed all 2,013 production modules. It now skips modules whose text has no producer, no PRODUCER, and no backslash.
  • Fuzz harness: every spawned run.ts loaded fast-check. Only generated runs load it now.

Contract change: the fixture guard no longer fails on a syntax error in a file outside its candidate set. Lint and typecheck still parse every file.

Validation

Timings measured at base c37bb9563 and head on this host:

Test Base Head
daemon-fixture-launches 3.4-3.8 s 1.3 s
snapshot-producer-emitters, each repo scan 3.4 s 1.05-1.4 s
fuzz/harness promotion case 2.37 s 1.62 s
  • Equivalence: with every source file seeded with a raw launcher, old and new fixture scans return the same 19 violations. Producer scans are identical on all 2,013 modules.
  • Four new fixture-guard cases, found by review, pass at base and head.
  • pnpm check:affected --run --head c181a8469 passed every runnable check, including full unit (21,401 passed).

Reviewed with sol-loop: 3 rounds with gpt-6.2-sol. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code.

samanyudas and others added 3 commits November 21, 2026 19:46
…e scan

The daemon fixture guard parsed all 4,391 source files to build the whole
import graph, then walked it from the five seed files. That took about
2.5 s, over the 2.5 s unit budget, and under full-suite load the test
crossed its 5 s timeout.

The scan now walks the graph from the seeds and parses a file only when it
could import a family member: its text names the member, or names the
directory for an index, or it sits under a path the request could reach
with `.` and `..` steps, or it contains a backslash escape that could spell
any request. The scan takes about 1.0 s, and it returns the same violations
on the repository with every file seeded with a raw launcher. New cases pin
`.` and `..` requests that the resolver maps to a sibling fixture module, and
a module named `.ts`.

The guard no longer fails on a syntax error in a file outside that
candidate set. Such a file cannot import a family member, so the error never
affected detection. Lint and typecheck still parse every file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itter scan

Four tests in the snapshot producer guard each parsed and walked all 2,013
production modules, about 3.4 s per test. Under full-suite load one of them
crossed the 5 s timeout.

A module records a producer only through a `producer` key or a
`*_PRODUCER` binding, and an escape can spell either. The scan now skips a
module whose text has neither name and no backslash. Each repository scan
takes about 1.05 s, and every module's scan result is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`run.ts` imported `generate.ts` eagerly, so every harness run loaded
fast-check and the arbitraries, about a second, even for a saved case,
corpus promotion, self-check, or an options error. The harness tests spawn
`run.ts` per case, and the promotion cases ran near the 2.5 s unit budget.

A generate run now imports `generate.ts` once, before the first target's
timer, so no target's reported duration includes the load. A promotion run
drops from about 2.4 s to 1.65 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member

Thanks for the fix. The change at c181a84 is ready: the code looks correct, CI is green (2 checks, none failing), and there are no conflicts. Not blocking: mayImport in daemon-fixture-launch-guard.ts re-derives the resolver's candidate set by hand, so a later change to resolveLocalImport (for example .tsx or .mts) could silently narrow the filter, and a raw-text relative-request scan resolved through resolveLocalImport itself, or a test that pins the two together, would remove that coupling and shorten its long comments; the skip regex's \\ and PRODUCER branches in snapshot-producer-emitters.test.ts run only against the live repo, so one example module written as 'produc\u0065r' would cover them; and the PR could link a tracking issue if one exists. These can be taken or left. Not verified here: the three tests, the timings, and the 19-violation and 2,013-module equivalence claims were not re-run at this commit, and the prefilter was checked by reading the code only.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 21, 2026
@thymikee
thymikee merged commit 6df9dbb into callstack:main Nov 21, 2026
18 of 20 checks passed
@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 Drafted by Claude Opus 5.5. Reviewed by @samanyudas and posted on their behalf.

All three optional points are in #4898, since this merged before they landed.

  • Resolver coupling: mayImport is gone. Quoted . text in unescaped files now goes through resolveLocalImport itself, so a resolver change also widens the prefilter.
  • Skip-regex branches: two example modules now need the backslash and PRODUCER branches. Each fails when its branch is removed.
  • Tracking issue: none is open. Diagnose helper exit-evidence and repo-guard timeouts during full-unit validation #4512 is the closest. It recorded this scan timing out and was closed as not planned.

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

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants