meta.reviews.fragment_format

Each fragment records its workspace-relative source path, selector, and exact selected contents. Contents are stored as source lines; joining them with newline characters recovers the selected text, including its whitespace and line endings. The data model is defined below in Rust notation, without prescribing a JSON encoding:

struct InputFragment {
    path: String,           // Workspace-relative UTF-8 source file path.
    selector: Selector,
    contents: Vec<String>, // Join with '\n' to recover the selected text.
}

enum Selector {
    WholeFile,
    LineRange { start: usize, end: usize },
    Claim { anchor_id: String },
    Test {
        crate_name: String,
        target: String,
        rust_path: String,
    },
}

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

Implementation

Implemented crates/sage-meta/src/review.rs:56–61

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.fragment_format`
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct InputFragment {
    pub path: String,
    pub selector: Selector,

}

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 ↗

Review: Accepted · final_quality.

Fresh final marker followup of meta.reviews.fragment_format. Preserved prior input/output, started fresh, read the full claim and associated test, and recaptured all prior dependencies: fixture helpers lines 1–106, the semantic whole_files_and_ranges_preserve_exact_line_endings_and_detect_selected_edits test selector, correspondence.rs, spec.rs and workspace.rs. Compared all fragments by path/selector and both association metadata sets. Only an implementation_references comment in the supplementary spec.rs capture changed. All fragment-format implementation behavior, claim, tests, helpers and metadata remain unchanged; no fragments were removed. I assessed this isolated marker against the complete prior findings below.

The sole ordinary implementation association covers InputFragment in review.rs. Its fields are exactly workspace-relative path, selector and source-line contents. Selector provides WholeFile, inclusive LineRange start/end, Claim anchor_id and Test crate_name/target/rust_path, consistent with the claim without imposing an extra JSON encoding requirement. Initial inventory takes relative claim paths from the configured workspace book root and implementation/test paths from Cargo source inventory. Additional reads validate workspace-relative nontraversing paths resolving inside the workspace. Semantic selectors check identities and source paths; whole-file/range reads use UTF-8 source directly.

source_lines splits on newline characters, preserving carriage returns, blank elements and terminal empty elements. Joining with newline reconstructs whitespace, CRLF/mixed endings and terminal-newline presence exactly. Initial and additional captures use the same representation. Range selection uses split_inclusive and concatenation to retain line endings; claim selection returns canonical bounded claim text and test selection exact original function text. Captured specification/correspondence/workspace code establishes source identity and selection provenance.

The associated initial_context_preserves_instructions_and_exact_uniform_fragments test compares returned and saved input, coordinator instructions and prompt, then checks claim path/selector/text, exact whole implementation file text and exact test source/path. It verifies semantic test fragments rather than a whole test-file snapshot and expected metadata/counts. Fixture constants contain attributes, indentation and trailing-newline source, and substantive assertions are visible in the body. Supplementary whole_files_and_ranges_preserve_exact_line_endings_and_detect_selected_edits checks exact CRLF/blank-line range output, unterminated last line, duplicate whole-file captures and exact joined mixed-ending text, then requires a terminal-newline change to invalidate review. It is supplemental captured evidence, not falsely presented as an associated test for this anchor.

These mechanisms/assertions account for all fields, selector shapes and reversible exact line representation. No TODO/N/A entries exist. No source edits, formatting, tests or workspace build were performed; executed review start/read, capture comparison 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