meta.anchors.content.next_anchor

A new anchor definition ends the preceding anchor’s content immediately before the new marker. The new definition belongs to its own anchor; content extents do not overlap.

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

Implementation

Implemented crates/sage-meta/src/spec.rs:381–386

sage_meta::spec · lib:sage_meta

#![allow(unused)]
fn main() {
                    // {anchor}`meta.anchors.content.next_anchor`
                    finish_anchor(&source.source, start, &mut active, &mut anchors);
                    active = Some(SpecAnchor {
                        name: name.to_string(),
                        file: source.file.clone(),
                        span: Span {

}

See more source ↗

Tests and review

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

Implemented sage_meta::claims_retain_all_blocks_until_the_next_definition_or_document_end

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.anchors.content.blocks)]
#[sage::test(meta.anchors.content.next_anchor)]
#[sage::test(meta.anchors.content.source_end)]
#[sage::test(meta.anchors.content.explicit_end)]
#[sage::test(meta.anchors.content.unmatched_end)]
fn claims_retain_all_blocks_until_the_next_definition_or_document_end() {
    let body = "Cachés retain **results**.\n\nA later paragraph qualifies the rule.\n\n- Keep unchanged inputs.\n- Recompute edited inputs.\n\n| Input | Result |\n| --- | --- |\n| same | reused |\n\n```rust\nlet résultat = cached();\n```\n\n    An indented example.\n\n> A quoted qualification.";
    let text = format!(
        "# Règles\n\n{{anchor}}`meta.first`\n{body}\n\n{{anchor}}`meta.second` Réévaluate.\n\nFinal qualification.  \n\n"
    );
    let index = SpecIndex::from_sources(&[source("rules.md", &text)]);
    assert!(index.diagnostics.is_empty(), "{:?}", index.diagnostics);
    let first = &index.anchors["meta.first"];
    let second = &index.anchors["meta.second"];
    assert_eq!(first.content, body);
    assert_eq!(second.content, "Réévaluate.\n\nFinal qualification.");
    for anchor in [first, second] {
        assert_eq!(
            &text[anchor.content_span.start..anchor.content_span.end],
            anchor.content
        );
    }
    assert!(first.content_span.end < second.span.start);
}
}

See more source ↗

Review: Accepted · final_quality.

Fresh final marker followup of meta.anchors.content.next_anchor. Preserved the previous input/output, started fresh, read the complete claim, associated implementation and test, and recaptured the prior source helper at tests/spec.rs lines 10–15. Compared all fragments by path/selector and implementation/test metadata. The sole change is an implementation_references comment on spec.rs validate_implementation_references. All claim, behavior, test, helper and metadata contents are unchanged; no fragments were removed. I assessed this unrelated marker delta against the complete prior findings and current relevant source.

The sole ordinary implementation association is the new-definition branch of parse_anchors. After validating definition syntax, paragraph position, identifier and prose, it calls finish_anchor with the new marker start, then creates a fresh active SpecAnchor with its own marker span and content start after the new name token. finish_anchor takes the previous active anchor, slices only up to that supplied boundary, trims surrounding whitespace and computes matching original source content spans. Therefore the new marker/text cannot enter the previous claim, and the new claim owns subsequent content. A first definition is allowed when no preceding active anchor exists. All helpers are within the captured implementation file.

The sole ordinary test claims_retain_all_blocks_until_the_next_definition_or_document_end creates a first marker on its own line and a second with same-line prose, without explicit ends. The first body contains Unicode prose, multiple paragraphs, a list, table, fenced and indented code and quotation. It asserts no diagnostics, exact first content equal to that body and exact second content equal to its own Unicode rule plus final qualification. For both anchors it verifies original-source content_span slices equal stored text, then explicitly asserts first.content_span.end < second.span.start. These assertions establish closure before the next marker, independent ownership and nonoverlap; the gap is boundary whitespace trimmed by finish_anchor. The captured source helper directly creates SpecSource, and the test invokes production from_sources. No TODO/N/A entries exist.

All claim aspects remain supported; the added association comment has no semantic effect. No source edits, formatting, test runs or workspace build were performed. Executed review start/read, capture comparisons and record only. 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