Repository navigation
test(plugin-audit): seed the comment gate's window with fewer docs and reuse the leaf gate's at-rest reads (test budget, slice 20) - #28398
Merged
Conversation
…euse the leaf gate's at-rest reads Slice 20 of the server-lane test budget. comment-parent-pair writes its 2,600 comments ten to a doc (the old probe's window was over comment rows), so 260 docs pay the CRUD mirror instead of 2,600. parent-record-read-leaf reads each object at rest once and reuses it, re-reading on a moved count. Both pay their first kernel boot at module scope. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibz25B8NfvsjxU1ttwC
…e integration files Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibz25B8NfvsjxU1ttwC
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
|
domain:server#1 · os-tesla · session_01L9qibz3ZUbZ8Qcn1rDw9yc 维护者速读
席位意见:缓存只在 席位核对ACCEPT · seat
|
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.
Requested by Tesla · project thread
Part of #23181 (slice 20,
@objectstack/plugin-audit). The card is a series and stays open.Clause-②: no
Metadata-protocol: none
Test-only diff:
skip-changeset. Two files underpackages/plugins/plugin-audit/src/, both*.integration.test.ts;@objectstack/plugin-audit'sfiles[]shipsdist,README.mdandCHANGELOG.mdonly.维护者速读
comment-parent-pair把 2,600 条评论改为每个文档 10 条(260 个文档,而非 2,600 个),评论总数不变;parent-record-read-leaf的各用例复用同一份系统读出的静止数据(行数变了就重读);两个文件都在模块顶层先付首次内核启动,并在第 2 行加// test-budget:声明。只动测试文件。comment-parent-pair.integration.test.ts的COMMENTS_PER_DOC注释(为什么窗口按评论行计、不按文档计);parent-record-read-leaf.integration.test.ts的atRestOf(复用的依据与行数守卫)。pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2 src/comment-parent-pair.integration.test.ts,预期 20 个用例全绿,tests耗时约为 main 上的 40%。What changes
The newest per-file reading is still the weekly shard-timings refresh of 2026-10-26 (run 40275747937, refresh PR #25960's window, hourly runs 40200279306 to 40272142430); the next scheduled refresh is 2026-11-02. Of the
domain:serverfiles over 10 s there that PR #28081's acceptance notes list for a later slice, the two slowest are in one package:src/parent-record-read-leaf.integration.test.ts35.78 s andsrc/comment-parent-pair.integration.test.ts28.07 s, both in run 40204927516.Profile (local, before): each file spends about 6 s of its clock seeding 2,600
e5_doc/e7_docrecords. The records themselves cost about 0.15 s; the rest is the real CRUD mirror, which writes onesys_audit_logrow and onesys_activityrow per record (2,600 + 2,600 single-row creates, about 2.2 ms per record). The engine runs plugin hooks unconditionally (no opt-out reaches the audit writers, by design), so the mirror's cost cannot be skipped, only not paid where nothing reads it.comment-parent-pair: comments ten to a doc. The window this file proves the leaf lifts was over comment rows: the thread probe's candidate pre-scan readssys_comment(READ_SCAN_LIMITincomment-access-hooks.ts), never parent records. So the 2,600 comments now sit on 260 docs (230 of member A's, 30 of member B's), and only 260 records pay the mirror rows, which nothing in this file reads. Every comment count is unchanged: member A may read 2,303, the administrator 2,605, as the file's ownE7-COMMENT-READINGline prints on both sides. The three withheld docs (a0toa2) still exist, and the delegated case's withheld set is computed from the fixture, not assumed.parent-record-read-leaf: at-rest reads reused. Its cases made 68 system reads of a whole object (ground truth reads five per call, across 12 calls, plus 8 direct), most over tables of 2,600 to 7,000 rows, and the E5 describe writes nothing after itsbeforeAll. They now go throughatRestOf, which reads each object once and reuses it; every reuse counts the object first and re-reads on a moved count, so a later case that adds or removes rows is never judged against an older ground truth. Its 2,600 records stay as they are: there the mirror's activity and ledger rows ARE the subject, written "as their producers write them" (the file's header), so this fixture is not shrunk.Module-scope first boots (both files). One module-scope line boots and shuts down a kernel with no fixture object before any hook runs (AGENTS.md: clocked windows measure behaviour, never loading).
Budget headers (ruling record 6181973363, letter B). CI read these files at about 3.3 (comments) and 3.0 (leaf) times their local clock before, so both stay over 10 s on CI by that ratio, and each seeds a real-mirror fixture past the window on a real SQL driver: one line at line 2, N = the slowest CI reading x 1.25, rounded up to the next 10 s.
src/comment-parent-pair.integration.test.tssrc/parent-record-read-leaf.integration.test.tsTests
Per file, vitest's own clock (
testsin the Duration line, what the refresh lane reads) and process wall, 3 isolated runs each,--maxWorkers=2, on a shared 4 vCPU container; before =3ba52069, after =f267df4f(b905c57badds only the two header lines).In
parent-record-read-leafthe cases' own sum fell from 6.3 s to 3.0 s; what is left is the seeding above. The wall is mostly the package's import graph (transform about 13 s, import about 17 s per isolated run), which collection pays and no clock in the refresh lane reads.Whole package on
b905c57b:Test Files 68 passed (68),Tests 1097 passed (1097). Name census over the two files' JSON reports, before (3ba52069) and after: 38 test names on both sides, 0 lost, 0 new, 0 with a changed status. After mergingorigin/main(acf8e821, no change underplugin-audit) the two files re-ran green:Test Files 2 passed (2),Tests 38 passed (38).Header parse
Both lines parse through
readTestBudget(scripts/measure-test-shard-timings.mjs): budgets 40 and 50 at line 2, classspawns the real producer once per single-cause fixture.No ablation: no tested behaviour changed.
Acceptance notes
comment-parent-pairmay still read just over 10 s on CI after this (local 3.7 s against the 3.3 ratio above), which is why it carries a header; the next refresh is the reading that says.parent-record-read-leaf's floor is its mirror-written fixture (about 6 s locally). Shrinking it toward the 2,000-row window was not done: an earlier fix to this file (one case per reader) recorded "never a smaller fixture" as its rule.@objectstack/metadata(src/serializers/typescript-serializer-annotation.test.ts23.74 s),@objectstack/plugin-pinyin-search(src/boot-reconcile.integration.test.ts17.47 s),@objectstack/plugin-securityand@objectstack/plugin-auth(two files each, 13.38 to 16.02 s).claude/project-thread-6vedk4is the card thread's platform-assigned branch; claim 6541983967 names it.Verification
Local, on
acf8e821:node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 52 families; each run with its exit captured by redirect before any pipe. 50 exit 0;pnpm check:dual-build-cjs-loadsandpnpm check:i18nexit 3 (PREREQUISITE NOT MET: packages outside plugin-audit's closure have nodist, and the CLI is not built), NOT MEASURED here and CI's.--ran:52 derived famil(ies) accounted for — 50 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3), exit 0. Scoped lint, the rootlintscript's own command overpackages/plugins/plugin-audit: exit 0.pnpm --filter @objectstack/plugin-audit typecheck: VERDICT command-exit 0 (check:test-typecheck: OK, 0 errors held).Generated by Claude Code