Repository navigation
test(lint): index the access-matrix rows once in the exhaustive fold case - #22358
Merged
objectstack-fleet[bot] merged 1 commit intoOct 8, 2026
Merged
Conversation
…case The "exhaustively matches the fold over every declared bit combination" case looked each of its 3^8 = 6,561 rows up with `m.entries.find(...)`, rebuilding the `ps_NNNN` name inside the callback: 21,526,641 callback calls, quadratic in the entry count. It ran 0.6-0.75 s on a quiet box and crossed vitest's 5 s default on a loaded CI shard. Index the rows by permission set once in a Map (first match wins, so each lookup returns the row `find` returned). The enumeration, the cell count and all four assertions are unchanged. Claude-Session: https://claude.ai/code/session_01DhTqaEHqPVSVnAkjG3jywn Co-authored-by: Claude <noreply@anthropic.com>
Contributor
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
This was referenced Oct 8, 2026
objectstack-fleet
Bot
deleted the
claude/issue-22346-access-matrix-linear-lookup
branch
October 8, 2026 23:11
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #22346
Clause-②: no
What changed
One test case, test-only:
packages/lint/src/build-access-matrix.test.ts, "exhaustively matches the fold over every declared bit combination". Its per-entrym.entries.find(...)lookup is replaced by oneMap, built once fromm.entriesand keyed bypermissionSet. The first match wins, so every lookup returns the same rowfindreturned. The 3^8 enumeration, the cell count and all four assertions are unchanged.build-access-matrix.tsis untouched, no timeout is raised, and nothing is skipped.Why
Part of: the card's generator closes the card when an hourly run is green. Its second cause, the shard-timing drift, belongs to #22014, which remains open. This PR removes only the lint case's half.Measurements
All wall times were taken under
scripts/pm/os-verify-lock.shin a shared container. The lock excludes other locked runs, not unlocked sibling work, so the ratios carry more weight than the absolute numbers.H1: the lookup is quadratic (confirmed). A counter in the
findcallback, written the same way as the case, read 21,526,641 calls per run. That is 6,561 × 6,562 / 2, and each call rebuilds theps_NNNNname.H2: the lookup dominates (confirmed). A scratch script (not committed) timed each step of the case three times at
54c3ce10c:buildAccessMatrixfind(as on main)Mapbuilt onceNo other step in the case is quadratic.
buildAccessMatrix, its sort included, costs too little to report.Case wall time, as vitest reports it per test. Command:
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 --reporter=verbose src/build-access-matrix.test.ts, three runs per tree:54c3ce10cb447bfa07That is about 15x faster. CI crossed the 5 s default only on a loaded shard (the triage measured a 473 s import phase there). At this container's speed, the case now runs at about 1/100 of the limit.
Ablation.
scripts/ablation-replace.mjsput the per-entryfindback in place of theMaplookup three times, each in wrap mode. Each time the anchor count went 1 → 0, the replacement count went 0 → 1, and the blob went84866b0a6a8f→40761cc2c49a.findput back (mutation)All 8 cases passed under the mutation, which is expected: the timing is the pin, and no assertion was added. On every restore leg, the blob after restore equalled the blob at HEAD (
84866b0a6a8f), andgit diff HEADwas empty.The assertions are unchanged
The case has 4
expect(calls before and after the change. Their matcher text is identical (compared as text withcmp):Across the whole file there are 28
expect(lines before and after, byte-identical as a sorted set, and 8it(cases before and after. The full diff of the case:Two placeholders stand in for angle-bracket text, which GitHub's body sanitizer removes.
TYPE_ARGSis the Map's two type arguments:string, and the entry type written as(typeof m.entries)[number].LESS_THANis the less-than operator. The committed lines are in the file.Verification (at
b447bfa07)pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2: 127 files passed; 5838 tests passed and 5 were skipped, out of 5843.pnpm --filter @objectstack/lint typecheck: exit 0.tsconfig.test.json's program (--listFiles: 1 hit). The buildtsconfig.jsonexcludes it (0 hits).check:test-typecheckpasses, and this file is not on the debt ledger, so it compiles with zero errors.eslint --no-inline-config --format json packages/lint/src/build-access-matrix.test.tsreports 1 file, 0 errors, 0 warnings.--print-configshows that ESLint lints it, with 5 rules.parserOptions.projectandprojectServiceare both null), and the diff edits no config. So no untouched file's verdict can change.pnpm lintbelongs to CI.node scripts/pm/dispatch-gates.mjs --commands(no paths) atb447bfa07derives the same 54 commands as the list taken at dispatch.check:lean-entry-closurefirst refused with PREREQUISITE NOT MET. It is green after building the@objectstack/objectqlclosure.check:dual-build-cjs-loadsrefused with PREREQUISITE NOT MET because it needs every package built. It is NOT MEASURED locally and is left to CI.--ranverdict: "54 derived famil(ies) accounted for — 53 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".Changeset
No changeset;
skip-changesetis applied instead.pnpm --filter @objectstack/lint build: the package'sfilesaredist,README.mdandCHANGELOG.md. The new symbolrowByPermissionSetand the case title have 0 hits there; the positive controlbuildAccessMatrixhas 6.check-empty-changeset.mjsrefuses an empty-frontmatter changeset, so the label is the declared opt-out.Acceptance notes
Generated by Claude Code