Skip to content

fix stale code anchor detection - #115

Closed
GautamSharma99 wants to merge 1 commit into
Autoloops:mainfrom
GautamSharma99:fix-stale-code-anchor-detectio
Closed

fix stale code anchor detection#115
GautamSharma99 wants to merge 1 commit into
Autoloops:mainfrom
GautamSharma99:fix-stale-code-anchor-detectio

Conversation

@GautamSharma99

@GautamSharma99 GautamSharma99 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds content-version tracking for claim code anchors so Greplica can detect when an anchored symbol still exists but its implementation
has changed since the claim was recorded.

Previously, anchor audit only checked whether the file and symbol still resolved. That meant a code_verified claim could silently become
false after a function body changed, while greplica graph audit anchors, greplica graph view, and greplica graph context still presented
the claim as healthy.

Changes

  • Adds content_hash to claim code anchors.
  • Computes and stores the resolved anchor content hash when a proposal is applied.
  • Recomputes the current anchor hash during anchor resolution.
  • Adds a new stale_content anchor status when the stored hash differs from the current resolved content.
  • Includes stale content in greplica graph audit anchors.
  • Surfaces stale claims in the graph view Freshness chart.
  • Labels stale anchors in graph context Markdown so agents do not consume drifted claims as clean facts.
  • Adds regression coverage that:
    • applies a claim anchored to a function,
    • verifies a content hash is persisted,
    • changes the function body without renaming the symbol,
    • verifies audit reports stale_content,
    • verifies graph view serializes the stale count.

Validation

  • npm run build
  • node scripts/check-graph-view.js
  • npm test

@kushalpatil07

Copy link
Copy Markdown
Contributor

Closing this implementation as superseded by the incremental anchor-fingerprint path in merged #111 and the narrower foreground work in #128. Remaining product behavior stays tracked in #90/#91.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants