Skip to content

feat(refs): hub→hub composition, lint validation pass (#4)#148

Merged
Connorrmcd6 merged 1 commit into
mainfrom
feat/4-refs-composition-pr1
Jun 29, 2026
Merged

feat(refs): hub→hub composition, lint validation pass (#4)#148
Connorrmcd6 merged 1 commit into
mainfrom
feat/4-refs-composition-pr1

Conversation

@Connorrmcd6

@Connorrmcd6 Connorrmcd6 commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves refs from forward-declared/inert into a validated hub-composition graph — PR1 of 2. This stage deliberately stops short of verdict propagation, per the §9.3 unlock discipline: composition compounds the granularity problem (§8/§11.3), so the validated base ships first and staleness propagation (ReferencedStale) follows in PR2.

What changed and why

surf-core

  • anchor.rs — extracted parse_segment so the @N positional-collision grammar is shared rather than duplicated.
  • New refs.rsparse_refRef { path, segments }. A ref is a hub path (./cli-verify.md) optionally followed by > symbol to address one claim within the target (./resolve.md > resolve_nodes), reusing the at: segment grammar. Pure parsing; exported from lib.rs.

surf-cli

  • workspace.rsresolve_ref_path normalizes a hub-relative ref to a workspace-rel path by component arithmetic (no filesystem access).
  • lint.rs — the workspace loop builds a rel → &Hub index once; new lint_refs blocks a ref that is malformed, doesn't resolve to a loaded hub, points at its own hub, or names a claim the target lacks (same fail-on-typo reasoning as covers). The check verdict is untouched.

Samples + docs

  • Seeded real refs: in the 5 hubs that already cross-linked in prose (hash→cli-verify; hub-format→cli-lint/cli-check; cli-workspace→cli-check/cli-lint/config; cli-check→cli-git/cli-verify; cli-git→rename).
  • Reclassified the 2 doc-pointing refs (cli-reference, cli-stats) to prose links — docs aren't hubs; both already linked the doc in prose, so the refs dropped to [].
  • Updated authoring-hubs.md, the hub-format hub's prose, and CHANGELOG.
  • hubs/anchor.md — re-sealed the parse_anchor claim hash (the parse_segment extraction is a pure change ≠ falsification refactor; the claim's prose is unchanged). The diff is the single hash line.

Verification

All run on this branch:

  • cargo fmt --all --check — clean
  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo test --all229 passed, 0 failed (2 pre-existing #[ignore]), incl. 4 new parse_ref + 7 new lint_refs tests
  • Dogfood: surf lint → 0 errors (18 pre-existing advisory warnings), surf check → all anchored spans match

Scope

Part of #4 (does not close it). PR2 will add ReferencedStale verdict propagation — a hub flagged when a hub it refs goes stale — which completes the issue.

🤖 Generated with Claude Code

Resolve `refs` from forward-declared/inert to a validated hub-composition
graph — the first of two stages, deliberately stopping short of verdict
propagation per the §9.3 unlock discipline (composition compounds the
granularity problem, so prove the base before stacking the cascade).

A `refs:` entry now names another hub by a path relative to the
referencing hub, optionally `> symbol` to address one claim within it
(matched against that claim's `at:` anchor, reusing the segment grammar).
`surf lint` blocks a ref that is malformed, doesn't resolve to a loaded
hub, points at its own hub, or names a claim the target lacks — the same
fail-on-typo reasoning as `covers`. The `check` verdict is untouched: a
referenced hub going stale does not yet flag its referrers (PR2).

The repo's own hubs now declare their cross-hub refs, and the two prior
doc-pointing refs were reclassified to prose links (docs aren't hubs).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Connorrmcd6 Connorrmcd6 merged commit 485cc2e into main Jun 29, 2026
4 checks passed
@Connorrmcd6 Connorrmcd6 deleted the feat/4-refs-composition-pr1 branch June 29, 2026 09:25
Connorrmcd6 added a commit that referenced this pull request Jun 29, 2026
* feat(refs): propagate hub staleness across refs (#4)

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>

* docs(dogfood): log refs propagation firing on its own commit (#4)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant