meta.reviews.claim_text

An anchor’s review text is the complete source content selected by the anchor-content boundaries, with surrounding whitespace removed. For .sage prose, its enclosing common indentation is removed first; remaining internal whitespace and Markdown markup are preserved. The saved input covers the same content that the generated anchor views present as the claim, including any paragraphs, lists, or examples within its extent.

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

Implementation

Implemented crates/sage-meta/src/browser.rs:145–150

sage_meta::browser · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.claim_text`
pub fn render_spec_markdown(
    spec: &crate::spec::SpecIndex,
    file: &str,
    text: &str,
    page_url: &str,

}

See more source ↗

Implemented crates/sage-meta/src/review.rs:177–182

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
        // {anchor}`meta.reviews.claim_text`
        let mut fragments = vec![InputFragment {
            path: claim_path(workspace, &anchor.file)?,
            selector: Selector::Claim {
                anchor_id: name.clone(),
            },

}

See more source ↗

Implemented crates/sage-meta/src/spec.rs:416–421

sage_meta::spec · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.claim_text`
// {anchor}`meta.reviews.selector_claim`
fn finish_anchor(
    source: &str,
    end: usize,
    active: &mut Option<SpecAnchor>,

}

See more source ↗

Implemented crates/sage-meta/src/book/anchors.rs:274–279

sage_meta::book::anchors · bin:sage-meta

mdBook parses this HTML inside a larger raw HTML wrapper. Encode line breaks so blank lines in examples cannot end that wrapper.

#![allow(unused)]
fn main() {
    // {anchor}`meta.reviews.claim_text`
    fn claim(&self, anchor: &SpecAnchor, url: &str) -> String {
        // mdBook parses this HTML inside a larger raw HTML wrapper. Encode
        // line breaks so blank lines in examples cannot end that wrapper.
        sage_meta::render_spec_markdown(self.spec, &anchor.file, &anchor.content, url)
            .expect("claim roles were validated before page generation")

}

See more source ↗

Tests and review

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

Implemented sage_meta::anchor_pages_and_disclosures_render_the_complete_reviewed_content

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.claim_text)]
fn anchor_pages_and_disclosures_render_the_complete_reviewed_content() {
    let fixture = Fixture::new("manual");
    fixture.doc("SUMMARY.md", "# Summary\n\n- [Design](design/README.md)\n  - [Crates](design/crates/README.md)\n  - [Handwritten](design/handwritten.md)\n  - [Anchors](design/anchor/README.md)\n");
    fixture.doc("design/anchor/README.md", "# Anchors\n");
    let claim = "The **cached result** is reused.\n\nA second paragraph preserves `identity` with [crate context](crates/README.md).\n\n- Same input\n- Same result\n\n| Input | Result |\n| --- | --- |\n| unchanged | reused |\n\n```rust\nassert_eq!(first, second);\n\n// The blank line belongs to this example.\nassert!(cached);\n```";
    let definitions = format!(
        "# Handwritten\n\n{{anchor}}`multiblock`\n{claim}\n\n<!-- end anchor -->\n\nUnrelated commentary is outside the claim.\n"
    );
    fixture.doc("design/handwritten.md", &definitions);
    let spec = sage_meta::spec::SpecIndex::load_workspace(&fixture.root).unwrap();
    assert!(spec.diagnostics.is_empty(), "{:?}", spec.diagnostics);
    let rust = sage_meta::correspondence::CorrespondenceIndex::load(&fixture.root).unwrap();
    let inputs = sage_meta::review::inventory(&spec, &rust).unwrap();
    let claim_fragment = inputs["handwritten.multiblock"]
        .fragments
        .iter()
        .find(|fragment| {
            matches!(
                &fragment.selector,
                sage_meta::review::Selector::Claim { anchor_id }
                    if anchor_id == "handwritten.multiblock"
            )
        })
        .unwrap();
    assert_eq!(claim_fragment.contents.join("\n"), claim);

    let mut input = fixture.input("items");
    let children = input[1]["items"][0]["Chapter"]["sub_items"]
        .as_array_mut()
        .unwrap();
    children[1]["Chapter"]["content"] = json!(definitions);
    children.push(json!({"Chapter":{"name":"Anchors","content":"# Anchors\n","path":"design/anchor/README.md","source_path":"design/anchor/README.md","number":[2,3],"parent_names":["Design"],"sub_items":[]}}));
    let output = fixture.run(&input);
    assert!(
        output.status.success(),
        "{}",
        String::from_utf8_lossy(&output.stderr)
    );
    let book: Value = serde_json::from_slice(&output.stdout).unwrap();
    let entries = chapters(book["items"].as_array().unwrap());
    let page = entries["design/anchor/handwritten/multiblock.md"]["content"]
        .as_str()
        .unwrap();
    let definition = page
        .split_once("<div class=\"anchor-definition\">")
        .unwrap()
        .1
        .split_once("</div>")
        .unwrap()
        .0;
    let overview = entries["design/anchor/README.md"]["content"]
        .as_str()
        .unwrap();
    let disclosure = overview
        .split_once("data-anchor-text=\"handwritten.multiblock\"")
        .unwrap()
        .1
        .split_once("<td colspan=\"3\">")
        .unwrap()
        .1
        .split_once("<p><a href=")
        .unwrap()
        .0;
    for (rendered, crate_href) in [
        (definition, "../../crates/index.html"),
        (disclosure, "../crates/index.html"),
    ] {
        assert!(
            !rendered.contains("\n\n"),
            "raw HTML must survive mdBook's Markdown pass"
        );
        let rendered = rendered.replace("&#10;", "\n");
        assert!(rendered.contains("<p>The <strong>cached result</strong> is reused.</p>"));
        assert!(rendered.contains("<p>A second paragraph preserves <code>identity</code>"));
        assert!(rendered.contains(&format!("href=\"{crate_href}\">crate context</a>")));
        assert!(rendered.contains("<ul>\n<li>Same input</li>\n<li>Same result</li>\n</ul>"));
        assert!(rendered.contains("<table>"));
        assert!(rendered.contains("<th>Input</th><th>Result</th>"));
        assert!(rendered.contains("<td>unchanged</td><td>reused</td>"));
        assert!(rendered.contains(
            "<pre><code class=\"language-rust\">assert_eq!(first, second);\n\n// The blank line belongs to this example.\nassert!(cached);\n</code></pre>"
        ));
        assert!(!rendered.contains("end anchor"));
        assert!(!rendered.contains("Unrelated commentary"));
    }
    assert_eq!(
        definition.replace("../../crates/index.html", "../crates/index.html"),
        disclosure,
        "the page and disclosure present the same claim with page-relative links"
    );
    for (chapter, protected_claim) in [(page, definition), (overview, disclosure)] {
        let events = pulldown_cmark::Parser::new_ext(chapter, pulldown_cmark::Options::all())
            .collect::<Vec<_>>();
        assert!(events.iter().all(|event| !matches!(
            event,
            pulldown_cmark::Event::Start(pulldown_cmark::Tag::CodeBlock(_))
        )));
        assert!(
            events.iter().all(|event| !matches!(
                event,
                pulldown_cmark::Event::Text(text) if text.contains("assert!(cached)")
            )),
            "an example must not escape its generated HTML into Markdown prose"
        );
        let mut final_html = String::new();
        pulldown_cmark::html::push_html(&mut final_html, events.into_iter());
        assert!(
            final_html.contains(protected_claim),
            "mdBook's Markdown pass must retain the complete claim HTML"
        );
    }
    let context = entries["design/handwritten.md"]["content"]
        .as_str()
        .unwrap();
    assert!(context.contains("Unrelated commentary is outside the claim."));
}
}

See more source ↗

Implemented sage_meta::complete_claim_blocks_are_selected_but_unrelated_movement_is_not_stale

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.claim_text)]
#[sage::test(meta.reviews.selector_claim)]
#[sage::test(meta.reviews.staleness)]
#[sage::test(meta.reviews.source_representation)]
fn complete_claim_blocks_are_selected_but_unrelated_movement_is_not_stale() {
    let fixture = Fixture::new();
    let body = "First **paragraph**.\n\nSecond paragraph.\n\n- list item\n\n| A | B |\n|---|---|\n| 1 | 2 |\n\n```rust\nlet x = 4;\n```";
    let claim =
        format!("# Heading\n\n{{anchor}}`demo.rule`\n{body}\n\n<!-- end anchor -->\nOutside\n");
    fixture.write("md/design/README.md", &claim);
    let input = fixture.start();
    let fragment = input
        .fragments
        .iter()
        .find(|f| matches!(f.selector, Selector::Claim { .. }))
        .unwrap();
    assert_eq!(fragment.contents.join("\n"), body);
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    fixture.write(
        "md/design/README.md",
        &format!("\n\n{}", claim.replace("Outside", "Changed outside")),
    );
    assert!(sage_meta::check(&fixture.0).is_valid());
    for text in ["Second paragraph", "list item", "| 1 | 2 |", "let x = 4"] {
        fixture.write("md/design/README.md", &claim.replace(text, "changed"));
        assert!(!sage_meta::check(&fixture.0).is_valid(), "{text}");
    }
}
}

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 ↗

Review: Accepted · final_quality.

Fresh final marker followup of meta.reviews.claim_text. Preserved previous input/output, started fresh, read the complete claim and three ordinary test bodies, and recaptured every prior dependency: book/spec/review fixtures, parser prose extraction and book escaping. Compared all fragments by path/selector and both association metadata sets. Only an implementation_references association comment in spec.rs changed. All claim, behavior, tests, helpers and metadata are unchanged; no fragments were removed. This unrelated marker was reassessed against the complete prior findings below.

All four ordinary implementation entries are accounted for. spec.rs parse_anchors finalizes at real next-definition/heading/explicit-end/source-end boundaries; finish_anchor takes the whole selected source slice and trims only surrounding whitespace while retaining original spans. Sage load_workspace dedents each prose block first using common indentation among nonblank lines and retains an offset map. Relative indentation, internal newlines, Unicode and Markdown remain. Captured Parser::prose supplies the triple-quoted interior and original extent. review.rs inventory passes anchor.content through newline splitting into Claim fragments; claim selection re-resolves the same canonical content, without positional identity. AnchorPages::claim passes that same content to browser.rs render_spec_markdown for both page and disclosure views. Rendering supports rich Markdown, page-relative links and literal code, protects roles and escapes raw HTML. Outer newline encoding keeps generated raw-HTML wrappers intact through the subsequent Markdown stage. Saved source Markdown and rendered claim meaning are corresponding representations, not identical HTML strings.

complete_claim_blocks_are_selected_but_unrelated_movement_is_not_stale asserts exact captured Markdown containing later paragraph/list/table/fenced code, permits unrelated preceding/outside movement, then independently changes each later content category and requires stale validation. sage_prose_rules_have_precise_spans_model_owners_and_cross_source_references asserts exact normalized Sage text and identical review claim including Unicode, paragraphs/list/code and retained relative indentation, plus original source slices and separate member/method claims. anchor_pages_and_disclosures_render_the_complete_reviewed_content asserts exact source claim, runs actual preprocessing and checks both page definition and disclosure for bold/code, second paragraph, relative link, list, table and complete fenced example with its blank line. Both exclude the end marker/outside commentary while original context retains commentary. Their content is equal after only href normalization; a subsequent Markdown pass preserves the protected HTML and does not leak the example into prose/code events. Fixture helpers use actual inputs and production review/preprocessing paths; these assertions are visible in the tests.

Together these tests substantiate complete extent capture, surrounding-only trimming, Sage dedenting with internal preservation, later-content freshness and generated-view correspondence. No TODO/N/A entries exist. The marker-only change alters none of these conclusions. No source edits, formatting, tests 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