Skip to content

service-knowledge: the purge re-read confirms by id text only, so a caller-supplied numeric id restored mid-walk on driver-mongodb / driver-memory loses its document until its next event #37221

Backlog

Description

@objectstack-fleet

repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL

Follow-up from #37096 / PR #37164 (epic #37000, ADR-0161 K8). Filed by zone a4-K. The limit is stated and pinned in that PR.

The limit

KnowledgeService.reindexSource purges a listed document only after a re-read confirms that no row backs it. The re-read uses the source's where plus the record id. The id is recovered from the document id as text.

  • On driver-mongodb and driver-memory, a caller can supply a numeric id that is kept as given.
  • Text '5' does not match number 5 there. So if such a row is restored during a complete reindex walk, the confirm finds nothing and its document is deleted.
  • The row itself is untouched. The document comes back at the row's next record event or the next complete reindex.
  • A row that exists for the whole walk is not affected. The walk produces its document, so it is never a purge candidate.

This is pinned at the PR head by the test "the purge re-reads by the id text only: a numeric id restored mid-walk is not found (the stated limit)". It is stated in the TSDoc, content/docs/protocol/knowledge.mdx, the changeset and the PR's Acceptance notes.

Why it was not fixed in #37164

Options for whoever picks this up (a design choice, not settled here)

  • Carry the id's original JS type through the document. For example, store the record id with its type in KnowledgeDocument.metadata, or alongside docHash, and re-read with that value. This needs an adapter-contract or metadata-shape decision.
  • Let the driver contract expose whether an object's id column is numeric or text, and use it to choose the re-read value.
  • Accept the limit as documented (current state).

Dedupe words: knowledge purge numeric id, rereadRow id text, docHash purge mongodb numeric.

Activity

  1. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    First touch 2026-11-25T05:29Z.

  2. added
    area:ai
    domain:server
    pm:queue
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:aidomain:serverpm:queuepriority:p3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions