meta.reviews.input_fragments

Every piece of source context supplied to or consulted by a validation agent is recorded in one uniform collection of input fragments, whether prepared automatically, supplied by a coordinator, or declared by the reviewer. Helpers and surrounding context used during review are additional fragments; recording only the initial claim and tests does not excuse omitting other context used. Automatic preparation and recorded reads use the same fragment representation and freshness checks. Reviewers are responsible for declaring every source dependency used in their assessment.

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

Implementation

Implemented crates/sage-meta/src/review.rs:152–157

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.input_fragments`
// {anchor}`meta.reviews.review_scope`
// {anchor}`meta.book.index_status`
pub fn inventory(
    spec: &SpecIndex,
    rust: &CorrespondenceIndex,

}

See more source ↗

Tests and review

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

Implemented sage_meta::initial_context_preserves_instructions_and_exact_uniform_fragments

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.input_format)]
#[sage::test(meta.reviews.input_fragments)]
#[sage::test(meta.reviews.fragment_format)]
#[sage::test(meta.reviews.review_instructions)]
#[sage::test(meta.reviews.review_scope)]
#[sage::test(meta.reviews.source_representation)]
#[sage::test(meta.reviews.preparation)]
fn initial_context_preserves_instructions_and_exact_uniform_fragments() {
    let fixture = Fixture::new();
    let instructions = vec![
        "Check all scenarios.\nKeep this newline.".into(),
        "Account for TODO rationale.".into(),
    ];
    let input = review::start(&fixture.0, "demo.rule", instructions.clone()).unwrap();
    assert_eq!(input.coordinator_instructions, instructions);
    assert_eq!(input.prompt, review::PROMPT);
    assert_eq!(input, fixture.input());
    let claim = input
        .fragments
        .iter()
        .find(|f| matches!(&f.selector, Selector::Claim { anchor_id } if anchor_id == "demo.rule"))
        .unwrap();
    assert_eq!(claim.path, "md/design/README.md");
    assert_eq!(claim.contents.join("\n"), "The result is four.");
    let implementation = input
        .fragments
        .iter()
        .find(|f| f.path == "src/behavior.rs" && matches!(f.selector, Selector::WholeFile))
        .unwrap();
    assert_eq!(
        implementation.contents.join("\n"),
        std::fs::read_to_string(fixture.0.join("src/behavior.rs")).unwrap()
    );
    let test = input
        .fragments
        .iter()
        .find(|f| matches!(f.selector, Selector::Test { .. }))
        .unwrap();
    assert_eq!(test.path, "src/tests.rs");
    assert_eq!(test.contents.join("\n"), TEST);
    assert!(
        !input
            .fragments
            .iter()
            .any(|f| f.path == "src/tests.rs" && matches!(f.selector, Selector::WholeFile))
    );
    assert_eq!(input.implementations.len(), 1);
    assert_eq!(input.implementations[0].file, "src/behavior.rs");
    assert_eq!(input.implementations[0].status, TestStatus::Ordinary);
    assert_eq!(input.tests.len(), 1);
}
}

See more source ↗

Implemented sage_meta::input_keeps_complete_association_metadata_and_appends_context_in_one_collection

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.input_format)]
#[sage::test(meta.reviews.review_scope)]
#[sage::test(meta.reviews.input_fragments)]
#[sage::test(meta.reviews.preparation)]
fn input_keeps_complete_association_metadata_and_appends_context_in_one_collection() {
    let fixture = Fixture::new();
    fixture.write(
        "src/lib.rs",
        "#[sage::item(crate)] mod model {}\n#[cfg(unix)] mod behavior;\n#[cfg(test)] mod tests;\n",
    );
    let initial = fixture.start();
    let implementation = &initial.implementations[0];
    assert_eq!(implementation.crate_name, "demo");
    assert_eq!(implementation.target, "lib:demo");
    assert_eq!(implementation.module, "demo::behavior");
    assert_eq!(implementation.file, "src/behavior.rs");
    assert!(implementation.cfg.iter().any(|cfg| cfg.contains("unix")));
    assert!(
        implementation
            .excerpt
            .join("\n")
            .contains("pub fn result() -> u32 { 4 }")
    );
    assert!(!implementation.region);
    assert_eq!(implementation.status, TestStatus::Ordinary);
    assert_eq!(implementation.explanation, None);
    let test = &initial.tests[0];
    assert_eq!(test.crate_name, "demo");
    assert_eq!(test.target, "lib:demo");
    assert_eq!(test.rust_path, "demo::tests::verifies_result");
    assert_eq!(test.file, "src/tests.rs");
    assert!(test.cfg.iter().any(|cfg| cfg.contains("test")));
    assert_eq!(test.status, TestStatus::Ordinary);
    fixture.write("helper.txt", "extra context\n");
    assert_eq!(
        review::capture_read(&fixture.0, "demo.rule", "helper.txt", Selector::WholeFile).unwrap(),
        "extra context\n"
    );
    let captured = fixture.input();
    assert_eq!(captured.implementations, initial.implementations);
    assert_eq!(captured.tests, initial.tests);
    assert_eq!(
        &captured.fragments[..initial.fragments.len()],
        initial.fragments
    );
    assert_eq!(captured.fragments.len(), initial.fragments.len() + 1);
    assert_eq!(
        captured.fragments.last().unwrap().contents.join("\n"),
        "extra context\n"
    );
    let json = serde_json::to_value(&captured).unwrap();
    let mut keys: Vec<_> = json
        .as_object()
        .unwrap()
        .keys()
        .map(String::as_str)
        .collect();
    keys.sort();
    assert_eq!(
        keys,
        [
            "coordinator_instructions",
            "fragments",
            "implementations",
            "prompt",
            "tests"
        ]
    );
}
}

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

Reviewed all requirements of meta.reviews.input_fragments, associated review.rs source and all four complete associated tests. This is source inspection; no behavior tests were executed, and central suite results are separate evidence.

inventory creates claim, whole implementation-file and complete semantic test fragments in the single ReviewInput.fragments vector, each using InputFragment path/selector/source_lines. capture_read resolves a declared dependency with select, appends that same InputFragment representation, persists the expanded input and only then returns its text. There is no alternate helper-context format exempt from freshness. input_errors compares current initial fragments as an ordered prefix, then reselects every appended fragment and compares exact joined contents; missing/ambiguous selectors and changed text are errors. record invokes that validation before writing output and does not rewrite saved input to conceal stale context. Captured correspondence and fixture sources explain initial selection; captured check wiring applies the same validation after recording.

Dependency completeness is explicitly reviewer-declared, not an automatic audit of arbitrary tool reads. The captured review skill requires capture of additional source dependencies before using them, including helpers and surrounding context, and warns coordinators against uncaptured context. PROMPT likewise requires following and capturing helpers. This is the claim's stated responsibility allocation: availability of initial claim/tests does not excuse undeclared extra context. Ordered coordinator instruction text is stored separately as instructions; coordinator-supplied source context must still be captured as fragments.

initial_context_preserves_instructions_and_exact_uniform_fragments asserts exact saved/returned input, prompt/instructions and claim/implementation/test paths/selectors/reconstructed text, including semantic tests rather than whole test files. input_keeps_complete_association_metadata_and_appends_context_in_one_collection checks all metadata, an extra helper read's exact text, unchanged association vectors and initial-fragment prefix, precisely one appended fragment and the single schema collection. whole_files_and_ranges_preserve_exact_line_endings_and_detect_selected_edits verifies extra range/whole-file reads with mixed line endings, invalid-range rejection, retained validity for unselected edits, failure for selected edits, repeated capture equality and terminal-newline freshness. invalid_reports_and_stale_inputs_never_complete_an_active_review rejects recording before start and malformed reports, then mutates an initial implementation source and asserts failed recording preserves input bytes and leaves the gate invalid; it also checks a concrete changes-requested report can be recorded without passing the gate. Captured Fixture/TEST helpers perform real workspace/read/write/review operations, with substantive assertions in the test bodies.

These tests jointly establish uniform initial/later context and shared exact freshness handling. Reviewer declaration remains a process obligation, not falsely claimed automated source-read detection. No TODO or N/A entries are associated with this anchor. No concrete defect or additional necessary edit was found; no source changes are requested.

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