Repository navigation
fix(service-knowledge): a package duplicate the knowledge service itself refuses is told the source cannot be copied, and to duplicate the package again - #38341
Conversation
…orm knowledge service's verdict Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
…vice's own verdict for its caller Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
…s the service with its door Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 34 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin daba81a88d957df2230984cc6911b5f22f028a24 && git checkout daba81a88d957df2230984cc6911b5f22f028a24
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ad3d04f020303056224651c052109c61c18db13d 221e401b1127827ce46f6e07ef4901627127adc8 && git checkout -B drift-repro ad3d04f020303056224651c052109c61c18db13d && git merge --no-ff 221e401b1127827ce46f6e07ef4901627127adc8
node scripts/docs-audit/affected-docs.mjs --json ad3d04f020303056224651c052109c61c18db13d
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: The review is owed by the declaration alone ( ① Derived judgments
② Semver level
③ Boundary flags
N1: the new No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head Review summary
Next: Tier S. The area marks it ready and lands it once every check is green at this head. |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Landing · area o1-C · head
State: ready + auto-merge; #38210 closes on merge via |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46157343305 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…'s duplicate-door sentence Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: A delta on the declaration face, ① Derived judgments
② Semver levelThis delta adds no published surface. The changeset is unchanged: ③ Boundary flags
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT (delta) at head
Next: Tier S. The area re-queues it once every check is green at this head. #38353 was ejected only behind this PR, and needs only a re-queue. |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Landing (re-queue) · area o1-C · head
The queue ejection (build 46157343305) was a semantic conflict with #38224's duplicate-door case, fixed at this head. On this head |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46164293751 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Landing (re-queue) · area o1-C · head The second ejection (queue build 46164293751, |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Landing (re-queue) · area o1-C · head The third removal was |
…ate cases (objectstack-ai#38378) Part of objectstack-ai#37736 Closes objectstack-ai#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: - PR CI on objectstack-ai#38341: job 141025552341 (`Error: Test timed out in 5000ms.`; green on its one re-run); - merge-queue run 46164293751, job 141039144745 (Test Core 6/12), which ejected objectstack-ai#38341 from the queue. objectstack-ai#38341 does not touch this file. 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). <details><summary>File alone, 5 runs (--maxWorkers=2)</summary> ``` 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 ``` </details> <details><summary>Inside the full service-knowledge suite, 3 runs (--maxWorkers=2; 700/700 each)</summary> ``` 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 ``` </details> <details><summary>Doubled load: two full suites at once, --maxWorkers=4 each, on 4 vCPU (load average 6.90), 2 rounds; 700/700 each</summary> ``` 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 ``` </details> <details><summary>First-case warm-up control: the cluster-lock case run alone (so it runs first), 3 runs</summary> ``` 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. </details> <details><summary>Package test and typecheck after the edit (77e6bad)</summary> ``` (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 ``` </details> 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](https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP)_ Co-authored-by: Claude <noreply@anthropic.com>
Fixes #38210
Clause-②: yes (widening) —
@objectstack/service-knowledge'sKnowledgeService.admitAuthoredSourcetakes an optional third inputoptions: { door?: 'save' | 'duplicate' };@objectstack/metadata-core's exported interfaceKnowledgeSourceSaveAdmitter.admitAuthoredSourcedeclares the same optionaloptionsinputMetadata-protocol: none
维护者速读
What changes
@objectstack/service-knowledge.admitAuthoredSource(item, ctx, options?)readsoptions.door. One table,AUTHORED_SOURCE_DOOR_WORDING, holds what each door's caller is told. Itssaverow is today's text, and any value other than'duplicate'reads assave. Withdoor: 'duplicate':whereandcontent/metadataFields) tell the caller to remove the field and duplicate the package again, or to have someone who may query it duplicate the package. The display-field arm says "Have someone who may query it duplicate the package.";@objectstack/metadata-core.authoredKnowledgeSourceRefusalpasses{ door }to the service'sadmitAuthoredSourceonly for a door other thansave. The/metasave and the MCP draft save still ask with(item, context)alone, so their sentences and the arguments they send are unchanged. The duplicate door's prefix (Duplicating package "ID" is refused, and nothing was copied.) is the only place that says nothing was copied.@objectstack/runtime, test-only. A new devDependency on@objectstack/service-knowledge(no cycle: service-knowledge depends on neither runtime nor anything that depends on it), plus a source alias invitest.config.tsbeside the other dev-only service aliases. The duplicate door inpackages/runtime/src/domains/packages.tsalready passeddoor: 'duplicate'and is not edited.Read first (by risk):
packages/services/service-knowledge/src/knowledge-service.ts,AUTHORED_SOURCE_DOOR_WORDING: thesaverow must reproduce today's bytes in every arm.packages/metadata-core/src/knowledge-source-save-admission.ts: the conditional third argument (a save sends two arguments, as before).packages/runtime/src/domains/packages-knowledge-source-gate.test.ts, the new top-level describe at the end: the real-kernel pins and the byte-exact save controls.Tests
All runs are at head
677ed7a5ca4(after mergingorigin/main) unless marked otherwise.runtime, real kernel (packages-knowledge-source-gate.test.ts, new top-level describe). AnObjectKernelrunsKnowledgeServicePluginover host doubles for the engine, the security service and the metadata protocol. Four arms reach the service's own verdict: the 503 transient (the schema read throws), the 403contentfield, the 403wherefield and the 403 display field.Duplicating package "pkg-a" is refused, and nothing was copied. The knowledge source "faq" cannot be copied:. It has nosave the source,save it again,Nothing was written,was not savedorthe save.nothing was copiedoccurs exactly once. It tells the caller to duplicate the package again (display field: someone who may query it duplicates the package).duplicatePackageis never called.PUT /meta/knowledge_source/faqis pinned to the full literal message, status and code. Nothing is saved.(item, ctx, { door: 'duplicate' }).service-knowledge(knowledge-source-admission.test.ts):door: 'duplicate'across eight arms (content, where, display field, gate throws, security answers neither, no identity, unmounted adapter, disabled package). Each keeps the save's status, code, object and field, has no save wording, and carries its remedy. Asked withdoor: 'save', each arm equals the no-door verdict.metadata-core(knowledge-source-save-admission.test.ts): the duplicate door hands{ door: 'duplicate' }to the service. A save, withdooromitted or'save', calls it with exactly[item, context].5f857ffe4be.knowledge-service.tswas restored to the basef19350b410blob (hash22f53d295bequals the base blob) and the runtime file was re-run. All 4 duplicate pins went red and the 4 save-door controls stayed green (Tests 4 failed | 79 passed (83)). So the save door's bytes equal the base's, and the pins depend on the door wording. Restored withgit restore --source=HEAD --staged --worktree: blob6e9f33f7c5equals HEAD, andgit status --porcelainwas empty. The suite is green again on the final head (below).Package runs at 677ed7a
pnpm --filter '@objectstack/runtime^...' build --concurrency=2: exit 0.pnpm --filter @objectstack/runtime exec vitest run --project local --maxWorkers=2overpackages-knowledge-source-gate,meta-save-capability-gate,mcp-authoring,meta-type-write-capability-parity:Test Files 4 passed (4),Tests 210 passed (210).pnpm --filter @objectstack/service-knowledge test:Test Files 19 passed (19),Tests 683 passed (683).pnpm --filter @objectstack/metadata-core test:Test Files 29 passed (29),Tests 1118 passed (1118).pnpm --filter @objectstack/service-knowledge typecheck: exit 0, test layer 0 errors.pnpm --filter @objectstack/runtime typecheck: exit 0,27 file(s) / 183 error(s) / 66 pinned signature(s) held(unchanged ledger).pnpm --filter @objectstack/metadata-core typecheck: exit 0 (at5f857ffe4be;origin/maindid not touch the package).Derived gates at 677ed7a
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 86 commands. All were run, each exit captured before any pipe.--ranprinted:86 derived famil(ies) accounted for — 84 run, 2 NOT-MEASURED.check:test-source-alias,check:cross-package-test-inputs,check:undeclared-dep-imports,check:published-files,check:dts-closure,check:workspace-manifest-cycles,check:query-options-erasure,check:nul-bytesandcheck:empty-changeset.check:dual-build-cjs-loads, reason:PREREQUISITE NOT MET, because the gate reads every package'sdist/and this worktree built only the runtime closure.check:type-check-debt, reason: its closure build waits on the shared verify lock, and the local timeout fired first.Lint & Repo Gates.Acceptance notes
runtimesuite. Only the four files that assert this gate's calls ran. CI'sTest Coreruns the rest.Verification
Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run --project local --maxWorkers=2 src/domains/packages-knowledge-source-gate.test.ts. Expected:Tests 83 passed (83), including eight cases under/packages duplicate and /meta save on a real kernel running KnowledgeServicePlugin.Generated by Claude Code