Relink gate: refuse drift link on stale anchors unless explicitly reviewed#19
Merged
laulauland merged 7 commits intomainfrom Apr 14, 2026
Merged
Relink gate: refuse drift link on stale anchors unless explicitly reviewed#19laulauland merged 7 commits intomainfrom
laulauland merged 7 commits intomainfrom
Conversation
The doc: hash was a whole-file hash of the markdown doc. It powered the relink gate by detecting whether the doc had changed since the last link. Problem: any unrelated doc change (typo, different section) opened the gate, giving false passes on bindings that weren't actually reviewed. Simplify the gate to: stale binding → always require --doc-is-still-accurate. No doc hash comparison needed. This is stricter but correct — the flag is an explicit human assertion that the doc was reviewed. - Remove computeDocHash and doc_hex plumbing from link.zig - Simplify isDocGateBlocked to only check staleness - Add Binding.removeField to strip leftover doc: from old lockfiles - Strip doc: from drift.lock - Update tests and docs
6 tasks
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
drift linknow refuses to restamp stale anchors. When a target's signature has changed, the command prints both sides — the doc section (spec) and the current code — then exits 1. The only way through is--doc-is-still-accurate, an explicit assertion that the doc was reviewed and doesn't need changes.This prevents agents and humans from blindly relinking without reading what changed.
What happens on stale relink
For symbol anchors, drift prints the doc section and the current symbol body via tree-sitter. For heading anchors, it prints both heading sections. Output is capped at 10 lines per side.
Changes
src/commands/link.zig—isDocGateBlockedchecks staleness,printStaleContextshows both sides,printBlanketRefusalconsolidates output for multi-anchor docssrc/main.zig—--doc-is-still-accurateflag for the link commandsrc/markdown.zig—extractHeadingSectionContentfor heading target display.claude/skills/drift/SKILL.md,docs/CLI.md— updated documentationTest plan
zig build testpassesdrift link <doc>on stale anchor → prints context, exits 1drift link <doc> --doc-is-still-accurate→ succeeds