meta.language.calls.declared

Every observed architectural call must be permitted by its caller’s resolved dependency envelope. An undeclared call is an error, including recursive entry into the same operation and requests satisfied from a query cache.

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

Implementation

Implemented crates/sage-meta/src/contracts.rs:231–236

sage_meta::contracts · lib:sage_meta

#![allow(unused)]
fn main() {
    // {anchor}`meta.language.calls.declared`
    // {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() {

}

See more source ↗

Implemented crates/sage-meta/src/validate.rs:29–34

sage_meta::validate · lib:sage_meta

#![allow(unused)]
fn main() {
// {anchor}`meta.language.calls.declared`
// {anchor}`meta.language.calls.forbidden`
// {anchor}`meta.language.envelopes.permissions`
pub(crate) fn resolve_contracts(
    documents: &[Document],
) -> Result<BTreeMap<String, crate::contracts::OperationContract>, Vec<Diagnostic>> {

}

See more source ↗

Tests and review

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

Implemented sage_meta::real_salsa_contract_fixture

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.calls.declared)]
#[sage::test(meta.language.calls.forbidden)]
#[sage::test(meta.contracts.validated_session)]
#[sage::test(meta.contracts.cache_invocations)]
#[sage::test(meta.contracts.observation_coverage)]
fn real_salsa_contract_fixture() {
    let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
    let fixture = root.join("tests/fixtures/contracts");
    let output = std::process::Command::new(env!("CARGO"))
        .args(["test", "--locked", "--manifest-path"])
        .arg(fixture.join("Cargo.toml"))
        .args(["--", "--nocapture", "--test-threads=1"])
        .env(
            "CARGO_TARGET_DIR",
            root.join("../../target/sage-contract-fixture"),
        )
        .output()
        .expect("run the isolated contracts fixture");
    assert!(
        output.status.success(),
        "contract fixture failed:\n{}\n{}",
        String::from_utf8_lossy(&output.stdout),
        String::from_utf8_lossy(&output.stderr)
    );
    let stdout = String::from_utf8(output.stdout).unwrap();
    let evidence: Vec<serde_json::Value> = stdout
        .lines()
        .filter_map(|line| line.split_once("SAGE_CONTRACT_EVIDENCE:"))
        .map(|(_, json)| serde_json::from_str(json).unwrap())
        .collect();
    assert_eq!(evidence.len(), 2, "expected cold and prewarmed reports");
    let root = "sage_contract_fixture::nodes::Root::run";
    let helper = "sage_contract_fixture::nodes::Helper::work";
    let leaf = "sage_contract_fixture::nodes::Leaf::read";
    for prewarmed in [false, true] {
        let sample = evidence
            .iter()
            .find(|sample| sample["prewarmed"] == prewarmed)
            .expect("each cache scenario must report evidence");
        let operations = &sample["model"]["operations"];
        assert!(operations[helper]["invokes"].as_array().unwrap().is_empty());
        assert_eq!(
            operations[root]["prohibits"][0]["targets"],
            serde_json::json!([leaf])
        );
        let report = &sample["contracts"];
        assert_eq!(report["calls_conform"], false);
        assert_eq!(report["coverage"]["checked_requests"], 3);
        assert!(report["coverage"]["gaps"].as_array().unwrap().is_empty());
        let violations = report["violations"].as_array().unwrap();
        assert_eq!(violations.len(), 2);
        assert_eq!(violations[0]["kind"], "UndeclaredCall");
        assert_eq!(violations[1]["kind"], "ForbiddenTransitive");
        assert_eq!(violations[1]["rule"]["operation"], root);
        assert_eq!(
            violations[1]["path"]
                .as_array()
                .unwrap()
                .iter()
                .map(|frame| frame["operation"].as_str().unwrap())
                .collect::<Vec<_>>(),
            [root, helper, leaf],
        );
        if prewarmed {
            let events = sample["query_events"].as_array().unwrap();
            assert!(events.iter().any(|event| {
                let event = event.as_str().unwrap();
                event.starts_with("return Leaf::read") && event.contains("[Reused]")
            }));
            assert!(
                !events
                    .iter()
                    .any(|event| event.as_str().unwrap().starts_with("execute Leaf::read"))
            );
        }
    }
}
}

See more source ↗

Implemented sage_meta::reports_direct_and_ancestor_violation_with_complete_path_and_rule

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.calls.declared)]
#[sage::test(meta.language.calls.forbidden)]
fn reports_direct_and_ancestor_violation_with_complete_path_and_rule() {
    let mut session = session(model(FORBIDDEN), &["Root::run"]);
    let root = session.enter("demo::Root::run", Some("root:1"));
    let helper = session.enter("demo::Helper::work", Some("helper:2"));
    let leaf = session.enter("demo::Leaf::read", Some("leaf:3"));
    session.exit(leaf);
    session.exit(helper);
    session.exit(root);
    let report = session.finish();
    assert!(!report.calls_conform);
    assert_eq!(report.coverage.checked_requests, 3);
    assert_eq!(report.violations.len(), 2);
    assert_eq!(report.violations[0].kind, ViolationKind::UndeclaredCall);
    let forbidden = &report.violations[1];
    assert_eq!(forbidden.kind, ViolationKind::ForbiddenTransitive);
    assert_eq!(
        forbidden.rule.as_ref().unwrap().operation,
        "demo::Root::run"
    );
    assert_eq!(
        forbidden
            .path
            .iter()
            .map(|frame| frame.operation.as_str())
            .collect::<Vec<_>>(),
        ["demo::Root::run", "demo::Helper::work", "demo::Leaf::read"]
    );
    assert_eq!(forbidden.path[2].receiver.as_deref(), Some("leaf:3"));
    assert_eq!(report.trace.len(), 6);
}
}

See more source ↗

Implemented sage_meta::same_operation_entry_is_recursion_and_needs_permission

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

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.calls.declared)]
#[sage::test(meta.contracts.cache_invocations)]
#[sage::test(meta.language.envelopes.receiver_calls)]
fn same_operation_entry_is_recursion_and_needs_permission() {
    let leaf = r#"class Tree { """Tree.""" fn walk() -> u32 { """Walk.""" envelope {} } }"#;
    let mut denied = session(model(leaf), &["Tree::walk"]);
    let a = denied.enter("demo::Tree::walk", Some("tree:1"));
    let b = denied.enter("demo::Tree::walk", Some("tree:1"));
    denied.exit(b);
    denied.exit(a);
    assert_eq!(
        denied.finish().violations[0].kind,
        ViolationKind::UndeclaredCall
    );

    let recursive = leaf.replace("envelope {}", "envelope { invokes self.walk(); }");
    let mut allowed = session(model(&recursive), &["Tree::walk"]);
    let a = allowed.enter("demo::Tree::walk", Some("tree:1"));
    let b = allowed.enter("demo::Tree::walk", Some("tree:1"));
    allowed.exit(b);
    allowed.exit(a);
    let report = allowed.finish();
    report.assert_calls_conform();
    assert_eq!(report.coverage.checked_requests, 2);
    assert!(matches!(&report.trace[1], ContractEvent::Enter(frame) if frame.parent == Some(a)));
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_187.

Source review complete for meta.language.calls.declared. Independently verified exact byte equality of both implementation files and both containing test files against the historical input; that baseline supports, but does not replace, this assessment of the current claim and complete association set. The claim requires caller-envelope permission for every observed architectural call, specifically including same-operation recursion and cache-satisfied requests. resolve_contracts resolves each operation's own invokes targets (including permitted dispatch and receiver restrictions); ContractSession enters every source request through check_request against the immediate caller and records UndeclaredCall when no permission/dispatch exists. There is no self-recursion exemption and checking occurs before any execution/cache distinction; unknown operations and receiver gaps cannot yield conformance. Both ordinary implementation entries are sufficient. All three ordinary associated tests were inspected: reports_direct_and_ancestor_violation_with_complete_path_and_rule asserts three checked requests and the undeclared Helper-to-Leaf error alongside the separate ancestor prohibition; same_operation_entry_is_recursion_and_needs_permission rejects an empty-envelope recursive call, then explicitly permits self.walk and asserts conformance, two requests and parent identity; real_salsa_contract_fixture asserts empty Helper permissions, nonconformance and UndeclaredCall for both cold and prewarmed cases, with a Reused Leaf return and no Leaf execution when warm. Captured runtime setup confirms the unit model and roots. Captured fixture queries, model, callback setup and evidence serialization establish that integration assertions inspect actual request observations. Captured SalsaObserver checks WillRequest independently of WillExecute and delegates ordinary fetches to session.enter; internal validation/traversal contexts are not invented source calls. These assertions would detect exemptions for recursion or cache hits and permissive handling of undeclared direct calls. Scope remains observed architectural calls, without a guarantee of instrumentation for every Rust call. No TODO/N/A entries or deferred prerequisites exist. Execution: personally ran review start/read and exact-comparison commands; no behavioral tests or workspace build were run by this reviewer. The supplied coordinator baseline reports 321 passing functional sage-meta tests and a passing root cargo build; those are separately reported execution. No source changes or 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