feat(refs): propagate hub staleness across refs (#4)#149
Merged
Conversation
Second and final stage of refs hub composition (PR1, #148, shipped the validated graph). `surf check` now propagates staleness one hop: a hub that directly references a stale hub — or a stale claim within one, via `> symbol` — inherits a `ReferencedStale` divergence and fails the gate. The signal that flags a dependency now flags everything composed on it. Propagation is one-hop by construction: the stale set is built only from base per-claim divergences, never from other propagated ones, so a chain A → B → C does not cascade. Claim-level refs match the specific diverged claim by anchor-segment suffix, so a ref to a still-clean sibling claim stays green. Dogfood surfaced itself: this change to `check_workspace` diverged its own claim in cli-check.md, which propagated REF-STALE to the two hubs that ref it — re-sealed after documenting the new behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Second and final stage of
refshub composition (PR1 #148 shipped the validated graph; this turns on propagation, completing #4).surf checknow propagates staleness one hop: a hub that directly references a stale hub — or a stale claim within one, via> symbol— inherits aReferencedStaledivergence and fails the gate. The signal that flags a dependency now flags everything composed on top of it.What changed and why
surf-core/report.rs— newDivergenceKind::ReferencedStalevariant (serializes asreferenced_stale);detaildoc broadened. Additive to the v1 JSON contract.surf-cli/check.rs—check_workspacebuilds a stale set during the per-claim walk (hub → diverged-claim anchor paths), thenpropagate_refswalks every hub'srefsand emits aReferencedStaledivergence when a ref resolves to a stale target. Whole-hub refs fire on any divergence in the target; claim-level refs (> symbol) match the specific diverged claim by anchor-segment suffix, so a ref to a still-clean sibling stays green.print_humangained aREF-STALEline.One-hop by construction
The stale set is built only from base per-claim divergences, never from other propagated ones, so a chain
A → B → Cdoes not cascade — exactly the bounded behavior the §9.3 unlock discipline calls for.Dogfood surfaced itself
This change to
check_workspacediverged its own claim incli-check.md, which propagatedREF-STALEto the two hubs thatrefit (cli-workspace.md,hub-format.md). Re-sealed after updating the claim prose to document the new behavior — the feature catching its own drift.Verification
All run on this branch:
cargo fmt --all --check— cleancargo clippy --all-targets --all-features -- -D warnings— cleancargo test --all— 233 passed, 0 failed (2 pre-existing#[ignore]), incl. 4 new propagation tests (ref_to_stale_hub_propagates,ref_to_clean_hub_does_not_propagate,claim_level_ref_targets_the_named_claim,propagation_is_one_hop)surf lint→ 0 errors,surf check→ all anchored spans matchTry it
From the repo root after
cargo build:Closes #4
🤖 Generated with Claude Code