meta.language.envelopes.class_calls

invokes crate::module::Class::method(); permits a call on any instance of the named class or a known subclass. This permission does not require equality with the caller’s receiver.

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

Implementation

Implemented crates/sage-meta/src/contracts.rs:232–237

sage_meta::contracts · lib:sage_meta

#![allow(unused)]
fn main() {
    // {anchor}`meta.language.envelopes.class_calls`
    // {anchor}`meta.language.envelopes.receiver_calls`
    // {anchor}`meta.language.envelopes.direct_calls`
    fn check_request(&mut self, invocation: &Invocation) {
        if let Some(caller) = self.active.last().cloned() {
            if let Some(contract) = self.model.operations.get(&caller.operation) {

}

See more source ↗

Implemented crates/sage-meta/src/validate.rs:356–361

sage_meta::validate · lib:sage_meta

#![allow(unused)]
fn main() {
        // {anchor}`meta.language.envelopes.class_calls`
        for descendant in self.classes.keys() {
            if self.ancestors(descendant).contains(&class)
                && let Some(target) = self.method(descendant, &name)
            {
                targets.insert(target);

}

See more source ↗

Tests and review

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

Implemented sage_meta::a_class_wide_permission_does_not_require_receiver_identity

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.envelopes.class_calls)]
fn a_class_wide_permission_does_not_require_receiver_identity() {
    let model = model(
        r#"
        class Item { """Item."""
            fn run() -> u32 { """Run.""" envelope {
                invokes self.read(); invokes crate::Item::read();
            } }
            query read() -> u32 { """Read.""" envelope {} }
        }
    "#,
    );
    for (caller, callee) in [(None, None), (Some("item:1"), Some("item:2"))] {
        let mut checked = session(model.clone(), &["Item::run"]);
        let run = checked.enter("demo::Item::run", caller);
        let read = checked.enter("demo::Item::read", callee);
        checked.exit(read);
        checked.exit(run);
        checked.finish().assert_calls_conform();
    }
}
}

See more source ↗

Implemented sage_meta::overrides_inherit_prohibitions_and_calls_dispatch_to_known_implementations

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.envelopes.class_calls)]
fn overrides_inherit_prohibitions_and_calls_dispatch_to_known_implementations() {
    let mut session = session(
        model(
            r#"
        class Base { """Base."""
            query run() -> u32 { """Run.""" envelope { forbid transitive crate::Leaf::read; } }
        }
        class Child extends crate::Base { """Child."""
            override query run() -> u32 { """Run.""" envelope {} }
        }
        class Leaf { """Leaf.""" query read() -> u32 { """Read.""" envelope {} } }
        class Caller { """Caller."""
            fn run() -> u32 { """Run.""" envelope { invokes crate::Base::run(); } }
        }
    "#,
        ),
        &["Caller::run"],
    );
    let caller = session.enter("demo::Caller::run", None);
    let child = session.enter("demo::Child::run", None);
    let leaf = session.enter("demo::Leaf::read", None);
    session.exit(leaf);
    session.exit(child);
    session.exit(caller);
    let report = session.finish();
    assert_eq!(report.violations.len(), 2);
    assert_eq!(
        report.violations[1].rule.as_ref().unwrap().operation,
        "demo::Base::run"
    );
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_193.

Source review: the complete claim requires class-qualified invokes to permit the named class and known subclasses, independently of caller receiver identity. Both ordinary implementation entries satisfy this: validate.rs resolves the named method, includes descendants through ancestors/method lookup, and marks only self-rooted permissions same_receiver; contracts.rs accepts any matching unrestricted permission before receiver comparison. Both ordinary associated tests were inspected. a_class_wide_permission_does_not_require_receiver_identity calls Item::read with missing and unequal identities, alongside a self permission, and asserts calls_conform (which checks both violations and gaps). overrides_inherit_prohibitions_and_calls_dispatch_to_known_implementations calls Child::run under Base::run permission: its exact two-violation count and inherited-rule assertion account for the undeclared Leaf edge and inherited prohibition, leaving no extra undeclared Child edge. This meaningfully exercises known-subclass permission. Captured runtime test setup helpers parse a demo model and establish explicit roots. No TODO/N/A entries or deferred prerequisites exist. Baseline: independently verified exact byte equality of contracts.rs, validate.rs, and runtime_contracts.rs with the supplied historical snapshots; the earlier rationale remains supported by current source and full associated assertions. Execution: personally ran review start/read and byte comparison, then review record; no behavioral tests or build were run by this reviewer. The coordinator separately reports 321 passing functional tests and a passing root build. No source edits 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