meta.reviews.validation_layout

Each anchor has one directory named by its complete dotted ID, for example:

validations/meta.reviews.gate/
    summary.json
    input.json
    output.json

summary.json identifies the review; input.json contains the context captured for it; output.json contains the completed assessment. cargo meta review start creates or resets the directory and writes the first two files. Until recording completes, output.json is absent and the validation cannot satisfy the gate. The directory name must be a valid anchor ID and match summary.json. Starting a new review discards the previous validation; earlier validations are not retained.

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

Implementation

Implemented crates/sage-meta/src/review.rs:516–521

sage_meta::review · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.reviews.validation_layout`
// {anchor}`meta.reviews.preparation`
// {anchor}`meta.reviews.review_instructions`
pub fn start(
    workspace: &Path,
    anchor: &str,

}

See more source ↗

Tests and review

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

Implemented sage_meta::completed_corrupt_records_and_invalid_layout_cannot_pass

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.gate)]
#[sage::test(meta.reviews.validation_layout)]
#[sage::test(meta.reviews.output_format)]
#[sage::test(meta.reviews.review_diagnostics)]
fn completed_corrupt_records_and_invalid_layout_cannot_pass() {
    for fault in [
        "malformed",
        "blank reviewer",
        "blank report",
        "blank edit",
        "extra field",
        "missing summary",
        "missing input",
        "missing output",
        "non-directory",
    ] {
        let fixture = Fixture::new();
        fixture.approve();
        let directory = fixture.0.join("validations/demo.rule");
        match fault {
            "malformed" => fixture.write("validations/demo.rule/output.json", "{"),
            "missing summary" => std::fs::remove_file(directory.join("summary.json")).unwrap(),
            "missing input" => std::fs::remove_file(directory.join("input.json")).unwrap(),
            "missing output" => std::fs::remove_file(directory.join("output.json")).unwrap(),
            "non-directory" => {
                fixture.write("validations/unexpected", "not a validation directory")
            }
            _ => {
                let mut output = serde_json::to_value(Fixture::report()).unwrap();
                match fault {
                    "blank reviewer" => output["reviewer"] = " ".into(),
                    "blank report" => output["report"] = "\n".into(),
                    "blank edit" => output["requested_edits"] = serde_json::json!([""]),
                    _ => output["outcome"] = true.into(),
                }
                fixture.write(
                    "validations/demo.rule/output.json",
                    &serde_json::to_string(&output).unwrap(),
                );
            }
        }
        assert!(!sage_meta::check(&fixture.0).is_valid(), "{fault}");
        let output = fixture.run(&["check"]);
        assert!(!output.status.success(), "{fault}");
        let error = String::from_utf8_lossy(&output.stderr);
        let anchor = if fault == "non-directory" {
            "unexpected"
        } else {
            "demo.rule"
        };
        assert!(error.contains(anchor), "{error}");
        assert!(error.contains("invalid validation"), "{error}");
        assert!(error.contains("sage-review-checklist/SKILL.md"), "{error}");
        let reason = match fault {
            "malformed" => "EOF",
            "blank reviewer" | "blank report" => "nonblank reviewer and report",
            "blank edit" => "nonblank strings",
            "extra field" => "unknown field",
            "missing summary" | "missing input" | "missing output" => "No such file",
            "non-directory" => "not a real directory",
            _ => unreachable!(),
        };
        assert!(error.contains(reason), "{fault}: {error}");
    }
}
}

See more source ↗

Implemented sage_meta::invalid_ids_and_paths_are_rejected_without_destroying_existing_reports

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.preparation)]
#[sage::test(meta.reviews.recorded_reads)]
#[sage::test(meta.reviews.gate)]
#[sage::test(meta.reviews.validation_layout)]
fn invalid_ids_and_paths_are_rejected_without_destroying_existing_reports() {
    let fixture = Fixture::new();
    fixture.approve();
    let output = std::fs::read(fixture.0.join("validations/demo.rule/output.json")).unwrap();
    for anchor in [
        "../escape",
        "/absolute",
        "demo/rule",
        "demo..rule",
        "demo.missing",
    ] {
        assert!(review::start(&fixture.0, anchor, vec![]).is_err());
        assert_eq!(
            output,
            std::fs::read(fixture.0.join("validations/demo.rule/output.json")).unwrap()
        );
    }
    assert!(
        review::capture_read(
            &fixture.0,
            "demo.missing",
            "src/tests.rs",
            Selector::WholeFile
        )
        .is_err()
    );
    fixture.start();
    let before = fixture.input();
    for path in ["../outside", "/etc/passwd", "missing.txt"] {
        assert!(review::capture_read(&fixture.0, "demo.rule", path, Selector::WholeFile).is_err());
        assert_eq!(fixture.input(), before);
    }
    assert!(
        review::capture_read(
            &fixture.0,
            "demo.rule",
            "src/tests.rs",
            Selector::Claim {
                anchor_id: "demo.rule".into()
            }
        )
        .is_err()
    );
    assert!(
        review::capture_read(
            &fixture.0,
            "demo.rule",
            "src/tests.rs",
            Selector::Test {
                crate_name: "demo".into(),
                target: "test:missing".into(),
                rust_path: "demo::tests::verifies_result".into()
            }
        )
        .is_err()
    );
    assert_eq!(fixture.input(), before);
}
}

See more source ↗

Implemented sage_meta::start_invalidates_previous_success_and_record_is_required

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.reviews.validation_layout)]
#[sage::test(meta.reviews.summary_format)]
#[sage::test(meta.reviews.preparation)]
#[sage::test(meta.reviews.record_required)]
#[sage::test(meta.reviews.recorded_reads)]
#[sage::test(meta.reviews.recording)]
#[sage::test(meta.reviews.decisions)]
fn start_invalidates_previous_success_and_record_is_required() {
    let fixture = Fixture::new();
    assert!(!sage_meta::check(&fixture.0).is_valid());
    fixture.approve();
    assert!(sage_meta::check(&fixture.0).is_valid());
    let input = fixture.start();
    assert_eq!(fixture.input(), input);
    let summary = fixture.summary();
    assert_eq!(summary["anchor"], "demo.rule");
    assert!(summary["started_at_unix_seconds"].as_u64().unwrap() > 0);
    assert!(summary["recorded_at_unix_seconds"].is_null());
    assert_eq!(summary["schema_version"], review::SCHEMA_VERSION);
    assert_eq!(summary["policy_version"], review::POLICY_VERSION);
    assert!(summary.get("input_sha256").is_none());
    assert!(!fixture.0.join("validations/demo.rule/output.json").exists());
    assert!(!sage_meta::check(&fixture.0).is_valid());
    let saved = review::load_saved(&fixture.0.join("validations")).unwrap();
    assert_eq!(saved.reviews.len(), 1);
    assert!(saved.reviews[0].output.is_none());
    fixture.write("helper.txt", "context\n");
    review::capture_read(&fixture.0, "demo.rule", "helper.txt", Selector::WholeFile).unwrap();
    assert!(!sage_meta::check(&fixture.0).is_valid());
    let bytes = std::fs::read(fixture.0.join("validations/demo.rule/input.json")).unwrap();
    review::record(&fixture.0, "demo.rule", &Fixture::report()).unwrap();
    assert_eq!(
        bytes,
        std::fs::read(fixture.0.join("validations/demo.rule/input.json")).unwrap()
    );
    assert!(
        fixture.summary()["recorded_at_unix_seconds"]
            .as_u64()
            .unwrap()
            >= summary["started_at_unix_seconds"].as_u64().unwrap()
    );
    assert!(sage_meta::check(&fixture.0).is_valid());
    assert!(review::record(&fixture.0, "demo.rule", &Fixture::report()).is_err());
    assert!(
        review::capture_read(&fixture.0, "demo.rule", "helper.txt", Selector::WholeFile).is_err()
    );
}
}

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 ↗

Review: Accepted · final_quality.

Fresh followup review of meta.reviews.validation_layout. Preserved the prior input/output, started fresh and read the full claim, sole ordinary implementation association and all four ordinary test bodies. Recaptured prior fixture helpers (review tests lines 1–104), valid_anchor_name dependency (spec.rs lines 245–259), and check.rs orchestration. Compared all prior/current fragments by path/selector and implementation/test metadata. review.rs only gained a placeholder_status association comment. The spec.rs fixed line range shifted its incidental boundary context by one line, adding the preceding output.push_str and dropping the following markdown_files signature; the complete valid_anchor_name helper remains present and unchanged. All other captured contents and this anchor's association metadata are unchanged, with no removed captures. I reassessed this delta against the complete previous assessment, not a blind verdict refresh.

The associated start path in review.rs implements one current workspace/validations/<complete dotted ID> directory. anchor_directory uses valid_anchor_name to reject invalid ASCII identifier components and separators; start verifies that the valid ID exists in current inventory before resetting it. Under the directory lock it removes the old anchor directory, creates the current directory, writes input.json captured context and summary.json identity/start metadata with an unset recording timestamp. The old input/output are discarded, not retained as review history. record validates summary and captured-input freshness, writes output.json assessment and marks the summary recorded. load_saved accepts output only for recorded summaries. read_summary requires real directory identity matching the complete anchor ID; read_json requires regular files and valid JSON; load_saved rejects invalid directory IDs. validate/acceptable keep unfinished and malformed reviews failing, as exercised through the captured check.rs orchestration. The fixture operates on real temporary Cargo/model/spec/filesystem layouts.

All four associated tests expose relevant assertions. start_invalidates_previous_success_and_record_is_required creates a valid previous report, restarts, compares saved/returned input, checks summary identity and null recording time, output absence, one unfinished loaded record and failed gate; recording after an appended read preserves input bytes and restores validity, while later record/read attempts fail. completed_corrupt_records_and_invalid_layout_cannot_pass deletes each required file, supplies malformed/blank/extra-field reports and a non-directory entry; both library and CLI checks must fail with the expected anchor and reason. invalid_ids_and_paths_are_rejected_without_destroying_existing_reports tests traversal, absolute/slashed names, empty dotted components and an unknown valid ID, requiring rejection and preservation of the existing output bytes. Its remaining path/selector rejection assertions additionally preserve active captured context. unsupported_versions_and_mismatched_identity_cannot_pass corrupts the summary identity and each version independently and checks the specific mismatch/version diagnostic. Together these assertions cover naming, directory-summary agreement, reset/invalidation, the three-file roles and completed-record requirements.

No TODO or N/A entries exist. The marker and incidental line-range-boundary changes do not change behavior or adequacy; the helper remains fully captured. No source edits, formatting, tests or workspace build were performed in this followup. Commands executed were review start/read, capture comparison and record. Central/previous execution was not represented as new execution. 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