Skip to content

feat: content-hash invalidation of proven (stale detection)#5

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/modest-hawking-3fd6it
Jun 18, 2026
Merged

feat: content-hash invalidation of proven (stale detection)#5
hyperpolymath merged 1 commit into
mainfrom
claude/modest-hawking-3fd6it

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Engine polish (1/4) — content-hash invalidation of proven

Implements the proven -> inbox auto-invalidation from arghda-spec.adoc's open question, and answers a recurring echo-types pain: "is this proven thing still valid, or did something underneath it change?"

What's added

  • hash module — dependency-free SHA-256 (FIPS 180-4), pinned against the NIST vectors (empty / abc / hello world / multi-block). Kept hermetic (no sha2 dependency tree) in keeping with the crate's lightweight ethos; this is change-detection, not a security boundary.
  • proven module — the .arghda/hashes.json manifest (basename -> {sha256, promoted_at}).
  • Workspace::transition records a file's hash on entry to proven and drops it on exit; Workspace::stale_proven recomputes and flags proven files whose content changed since promotion (or were never recorded — the "how did this get into proven/?" case).
  • CLI stale <ws> [--invalidate] — lists stale proven files; --invalidate moves each back to inbox (proven -> inbox) with an Invalidate event.

Scope

v1 hashes file content only. The spec's "file + transitive imports" form needs the workspace to track the source tree's include root (the flat triage layout doesn't carry it) — a documented follow-on.

Verification (real, not eyeballed)

  • cargo fmt / clippy -D warnings / test clean; 35 tests (+4 SHA-256 NIST vectors, +3 proven-lifecycle). just check + just validate-rsr green.
  • End-to-end CLI dogfood: promote records the hash; editing the proven file is flagged "content changed since promotion"; stale --invalidate moves it back to inbox and logs the Invalidate event.

Next (engine polish, in order)

config + unpinned-headline, then the Groove /.well-known/groove manifest, then unused-import (needs the external agda-unused).

Draft for review.

🤖 Generated with Claude Code

https://claude.ai/code/session_019GiSiEfgZCte35dyykgBHs


Generated by Claude Code

Implements the `proven -> inbox` auto-invalidation from arghda-spec.adoc's
open question ("record a content hash so upstream changes can invalidate
proven"). Answers the recurring echo-types pain: "is this proven thing
still valid, or did something underneath it change?"

- `hash` module: dependency-free SHA-256 (FIPS 180-4), pinned against the
  NIST vectors (empty / "abc" / "hello world" / multi-block). Kept hermetic
  (no sha2 dependency tree) in keeping with the crate's lightweight ethos;
  this is change-detection, not a security boundary.
- `proven` module: the `.arghda/hashes.json` manifest (basename -> {sha256,
  promoted_at}).
- `Workspace::transition` records a file's hash on entry to `proven` and
  drops it on exit; `Workspace::stale_proven` recomputes and flags proven
  files whose content changed since promotion (or were never recorded — the
  "how did this get into proven/?" case).
- CLI `stale <ws> [--invalidate]`: lists stale proven files; `--invalidate`
  moves each back to inbox (proven -> inbox) with an Invalidate event.

Scope: v1 hashes file content only. The spec's "file + transitive imports"
form needs the workspace to track the source tree's include root (the flat
triage layout doesn't carry it) — a documented follow-on.

Verification
- cargo fmt/clippy(-D warnings)/test clean; 35 tests (+4 SHA-256 vectors,
  +3 proven lifecycle). `just check` + `just validate-rsr` green.
- End-to-end CLI dogfood: promote records the hash; editing the proven file
  is flagged "content changed since promotion"; `stale --invalidate` moves
  it back to inbox and logs the Invalidate event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019GiSiEfgZCte35dyykgBHs
@hyperpolymath hyperpolymath marked this pull request as ready for review June 18, 2026 16:12
@hyperpolymath hyperpolymath merged commit 4e47f3a into main Jun 18, 2026
1 check passed
@hyperpolymath hyperpolymath deleted the claude/modest-hawking-3fd6it branch June 18, 2026 16:12
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