Skip to main content

Module history

Module history 

Source
Expand description

Per-entity history — the narrative query behind an inspector’s “how did this entity get this way”.

The engine already records everything a story needs (commit subjects, provenance trailers, agent notes, batch entity lists, rename chains) but exposed it only as branch-wide feeds; every consumer filtered client-side. This module owns the per-entity filter, rename-chain attribution, and pagination — one semantic for every surface.

Data sources per backend, all pre-existing:

  • git-branch: the commit-note walk that already rides changes_since (BackendChanges::notes, newest-first) — full fidelity: sha, subject, trailers, batch Entities: lists, authoritative rename pairs in the subject.
  • folder / in-memory: MemBackend::read_provenance (the .memstead/changes.jsonl line scan / its in-memory analogue, oldest-first) — same story, coarser: no batch entity lists, and rename records carry only the post-rename id, so chains are not stitchable. Both gaps surface as stated limitations, never as silently absent entries.
  • archive: the seam records no history — typed refusal, never a fabricated empty story.

This query is read-only and mutates nothing; it deliberately stays narrative-only (content-level diffs per touch are the pairwise diff op’s job, git-branch consumers only).

Structs§

EntityHistoryReport
Result of Engine::entity_history — one page of the newest-first touch feed plus the explicit bounds of what it omits.
EntityProvenance
The entity read’s derived provenance block: created-by and last-modified-by, derived from the append-only history record — never from anything an agent can edit after the fact.
EntityTouch
One recorded touch of an entity, newest-first in the report.
ProvenanceRecord
One derived provenance record — who performed a boundary touch of an entity’s story, in what declared role, when (agent-trust plan 13). Served by the entity read’s opt-in provenance block.

Enums§

StoryStart
Where the returned story starts — the visible-truncation contract: whatever the record cannot reach is stated, never silent.

Constants§

HISTORY_PAGE_DEFAULT
Default page size when the caller passes None.
HISTORY_PAGE_MAX
Hard page-size cap; larger requests clamp here.