Skip to content

Persist parser source snapshots and reject changed-during-parse results #978

Description

@TheGreenCedar

Parent: #911

Problem

Parser-backed indexing reads source bytes before parsing but records filesystem
metadata later. A concurrent edit can therefore publish graph data from old
bytes while stamping it with the newer modification time, allowing refresh
planning to treat stale graph data as current.

Scope

Persist the identity of the bytes actually parsed and reject results when the
source changes before publication. Keep this slice inside indexer/store source
snapshot integrity; do not alter repository identity, discovery/deletion
semantics, or runtime publication ownership.

Acceptance Criteria

  • Add a nullable stored content hash for parser-backed file projections,
    with an additive schema migration that preserves legacy rows.
  • Hash the source bytes already read for parsing; do not add a redundant
    pre-parse read.
  • Re-read and compare the source before accepting parser or artifact-cache
    results.
  • Stamp the captured metadata only when the verified bytes still match.
  • Convert changed-during-parse/cache results into an incomplete file-level
    retry error and do not publish graph data from the stale bytes.
  • Carry hashes through the existing projection batch/storage boundary
    without adding content identity to the widely constructed FileInfo.
  • Clear stored hashes for refreshed rows that do not provide a verified
    content identity.
  • Expose one focused store read for proof and later Replace mtime-only freshness with content and completeness identity #911 planning work.
  • Cover unchanged parsing, artifact-cache hits, changed-during-parse with a
    restored same timestamp, projection round-trip/clearing, and migration
    from the prior schema.
  • Update the changelog and nearest testing/architecture documentation.

Non-Goals

Verification

  • Focused codestory-store migration/projection tests
  • Focused codestory-indexer source-snapshot and cache tests
  • cargo fmt --all -- --check
  • Relevant package clippy checks with warnings denied
  • git diff --check

Run Cargo commands serially.

Refs #899

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:grounding-runtimev0.14.3 stabilization and v0.15 grounding/runtime rewriteepic:security-trustSecurity, trust boundaries, local artifacts, and config mutationepic:sidecar-provenanceSidecar provenance, freshness, and manifest workphase:next-waveActive next implementation wavepriority:p1Release blocker or high-risk reliability/security issuerelease:v0.15.0Planned for the v0.15.0 Grounding Runtime Rewrite releasesaga:codestory-intelligenceCodeStory product-grade intelligence sagatype:contractRuntime, CLI, API, or evidence contract work

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions