Repository navigation
test(plugin-auth): seed the stored-issuer pre-flight fixture in one transaction - #25684
Merged
objectstack-fleet[bot] merged 2 commits intoOct 24, 2026
Merged
objectstack-fleet[bot] merged 2 commits into
objectstack-fleet[bot] merged 2 commits into
Conversation
…ransaction `arrangeAccountTable` inserted its rows one at a time, so every row was its own autocommit, and its own fsync, on the case's SQLite file. The 1,200-row "walk of several pages" case spent its 10 s budget there under the hourly full battery's load. The fixture now seeds through `knex.batchInsert` (one transaction, 200-row multi-row statements, inside SQLite's 500-term compound-select limit), still straight through knex and independent of the code under test. Assertions are unchanged. Claude-Session: https://claude.ai/code/session_01JVTd3PprStGa26aez5omLB Co-authored-by: Claude <noreply@anthropic.com>
…eflight-walk-fixture-budget
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): |
Contributor
Author
席位核对ACCEPT ·
Generated by Claude Code |
objectstack-fleet
Bot
deleted the
claude/issue-25648-preflight-walk-fixture-budget
branch
October 24, 2026 17:11
This was referenced Oct 24, 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.
Fixes #25648
Clause-②: no
Metadata-protocol: none
What changed
One file:
packages/plugins/plugin-auth/src/account-identity-preflight-stored-issuer.test.ts, test-only.arrangeAccountTable, the fixture every case in the file uses, seededsys_accountwith oneknex(...).insert(row)per row. Each insert was its own autocommit on the case's SQLite file. The better-sqlite3 build here compilesDEFAULT_SYNCHRONOUS=2(FULL), andtmpdir()sits on a real disk (ext4 in this container), so every row also paid an fsync. The "walk of several pages" case seeds 1,200 rows, so it made 1,200 commits before reaching the code under test.The fixture now seeds with
knex.batchInsert(SYS_ACCOUNT_OBJECT, rows, SEED_CHUNK_ROWS), which runs every chunk inside one transaction, withSEED_CHUNK_ROWS = 200. knex compiles a multi-row SQLite insert as oneselect ... union all select ..., so a chunk is limited by SQLite's compound-select limit (MAX_COMPOUND_SELECT=500in this build) and its bound-variable limit (MAX_VARIABLE_NUMBER=32766). 200 rows of five columns is 200 terms and 1,000 bindings, inside both. The seed still goes straight through knex, independent of the code under test, as the fixture's doc comment requires. driver-sql's own suite seeds the same way (sql-driver-json-backfill-depth-limit.test.ts).What is unchanged:
arrangeAccountTableand adds one constant above it.PAGE_SIZE = 500, a module constant inaccount-identity-preflight.ts.AccountIdentityPreflightOptionsexposes onlymax, so the case cannot set the page size. With 1,200 rows the walk reads pages of 500, 500 and 200, and the colliding rowsacc_0000andacc_1199sit on the first and last page.expect(after.scanned).toBe(1_200)and the first-and-last-page collision assertions are untouched.testTimeout: 10_000in the package's vitest config), so no per-case timeout is needed.Measurements
The same command was used before and after. Before is
9dac9eb8d6(origin/main at dispatch); after is8d612d65f1(the fix) andac38bbde12(the fix merged with main). This is a shared 4-core container with up to three agents running at once, so the absolute numbers are shared-box readings. The ratios are what to read.The case alone:
pnpm --filter @objectstack/plugin-auth exec vitest run src/account-identity-preflight-stored-issuer.test.ts --reporter=verbose, three runs each:teststime9dac9eb8d6)8d612d65f1)ac38bbde12)Under load:
pnpm --filter @objectstack/plugin-auth test --reporter=verbose, the whole 193-file suite, with this case's duration read from the verbose log:9dac9eb8d6)8d612d65f1)The after run fell on a busier box (suite wall 359 s against 303 s), and the case still dropped from 2090 ms to 82 ms, about 25x. Locally, seeding was about 1.65 s of the case's 1.72 s. In the failing schedule run the case went past 10 s while
objectql's 466 files ran in the same turbo run. Removing 1,199 fsyncs takes out the part of the case that is disk-bound, which is the part that grows with I/O contention; the rest is CPU.Verification
All on the final head
ac38bbde12unless noted:pnpm exec turbo run build --concurrency=2 --filter='@objectstack/plugin-auth...', then the single-file run (10/10 passed), thenpnpm --filter @objectstack/plugin-auth typecheck(check:test-typecheck: OK):os-verify-lock: VERDICT command-exit 0.tsc --noEmit --listFiles -p tsconfig.test.jsonlists this test file once, and none of the 88 ledgered test-layer errors is in it.eslint packages/plugins/plugin-auth --no-inline-config: exit 0, no output.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 58 commands atac38bbde12. All 58 were run, each exit code recorded before any pipe. 57 exited 0.pnpm check:dual-build-cjs-loadsexited 3 (PREREQUISITE NOT MET: it needsdist/for about 42 packages outside plugin-auth's closure), so it is NOT MEASURED locally. This is a declared narrowing: the gate reads built output, and this diff changes no built output. Its reading is CI's.--ranreconciliation: "58 derived, 57 run, 1 NOT-MEASURED, 0 UNRUN", exit 0.test:repo(the vitestrepoproject) was not run locally: the diff touches none of its tests. It belongs to CI'sTest Core.No ablation: the diff changes no tested behaviour, only how a fixture writes its rows.
Acceptance notes
CIruns after this merges.files[]isdist,README.mdandCHANGELOG.md. After building,arrangeAccountTableandSEED_CHUNK_ROWSappear in 0 of those files, and the positive controlprobeAccountIdentityCollisionsappears in 5. The PR takesskip-changeset.teststime fell from about 2.0 s to about 0.3 s.Generated by Claude Code