meta.reviews.test_source

Each associated test’s review input contains the complete annotated Rust function source, including its attributes, signature, body, and contained comments. It also records the Cargo crate and target, Rust path, file path, inherited configuration conditions, and ordinary, todo, or not_applicable status. Source line numbers and byte offsets are excluded from the input.

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

Implementation

Implemented crates/sage-meta/src/review.rs:215–220

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
        // {anchor}`meta.reviews.test_source`
        // {anchor}`crates.sage_test_harness.compile_tests.review_visibility`
        let mut tests = Vec::new();
        let mut test_fragments = BTreeMap::new();
        for site in rust.tests.get(name).into_iter().flatten() {
            let source = rust

}

See more source ↗

Tests and review

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

Implemented sage_meta::accepted_placeholder_reports_preserve_todo_and_na_evidence

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.decisions)]
#[sage::test(meta.reviews.review_scope)]
#[sage::test(meta.reviews.input_format)]
#[sage::test(meta.reviews.test_source)]
fn accepted_placeholder_reports_preserve_todo_and_na_evidence() {
    for (module, expected) in [
        ("todo", TestStatus::Todo),
        ("not_applicable", TestStatus::NotApplicable),
    ] {
        let fixture = Fixture::new();
        fixture.write("src/behavior.rs", &format!("mod {module} {{\n// {{anchor}}`demo.rule`\n// Deferred until the concrete backend exists; editorial for N/A.\nfn placeholder() {{}}\n}}"));
        fixture.write("src/tests.rs", &format!("mod {module} {{\n// Deferred until the concrete backend exists; editorial for N/A.\n#[test] #[sage::test(demo.rule)] fn placeholder() {{}}\n}}"));
        let input = fixture.start();
        assert_eq!(input.tests[0].status, expected);
        assert_eq!(input.implementations[0].status, expected);
        assert!(
            input.implementations[0]
                .explanation
                .as_ref()
                .unwrap()
                .contains("backend")
        );
        let mut output = Fixture::report();
        output.report = "The explicit placeholder explains why concrete evidence is unavailable and names its prerequisite. This accepts the stated gap, not implemented behavior.".into();
        review::record(&fixture.0, "demo.rule", &output).unwrap();
        let check = sage_meta::check(&fixture.0);
        assert!(check.is_valid());
        let stage = check.review.unwrap();
        assert_eq!(stage.approved, 0);
        assert_eq!(
            (stage.todo, stage.not_applicable),
            if module == "todo" { (1, 0) } else { (0, 1) }
        );
    }
}
}

See more source ↗

Implemented sage_meta::inline_test_capture_preserves_intent_and_excludes_macro_implementation

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.test_source)]
#[sage::test(crates.sage_test_harness.compile_tests.review_visibility)]
fn inline_test_capture_preserves_intent_and_excludes_macro_implementation() {
    let fixture = Fixture::new();
    let inline = r##"#[test]
#[sage::test(demo.rule)]
fn inline_case() {
    compile_test! {
        source: "fn f() { missing; } //# ERROR if SAGE\n//# WARN if rustc",
        edition: "2021",
        diagnostics: expect![[r#"expected diagnostic"#]],
    }
}"##;
    let macro_source = "macro_rules! compile_test { ($($tt:tt)*) => {} }\n";
    fixture.write("src/tests.rs", &format!("{macro_source}{inline}"));
    let input = fixture.start();
    let captured = input
        .fragments
        .iter()
        .find(|fragment| matches!(fragment.selector, Selector::Test { .. }))
        .unwrap();
    assert_eq!(captured.contents.join("\n"), inline);
    assert!(input.fragments.iter().all(|fragment| {
        !fragment
            .contents
            .join("\n")
            .contains("macro_rules! compile_test")
    }));
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    assert!(sage_meta::check(&fixture.0).is_valid());
    let changed_macro = macro_source.replace("=> {}", "=> { panic!() }");
    fixture.write("src/tests.rs", &format!("{changed_macro}{inline}"));
    assert!(sage_meta::check(&fixture.0).is_valid());
    // Severity and compiler qualifiers express intended behavior. Each edit
    // must invalidate approval even without any changed observed snapshot.
    for changed in [
        inline.replace("ERROR", "WARN"),
        inline.replace("WARN", "ERROR"),
        inline.replace("if SAGE", "if rustc"),
        inline.replace("if rustc", "if SAGE"),
    ] {
        fixture.write("src/tests.rs", &format!("{changed_macro}{changed}"));
        assert!(!sage_meta::check(&fixture.0).is_valid(), "{changed}");
    }
}
}

See more source ↗

Implemented sage_meta::test_selector_preserves_metadata_and_ignores_unrelated_line_movement

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.test_source)]
#[sage::test(meta.reviews.selector_test)]
#[sage::test(meta.reviews.staleness)]
#[sage::test(meta.reviews.fragment_associations)]
#[sage::test(meta.reviews.input_format)]
#[sage::test(meta.reviews.fragment_freshness)]
fn test_selector_preserves_metadata_and_ignores_unrelated_line_movement() {
    let fixture = Fixture::new();
    fixture.write(
        "src/tests.rs",
        &format!("#[cfg(unix)]\nmod nested {{\n{TEST}\n}}\n"),
    );
    let input = fixture.start();
    let test = &input.tests[0];
    assert_eq!(test.crate_name, "demo");
    assert_eq!(test.target, "lib:demo");
    assert_eq!(test.rust_path, "demo::tests::nested::verifies_result");
    assert_eq!(test.file, "src/tests.rs");
    assert!(test.cfg.iter().any(|cfg| cfg.contains("unix")));
    assert!(test.cfg.iter().any(|cfg| cfg.contains("test")));
    assert_eq!(test.status, TestStatus::Ordinary);
    let selector = Selector::Test {
        crate_name: test.crate_name.clone(),
        target: test.target.clone(),
        rust_path: test.rust_path.clone(),
    };
    assert_eq!(
        review::capture_read(&fixture.0, "demo.rule", "src/tests.rs", selector).unwrap(),
        TEST
    );
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    fixture.write(
        "src/tests.rs",
        &format!("// Unrelated\n\n#[cfg(unix)]\nmod nested {{\n{TEST}\n}}\n"),
    );
    assert!(sage_meta::check(&fixture.0).is_valid());
    fixture.write(
        "src/tests.rs",
        &format!("#[cfg(windows)]\nmod nested {{\n{TEST}\n}}\n"),
    );
    assert!(!sage_meta::check(&fixture.0).is_valid());
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Fresh complete followup assessment of test_source. Saved and read prior report/inputs before start, recaptured all five dependencies, and compared every current fragment. The sole delta is the added placeholder_status association comment immediately before test inventory construction in review.rs. Claim, three tests, correspondence span/cfg extraction, status helper, fixture and design policy are unchanged. No input representation behavior changed.

The complete claim requires the whole annotated test function (attributes/signature/body/contained comments), crate/target/Rust path/file/inherited cfg/status metadata, and exclusion of source coordinates. The sole ordinary implementation association owns the inventory conversion: it slices the original function span, preserves text through source_lines, constructs a semantic Selector::Test fragment keyed by source path/crate/target/Rust path, copies all required metadata to ReviewTest and classifies status from the owner. Neither ReviewTest nor Selector::Test stores line/byte positions; extraction spans remain internal. Missing source and ambiguous identities fail rather than yielding truncated input. Captured correspondence helpers supply complete item spans, accumulated module and function cfg, and byte conversion to original source. Captured placeholder_status preserves TODO/N/A module ancestry and otherwise Ordinary. The new comment connects this existing behavior to another claim without changing it.

All three ordinary test bodies were read fully. test_selector_preserves_metadata_and_ignores_unrelated_line_movement directly asserts every identity field, inherited test/unix cfg and Ordinary status; exact TEST equality includes attributes, signature, contained comment and assertion. Approval survives unrelated preceding text but fails after cfg changes, exposing coordinate leakage or metadata omission. inline_test_capture_preserves_intent_and_excludes_macro_implementation requires exact equality with the full annotated function including macro input, options, expectation and diagnostic markers. It excludes the external macro definition, preserves validity after changing only that definition and invalidates after each changed severity/compiler qualifier inside the function. accepted_placeholder_reports_preserve_todo_and_na_evidence checks both placeholder statuses explicitly, retains rationale and verifies that an accepted report counts deferred/N/A evidence rather than ordinary approved behavior. These fixture placeholders are substantive tests of classification, not deferred evidence for this claim.

The recaptured fixture constructs real source files and calls production APIs; assertion details remain in the annotated bodies. There are no TODO/N/A implementation or test associations for this anchor and no deferred requirement. The one marker-only delta was assessed against the complete prior accounting, with all other relied-on inputs verified unchanged. No source changes or test-suite reruns occurred; this review performed fresh start/read/record and source inspection, while central execution is reported separately. 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