You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(core): cheapen the authz transport scan so it stops aborting the shard (#13656)
`authz-store-unavailable.test.ts` rebuilt its transport ledger from source
TWICE per run — once in the CONTROL test, once in the SET EQUALITY test — and
each rebuild walked all of `packages/`, `statSync`'d every directory entry, and
read every `.ts` file into a UTF-8 string before discarding 59% of them for
their path. Measured on this tree: 10,152 file opens and 147.5 MB decoded into
transient JS strings per run, against vitest's inherited 5000 ms default. On CI
that timed out, and a timeout ABORTS THE SHARD — so one slow test cost eleven
other packages their entire run, on PRs that never touched authorization.
Four changes, none of which touch what the suite asserts:
- the scaffolding path filter runs BEFORE the read instead of after it. A
path belongs to the result iff it both contains the call and is not
scaffolding, and set intersection does not care which half is tested
first, so the reordering is semantically free: 2,979 of 5,076 files are no
longer read in full only to be thrown away.
- the needle is matched against BYTES. The needle is pure ASCII and an ASCII
byte never occurs inside a multi-byte UTF-8 sequence, so a byte hit and a
decoded-string hit are the same hit — with no 147 MB decode in between.
- `readdirSync(dir, { withFileTypes: true })` answers "is this a directory?"
from the readdir result, replacing 5,926 `statSync` calls. The symlink limb
keeps the old follow-the-link semantics exactly, so a transport behind a
symlinked directory still cannot escape the ledger.
- the enumeration is computed once per PROCESS. It is still rebuilt FROM
SOURCE on every run, which is the guarantee the #13279 ruling requires; it
is simply not rebuilt twice for one answer.
The 5000 ms budget was inherited, never chosen, and was measurably the wrong
budget for a filesystem scan. The two scanning tests now state one explicitly.
It is a budget, not a timing assertion — deliberately not
`expect(elapsed).toBeLessThan(n)`, which on a shared runner is flaky by
construction.
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments