Description
The primary long-term recovery path for the SQLite-backed state-store should be deterministic rebuild from canonical per-run Artifacts. Since execution.result.json, evidence.json, correlation.json, and related run Artifacts represent the source of truth, the state-store should be able to re-derive its persisted rows from those Artifacts without depending on legacy shared indexes.
This story adds canonical Artifact-based rebuild behavior for the SQLite-backed state-store.
Scope
In scope:
- Rebuild SQLite-backed state-store content from canonical per-run Artifacts
- Support deterministic re-derivation of persisted run and correlation state from existing Artifact evidence
- Preserve canonical Artifacts as the source of truth during rebuild operations
- Keep rebuild behavior fail-closed when required Artifact evidence is missing or invalid
- Keep implementation aligned with the existing
artifact_management action-plus-shared helper structure
Out of scope:
- Long-term support for legacy shared
correlation-index.json import
- New public MCP query/read contracts beyond the rebuild capability entrypoint
- Replacing canonical Artifacts with the DB itself
- Performance Suite integration
Expected Tables / Detailed Schema Direction
Rebuild must be able to repopulate at least these targets from canonical evidence:
| Table |
Rebuild source |
Minimum direction |
suite_runs |
execution.result.json, context.resolved.json, run directory metadata |
restore run identity, status, timing, Artifact linkage |
correlation_runs |
correlation/correlation.json |
restore key/session/window/verdict summary |
watcher_runs |
watcher-related canonical evidence when present |
restore watcher status/outcome summary |
external_verifications |
canonical verification evidence when present |
restore verification status/provider summary |
artifacts |
canonical Artifact file set |
restore Artifact link rows |
Acceptance Criteria
- SQLite-backed state can be rebuilt deterministically from canonical per-run Artifacts
- Rebuild uses Artifact evidence as the source of truth rather than legacy shared indexes
- Rebuild fails closed when required deterministic evidence is missing or invalid
- The implementation remains aligned with the existing
artifact_management action-plus-shared helper structure
- The rebuilt state is sufficient to restore persisted run/correlation indexing behavior
Implementation Notes
- Rebuild should be the preferred long-term maintenance path and should not depend on legacy JSON index presence.
- Keep rebuild logic bounded and summary-oriented in its public response even if internal scanning covers many runs.
Testing
UT for Artifact-to-state rebuild mapping logic
UT for fail-closed handling on missing or invalid canonical Artifacts
IT for full rebuild from existing regression run Artifacts
IT for deterministic rebuild summaries on repeated runs over the same Artifact set
Description
The primary long-term recovery path for the SQLite-backed state-store should be deterministic rebuild from canonical per-run Artifacts. Since
execution.result.json,evidence.json,correlation.json, and related run Artifacts represent the source of truth, the state-store should be able to re-derive its persisted rows from those Artifacts without depending on legacy shared indexes.This story adds canonical Artifact-based rebuild behavior for the SQLite-backed state-store.
Scope
In scope:
artifact_managementaction-plus-shared helper structureOut of scope:
correlation-index.jsonimportExpected Tables / Detailed Schema Direction
Rebuild must be able to repopulate at least these targets from canonical evidence:
suite_runsexecution.result.json,context.resolved.json, run directory metadatacorrelation_runscorrelation/correlation.jsonwatcher_runsexternal_verificationsartifactsAcceptance Criteria
artifact_managementaction-plus-shared helper structureImplementation Notes
Testing
UTfor Artifact-to-state rebuild mapping logicUTfor fail-closed handling on missing or invalid canonical ArtifactsITfor full rebuild from existing regression run ArtifactsITfor deterministic rebuild summaries on repeated runs over the same Artifact set