2.0 KiB
State Internals
internal/state owns safe workspace paths, atomic artifact writes, metadata,
prior-snapshot lookup, and read-only inspection. Operators should use the
operations guide for lifecycle and retention.
Artifact Paths
For each run, paths are grouped by artifact group and valid start date:
| Artifact | Location |
|---|---|
| Module snapshot | snapshots/<group>/<date>/modules.<run-id>.json |
| Metadata | snapshots/<group>/<date>/metadata.<run-id>.json |
| Data package | data-packages/<group>/<date>/data_package.<run-id>.yaml |
| Prompt preparation | preflight/<group>/<date>/prompt_preparation.<run-id>.json |
| Prompt execution | snapshots/<group>/<date>/prompt_execution.<run-id>.json |
| Raw generated text | snapshots/<group>/<date>/generated_text_raw.<run-id>.json |
| Validated generated text | snapshots/<group>/<date>/generated_text.<run-id>.json |
| Render context | snapshots/<group>/<date>/render_context.<run-id>.json |
| Managed report | reports/<group>/<date>/report.<run-id>.md |
| Notification | notifications/<group>/<date>/distributor.<run-id>.json |
Batch notification records are notifications/batches/<batch>/<local-date>/distributor.<batch-run-id>.json.
Metadata And Debug Storage
New metadata is weatherreporter.metadata.v2 and gains preparation and
execution paths only after those artifacts are saved. Legacy V1 records remain
readable; their historic preflight and generated-text-result fields are mapped
to the corresponding preparation and execution views during inspection. New
runs never write V1 records.
PromptDebugWriter is separate from workspace state. An empty root disables
it. An enabled absolute root is checked for safe directories and symlinks, then
stores preparation.json and execution.json beneath
<root>/<report-id>/<valid-date>/<run-id>/. Directories are 0700; files are
atomic 0600. Normal state discovery does not read this root.
Focused checks:
go test ./internal/state