Documentation
¶
Overview ¶
Package readback derives "what has writ deployed" from the store's graph and trace documents (phase-8 step 47 slice 1).
The deployed state is not a file of its own — it is a time-ordered, best-effort fold over the writ-tool runs recorded in the store: a run's successful deploying units (link / copy / write / decrypt) mark their targets deployed; successful removing units (unlink / remove) mark them gone; failed and undispatched units count for nothing. Per-unit file metadata comes from the graph origin's `files` annotation (stamped at plan time by the deploy package); per-unit outcomes come from the trace's receipt stack. The store is user territory — deleted documents fold as missing pieces (reported, never fatal), but a missing run index is an error per the settled design: `writ status` refuses to report from silence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentDigest ¶
ContentDigest renders `data`'s canonical content identity ("sha256:<hex>").
For comparison against a recorded Entry.RecordedDigest.
Parameters:
- `data`: the content to hash.
Returns:
- `string`: the canonical digest form.
Types ¶
type Entry ¶
type Entry struct {
// Target is the absolute target path — the fold key.
Target string
// Source is the absolute source path the target was deployed from.
Source string
// Action is the target-producing action name (e.g. "file.link", "file.write_text").
Action string
// Scope is the graph origin's scope ("system" / "home", or "" for unscoped runs).
Scope string
// Project is the owning project recorded at plan time.
Project string
// Layer is the contributing layer recorded at plan time, or "" in single-source mode.
Layer string
// TargetRoot is the scope's target root from the run's origin annotations (e.g. $HOME for home) — the
// confinement root and prune boundary for removal consumers.
TargetRoot string
// RecordedEtag is the target's cheap change-detection token captured in the run's ledger snapshot
// (phase-8 step 48), or "" for runs traced before the capture existed.
RecordedEtag string
// RecordedDigest is the target's as-deployed content identity ("<algo>:<hex>") captured in the run's
// ledger snapshot (phase-8 step 48) — what drift attribution compares against; "" for pre-capture runs.
RecordedDigest string
// RecordedSourceDigest is the SOURCE file's content identity from the same snapshot, when the run
// cataloged the source (encrypted chains use it: the encrypted source's bytes are hashable without
// decrypting); "" when the source was not cataloged or the run predates the capture.
RecordedSourceDigest string
// GraphChecksum identifies the graph whose run last touched this target.
GraphChecksum string
// At is the trace timestamp of the run that last touched this target.
At time.Time
}
Entry is one folded target: the deployed state of one absolute target path.
type Inventory ¶
type Inventory struct {
// Entries maps each deployed absolute target path to its folded state.
Entries map[string]Entry
// Packages records the successful package operations (`pkg.*` receipts) writ's runs performed, in fold
// order — fact-of-record for reporting; package-manager drift is not writ's concern.
Packages []PackageRecord
// Findings are the store-health observations: index entries whose documents are gone, and documents the
// index never recorded. Informational — the fold proceeds over whatever survives.
Findings []string
// Runs is the number of traces folded.
Runs int
}
Inventory is the fold's output: the deployed entries plus the store-health findings.
func Fold ¶
Fold derives the deployed-state inventory from the store.
Reads the run index (missing index = error, per the settled design), joins trace events to writ-tool graph events by checksum, orders the runs by time, and folds each run's per-unit outcomes over its graph's `files` annotation. Documents deleted out from under the index fold as findings; traces on disk that the index never recorded (pre-index history) fold in via directory enumeration.
Parameters:
- `ctx`: the context for the document-loading runtime environment.
Returns:
- `*Inventory`: the folded entries, findings, and run count.
- `error`: non-nil when the index is missing or the loading environment cannot be built.
type PackageRecord ¶
type PackageRecord struct {
// Action is the package action name (e.g. "pkg.install").
Action string
// UnitID is the dispatched unit's id within its graph.
UnitID string
// GraphChecksum identifies the graph whose run performed the operation.
GraphChecksum string
// At is the run's trace timestamp.
At time.Time
}
PackageRecord is one successful package operation from a writ trace.