crates.sage_ir.checking.signature.storage

Checked interfaces are self-contained semantic values. Signature lowering reads CST from one stash and writes all checked types, binders, predicates, and retained alias applications into a separate result stash. No checked value points into tree-sitter state or the source CST stash. This is the signature-level ownership boundary established by Stash for type-level interning.

Read in specification context · design/crates/sage_ir/checking.sage

Implementation

Implemented crates/sage-ir/src/check/sig.rs:72–76

sage_ir::check::sig · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.storage`
    pub fn finish<T: StashHash + Copy>(self, root: T) -> Stashed<T> {
        Stashed::new(self.target_stash, root)
    }
}

}

See more source ↗

Implemented crates/sage-ir/src/check/trait_env.rs:48–53

sage_ir::check::trait_env · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.storage`
// {anchor}`crates.sage_ir.checking.signature.body_independence`
pub(crate) fn lower_predicates<'db>(
    cx: &mut Check<'_, 'db>,
    source_generics: Slice<GenericParamCst<'db>>,
    checked_generics: Slice<GenericParam<'db>>,

}

See more source ↗

Implemented crates/sage-ir/src/cst/generics.rs:109–114

sage_ir::cst::generics · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.storage`
// {anchor}`crates.sage_ir.checking.signature.body_independence`
impl<'db> CheckGenerics<'db> for Slice<GenericParamCst<'db>> {
    fn check(
        self,
        db: &'db dyn crate::Db,

}

See more source ↗

Implemented crates/sage-ir/src/cst/paths.rs:181–186

sage_ir::cst::paths · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.storage`
    pub(crate) fn check_type_args(&self, cx: &mut Check<'_, 'db>) -> Slice<Ptr<Ty<'db>>> {
        let src_args = &cx.source_stash[self.type_args];
        if src_args.is_empty() {
            return cx.target_stash.alloc_slice(&[]);
        }

}

See more source ↗

Implemented crates/sage-ir/src/cst/ty.rs:102–107

sage_ir::cst::ty · lib:sage_ir

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.storage`
    // {anchor}`crates.sage_ir.checking.signature.body_independence`
    pub(crate) fn check(self, cx: &mut Check<'_, 'db>) -> Ty<'db> {
        let src = cx.source_stash;
        match self.kind {
            TypeCstKind::Path(path_ptr) => {

}

See more source ↗

Implemented crates/sage-ir/src/external_syms.rs:298–303

sage_ir::external_syms · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.storage`
pub fn apply_external_adt_signature<'db>(
    db: &'db dyn crate::Db,
    target: &mut Stash,
    adt: SymExt<'db>,
    explicit_args: &[Ptr<Ty<'db>>],

}

See more source ↗

Implemented crates/sage-ir/src/local_syms/fns.rs:20–25

sage_ir::local_syms::fns · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.storage`
fn open_owner<'db>(
    cx: &mut crate::check::Check<'_, 'db>,
    owner: Option<LocalAssociatedOwner<'db>>,
) -> OpenedOwner<'db> {
    use crate::generic_param::GenericParamKind;

}

See more source ↗

Implemented crates/sage-ir/src/ty_fold.rs:25–30

sage_ir::ty_fold · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_ir.checking.signature.storage`
pub fn default_fold_ty<'db>(folder: &mut impl TyFolder<'db>, ty: Ty<'db>) -> Ty<'db> {
    match ty {
        Ty::Adt(sym, args) => {
            let args = fold_ptr_slice(folder, args);
            Ty::Adt(sym, args)

}

See more source ↗

Implemented crates/sage-stash/src/lib.rs:560–565

sage_stash · lib:sage_stash

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_ir.checking.signature.storage`
    pub fn new(stash: Stash, root: T) -> Self {
        let mut hasher = FingerprintHasher::new();
        root.stash_hash(&stash, &mut hasher);
        let fingerprint = hasher.finalize();
        Self {

}

See more source ↗

Tests and review

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

TODO sage_meta::todo::checking_signature_storage

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

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_ir.checking.signature.storage)]
    fn checking_signature_storage() {
        // TODO: Complete the claim-specific verification matrix:
        // Structural snapshots traverse representative signatures after the parser and source stash
        // borrows have ended, cover retained aliases and predicates, and detect any cross-stash pointer.
    }
}

See more source ↗

Review: Accepted · Codex /root/final_quality.

Assessed the complete signature.storage claim, all nine ordinary implementation entries, and the one associated TODO test. Requirements: source CST remains input in its own stash; checked types, binders, predicates and retained alias applications live in a separate result stash; no result contains tree-sitter references or pointers into the CST stash. Captured checking design and the linked Stash architectural rationale, which specifies structural copying between owners and debug stash identity checks rather than database-global meaning for numeric handles.

Implementation: Check::new holds an immutable source_stash and creates a fresh target_stash. Check::finish in sig.rs moves that target into Stashed::new with the checked root. CheckGenerics allocates the parameter slice in target; semantic parameter identities are copied handles, not CST pointers. PathSegment::check_type_args checks source syntax and allocates both types and argument slices in target. TypeCst::check recursively translates references, tuples, slices, arrays and function types using target allocation. Resolved named aliases retain definition identity with already-checked target arguments. Existing semantic Self resolutions come from the current checking context rather than raw source types. lower_predicates in trait_env.rs builds checked subject types, trait arguments and predicate slices in target, and Check::complete_parameter_env combines target-owned predicate values.

open_owner in fns.rs calls signature.copy_into(target_stash) before using the owner binder's types, predicate slices and generic slice. It then constructs new Self/predicate values and final function signature collections in the same target. Captured Binder::stash_copy explicitly copies both value and generic slice. The initial sage-stash implementation defines Stashed as owning its Stash and root; copy_into invokes structural StashCopy. Ptr and Slice implementations read source entries, recursively copy values and allocate destination entries. Captured derive implementation generates that recursive copy for every struct field and enum payload, covering derived Ty and alias representations rather than relying on a shallow Copy of their stash handles. Captured Ty/Alias/Binder definitions contain semantic handles, scalar values and destination-relative Ptr/Slice fields, not parser-node borrows.

apply_external_adt_signature in external_syms.rs accepts explicit type arguments already in target, folds source-owned defaults into target with earlier substitutions, and folds the declaration predicate environment into target. Substitute entries contain target-owned Ty values, so returning a substituted Ty directly is correct for this path. ty_fold.rs default_fold_ty and alias helpers reallocate nested ADT arguments, named/opaque alias arguments, associated projection Self/trait arguments, reference/array/slice inners, tuples and function types. Parameter and identity-only leaves remain scalar handles. fold_parameter_env rebuilds each predicate and its argument slices. The external metadata signature lowerers allocate their original semantic products in their own fresh stash; external application then crosses the ownership boundary explicitly. Stashed::new retains ownership and computes the rooted fingerprint; fingerprinting is not treated as proof that every pointer is valid.

The sole associated test todo::checking_signature_storage is explicitly deferred and contains no assertions. It specifies representative structural signature traversals after parser/source-stash borrows have ended, retained aliases and predicates, and detection of cross-stash pointers. That is an honest remaining verification requirement: completing it requires source-derived nested signatures, scopes that end source borrows before result traversal, and assertions that exercise the entire reachable result graph (with debug stash identity validation where applicable). Coverage should distinguish target-owned substitutions from source-owned default/predicate inputs and include the alias variants supported by their producers. The placeholder is not claimed to establish these guarantees, and no test execution is inferred from its annotation. No new suspected defect was identified in the inspected allocation/copy routes.

Commands executed: fresh review start with coordinator instructions, source and complete-test inspection, review read captures for design/RFD, Ty/Alias/Binder representations and the structural-copy derive. No tests or build were executed by this reviewer; central suite results remain separate. No source edits. No requested edits, with the existing test TODO explicitly retained rather than full verification claimed.

Browse crates anchors

139 anchors

Specification anchors and declared coverage
AnchorImplementationTests
crates (139)114 Implemented37 TODO2 N/A74 Implemented107 TODO
crates.sage_inspector (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
crates.sage_inspector.inspection (15)13 Implemented1 TODO2 N/A3 Implemented15 TODO
balanced_tracesImplementedTODO
canonical_ownershipImplementedImplementedTODO
derive_reflectionImplementedImplementedTODO
detail_free_indexImplementedTODO
deterministic_traceImplementedTODO
durable_navigationN/ATODO
generic_browserN/ATODO
owned_reflectionImplementedImplementedTODO
product_availabilityImplementedTODO
revision_and_demandImplementedTODO
semantic_phase_boundaryImplementedTODO
source_evidenceImplementedTODO
typed_serviceImplementedTODO
unknown_workImplementedTODOTODO
workspace_actorImplementedTODO
crates.sage_ir (90)67 Implemented34 TODO40 Implemented88 TODO
crates.sage_ir.checking (12)12 Implemented3 TODO5 Implemented12 TODO
crates.sage_ir.checking.body (5)5 Implemented2 TODO3 Implemented5 TODO
elaborationImplementedImplementedTODO
expected_typesImplementedTODOTODO
interface_dependenciesImplementedImplementedTODO
isolated_completionImplementedImplementedTODO
operator_callsImplementedTODOTODO
identity_mintingImplementedTODO
owned_productsImplementedImplementedTODO
crates.sage_ir.checking.signature (4)4 Implemented1 TODO1 Implemented4 TODO
body_independenceImplementedTODO
narrow_detailImplementedTODOTODO
owner_binderImplementedImplementedTODO
storageImplementedTODO
symbol_keyed_interfacesImplementedTODO
crates.sage_ir.crate (9)9 TODO9 TODO
explicit_restrictionsTODOTODO
identity_before_detailTODOTODO
incremental_evidenceTODOTODO
narrow_demandsTODOTODO
reexecution_and_invalidationTODOTODO
represented_completenessTODOTODO
restrictions_and_gapsTODOTODO
semantic_query_boundariesTODOTODO
terminal_incompletenessTODOTODO
crates.sage_ir.inference (8)8 Implemented6 Implemented8 TODO
atomic_checkingImplementedImplementedTODO
body_local_quiescenceImplementedImplementedTODO
canonical_boundaryImplementedImplementedTODO
completed_body_boundaryImplementedTODO
numeric_domainsImplementedImplementedTODO
subtyping_and_coercionImplementedImplementedTODO
terminal_obligationsImplementedTODO
transaction_isolationImplementedImplementedTODO
crates.sage_ir.metadata (4)4 Implemented1 TODO4 TODO
explicit_incompletenessImplementedTODO
keyed_reuseImplementedTODOTODO
product_boundariesImplementedTODO
provider_authorityImplementedTODO
crates.sage_ir.modules (8)7 Implemented1 TODO4 Implemented8 TODO
crates.sage_ir.modules.expand (4)4 Implemented2 Implemented4 TODO
completenessImplementedImplementedTODO
dependenciesImplementedTODO
direct_membersImplementedTODO
recursion_and_fixpointImplementedImplementedTODO
crates.sage_ir.modules.parse (4)3 Implemented1 TODO2 Implemented4 TODO
dependenciesImplementedTODO
detail_firewallImplementedImplementedTODO
recovery_completenessTODOTODO
syntax_identitiesImplementedImplementedTODO
crates.sage_ir.resolution (5)5 Implemented1 TODO3 Implemented4 TODO
crates.sage_ir.resolution.lookup (5)5 Implemented1 TODO3 Implemented4 TODO
completenessImplementedTODOImplementedTODO
dependenciesImplementedTODO
expansion_import_ambiguityImplementedImplemented
identity_onlyImplementedTODO
precedenceImplementedImplementedTODO
crates.sage_ir.solver (9)7 Implemented7 TODO5 Implemented9 TODO
alternative_isolationImplementedTODOImplementedTODO
bounded_completenessImplementedTODOTODO
candidate_completenessImplementedTODO
canonical_cyclesTODOTODO
canonical_outputsImplementedImplementedTODO
local_index_firewallTODOTODO
normalization_demandImplementedTODOImplementedTODO
schedule_independenceImplementedTODOImplementedTODO
shared_final_resultImplementedTODOImplementedTODO
crates.sage_ir.symbols (8)8 Implemented4 Implemented7 TODO
associated_identityImplementedImplemented
associated_interfacesImplementedTODO
body_interfacesImplementedImplementedTODO
definition_identityImplementedTODO
external_fact_queriesImplementedTODO
external_identityImplementedTODO
kind_wrappersImplementedImplementedTODO
local_identityImplementedImplementedTODO
crates.sage_ir.types (27)16 Implemented12 TODO13 Implemented27 TODO
crates.sage_ir.types.aliases (2)1 Implemented1 TODO1 Implemented2 TODO
identityImplementedImplementedTODO
revelationTODOTODO
crates.sage_ir.types.binder (1)1 Implemented1 TODO1 Implemented1 TODO
owner_parametersImplementedTODOImplementedTODO
crates.sage_ir.types.body (13)4 Implemented9 TODO3 Implemented13 TODO
awaitTODOTODO
closuresTODOTODO
conditional_patternsTODOTODO
coroutinesTODOTODO
diagnosed_recoveryImplementedImplementedTODO
elaboratedTODOImplementedTODO
for_iterationTODOTODO
indexingTODOTODO
macro_expansionTODOTODO
no_inferenceImplementedImplementedTODO
resolved_referencesImplementedTODO
try_residualTODOTODO
typed_provenanceImplementedTODO
crates.sage_ir.types.calls (2)1 Implemented1 TODO1 Implemented2 TODO
dispatch_familiesTODOTODO
selected_semanticsImplementedImplementedTODO
crates.sage_ir.types.lifetimes (2)2 Implemented2 Implemented2 TODO
dummyImplementedImplementedTODO
unchecked_borrowsImplementedImplementedTODO
crates.sage_ir.types.operators (2)2 Implemented1 Implemented2 TODO
lazy_control_flowImplementedTODO
trait_callsImplementedImplementedTODO
scoped_identitiesImplementedTODO
crates.sage_ir.types.spans (4)4 Implemented4 Implemented4 TODO
generated_identityImplementedImplementedTODO
item_originImplementedImplementedTODO
offset_reuseImplementedImplementedTODO
relative_compositionImplementedImplementedTODO
crates.sage_oracle_harness (4)4 Implemented2 TODO1 Implemented4 TODO
crates.sage_oracle_harness.crate (4)4 Implemented2 TODO1 Implemented4 TODO
deterministic_emissionImplementedTODO
exact_comparisonImplementedTODOImplementedTODO
fixed_projectionImplementedTODO
independent_coverageImplementedTODOTODO
crates.sage_stash (5)5 Implemented5 Implemented
crates.sage_stash.storage (5)5 Implemented5 Implemented
handle_ownershipImplementedImplemented
immutable_entriesImplementedImplemented
query_valueImplementedImplemented
rooted_equalityImplementedImplemented
typed_interningImplementedImplemented
crates.sage_test_harness (25)25 Implemented25 Implemented
crates.sage_test_harness.compile_tests (25)25 Implemented25 Implemented
annotation_validationImplementedImplemented
blessing_gateImplementedImplemented
callsite_updatesImplementedImplemented
checking_scopeImplementedImplemented
compiler_conditionsImplementedImplemented
completed_typesImplementedImplemented
coordinatesImplementedImplemented
dependenciesImplementedImplemented
diagnostic_countsImplementedImplemented
diagnostic_locationsImplementedImplemented
editionImplementedImplemented
fixturesImplementedImplemented
grouped_observationsImplementedImplemented
invocationImplementedImplemented
production_executionImplementedImplemented
project_isolationImplementedImplemented
query_captureImplementedImplemented
query_projectionImplementedImplemented
renderingImplementedImplemented
resolved_symbolsImplementedImplemented
review_visibilityImplementedImplemented
rustc_executionImplementedImplemented
rustc_lintsImplementedImplemented
starting_expressionsImplementedImplemented
target_lineImplementedImplemented