meta.book.anchor_moves

Moving a rule within its chapter preserves its identity. Changing its local name or moving it into a different chapter namespace renames the rule and requires updating specification, implementation, and test references. Published links to the old location retain a redirect or context alias. A compatibility link does not create a second canonical definition or satisfy a stale code reference.

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

Implementation

Implemented crates/sage-meta/src/book/redirects.rs:16–21

sage_meta::book::redirects · bin:sage-meta

#![allow(unused)]
fn main() {
// {anchor}`meta.book.anchor_moves`
pub(super) fn apply(context: &Value, sections: &mut [Value]) -> Result<(), Box<dyn Error>> {
    let root = Path::new(
        context
            .get("root")
            .and_then(Value::as_str)

}

See more source ↗

TODO crates/sage-meta/tests/spec_plan.rs:207–214

sage_meta::todo · test:spec_plan

TODO: Preserve same-chapter names; require updated references across namespaces and retain published redirects without duplicate rules.

#![allow(unused)]
fn main() {
    // {anchor}`meta.book.anchor_moves`<<
    #[test]
    #[sage::test(meta.book.anchor_moves)]
    fn moving_between_chapters_renames_rules() {
        // TODO: Preserve same-chapter names; require updated references across
        // namespaces and retain published redirects without duplicate rules.
    }
    // >>

}

See more source ↗

Tests and review

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

Implemented sage_meta::book::redirects::tests::active_landing_pages_keep_content_and_only_redirect_retired_fragments

crates/sage-meta/src/book/redirects.rs · bin:sage-meta

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(meta.book.anchor_moves)]
    fn active_landing_pages_keep_content_and_only_redirect_retired_fragments() {
        let fixture =
            Fixture::new(json!({"design/meta/index.html#old":"design/anchor/meta/new.html"}));
        let mut chapters = vec![
            json!({"Chapter":{"path":"design/meta/README.md","content":"Current specification","sub_items":[]}}),
        ];
        apply(&fixture.context(), &mut chapters).unwrap();
        let content = chapters[0]["Chapter"]["content"].as_str().unwrap();
        assert!(content.starts_with("Current specification"));
        assert!(content.contains("\"default\":null"));
        assert!(content.contains("\"old\":\"../anchor/meta/new.html\""));
        assert!(!fixture.0.join("manual/design/meta/index.html").exists());
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Implemented sage_meta::book::redirects::tests::retired_pages_have_relative_default_and_fragment_redirects

crates/sage-meta/src/book/redirects.rs · bin:sage-meta

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(meta.book.anchor_moves)]
    fn retired_pages_have_relative_default_and_fragment_redirects() {
        let fixture = Fixture::new(
            json!({"design/old.html":"design/crates/demo/guide.html", "design/old.html#old-rule":"design/anchor/demo/new_rule.html"}),
        );
        let mut chapters = vec![];
        apply(&fixture.context(), &mut chapters).unwrap();
        let html = std::fs::read_to_string(fixture.0.join("manual/design/old.html")).unwrap();
        assert!(html.starts_with(GENERATED));
        assert!(html.contains("\"default\":\"crates/demo/guide.html\""));
        assert!(html.contains("\"old-rule\":\"anchor/demo/new_rule.html\""));
        assert!(html.contains("new URL(target,location.href)"));
        assert!(html.contains("if(!specific&&!url.hash)url.hash=location.hash"));
        assert!(
            chapters.is_empty(),
            "redirects must not add canonical chapters"
        );
        apply(&fixture.context(), &mut chapters).unwrap();
        assert_eq!(
            std::fs::read_to_string(fixture.0.join("manual/design/old.html")).unwrap(),
            html
        );
    }
}

Conditional source: #[cfg(test)]

See more source ↗

TODO sage_meta::todo::moving_between_chapters_renames_rules

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

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(meta.book.anchor_moves)]
    fn moving_between_chapters_renames_rules() {
        // TODO: Preserve same-chapter names; require updated references across
        // namespaces and retain published redirects without duplicate rules.
    }
}

See more source ↗

Review: Accepted · /root/final_quality.

Fresh delta-based reassessment of meta.book.anchor_moves. Before resetting I preserved the prior input/output, read the prior complete assessment, started a new review and recaptured its three additional dependencies (spec.rs, workspace.rs, book.rs). Comparing every fragment by path and selector showed no additions/removals after recapture and identical implementation/test metadata. The only content differences are two comment associations in spec.rs: meta.anchors.implementation_references above validate_implementation_references and meta.book.crate_ownership above the existing modeled-owner check. Both leave behavior unchanged. The claim, redirects implementation, TODO implementation/test and both ordinary tests are identical. I rechecked the current identity and redirect paths and retain the full assessment below. No source changes or behavior tests performed.

Identity/reference requirements: chapter_namespace uses the Design path (README is its directory namespace and hyphens normalize), qualified combines it with the local name, and add_chapter_text does not include line/heading/order in identity. Thus intra-chapter movement preserves identity while local-name/namespace changes rename it. Canonical specification, implementation and test references validate against the anchor inventory, never redirects. Old code references therefore remain dangling after a rename even if the published URL redirects. Book processing loads canonical specifications before redirects; compatibility output does not insert anchors or canonical chapters. The two added comments merely expose associations around these already-reviewed paths.

Compatibility implementation: redirects.rs apply reads the configured book source root and anchor-redirects.json. Retired pages receive generated relative default/fragment destinations; active chapters preserve content and get only fragment redirects with default disabled. The script gives a specific fragment alias precedence and preserves unknown fragments on default page moves, using location.replace initially and on hash changes. Fallback links expose destinations. Path validation, cycle detection, symlink/handwritten-output protection and escaping guard output generation. This supplies compatibility URLs without duplicating canonical definitions.

Both ordinary tests remain substantively adequate for generation: retired_pages_have_relative_default_and_fragment_redirects uses a configured manual directory and asserts generated marker, exact relative default/fragment targets, URL-resolution/fragment-preservation script, no canonical chapter insertion and identical repeated output. active_landing_pages_keep_content_and_only_redirect_retired_fragments asserts unchanged current content prefix, null default, exact fragment destination and no competing generated landing file. Their captured Fixture constructs real files. These inspect generated output, not live browser execution.

The second implementation entry and third test are the same explicit TODO moving_between_chapters_renames_rules. It still defers the integrated move/rename scenario: before/after fixtures must verify same-chapter identity, renamed cross-namespace identity, updates to specification/implementation/test references, stale-reference rejection despite redirects, and a single canonical definition. Browser redirect interaction is not established by script-text checks. This remains visibly deferred and is not upgraded to implemented/tested by this recording. No N/A entries and no new concrete defect or requested edit.

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