meta.anchors.unique_names

Every specification anchor has a well-formed full name and exactly one definition in the Design chapter inventory. Malformed markers and duplicate full names are errors. Names are derived from the defining chapter; moves between chapter namespaces rename the rule and require updating its references.

Resolved names are dot-separated ASCII identifiers and describe independently testable behavior. A Markdown definition uses a chapter-local name with the custom MyST-style inline-role syntax. For example, in design/meta/language.md:

{anchor}`calls.declared`
Every observed architectural call must be permitted by its caller's resolved
dependency envelope.

The marker and the opening prose form one paragraph: do not leave a blank line between them. Later blocks can continue the same claim under the content rules. The example resolves to meta.language.calls.declared. Use the same definition syntax inside .sage triple-quoted prose. In either format, {spec} followed by a backtick-quoted full name references an existing rule without creating another definition.

Read in specification context · design/meta/anchors.md

Implementation

Implemented crates/sage-meta/src/spec.rs:850–855

sage_meta::spec · lib:sage_meta

#![allow(unused)]
fn main() {
        // {anchor}`meta.anchors.unique_names`
        for anchor in anchors {
            if let Some(previous) = self.anchors.get(&anchor.name) {
                self.diagnostics.push(Diagnostic {
                    file: anchor.file.clone(),
                    span: anchor.span.clone(),

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

Implemented sage_meta::canonical_inventory_uses_configured_chapters_and_local_names

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.book.chapter_names)]
#[sage::test(meta.book.authority)]
#[sage::test(meta.book.shared_model)]
#[sage::test(meta.anchors.unique_names)]
fn canonical_inventory_uses_configured_chapters_and_local_names() {
    let fixture = BookFixture::new(
        "- [Design](design/README.md)\n  - [Meta](design/meta/README.md)\n  - [Rules](design/meta/call-rules.md)\n  - [Tenets](design/tenets.md)\n- [RFD](rfds/proposal.md)\n",
    );
    fixture.write("design/README.md", "# Design\n");
    fixture.write(
        "design/meta/README.md",
        "{anchor}`authority` Meta is normative.\n",
    );
    fixture.write(
        "design/meta/call-rules.md",
        "{anchor}`declared` Calls are declared.\n",
    );
    fixture.write("design/tenets.md", "{anchor}`not_a_rule` A motivation.\n");
    fixture.write(
        "rfds/proposal.md",
        "{anchor}`not_a_rule` Historical rationale.\n",
    );
    let index = fixture.load();
    assert!(index.diagnostics.is_empty(), "{:?}", index.diagnostics);
    assert_eq!(
        index.anchors.keys().map(String::as_str).collect::<Vec<_>>(),
        ["meta.authority", "meta.call_rules.declared"]
    );
    assert_eq!(index.chapters["design/meta/README.md"].namespace, "meta");
    assert_eq!(
        index.anchors["meta.authority"].context_url,
        "design/meta/index.html#meta.authority"
    );
    assert_eq!(index.documents, 3);
}
}

See more source ↗

Implemented sage_meta::chapter_namespace_collisions_and_duplicate_local_rules_are_errors

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.book.chapter_names)]
#[sage::test(meta.anchors.unique_names)]
fn chapter_namespace_collisions_and_duplicate_local_rules_are_errors() {
    let fixture =
        BookFixture::new("- [One](design/call-rules.md)\n- [Two](design/call_rules.md)\n");
    fixture.write("design/call-rules.md", "{anchor}`same` First rule.\n");
    fixture.write("design/call_rules.md", "{anchor}`same` Second rule.\n");
    let index = fixture.load();
    assert!(
        index
            .diagnostics
            .iter()
            .any(|error| error.message.contains("namespace `call_rules` collides"))
    );
    assert!(index.diagnostics.iter().any(|error| {
        error
            .message
            .contains("duplicate specification anchor `call_rules.same`")
    }));
    assert!(sage_meta::spec::chapter_namespace("design/bad.name.md").is_err());
    assert!(sage_meta::spec::chapter_namespace("outside/design.md").is_err());
}
}

See more source ↗

Implemented sage_meta::duplicate_names_are_rejected_across_documents

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.unique_names)]
fn duplicate_names_are_rejected_across_documents() {
    let index = SpecIndex::from_sources(&[
        source("first.md", "{anchor}`meta.rule` First rule."),
        source("second.md", "{anchor}`meta.rule` Another rule."),
    ]);
    assert_eq!(index.anchors.len(), 1);
    assert_eq!(index.diagnostics.len(), 1);
    assert_eq!(index.diagnostics[0].file, "second.md");
    assert!(index.diagnostics[0].message.contains("duplicate"));
    assert!(index.diagnostics[0].message.contains("first.md"));
    assert_eq!(index.anchors["meta.rule"].file, "first.md");
    assert_eq!(index.validate(&BTreeMap::new()).len(), 2);
}
}

See more source ↗

Implemented sage_meta::malformed_roles_and_empty_or_misplaced_rules_are_errors

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.unique_names)]
fn malformed_roles_and_empty_or_misplaced_rules_are_errors() {
    for text in [
        "{anchor}missing A rule.",
        "{anchor} `meta.spaced` A rule.",
        "{anchor}``meta.double`` A rule.",
        "{anchor}`meta..empty` A rule.",
        "{anchor}`meta.9number` A rule.",
        "{anchor}`méta.unicode` A rule.",
        "{anchor}`meta::rust` A rule.",
        "{anchor}`meta.raw#name` A rule.",
        "{anchor}`meta.rule`without separator.",
        "{anchor}`meta.empty`\n",
        "{anchor}`meta.empty`\n\nThe rule belongs to another paragraph.",
        "Before {anchor}`meta.misplaced` A rule.",
        "# {anchor}`meta.heading` A heading.",
        "{anchor}`meta.comment` <!-- no rule -->\n",
    ] {
        let index = SpecIndex::from_sources(&[source("broken.md", text)]);
        assert!(!index.diagnostics.is_empty(), "accepted {text:?}");
        assert!(index.anchors.is_empty(), "indexed {text:?}");
        assert_eq!(index.diagnostics[0].file, "broken.md");
    }
}
}

See more source ↗

Implemented sage_meta::reference_roles_validate_targets_but_ignore_code_examples

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.canonical_sources)]
#[sage::test(meta.anchors.unique_names)]
fn reference_roles_validate_targets_but_ignore_code_examples() {
    let fixture = BookFixture::new("- [Rules](design/rules.md)\n");
    fixture.write("design/rules.md", "{anchor}`claim` A precise claim.\n\nSee {spec}`missing.rule`.\n\n`` {spec}`example` ``\n\n```text\n{spec}`code.example`\n```\n\n{spec} malformed\n");
    let index = fixture.load();
    assert_eq!(index.references.len(), 1);
    assert!(index.diagnostics.iter().any(|error| {
        error
            .message
            .contains("unknown specification reference `missing.rule`")
    }));
    assert!(
        index
            .diagnostics
            .iter()
            .any(|error| error.message.contains("expected {spec}"))
    );
    assert_eq!(index.diagnostics.len(), 2);
}
}

See more source ↗

Implemented sage_meta::sage_prose_rules_have_precise_spans_model_owners_and_cross_source_references

crates/sage-meta/tests/spec.rs · test:spec

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.canonical_sources)]
#[sage::test(meta.anchors.context_navigation)]
#[sage::test(meta.anchors.content.source_end)]
#[sage::test(meta.reviews.claim_text)]
#[sage::test(meta.anchors.unique_names)]
fn sage_prose_rules_have_precise_spans_model_owners_and_cross_source_references() {
    let fixture =
        BookFixture::new("- [Meta](design/meta.md)\n- [Crates](design/crates/README.md)\n");
    fixture.write(
        "design/meta.md",
        "{anchor}`rule` A rule refers to {spec}`crates.demo.nodes.member`.\n",
    );
    fixture.write("design/crates/README.md", "# Crates\n");
    fixture.write(
        "design/crates/demo/crate.sage",
        "crate demo { \"\"\"Demo.\"\"\" module nodes; }",
    );
    let sage = r#"module crate::nodes;
struct Value {
    """
    {anchor}`value`
    A value with **meaning**.

    Précise values survive edits.

    - Keep the cached value.

    ```text
        Preserve relative indentation.
    ```
    """
    """
    {anchor}`member`
    Fields obey {spec}`meta.rule`.
    """
    number: Value,
}
class Node {
    """A node."""
    query value() -> Value {
        """
        {anchor}`query`
        Query results have stable identity.
        """
        envelope {}
    }
}
"#;
    fixture.write("design/crates/demo/nodes.sage", sage);
    let index = fixture.load();
    assert!(index.diagnostics.is_empty(), "{:?}", index.diagnostics);
    let value = &index.anchors["crates.demo.nodes.value"];
    assert_eq!(value.entity.as_deref(), Some("demo::nodes::Value"));
    assert_eq!(
        value.content,
        "A value with **meaning**.\n\nPrécise values survive edits.\n\n- Keep the cached value.\n\n```text\n    Preserve relative indentation.\n```"
    );
    assert_eq!(&sage[value.span.start..value.span.end], "{anchor}`value`");
    assert_eq!(
        &sage[value.content_span.start..value.content_span.end],
        "A value with **meaning**.\n\n    Précise values survive edits.\n\n    - Keep the cached value.\n\n    ```text\n        Preserve relative indentation.\n    ```"
    );
    let rust = sage_meta::correspondence::CorrespondenceIndex::from_sources(&[]).unwrap();
    let inputs = sage_meta::review::inventory(&index, &rust).unwrap();
    assert_eq!(
        inputs["crates.demo.nodes.value"].fragments.iter().find(|fragment| matches!(&fragment.selector, sage_meta::review::Selector::Claim { anchor_id } if anchor_id == "crates.demo.nodes.value")).unwrap().contents.join("\n"),
        "A value with **meaning**.\n\nPrécise values survive edits.\n\n- Keep the cached value.\n\n```text\n    Preserve relative indentation.\n```"
    );
    assert_eq!(
        index.anchors["crates.demo.nodes.member"].entity.as_deref(),
        Some("demo::nodes::Value::number")
    );
    assert_eq!(
        index.anchors["crates.demo.nodes.member"].content,
        "Fields obey {spec}`meta.rule`."
    );
    assert_eq!(
        index.anchors["crates.demo.nodes.query"].entity.as_deref(),
        Some("demo::nodes::Node::value")
    );
    let query = &index.anchors["crates.demo.nodes.query"];
    assert_eq!(query.content, "Query results have stable identity.");
    assert_eq!(
        &sage[query.content_span.start..query.content_span.end],
        query.content
    );
    assert_eq!(
        value.context_url,
        "design/crates/demo/nodes.html#anchor:crates.demo.nodes.value"
    );
    assert_eq!(index.references.len(), 2);
    for reference in &index.references {
        assert_eq!(
            &index.sources[&reference.file][reference.span.start..reference.span.end],
            format!("{{spec}}`{}`", reference.name)
        );
    }
}
}

See more source ↗

TODO sage_meta::todo::definitions_across_markdown_and_sage

crates/sage-meta/tests/spec_plan.rs · test:spec_plan

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(meta.anchors.canonical_sources)]
    #[sage::test(meta.anchors.unique_names)]
    fn definitions_across_markdown_and_sage() {
        // TODO: Check both definition origins, cross-source duplicates,
        // references, preserved context, and the chapter-based naming rules.
        // Envelope-clause rule ownership additionally requires clause-level
        // prose syntax, captured clause source spans, and a stable clause owner
        // representation; parser::method models effects without prose. Add
        // owner/source-location assertions once that representation exists.
    }
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Fresh full review of unique_names after the latest shared-file association-only delta. The new implementation_references marker in spec.rs does not change naming behavior; the complete current claim, sole ordinary implementation file, six ordinary tests and sole TODO were independently reassessed.

Requirements include well-formed full names, one canonical definition in the Design inventory, errors for malformed markers/duplicates, chapter-derived identities and renaming on namespace moves, ASCII dotted identifiers, paragraph-contiguous opening prose, identical syntax inside Sage prose, and full-name references that do not define another rule. Independently testable behavior is an authoring/review obligation, not something identifier syntax can prove.

The associated duplicate-insertion loop in add_chapter_text checks the shared anchors map after qualification and diagnoses duplicate full names while retaining the first definition. The captured file also contains valid_anchor_name (ASCII identifier components), paragraph/role/single-backtick/nonempty-prose checks, chapter_namespace (Design prefix, README treatment, hyphen normalization, invalid component rejection), and qualified namespace plus local-name composition. Both Markdown and dedented Sage prose reach the same parser/insertion path. References are parsed into a separate collection and resolved against definitions after inventory loading, never inserted as definitions. Moving to a different chapter namespace consequently computes a different full name and leaves unupdated old references dangling; this is not automatic migration. The linked anchor_moves claim was captured to confirm that compatibility-link/migration policy is separate context, not a claim that the current name parser rewrites consumers.

All six ordinary test bodies were read. canonical_inventory_uses_configured_chapters_and_local_names asserts exactly the expected README-derived and normalized hyphenated names, correct namespace/context, and exclusion of tenets/RFD definitions. chapter_namespace_collisions_and_duplicate_local_rules_are_errors requires both namespace-collision and duplicate-full-name diagnostics and rejects dotted/outside-Design chapter paths. duplicate_names_are_rejected_across_documents requires one retained definition, one duplicate diagnostic attributed to the second document naming the first, and retention of the original file; validation preserves that error. malformed_roles_and_empty_or_misplaced_rules_are_errors enumerates fourteen malformed name/role/paragraph cases, including blank-separated prose, and requires diagnostics and no indexed anchor. reference_roles_validate_targets_but_ignore_code_examples requires exactly one actual reference, unknown-target and malformed-role diagnostics, and no false references from code examples. sage_prose_rules_have_precise_spans_model_owners_and_cross_source_references verifies valid chapter-qualified Sage names, exact rule content/source slices, model owners and context, and two cross-format references with exact original marker spans and no diagnostics. Its review-fragment assertion preserves exact claim content. The helpers source and BookFixture were captured and invoke real production parsing/loading; review claim construction was captured for that supplementary assertion.

The sole TODO definitions_across_markdown_and_sage preserves the broader cross-origin duplicate/reference/context/chapter-naming matrix, including fuller rename/move scenarios beyond the current examples. It is not treated as a passing behavioral test. Its explicit envelope-clause owner prerequisite remains unchanged and is relevant to the shared canonical_sources association: clause prose syntax, clause spans and stable owner representation must exist before that owner matrix can be asserted. Current ordinary coverage is substantial but does not silently complete this deferred matrix. The independently-testable-behavior requirement remains subject to substantive review of authored claims; this syntax checker does not claim semantic proof.

All aspects are accounted for by current code and assertions or the retained explicit TODO. No source edits or suite runs occurred in this review. Fresh start/read/record commands captured dependencies and current inputs; no prior verdict was blindly transplanted. No requested edits.

Browse meta anchors

116 anchors

Specification anchors and declared coverage
AnchorImplementationTests
meta (116)102 Implemented24 TODO103 Implemented36 TODO
meta.anchors (22)22 Implemented21 Implemented12 TODO
anchor_pagesImplementedImplementedTODO
book_explorerImplementedImplementedTODO
canonical_sourcesImplementedImplementedTODO
meta.anchors.content (7)7 Implemented7 Implemented
blocksImplementedImplemented
explicit_endImplementedImplemented
headingImplementedImplemented
literal_syntaxImplementedImplemented
next_anchorImplementedImplemented
source_endImplementedImplemented
unmatched_endImplementedImplemented
context_navigationImplementedImplementedTODO
evidence_statusImplementedImplementedTODO
explorer_navigationImplementedTODO
implementation_coverageImplementedImplementedTODO
implementation_referencesImplementedImplementedTODO
placeholder_statusImplementedImplementedTODO
point_excerptsImplementedImplementedTODO
region_balanceImplementedImplemented
region_excerptsImplementedImplementedTODO
test_coverageImplementedImplemented
test_referencesImplementedImplemented
unique_namesImplementedImplementedTODO
meta.book (21)10 Implemented18 TODO12 Implemented18 TODO
anchor_movesImplementedTODOImplementedTODO
authorityImplementedTODOImplementedTODO
browser_deliveryTODOImplementedTODO
browser_dependenciesTODOTODO
browser_rust_sourceTODOTODO
browser_searchTODOTODO
browser_serveTODOTODO
browser_structureTODOTODO
chapter_namesImplementedTODOImplementedTODO
crate_ownershipImplementedImplemented
crates_landingImplementedImplemented
entity_linksTODOTODO
index_groupsImplementedTODOImplementedTODO
index_namespace_pagesImplementedImplemented
index_rowsImplementedTODOImplementedTODO
index_statusImplementedTODOImplementedTODO
rfd_changesTODOTODO
sage_chaptersTODOImplementedTODO
self_descriptionTODOTODO
shared_modelImplementedTODOImplementedTODO
source_rolesTODOTODO
meta.contracts (4)4 Implemented3 TODO4 Implemented3 TODO
cache_invocationsImplementedTODOImplementedTODO
correspondenceImplementedImplemented
observation_coverageImplementedTODOImplementedTODO
validated_sessionImplementedTODOImplementedTODO
meta.language (39)39 Implemented39 Implemented
meta.language.calls (2)2 Implemented2 Implemented
declaredImplementedImplemented
forbiddenImplementedImplemented
meta.language.classes (3)3 Implemented3 Implemented
abstract_completeImplementedImplemented
override_signatureImplementedImplemented
single_inheritanceImplementedImplemented
meta.language.contexts (1)1 Implemented1 Implemented
inheritanceImplementedImplemented
meta.language.envelopes (7)7 Implemented7 Implemented
class_callsImplementedImplemented
createsImplementedImplemented
direct_callsImplementedImplemented
leafImplementedImplemented
permissionsImplementedImplemented
readsImplementedImplemented
receiver_callsImplementedImplemented
meta.language.fields (2)2 Implemented2 Implemented
context_stateImplementedImplemented
kindsImplementedImplemented
meta.language.methods (2)2 Implemented2 Implemented
kindsImplementedImplemented
proseImplementedImplemented
meta.language.model (3)3 Implemented3 Implemented
forbidden_pathsImplementedImplemented
inherited_prohibitionsImplementedImplemented
virtual_dispatchImplementedImplemented
meta.language.types (19)19 Implemented19 Implemented
argument_arityImplementedImplemented
declaration_proseImplementedImplemented
enum_variantsImplementedImplemented
field_proseImplementedImplemented
generic_parametersImplementedImplemented
member_commasImplementedImplemented
name_resolutionImplementedImplemented
opaque_representationImplementedImplemented
preludeImplementedImplemented
qualified_namesImplementedImplemented
recursive_valuesImplementedImplemented
struct_fieldsImplementedImplemented
tuplesImplementedImplemented
type_expressionsImplementedImplemented
unique_fieldsImplementedImplemented
unique_parametersImplementedImplemented
unique_variantsImplementedImplemented
unknown_namesImplementedImplemented
variant_proseImplementedImplemented
meta.reviews (27)27 Implemented27 Implemented
claim_textImplementedImplemented
complete_test_setImplementedImplemented
decisionsImplementedImplemented
fragment_associationsImplementedImplemented
fragment_formatImplementedImplemented
fragment_freshnessImplementedImplemented
gateImplementedImplemented
input_formatImplementedImplemented
input_fragmentsImplementedImplemented
output_formatImplementedImplemented
preparationImplementedImplemented
record_requiredImplementedImplemented
recorded_readsImplementedImplemented
recordingImplementedImplemented
review_delegationImplementedImplemented
review_diagnosticsImplementedImplemented
review_instructionsImplementedImplemented
review_scopeImplementedImplemented
selector_claimImplementedImplemented
selector_line_rangeImplementedImplemented
selector_testImplementedImplemented
selector_whole_fileImplementedImplemented
source_representationImplementedImplemented
stalenessImplementedImplemented
summary_formatImplementedImplemented
test_sourceImplementedImplemented
validation_layoutImplementedImplemented
meta.validation (3)3 TODO3 TODO
claim_specific_evidenceTODOTODO
independent_inspectionTODOTODO
review_packetsTODOTODO