meta.reviews.staleness

A saved review applies only when its anchor, schema version, review-policy version, complete claim, and implementation and test inputs match the current inventory. Source context must satisfy meta.reviews.fragment_freshness and associations must satisfy meta.reviews.fragment_associations. Unchanged claims and tests remain reusable when unrelated edits move them, as specified by their selectors. Changed text within a whole-file fragment, including blank-line changes, invalidates that fragment. A reusable review must also have a complete output under meta.reviews.output_format and no requested edits under meta.reviews.decisions.

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

Implementation

Implemented crates/sage-meta/src/review.rs:653–658

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.staleness`
pub fn acceptable<'a>(
    workspace: &Path,
    anchor: &str,
    input: &ReviewInput,
    checklist: &'a ReviewChecklist,

}

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::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::invalid_reports_and_stale_inputs_never_complete_an_active_review

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.recording)]
#[sage::test(meta.reviews.output_format)]
#[sage::test(meta.reviews.decisions)]
#[sage::test(meta.reviews.input_fragments)]
#[sage::test(meta.reviews.fragment_freshness)]
#[sage::test(meta.reviews.record_required)]
#[sage::test(meta.reviews.staleness)]
fn invalid_reports_and_stale_inputs_never_complete_an_active_review() {
    let fixture = Fixture::new();
    assert!(review::record(&fixture.0, "demo.rule", &Fixture::report()).is_err());
    fixture.start();
    for field in ["reviewer", "report", "edit"] {
        let mut output = Fixture::report();
        match field {
            "reviewer" => output.reviewer = "  ".into(),
            "report" => output.report.clear(),
            _ => output.requested_edits = vec!["\n".into()],
        }
        assert!(review::record(&fixture.0, "demo.rule", &output).is_err());
        assert!(!fixture.0.join("validations/demo.rule/output.json").exists());
    }
    let before = std::fs::read(fixture.0.join("validations/demo.rule/input.json")).unwrap();
    fixture.write(
        "src/behavior.rs",
        "// {anchor}`demo.rule`\npub fn result() -> u32 { 5 }\n",
    );
    assert!(review::record(&fixture.0, "demo.rule", &Fixture::report()).is_err());
    assert_eq!(
        before,
        std::fs::read(fixture.0.join("validations/demo.rule/input.json")).unwrap()
    );
    assert!(!sage_meta::check(&fixture.0).is_valid());
    fixture.start();
    let mut output = Fixture::report();
    output.requested_edits =
        vec!["Return four and add an assertion against the implementation.".into()];
    review::record(&fixture.0, "demo.rule", &output).unwrap();
    assert_eq!(
        review::load_saved(&fixture.0.join("validations"))
            .unwrap()
            .reviews[0]
            .output
            .as_ref(),
        Some(&output)
    );
    assert!(!sage_meta::check(&fixture.0).is_valid());
    let json: serde_json::Value = serde_json::from_slice(
        &std::fs::read(fixture.0.join("validations/demo.rule/output.json")).unwrap(),
    )
    .unwrap();
    assert_eq!(json.as_object().unwrap().len(), 3);
    assert!(json.get("decision").is_none());
    assert!(json.get("outcome").is_none());
}
}

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 ↗

Implemented sage_meta::unsupported_versions_and_mismatched_identity_cannot_pass

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.gate)]
#[sage::test(meta.reviews.summary_format)]
#[sage::test(meta.reviews.review_diagnostics)]
#[sage::test(meta.reviews.staleness)]
#[sage::test(meta.reviews.validation_layout)]
fn unsupported_versions_and_mismatched_identity_cannot_pass() {
    for field in ["schema_version", "policy_version", "anchor"] {
        let fixture = Fixture::new();
        fixture.approve();
        let mut summary = fixture.summary();
        summary[field] = if field == "anchor" {
            "demo.other".into()
        } else {
            999.into()
        };
        fixture.write(
            "validations/demo.rule/summary.json",
            &serde_json::to_string(&summary).unwrap(),
        );
        let report = sage_meta::check(&fixture.0);
        let error = report.ensure_valid().unwrap_err().to_string();
        assert!(error.contains("demo.rule"), "{error}");
        assert!(error.contains("sage-review-checklist/SKILL.md"), "{error}");
        let reason = if field == "anchor" {
            "does not match"
        } else {
            "unsupported schema/policy"
        };
        assert!(error.contains(reason), "{error}");
    }
}
}

See more source ↗

Implemented sage_meta::whole_files_and_ranges_preserve_exact_line_endings_and_detect_selected_edits

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.selector_whole_file)]
#[sage::test(meta.reviews.selector_line_range)]
#[sage::test(meta.reviews.recorded_reads)]
#[sage::test(meta.reviews.fragment_freshness)]
#[sage::test(meta.reviews.input_format)]
#[sage::test(meta.reviews.input_fragments)]
#[sage::test(meta.reviews.source_representation)]
#[sage::test(meta.reviews.staleness)]
fn whole_files_and_ranges_preserve_exact_line_endings_and_detect_selected_edits() {
    let fixture = Fixture::new();
    fixture.start();
    fixture.write("helper.txt", "first\r\n\r\nthird\nlast");
    assert_eq!(
        review::capture_read(
            &fixture.0,
            "demo.rule",
            "helper.txt",
            Selector::LineRange { start: 1, end: 2 }
        )
        .unwrap(),
        "first\r\n\r\n"
    );
    assert_eq!(
        review::capture_read(
            &fixture.0,
            "demo.rule",
            "helper.txt",
            Selector::LineRange { start: 4, end: 4 }
        )
        .unwrap(),
        "last"
    );
    for (start, end) in [(0, 1), (3, 2), (1, 5), (5, 5)] {
        assert!(
            review::capture_read(
                &fixture.0,
                "demo.rule",
                "helper.txt",
                Selector::LineRange { start, end }
            )
            .is_err()
        );
    }
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    fixture.write("helper.txt", "first\r\n\r\nUNSELECTED\nlast");
    assert!(sage_meta::check(&fixture.0).is_valid());
    fixture.write("helper.txt", "changed\r\n\r\nthird\nlast");
    assert!(!sage_meta::check(&fixture.0).is_valid());
    fixture.start();
    for _ in 0..2 {
        assert_eq!(
            review::capture_read(&fixture.0, "demo.rule", "helper.txt", Selector::WholeFile)
                .unwrap(),
            "changed\r\n\r\nthird\nlast"
        );
    }
    let input = fixture.input();
    let tail = &input.fragments[input.fragments.len() - 2..];
    assert_eq!(tail[0], tail[1]);
    assert_eq!(tail[0].contents.join("\n"), "changed\r\n\r\nthird\nlast");
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    fixture.write("helper.txt", "changed\r\n\r\nthird\nlast\n");
    assert!(!sage_meta::check(&fixture.0).is_valid());
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_094.

Fresh complete followup assessment of staleness. Saved/read the previous report and all captures before start, recaptured all four dependencies, and compared every fragment. The sole delta is an association comment for placeholder_status before test inventory construction in review.rs. The claim, all six associated tests, fixture helpers, review policy, check.rs and lib.rs are unchanged. There is no behavioral change to freshness or acceptance.

The full claim requires matching anchor/schema/policy, complete claim and implementation/test inputs, current selected source and association metadata, identity-based movement tolerance, exact whole-file text including whitespace, and complete output without requested edits. The sole ordinary implementation acceptable checks checklist versions, locates the matching anchor, requires inputs_match, requires output with nonblank reviewer/report and valid edit strings, and requires no edits. read_summary independently rejects directory/anchor mismatch and unsupported schema/policy; loading exposes invalid/unfinished records. input_errors compares verification prompt, implementation/test metadata and all initial fragments, then resolves every additional selector and checks exact content. Claim/test selectors use semantic identities rather than line offsets; whole-file source representation preserves blank lines and final newlines. record refuses invalid output or stale context before completion. Captured check orchestration uses inventory/load_saved/validate/acceptable rather than bypassing these checks. The new comment does not alter any path.

All six ordinary tests were read fully. unsupported_versions_and_mismatched_identity_cannot_pass separately mutates anchor, schema and policy and requires the gate to report the anchor and corresponding reason. added_or_removed_associations_invalidate_unchanged_saved_fragments requires failures after adding/removing tests and adding implementation evidence while explicitly preserving the earlier test metadata identity. test_selector_preserves_metadata_and_ignores_unrelated_line_movement asserts crate/target/path/file/cfg/status, exact captured function, continued validity after unrelated preceding text, and invalidity after cfg changes. complete_claim_blocks_are_selected_but_unrelated_movement_is_not_stale asserts full multiline paragraph/list/table/code text, survival of preceding blank-line and outside-prose edits, and invalidation for each changed substantive block. whole_files_and_ranges_preserve_exact_line_endings_and_detect_selected_edits verifies CRLF, blank lines, unterminated last line, invalid ranges, selected versus unselected range changes, repeated exact whole-file reads, and invalidation after merely adding a final newline. invalid_reports_and_stale_inputs_never_complete_an_active_review rejects recording without a start and blank output fields/edits, verifies output absence, rejects changed implementation text without rewriting input, and shows concrete requested edits keep the gate failing; it also verifies the exact three-field output shape.

The captured temporary-workspace fixture invokes real review/check APIs and leaves substantive assertions in test bodies. No TODO/N/A entries or deferrals exist. Plausible failures to compare versions, cfg, late claim blocks, blank-line text, or requested edits are directly targeted by these assertions. The actual single marker-only change was assessed against every requirement and the prior complete assessment; all other relied-on inputs were verified unchanged. No source edits or test reruns occurred; this review performed start/read/record and source inspection, with central execution 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