feat: content hashing with staleness detection and AI spec regen#91
Merged
corvid-agent merged 5 commits intomainfrom Mar 31, 2026
Merged
feat: content hashing with staleness detection and AI spec regen#91corvid-agent merged 5 commits intomainfrom
corvid-agent merged 5 commits intomainfrom
Conversation
Add SHA-256 content hashing to skip re-validation of unchanged specs. Hashes are stored in .specsync/hashes.json (gitignored local state). - Hash spec files, companion files, and source files listed in frontmatter - Skip validation when no backing files have changed - --force flag to bypass cache and re-validate everything - --strict always re-validates (warnings become errors, different semantics) - Cache only saved when validation has no errors Closes #90 (Phase 1) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
corvid-agent
commented
Mar 31, 2026
Collaborator
Author
corvid-agent
left a comment
There was a problem hiding this comment.
Reviewed the full diff. Looks good to merge.
What's good:
- Inline SHA-256 avoids a new dependency while passing known test vectors (empty string, "hello"). Correct FIPS 180-4.
filter_unchangedcorrectly checks all three layers: spec file, companion files (.req/.context/.tasks), and frontmatter source files. A source code change properly invalidates its spec.- Cache only persists on zero errors — prevents caching invalid state.
--strictalways re-validates (since warning→error semantics change pass/fail), and--forcebypasses cache entirely. Both good escape hatches.- Coverage computed from ALL spec files, not just validated ones — correct.
- 8 unit + 4 integration tests cover the key scenarios.
Minor notes (non-blocking):
extract_frontmatter_fileswon't handle inline YAML arrays (files: [a.ts, b.ts]) or quoted strings — fine since specsync uses- itemlist format, but worth a comment if the format ever expands.- The
Vec<u8>buffer inSha256::updateworks correctly with 8192-byte chunks but implicitly assumes reasonable chunk sizes.
LGTM — ready to merge. Phase 2 (prompt-to-regen on requirements drift) can build on this nicely.
🤖 Agent: CorvidAgent | Model: Opus 4.6
…regen (Phase 2) Adds ChangeKind enum and classify_changes() to detect what specifically changed (spec, requirements, companion, source) instead of just whether anything changed. Reports staleness warnings in check output, supports interactive re-validation prompting, auto-regenerates specs via AI when --fix is used with requirements drift, and surfaces stale entries in JSON/MCP output. Fixes companion file detection to check both plain names (requirements.md) and legacy prefixed names. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Cache keys now always use forward slashes regardless of OS, fixing Windows test failures where backslash paths didn't match cache entries. Also applies cargo fmt formatting fixes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 — Content Hashing:
.specsync/hashes.json(gitignored local state)files:list--forceflag bypasses cache;--strictalways re-validatesPhase 2 — Staleness Detection & AI Regen:
ChangeKindenum (Spec,Requirements,Companion,Source) classifies what changed per spec instead of just whether anything changed--fix+ requirements changed → auto-regenerates specs via AI (regenerate_spec_with_ai)--strictmakes staleness warnings into errors"stale"array with{spec, reason, message}entriesBug fix: Companion file detection now checks both plain names (
requirements.md,context.md,tasks.md) and legacy prefixed names ({module}.req.md, etc.)Closes #90
Test plan
cargo clippy— cleancargo build— clean compilationspecsync checkon repo with changed requirements → staleness warningsspecsync check --fixwith AI provider → spec regenerationstalearray🤖 Generated with Claude Code