Expand description
Scratch/candidate store: content-addressed .zen snapshots indexed in
scratch/index.jsonl.
Each CandidateEntry records a page_id (the page or source being
snapshotted), a snapshot_hash that addresses the raw .zen bytes in the
shared object store, a CandidateStatus, and optional workflow metadata.
§Append-only contract
This module is append-only: all writes are appends. put_scratch adds
new candidates; set_candidate_status transitions an existing candidate’s
status by appending a superseding entry (same id/page_id/snapshot_hash,
new status and timestamp). list_scratch resolves the latest status per
id via last-write-wins deduplication, returning one entry per distinct
candidate in first-appearance order. The raw file is fully auditable.
Structs§
- Candidate
Entry - A single scratch candidate record appended to
scratch/index.jsonl. - Candidate
Meta - Borrowed optional metadata for a new candidate (mirrors
VersionMeta). - Finalize
Report - Report of a finalize pass.
- NewCandidate
- The describing inputs for a new candidate snapshot: which page it captures,
the
.zensnapshot bytes, its lifecycle status, and optional metadata.
Enums§
- Candidate
Status - Lifecycle state of a scratch candidate.
Functions§
- finalize_
candidates - Apply each rejected candidate’s cleanup-policy to the scratch store.
- get_
scratch_ snapshot - Recover the stored
.zensnapshot bytes for a candidate entry. - list_
scratch - List candidate entries for
doc_id, one per distinct candidate id. - put_
scratch - Store a candidate snapshot and append a
CandidateEntryto the scratch index. - set_
candidate_ status - Transition a candidate’s lifecycle status by appending a superseding entry
(same
id/page_id/snapshot_hash, newstatus+ fresh timestamp). The scratch index stays append-only and auditable;list_scratchresolves the latest status peridvia last-write-wins.