Uh oh!
There was an error while loading. Please reload this page.
perf(test): keep one deterministic WAL race in the default suite - #2459
Merged
Conversation
`allows concurrent operational owners to initialize the same fresh WAL database` ran its two-process race twelve times, each round spawning a pair of workers and creating and removing a temp directory. That is 1686ms of a 3.22s file for an assertion one round already makes: two owners racing to initialize the same fresh database both succeed, and the result is a WAL database at the current schema version. Repetition does not strengthen that claim. It re-rolls the scheduler hoping to catch a rarer interleaving, which is stress coverage — valuable, but not something every ordinary run should pay for. The extra rounds move behind `MAKA_STORAGE_STRESS=1`, the same gate the other multi-process storage probes already use, so there is one stress route rather than a flag per file. Timing on this machine, `node --test dist/__tests__/sqlite-recovery-concurrency.test.js`: default 1686ms -> 139ms for the test, 3.22s -> 1.67s for the file stress=1 unchanged at 1665ms / 3.18s, still twelve rounds Refs #2388.
jackwener
commented
Aug 7, 2026
MemberAuthor
Review by maka-审美专家 — 通过:WAL 竞态重摇 12 轮按 stress/contract 覆盖之分收进既有 MAKA_STORAGE_STRESS 闸门(一条 stress 路线而非每文件一面旗),常规运行 1686ms→139ms,stress 路线原样保留。GitHub #2388 另一半(容量上限重复写入)经核实为契约强制(64KiB 单请求 vs 1MiB 累计=至少 16 轮),拒绝以生产代码测试后门迎合 issue 的错误前提——判断正确并已留证。CI 全绿。合入。 |
Uh oh!
There was an error while loading. Please reload this page.
3 tasks
Astro-Han pushed a commit
that referenced
this pull request
Aug 9, 2026
…nges (#2474) * ci(test): auto-enable storage stress rounds for WAL recovery race changes Refs #2388. #2459 gated the 12-round fresh-WAL race amplification behind MAKA_STORAGE_STRESS, but sqlite-recovery-concurrency.test.ts was not in STORAGE_STRESS_FILES, so CI never re-enabled the amplified rounds even when the recovery race surface itself changed. Add the test, its spawned worker fixture, and sqlite-runtime-store.ts (the store the race exercises) to the stress set, matching how the other multi-process storage probes are wired. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ac5rv6WUKWtMZgQb5QPN16 * ci(test): cover the WAL race's production owners and pin the stress routing Review follow-up: the amplified race path runs through acquireOperationalStateDatabase(), so operational-state-store.ts and sqlite-runtime-schema.ts own the fresh-WAL initialization, locking, and migration it exercises. Add both to STORAGE_STRESS_FILES, and extend the planner test's stress table with all five WAL-race paths so the routing contract stays executable. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ac5rv6WUKWtMZgQb5QPN16 * ci(test): trigger storage stress on every migration the WAL race executes Review follow-up: acquireOperationalStateDatabase() runs the migrations owned by the six sqlite-*-schema modules inside the amplified fresh-WAL race, so all six join STORAGE_STRESS_FILES and the planner's stress table. sqlite-runtime-store.ts leaves the set - the amplified operational_open_only branch never constructs it - and a negative planner case pins that boundary. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ac5rv6WUKWtMZgQb5QPN16 --------- Co-authored-by: Claude <noreply@anthropic.com>
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 freeto 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.
Refs #2388(第三条:Twelve repeated fresh-WAL race rounds in the default suite)。按 issue 要求,stress 策略单独成 PR,fixture 缩减不在本 PR。
改了什么
allows concurrent operational owners to initialize the same fresh WAL database原本把两进程竞争跑 12 轮,每轮起一对 worker + 建删临时目录。一轮就已经把契约断言完了:两个 owner 竞争初始化同一个全新库,都成功,且结果是当前 schema 版本的 WAL 库。重复不会让这个断言更强——它是在重摇调度器、指望撞上更罕见的交错,那是压力覆盖,有价值,但不该由每一次普通运行来买单。
多出来的 11 轮移到
MAKA_STORAGE_STRESS=1后面——这是仓库里既有的 stress 闸门(root-authority.test.ts、git-workspace-service.test.ts已在用),所以是一条统一的 stress 路线,不是每个文件一个新开关。耗时(本机,
node --test dist/__tests__/sqlite-recovery-concurrency.test.js)MAKA_STORAGE_STRESS=1两条路线都实跑验证过:默认 12 passed / 0 failed,stress 路线同样 12 passed / 0 failed。
顺带一条调查结论(不在本 PR 改,供 issue 参考)
issue 第一条 Repeated writes to reach a capacity limit 我核过了——指的应该是
rejects an expansion atomically before the complete boundary exceeds capacity(全套最慢的单个用例,4201ms)。它的放大是契约强制的,不是多余的:MAX_SANDBOX_BOUNDARY_FILESYSTEM_ENTRIES = 32MAX_SANDBOX_BOUNDARY_PATH_CHARS = 4096MAX_SANDBOX_BOUNDARY_SERIALIZED_BYTES = 64 KiBMAX_EXECUTION_BOUNDARY_SERIALIZED_BYTES = 1 MiB1 MiB ÷ 64 KiB = 至少 16 轮才能触到共享上限,而现有 fixture(32 条 × 1800 字符 ≈ 60 KiB/请求)已经贴着单请求上限了。我试过「两个大请求」的写法,分别被 32 条上限和 64 KiB 上限挡回来。要真正缩短它,只能给 store 加一个测试专用的可注入上限——那是往生产代码里开测试后门,我认为不值得,除非你们判断相反。
验证
top-level package import does not initialize node:sqlite(Node v25 的node:sqliteExperimentalWarning,与本改动无关)。