Repository navigation
fix(service-knowledge): a record write before the boot reads a runtime-composed knowledge service calls no store - #39414
Conversation
…e-composed knowledge service calls no store A runtime-composed knowledge service is read as enabled or held once, at kernel:bootstrapped. A record write before that reading (a seed, a package's sample data) was synced at once, so a deployment with no embedder called the store and logged a failed-batch warning. Record syncs that arrive while the reading is pending now wait for it: the queue worker paths await it, and the inline paths are deferred past it without holding the write up. Held, each completes with no store call; enabled, each runs as before. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CYvu4t9zSjsTHiUubP
📓 Docs Drift CheckThis PR changes 1 package(s): 2 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 — 5 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 d9627c67ad3b0209e089bedc5b10de66a9ccaad8 && git checkout d9627c67ad3b0209e089bedc5b10de66a9ccaad8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f b172943ca71afb2233ebbe9cd79e14303379ee5d && git checkout -B drift-repro f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f && git merge --no-ff b172943ca71afb2233ebbe9cd79e14303379ee5d
node scripts/docs-audit/affected-docs.mjs --json f32b7d6d8ff7ab5bf4e8f81903fc9a391bdff59f
|
…nt reading when the service stops A boot that fails before the reading left the record-sync worker waiting, so destroy() hung on the queue unsubscribe. stopBuilds() now completes every waiting sync without one, and a sync that arrives after the stop does not wait. The contract docblocks now say syncs wait for the reading. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CYvu4t9zSjsTHiUubP
|
card thread #38479 · os-bill · session_01Utp6CYvu4t9zSjsTHiUubP Contract reviewServed-tier: Round 1 on this head. The diff is one commit, ① Derived judgmentsThe fix. A runtime-composed service starts with Every record sync path, checked for a store call before the reading:
Not found: no record sync path reaches a store before the reading on a runtime-composed held service. Out of the card's scope, for the record only: Ordering on an enabled deployment. Duplicate syncs. The database queue renews each claimed row's lease while the handler is inside it ( Public surface of ② Semver level
The changeset text matches the code: every path (inline, per-message, batch) waits; held completes with no store; enabled runs as before; host-mounted is unchanged. ③ Boundary flags
Tests against the card
Findings
No must-fix. S1 is open. Implemented-by: VERDICT: PASS |
|
card thread #38479 · os-bill · session_01Utp6CYvu4t9zSjsTHiUubP Contract reviewServed-tier: Delta review. Round 1 is the record on ① Derived judgments
② Semver level
③ Boundary flags
Round 1 findings
New
No must-fix. No should-fix open. Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd 席位核对ACCEPT and landing · 2026-12-03T23:01Z · head
|
Requested by Bill · project thread
Fixes #38479
What changes
@objectstack/service-knowledge: a record sync that arrives before the boot reads a runtime-composed knowledge service as enabled or held (ADR-0161 K8, the dated note on item 12) now waits for that reading and calls no store meanwhile.KnowledgeServicefield,enablementWaiters, holds the waiting syncs.settleEnablementwakes them (knowledge-service-sources.ts).processRecordSync,processRecordSyncBatch) await the reading before they resolve a message.handleRecordUpsert,handleRecordDelete) are deferred past the reading and return at once. A write the boot itself awaits, such as a seed, would otherwise wait for a reading that comes after it. A deferred sync that fails is onewarnline.not-syncedon the queue paths), and enabled runs it as before. A host-mounted service (enabledByConfigurationunset) has no window and is unchanged.knowledge-service-record-sync.ts,knowledge-service-sources.ts). The facade gets one field and one host getter, socheck-facade-delegation-onlystays green.Why
On a held deployment (no embedder), a seed written before
kernel:bootstrappedreached the store. A fresh blank-template or Starter scaffold printedWARN [knowledge] a batch of 4 record syncs of source 'blank-blank_articles' failed (knowledge-turso has no embedder …). That contradicts #38369's "no store is called" for a held service. This blocks #38374 (draft PR #39340), whose templatestarter.test.tsno-embedder case is red on this line alone.Verification
src/__tests__/boot-window-38479.test.ts(4 cases): the held case and the enabled case are red on main and green here. The host-mounted control is green both ways. The fourth case is the card's second pin. On an enabled runtime-composed service, the reap guard is registered at the reading, before a sweep a later plugin runs atkernel:bootstrapped, and that sweep de-indexes before it deletes.@objectstack/service-knowledge: vitest 34 files / 912 tests green onorigin/main301a378 + this diff.pnpm typecheck(incl.check:test-typecheck) green.node scripts/check-facade-delegation-only.mjsgreen (knowledge-service.ts 1696/1758 lines). eslint on the four touched files is clean.starter.test.ts, run from a copy of the template against PR feat(examples): the Starter help articles as a knowledge source, in the blank template too #39340's headca114a34plus this diff: 6/6 green. Control: the same run with this diff's source reverted and the package rebuilt fails only the no-embedder case, on the exact WARN line above.@objectstack/example-startertests 17/17 and the create-objectstack parity test 15/15 are green on the same tree.Clause-②: no
Metadata-protocol: none
Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (eslint on the touched files)main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CYvu4t9zSjsTHiUubP