Skip to content

service-knowledge: a recycle-bin restore re-indexes the row on a kernel with no realtime service #38017

Description

@objectstack-fleet

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

Filing gate: ① follow-up of PR #38016 (#37954, out-of-scope finding of the dev report 7223077469, class a, measured at a public door; one card per PR) · Source: topic #37000
Grading: area:ai · Feature · p2 (suggested: same reach as #37954, which blocks cloud#4993 part 2; a restored record stays unsearchable until a rebuild or the daily reconcile) · reach: every kernel that mounts the knowledge service without a realtime service (hosted cloud kernels) · evidence: measured (container run in PR #38016's Verification: restore answers 200, the row is live, search_knowledge answers 0 hits for its text).
Dedupe: is:issue knowledge restore reindex → 15 (open: #37221, #37110, #37954, #37000; none on restore) · is:issue recycle bin restore knowledge → 13 (open: #37954, #37110, #37391 — erasure decision, another subject, #6015 seat post) · is:issue data.record.restored knowledge → 5 (open: #37954, #37110, #6015).
Reader: area o1-C of seat repo:objectstack#1 claims it after triage's first touch.

维护者速读

  • 问题:没有 realtime 服务的内核(托管云)上,从回收站恢复一条记录后,它不会重新进入知识库索引,要等每日对账或手工重建才能搜到。
  • 做什么:恢复操作也要触发知识库同步,和新建、修改一样。
  • 谁受益:云上所有用知识检索的租户。
  • 需要你做的:无。

What

On a kernel with no realtime service, #37954 (PR #38016) syncs record changes through the data engine's after-write hooks. A recycle-bin restore runs no engine hooks (ADR-0148 D2; packages/objectql/src/recycle-bin/restore.ts, engine.ts:5030) and only publishes data.record.restored, which the knowledge plugin hears only through the realtime subscription (knowledge-service-plugin.ts:668-670). So with no realtime the restored row is not re-indexed.

What: on the realtime-free path, a restore re-indexes the restored rows (master first, as the event order is), through the same handleRecordUpsert and the same post-commit deferral seam #37954 introduced (deferRecordSync), or through #37735's queue bridge if that has landed. The dev measures the hook point (an engine middleware or a restore hook on the restore operation, or an in-process listener for the restore event) and states it. ADR-0148 D2 (a restore is never a create) stays.

Acceptance

  • On a kernel with no realtime service: delete an indexed record, restore it from the recycle bin, and search finds its text without a rebuild.
  • With realtime present, a restore is synced once (no double handling).
  • A restore that rolls back indexes nothing.

Blocked-by: #37954

Activity

  1. added
    priority:p2
    pm:blocked
    area:ai
    on Nov 27, 2026
  2. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:ai · domain:server · Feature · p2 · pm:queue · size S; rationale: on a kernel with no realtime service, a recycle-bin restore does not re-index the row, so the restored record stays unsearchable until a rebuild or the daily reconcile. Same reach as #37954, which blocks cloud#4993 part 2, so the filer's p2 stands. Unlock: its Blocked-by: PR #38016 merged at 2026-11-27T17:10Z, so pm:blocked → pm:queue. Answers seat repo:objectstack#1's Request: triage (7224398103). Recorded 2026-11-27T17:26Z.

  3. added
    domain:server
    pm:queue
    and removed
    pm:blocked
    on Nov 27, 2026
  4. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim: PM loop round 10 · area o1-C (epic #37000; area concurrency 8 by the maintainer 2026-11-27T11:26Z) · 2026-11-27T23:07Z
    Session: session_016WV4cwPhGV4g9p1BGQaZbP
    Account: os-elon-musk
    Branch: claude/area-o1C-38017
    Worktree: objectstack-issue-38017
    Domain: domain:server
    Area: o1-C
    Seat: repo:objectstack#1
    File surface: packages/services/service-knowledge/src/knowledge-service-plugin.ts (the realtime-free record-sync path: a recycle-bin restore re-indexes the restored rows, through #37735's queue bridge now on main, else the post-commit deferral seam), possibly the restore operation's hook point in packages/objectql/src/recycle-bin/restore.ts (the dev measures and states it), service-knowledge tests, docs if they state the realtime-free sync triggers, a changeset.
    Container & model: S, mode:subagent, model: default tier (dispatch-gates --tier: "no path-derived mandate"), effort: high (reason: S; a post-commit and once-only sync across two triggers, measured at a public door)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack's own code, packages/services/service-knowledge/src/knowledge-service-plugin.ts | a recycle-bin restore on a kernel with no realtime service leaves the restored row unsearchable until a rebuild or the daily reconcile | every hosted kernel that mounts the knowledge service without a realtime service
    Thread-read: 7224414519
    Premise: holds, read on origin/main 58be677 — the realtime-free path syncs on the data engine's after-write hooks; a restore runs no engine hooks (ADR-0148 D2) and only publishes data.record.restored, which the plugin hears only through the realtime subscription.
    Serial constraints cleared: probe overlap-check (knowledge-service-plugin.ts, recycle-bin/restore.ts) against origin/main and every open PR: VERDICT clean exit 0. #38039 / #38040 / #37961 (dispatched, no PR yet) may touch the plugin file in other regions; whichever lands second merges main, and both PRs say so.
    Pre-claim lane: packages/services/service-knowledge/** ⇒ domain:server.
    Pre-claim deps: #37954 closed (PR #38016 merged); #37735 closed (PR #38043 merged 58be677, the queue bridge).
    Prior rulings read: card thread — triage 7224414519 (S, Feature p2).
    Fold-or-serial: not folded (#37221 rides a purge-confirm change, not this one).

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 27, 2026
  6. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

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

    {
     "issue": 38017,
     "status": "done",
     "branch": "claude/area-o1C-38017",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/38067",
     "session": "session_016WV4cwPhGV4g9p1BGQaZbP",
     "premise_still_valid": true,
     "summary": "Hook point measured: an engine middleware on the restore operation. Without realtime, publishDataEvent returns at once, so there is no event to listen for, and the engine dispatches no afterRestore (ENGINE_OPERATION_VERBS.restore = false). restoreRecycleBinEntry runs the whole restore through executeWithMiddleware, and its answer lists the rows written back, master first. KnowledgeRecordHooks, which starts only where the realtime subscription is not taken, now registers one global middleware, once per instance. After a restore answers, it syncs each restored row, master first: through enqueueRecordSync when the queue is composed, otherwise through deferRecordSync, serially and after the commit. A refused or failed restore syncs nothing. A restore with a stale roll-up (ERR_SUMMARY_RECOMPUTE) syncs its written rows, matched with isSummaryRecomputeRefusal, so @objectstack/types is now a direct dependency. The realtime path is unchanged, so a restore is synced once. ADR-0148 D2 stands. Docs (knowledge.mdx, realtime-free section) and a patch changeset are included.",
     "tests": "At 0434c0ed8c, under os-verify-lock (VERDICT command-exit 0): closure build turbo --filter='@objectstack/service-knowledge^...' 19/19 tasks, exit 0; package build exit 0; typecheck exit 0 (check:test-typecheck OK, 0 files / 0 errors); `pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2`: Test Files 19 passed (19), Tests 614 passed (614). New pins in record-hooks-sync.test.ts (real ObjectQL, recycle bin registered): restored record searchable again, master first; restore inside a rolled-back transaction indexes nothing; failed restore indexes nothing and keeps the entry; stale roll-up still indexes; no sync after destroy; exactly one upsert with and without realtime (plus a late source). New pin in record-sync-queue.test.ts (real kernel: SqlDriver + QueueServicePlugin + SysRecycleBin), on both triggers: a restore publishes one message and is searchable. Ablations (one lock run, VERDICT command-exit 0; ablation-replace blob proof per leg, tree restored clean vs HEAD). Src is imported relatively, so no dist leg was needed. Each leg's failures out of 18 tests: A1, no watchRestores: 3 failed. A2, no deferral: 4 failed, rollback pin 'handleRecordUpsert ... called 2 times'. A3, no register-once guard: 1 failed. A4, hooks beside realtime: first attempt refused by the tool (anchor inside its replacement), re-run with a distinct anchor, 2 failed. A5, stale roll-up branch dropped: 1 failed. A6, detail first: 1 failed. Not ablated: the failed-restore pin (no mutation of this code can sync a failed restore). Public door (showcase with realtime and webhooks removed locally, pnpm dev --fresh -p 38917, as the seeded admin): create 201, and search_knowledge over MCP found 1 hit; delete 200, 0 hits; POST recycle-bin/ENTRY/restore 200, 1 hit (the restored record), no rebuild; 3 completed knowledge-record-sync queue rows. Server stopped, config reverted.",
     "gates": "Local derived families NOT MEASURED: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` exit 0, 118 commands at 0434c0ed8c. The background loop that would run them was denied by the auto-mode permission classifier ('Undermining Oversight') and was not retried in any other form, so there is no --ran reconciliation. overlap-check against origin/main 58be6770ab and 7 PR heads: VERDICT clean exit 0. CI at report time on head 0434c0ed8c: every check-run of the PR in_progress (Check Changeset, Governed Surface Queue Guard, Lint · ESLint, Lint · PM dispatch-gates, Lint · docs & code guards, Lint · repo & tooling gates, Type Check · workspace/source/consumer/debt, Validate Package Dependencies, Spec property liveness, PR-body guards and others); opt-in, queue-only and schedule-only runs skipped. Test Core, Build Core and the UI jobs not yet listed.",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2: `git push` is not a REST write. 1) the fleet-write relay pr_create, POST /repos/objectstack-ai/objectstack/pulls (draft) plus POST /repos/objectstack-ai/objectstack/issues/38067/assignees (os-elon-musk), with the relay's read-back identical; 2) post-stamped.mjs os-dev-report comment, POST /repos/objectstack-ai/objectstack/issues/38017/comments",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [],
     "deviations": "The local derived gate run was denied by the permission classifier and not retried; families are cited from CI instead. The first build and verify calls took exit 99 (queue-timeout) several times and resumed under the same slot. The worst wait was about 45 minutes behind a holder running a full dogfood battery, which was active (live vitest workers) and not stalled. The showcase public-door run needed a full workspace build (turbo run build --concurrency=2, 124 tasks, under the lock). It also built the docs app, because the root script's --filter=!@objectstack/docs was not used."
    }
  7. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Close-out · area o1-C · 2026-11-28T02:36Z

    Delivered by PR #38067 (merged 6e06729 at 2026-11-28T02:36Z). Nothing remains on this card for the area. pm:dispatched removed with this comment.

  8. removed
    pm:dispatched
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:serverpriority:p2

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions