meta.language.model.virtual_dispatch

The checker resolves declared calls conservatively, including every known overriding implementation in the supplied model.

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

Implementation

Implemented crates/sage-meta/src/validate.rs:333–338

sage_meta::validate · lib:sage_meta

#![allow(unused)]
fn main() {
    // {anchor}`meta.language.model.virtual_dispatch`
    fn targets(
        &self,
        class_key: &str,
        entry: &Entry<'_>,
        path: &Path,

}

See more source ↗

Tests and review

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

Implemented sage_meta::detects_virtual_dispatch_path_to_forbidden_body

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.model.forbidden_paths)]
#[sage::test(meta.language.model.virtual_dispatch)]
fn detects_virtual_dispatch_path_to_forbidden_body() {
    let errors = check(
        r#"
        abstract class Function { """Interface."""
            query signature() -> crate::Value { """Interface.""" abstract; }
        }
        class Local extends crate::Function { """Local."""
            override query signature() -> crate::Value { """Bad dependency.""" envelope { invokes self.body(); } }
            query body() -> crate::Value { """Body.""" envelope {} }
        }
        class Other extends crate::Function { """Another implementation."""
            override query signature() -> crate::Value { """Also forbidden.""" envelope { invokes self.body(); } }
            query body() -> crate::Value { """Other body.""" envelope {} }
        }
        class Caller { """Consumer."""
            query run() -> crate::Value { """Read interfaces.""" envelope {
                invokes crate::Function::signature();
                forbid transitive crate::Local::body;
                forbid transitive crate::Other::body;
            } }
        }
    "#,
    );
    assert_eq!(errors.len(), 2, "{errors:?}");
    for implementation in ["Local", "Other"] {
        let path = format!(
            "demo::Caller::run -> demo::{implementation}::signature -> demo::{implementation}::body"
        );
        assert!(
            errors.iter().any(|error| error.message.contains(&path)),
            "{errors:?}"
        );
    }
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_206 independent review.

The complete claim requires conservative resolution of declared calls including every known override in the supplied model. Reviewed the sole ordinary implementation association (Model::targets in validate.rs), its complete source file, the sole ordinary associated test detects_virtual_dispatch_path_to_forbidden_body, and captured its check setup helper with review read. build_model collects classes from the supplied documents; targets resolves self or qualified calls, retains the declared/inherited method, then iterates all supplied classes and includes the selected method of each descendant. ancestors follows the full inheritance chain and method selects the nearest declaration, so indirect descendants and inherited implementations are included and duplicate targets are harmlessly deduplicated. There is no receiver selection that discards known alternatives and no promise about unknown external subclasses. check adds all resolved invoke targets to the graph and traverses that graph for prohibitions.
The test declares Function plus two distinct overrides Local and Other, each invoking its own body. Caller invokes the interface method and prohibits each concrete body. Its visible assertions require exactly two diagnostics and both complete Caller::run -> implementation::signature -> implementation::body paths. Omitting either known override would fail these assertions; this is meaningful conservative-dispatch integration coverage, with source reasoning accounting for arbitrary descendant enumeration. The captured helper constructs the demo crate, parses it, and invokes validate. No TODO/N/A entries exist, hence no deferred prerequisites.
Baseline verification: independently compared both current implementation and test files byte-for-byte with the historical input.json supplied in the instructions; both are exact matches. Reassessed the historical rationale against the current complete claim, metadata, implementation and assertions rather than treating that equality as approval. Execution: personally ran review start, review read and the byte comparison; no behavioral tests or broad build were run in this review. The coordinator separately reports 321 functional tests and a successful root build; those are not personal execution evidence. No source edits or unresolved concerns; 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