meta.reviews.fragment_associations

The complete association set and its metadata remain checked separately from fragment contents. Adding, removing, or changing an association invalidates the review even when all saved fragments still resolve to unchanged text.

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

Implementation

Implemented crates/sage-meta/src/review.rs:382–387

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.fragment_associations`
// {anchor}`meta.reviews.fragment_freshness`
pub fn input_errors(workspace: &Path, saved: &ReviewInput, current: &ReviewInput) -> Vec<String> {
    let mut errors = Vec::new();
    if saved.prompt != current.prompt {
        errors.push("verification prompt changed".into());

}

See more source ↗

Tests and review

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

Implemented sage_meta::added_or_removed_associations_invalidate_unchanged_saved_fragments

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.complete_test_set)]
#[sage::test(meta.reviews.fragment_associations)]
#[sage::test(meta.reviews.input_format)]
#[sage::test(meta.reviews.review_diagnostics)]
#[sage::test(meta.reviews.staleness)]
fn added_or_removed_associations_invalidate_unchanged_saved_fragments() {
    let fixture = Fixture::new();
    fixture.approve();
    let original = fixture.input();
    let second = "#[test] #[sage::test(demo.rule)] fn second() { assert_eq!(1 + 3, 4); }";
    fixture.write("src/tests.rs", &format!("{TEST}\n{second}"));
    let error = sage_meta::check(&fixture.0)
        .ensure_valid()
        .unwrap_err()
        .to_string();
    assert!(error.contains("demo.rule"), "{error}");
    assert!(error.contains("test associations"), "{error}");
    assert!(error.contains("sage-review-checklist/SKILL.md"), "{error}");
    let current = fixture.start();
    assert_eq!(current.tests.len(), 2);
    assert_eq!(current.tests, fixture.start().tests);
    assert_eq!(
        original.tests[0],
        *current
            .tests
            .iter()
            .find(|t| t.rust_path.ends_with("verifies_result"))
            .unwrap()
    );
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    fixture.write("src/tests.rs", TEST);
    let error = sage_meta::check(&fixture.0)
        .ensure_valid()
        .unwrap_err()
        .to_string();
    assert!(error.contains("demo.rule"), "{error}");
    assert!(error.contains("test associations"), "{error}");
    assert!(error.contains("sage-review-checklist/SKILL.md"), "{error}");
    fixture.approve();
    fixture.write("src/lib.rs", "#[sage::item(crate)] mod model {}\nmod behavior;\n#[cfg(test)] mod tests;\n// {anchor}`demo.rule`\nfn another_implementation() {}\n");
    let error = sage_meta::check(&fixture.0)
        .ensure_valid()
        .unwrap_err()
        .to_string();
    assert!(error.contains("demo.rule"), "{error}");
    assert!(error.contains("implementation associations"), "{error}");
    assert!(error.contains("sage-review-checklist/SKILL.md"), "{error}");
    assert_eq!(fixture.start().implementations.len(), 2);
}
}

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 · final_quality.

Reviewed the complete meta.reviews.fragment_associations claim, associated review.rs source, and both complete associated tests. This is source inspection; no behavior tests were executed by this reviewer, and central suite execution is reported separately.

ReviewInput stores implementation and test association metadata separately from InputFragment contents. inventory reconstructs the full per-anchor collections in deterministic order. ReviewImplementation includes crate/target/module/file, cfg, excerpt form, region, status and explanation; ReviewTest includes crate/target/Rust path/file, cfg and status. input_errors compares saved/current implementation and test vectors before independently validating fragment content and selectors. Therefore an unchanged captured body does not excuse a changed association or inherited metadata. record and normal review validation use current inventory/input_errors, so the separation applies to recording and later gate checks. Captured correspondence and evidence helpers establish how per-target/module cfg and status metadata are obtained independently of a test function's text, and captured shared check code routes stale-review issues into failure.

added_or_removed_associations_invalidate_unchanged_saved_fragments starts from an approved one-test input, appends another test and asserts the named anchor's test-associations failure with required review guidance. It asserts two tests in a refreshed deterministic inventory and exact preservation of the original test metadata. After recording that set it removes the second association and again asserts the association failure. It then adds an implementation in another file and requires the distinct implementation-associations diagnostic and a refreshed two-entry implementation list. Thus the test does not merely change a previously captured body to trigger generic staleness.

test_selector_preserves_metadata_and_ignores_unrelated_line_movement provides the crucial metadata-only case. It places unchanged TEST text under a cfg(unix) module and asserts crate, target, qualified Rust path, file, inherited unix/test conditions and Ordinary status. Semantic capture must return exactly TEST. After recording, adding unrelated comments/blank lines above the module stays valid. Replacing the enclosing condition with cfg(windows) while keeping TEST identical invalidates the review. Together the positive unrelated-movement assertion and negative inherited-condition assertion establish that metadata is checked separately from selected function contents.

Captured Fixture/TEST helpers create actual Cargo and specification inputs, start/record reviews and read saved input; the decisive checks are visible in the annotated bodies. Both additions/removals and changed association metadata are covered, including implementation/test separation. There are no TODO or N/A entries. No concrete defect or further necessary source edit was identified; requested edits are empty.

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