Skip to content

test(service-knowledge): measured timeouts for the multi-node sync-state cases - #38378

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/area-o1C-37736-timeout
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/area-o1C-37736-timeout

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Part of #37736
Closes #38376

Clause-②: no
Metadata-protocol: none

维护者速读

用户无感:只改知识库同步状态的一个测试文件里四个多节点用例的超时上限,产品代码一行未动。
为什么做:这个用例在合并队列高负载下超过默认 5 秒被判超时,把一个无关的 PR 踢出了队列(属于知识库同步状态的工作)。
出错会怎样:最坏只是超时上限偏宽、真卡住的用例要多等十几秒才报红;可直接撤回本 PR。
要你做什么:无。

What changes

packages/services/service-knowledge/src/__tests__/sync-state.test.ts only. The case "a rebuild through node A reads identically on node B while it runs and after it ends — an index already current included — and after both restart" boots four kernels over one SQLite file, seeds three records (each a queued record sync it waits on), runs two rebuilds (each followed by a vi.waitFor of 5000 ms) and restarts both nodes, all inside vitest's default 5000 ms testTimeout. Under the merge queue's full-suite load it timed out twice:

Each multi-node case in the file now carries an explicit per-case timeout, with a one-line reason comment naming its shape and its measured worst:

case shape worst measured (doubled suite load) budget = worst x 20, rounded up to a whole second
rebuild through node A reads identically on node B ... after both restart 4 kernel boots, 3 seeded syncs, 2 rebuilds, 2 restarts 1279 ms 26_000
a build whose node stopped mid-walk reads running ... then interrupted 2 kernel boots, 3 seeded syncs, 1 rebuild, 1 restart 771 ms 16_000
over a cluster lock: a boot leaves a build whose lease another node holds ... 3 kernel boots, 3 seeded syncs, 1 rebuild 808 ms 17_000
the next lease holder closes the build a stopped node left running ... 2 kernel boots, 3 seeded syncs, 3 rebuild calls 455 ms 10_000

Headroom factor x20: the queue shard ran the first case past 5000 ms, at least 3.9x its worst local reading under doubled load (1279 ms), so the factor is that observed floor rounded to 4 and multiplied by a further 5x margin. Nothing is skipped, no assertion changes, and no vi.waitFor changes. The single-node cases are not in this shape and are unchanged.

No changeset: the package publishes dist, README.md and CHANGELOG.md only; the test file is not an entry point (built dist/ holds zero hits for the new comment text, while the positive control sys_knowledge_sync_state hits dist/index.js and dist/index.cjs), so this PR carries skip-changeset. An empty-frontmatter changeset is refused by check-empty-changeset.

Tests

All measured at 77e6bad77df (base bc31d453ea9) on a 4-vCPU container, under os-verify-lock.sh, from vitest's JSON reporter (per-case duration, ms; cases in file order).

File alone, 5 runs (--maxWorkers=2)
run 1 file 2682 ms  995 231 284 201 93 120 95 165 302 110 84 1
run 2 file 2337 ms  742 181 267 198 96 121 92 158 288 109 82 1
run 3 file 2239 ms  672 177 259 193 95 119 90 156 290 105 80 1
run 4 file 2606 ms  813 190 341 231 114 124 96 163 306 130 96 1
run 5 file 2306 ms  657 183 260 199 95 116 93 188 291 114 109 1
Inside the full service-knowledge suite, 3 runs (--maxWorkers=2; 700/700 each)
suite 1  sync-state file 1806 ms  585 133 206 152 73 100 78 125 197 96 59 0
suite 2  sync-state file 2404 ms  776 164 250 235 96 122 94 152 296 125 93 1
suite 3  sync-state file 2455 ms  766 260 308 212 88 103 92 157 283 98 85 1
Doubled load: two full suites at once, --maxWorkers=4 each, on 4 vCPU (load average 6.90), 2 rounds; 700/700 each
A1 file 4087 ms  1023 330 808 403 185 190 130 194 455 180 188 0
A2 file 4380 ms  1279 365 526 386 196 137 158 282 614 233 200 1
B1 file 4285 ms  1023 771 679 303 166 229 247 255 336 155 120 0
B2 file 4121 ms  1172 371 431 371 204 176 196 223 583 224 171 1
First-case warm-up control: the cluster-lock case run alone (so it runs first), 3 runs
532 / 496 / 519 ms   (vs 177-341 ms when it runs third)

About 250 ms of the first case's cost is the file's first-case warm-up, not its own work; check:test-source-alias (which reads clocked-window dynamic loads in an edited test's reach) is green on this tree, so the warm-up is not a module load the gate's rule would move to module top.

Package test and typecheck after the edit (77e6bad)
(in packages/services/service-knowledge) pnpm test && pnpm typecheck && pnpm build
pnpm test       Test Files 20 passed (20) · Tests 700 passed (700)
pnpm typecheck  tsc --noEmit, then check-test-typecheck over tsconfig.test.json
pnpm build      check-dts-emitted: @objectstack/service-knowledge - 3/3 declared declaration file(s) present.
os-verify-lock: VERDICT command-exit 0 · held the lock 40s

No ablation: the diff changes only per-case timeouts, not a behaviour any test pins.

Acceptance notes

  • The single-node cases are outside this card's shape and keep the default 5000 ms. The reconcile case (single node, three syncs and a held reconcile) read up to 614 ms under doubled load, about 8x under its budget; not changed here.
  • The derived gate pnpm check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET) inside the sequential gate run, and its output was overwritten before it was read; a standalone rerun exited 0 (126 require entry points across 74 packages load). The --ran record keeps both readings and counts it NOT MEASURED; CI's run is the verdict.

Verification

Files to read first: packages/services/service-knowledge/src/__tests__/sync-state.test.ts, the four }, N_000); closings and the comment line above each it.

Two minutes: pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/sync-state.test.ts prints Tests 12 passed (12).

Local gates: node scripts/pm/dispatch-gates.mjs --commands derived 53 families for this diff at 77e6bad77df; 52 exited 0, check:dual-build-cjs-loads as above. --ran reconciliation: 53 derived, 52 run, 1 NOT-MEASURED. Repo-wide scans and the rest of the farm are CI's.


Generated by Claude Code

…d timeouts

The rebuild-through-node-A case boots four kernels over one file, seeds
three records, runs two rebuilds and restarts both nodes inside vitest's
default 5000 ms; under the merge queue's full-suite load it timed out.
Each multi-node case in the file now carries an explicit budget of 20x
its worst locally measured duration under doubled suite load. No case
is skipped and no assertion or waitFor changes.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing 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): node scripts/docs-audit/affected-docs.mjs --json b29b77a3ab245b6cff094148a868ee0e18d71e13 → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3

L1 verdict (L1-a): ACCEPT at head 77e6bad77df46746ee1fc0f3a01f43d8e2eaf5f0 (Part of #37736), on the code, with one landing condition.

Review summary

  • Shape. One test file, packages/services/service-knowledge/src/__tests__/sync-state.test.ts, +8/-4. Not governed, skip-changeset (the file is not published). No contract face is touched, so no contract record is owed.
  • The change. The four multi-node cases each get an explicit timeout and a one-line reason naming their work (kernel boots over one file, seeded syncs, rebuilds) and their worst measured duration under doubled suite load:
    • line 320 (four boots, two rebuilds): 26 s;
    • stopped mid-walk: 16 s;
    • cluster lock: 17 s;
    • next lease holder: 10 s.
  • Why I accept it.
    • Each budget is 20 times the case's worst local reading.
    • The queue ran line 320 past the 5 s default, at least 3.9 times its worst local reading, and a 26 s budget clears that with room.
    • Nothing is skipped, no assertion or waitFor changes, and the single-node cases keep the default.
    • This is a budget for real work (several kernel boots per case), not a mask on a hang, because a hang still fails at the new budget.
  • Gates. The area's dual-build-cjs-loads reading (exit 3 in the derived run, exit 0 standalone) is unrelated to a test-only diff, and CI decides it. When checked: 11 success, 21 skipped, 24 in progress, and 1 failed.

Landing condition: the failed check. PR-body guards fails check:closing-target-claim: the PR closes #38376, but no Claim: on that card names claude/area-o1C-37736-timeout. Either record the claim on #38376 naming this branch, or change Closes #38376 to a reference that does not close it. Then re-run the job. Neither route moves the head, so this verdict stands.

Next: Tier S. The area lands it once every check is green at this head, then re-queues #38341.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP

Landing · area o1-C · head 77e6bad77d · 2026-11-28T17:36Z · ACCEPT → PR #38378 comment 7242870771 (L1-a); seat 1's go 2026-11-28T16:36Z

Probe Reading
check-runs at 77e6bad77d (latest) 39 success · 21 expected skip · 0 failed · 0 pending
check-governed-merges.mjs --pr 38378 NOT governed · +8 / −4
landing-k.mjs --pr 38378 K = 2 < 15

The verdict's landing condition is met: the claim on #38376 (comment 7242879995) names this branch, and PR-body guards is green on its re-run. State: ready + auto-merge; #38376 closes on merge, and #37736 stays as delivered (Part of). Once this merges, #38341 re-queues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Queue-flake anchor: src/__tests__/sync-state.test.ts

2 participants