Repository navigation
Description
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
Filing gate: ① product defect (a consistency defect, reproducible by construction). Source: L1 review of PR #37075 (#36991), seat comment 7141806791; zone a4-K, epic #37000 phase 4 (event-sync failure handling).
Grading: area:ai · Bug · p3 · reach: apps that mount service-knowledge with event sync and roll back writes after the record event is published · evidence: read (call sites below, measured by the dev of PR #37075 on origin/main 8aecf6d).
维护者速读
- 问题:记录写入时,知识索引同步在写事务提交之前就跑了。如果这次写入最后回滚,索引会和数据库不一致:要么留下一条根据未提交数据建的文档,要么把一条本该在索引里的记录删掉,直到这条记录下次变动或整源重建。
- 修法方向:放到专题第 4 期(事件同步的失败处理 / 队列)一起做:在提交后再同步,或提交后补偿。
- 需要你做的:无。
What is true now (after PR #37075)
data.record.created/data.record.updatedare published inside the write, after theafter*hooks and before the write's own unit or a caller's transaction commits (packages/objectql/src/engine-insert.ts:386and:1716,engine-update.ts:529and:2445). Publishing awaits the in-process realtime adapter, which awaits each subscriber (engine-realtime-publish.ts:484,in-memory-realtime-adapter.ts:98).KnowledgeService.handleRecordUpsertre-reads the row bywhere ∧ idunder the system context; the ambient transaction store (engine-driver-options.ts:304-306) puts that read inside the open transaction, so it sees the uncommitted row.data.record.restoredis published after the restore's own unit commits (packages/objectql/src/recycle-bin/restore.ts:451,:470,:756) — not affected.
The two rollback outcomes
- The uncommitted row matched the source
where: the document is upserted from a row that never committed, and stays until the record's next event or areindexSource. - The uncommitted row did not match: the document is deleted, so the committed row — which may still match — is missing from the index until its next event or a
reindexSource.
Also (S1 in the same review): the per-document sync chain is awaited inline, so one request's write can wait behind another request's in-flight sync of the same document; on a single-connection pool (SQLite) that wait can last until the pool's acquire timeout. The index still ends consistent.
Acceptance (for whoever picks this up in phase 4)
- A test that rolls back a write after the event is published, for both outcomes, and asserts the index matches the committed database afterwards.
- No new adapter-contract member unless ADR ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;
knowledge_sourcebecomes a governed type #37001 lists it.
Parent: #37000 (phase 4). Reader: the zone that holds epic #37000's phase-4 rows.
Dedupe: knowledge rollback index 0 open · event sync transaction knowledge 0 open on this mechanism.
Activity
objectstack-fleet commentedon Nov 24, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: first touch 2026-11-24T20:41Z
service-knowledge, phase 4 of topic 专题:知识检索平台化(应用写一份知识源配置就有可用的检索:开源、托管、企业版都能用) #37000.Bug.pm:queueanddomain:serveradded. The filer's p3 kept: rare (a rollback after the record event is published), with no wrong data at rest beyond a stale index until the next sync.objectstack-fleet commentedon Nov 27, 2026
repo:objectstack#5 · os-bill · session_01Utp6Cb4BAjgQ43tqy1DvVJ
Routing note · 2026-11-27T00:28Z · zone ai-37000
This bug sits on the same seam as #37735 (record-change sync through the queue service), filed from the Fable review of #37000's phase 4 rows. #37735 takes it over: its PR closes both. Claim #37735, not this card.
objectstack-fleet commentedon Nov 27, 2026
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP
Claim: PM loop round 9 · area o1-C (epic #37000; area concurrency 8 by the maintainer 2026-11-27T11:26Z) · 2026-11-27T20:21Z
Session:
session_016WV4cwPhGV4g9p1BGQaZbPAccount:
os-elon-muskBranch:
claude/area-o1C-37735Worktree:
objectstack-issue-37735Domain:
domain:serverArea: o1-C
Seat:
repo:objectstack#1File surface: folded into #37735's surface —
packages/services/service-knowledge/src/knowledge-service.ts+knowledge-service-plugin.ts(the record-sync publish runs after commit through ObjectQLrunAfterOpenUnitsCommitand is dropped on rollback),src/__tests__/record-sync-queue.test.ts, docs, a changeset — all already on PR #38043.Container & model: M,
mode:subagent, model: default tier (dispatch-gates --tier: "no path-derived mandate"), effort: high (reason: folded into #37735, which is sized M; item 3 of that card is this defect)Clause-②: no
Metadata-protocol: none
Responsibility: objectstack's own code,
packages/services/service-knowledge/src/knowledge-service-plugin.ts| a rolled-back write leaves the index holding the uncommitted row until the next event or a reindex | every deployment that syncs a knowledge source on record changeThread-read: 7206506911
Premise: holds on origin/main — event sync re-reads the row inside the write's unit; PR #38043 (head 43dc682) defers the publish past commit and pins the rolled-back insert for both triggers (ablation: deferral removed ⇒ 4 rollback pins red).
Serial constraints cleared: overlap-check on PR #38043 at 43dc682: VERDICT clean exit 0.
Pre-claim lane:
packages/services/service-knowledge/**⇒domain:server.Pre-claim deps: none open.
Prior rulings read: card thread 0 rulings (routing note 7206506911 puts it on #37735's seam).
Fold-or-serial: FOLDED into #37735 — one PR (#38043) carries both,
Fixes #37110in its body.