crates.sage_stash.storage.query_value

A stash-owned tree is one incremental value. Salsa compares and backdates a Stashed<T> root as a unit; nodes below that root are not independent tracked identities. Finer incremental boundaries are introduced as semantic queries outside the tree, not by exposing its internal handles.

Read in specification context · design/crates/sage_stash/storage.sage

Implementation

Implemented crates/sage-stash/src/lib.rs:559–564

sage_stash · lib:sage_stash

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_stash.storage.query_value`
    // {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();

}

See more source ↗

Tests and review

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

Implemented sage_stash::equal_reconstructed_roots_backdate_but_changed_content_reexecutes_consumers

crates/sage-stash/tests/incremental.rs · test:incremental

#![allow(unused)]
fn main() {
#[test]
#[sage::test(crates.sage_stash.storage.query_value)]
fn equal_reconstructed_roots_backdate_but_changed_content_reexecutes_consumers() {
    let mut db = Database::default();
    let input = Input::new(&db, 10, false, 0);
    assert_eq!(consume(&db, input), 21);
    assert_eq!(*db.executions.lock().unwrap(), ["consume", "produce"]);
    db.executions.lock().unwrap().clear();

    assert_eq!(consume(&db, input), 21);
    assert!(
        db.executions.lock().unwrap().is_empty(),
        "warm demand reuses both queries"
    );

    input.set_layout(&mut db).to(true);
    assert!(
        db.executions.lock().unwrap().is_empty(),
        "edits alone do not execute queries"
    );
    assert_eq!(consume(&db, input), 21);
    assert_eq!(
        *db.executions.lock().unwrap(),
        ["produce"],
        "equal root stops downstream execution despite new handles and allocation order"
    );
    db.executions.lock().unwrap().clear();

    input.set_value(&mut db).to(20);
    assert_eq!(consume(&db, input), 41);
    assert_eq!(
        *db.executions.lock().unwrap(),
        ["produce", "consume"],
        "reachable changes propagate through the root value"
    );
    db.executions.lock().unwrap().clear();

    input.set_unrelated(&mut db).to(1);
    assert_eq!(consume(&db, input), 41);
    assert!(
        db.executions.lock().unwrap().is_empty(),
        "unread inputs do not invalidate the tree"
    );
}
}

See more source ↗

Review: Accepted · Codex anchor_027 final-source review.

Fresh review of the current query_value claim and all current evidence, using the recorded CI coordinator instructions. The one ordinary implementation entry is Stashed::new in crates/sage-stash/src/lib.rs; its current preview also includes the signature.storage association. Inspected the whole captured implementation file, including current owned_products/signature.storage markers at the constructor, fingerprint traversal, storage helpers, handle definitions, equality and Update. The complete associated test set is one ordinary incremental test. No TODO/N/A entries require justification.

The claim has four aspects: a tree is one incremental value; Salsa compares and backdates its Stashed root as a unit; its internal nodes are not independently tracked identities; and finer boundaries are external semantic queries rather than internal handles. Stashed owns the arena, root and fingerprint together. Construction computes a root-reachable fingerprint. FingerprintHasher traverses Ptr and Slice contents and hashes slice length/order; entry indices are cache keys, not the value fingerprint. Equality compares the single root fingerprint. With the salsa feature, Stashed::maybe_update returns false and retains the old complete tree when equal, and replaces the whole value when different. Ptr/Slice are ordinary local index handles with no tracked identity or database ingredient. Their own Update implementations compare indices but do not register tracked nodes; ordinary stash indexing has no database dependency reads. The public reflection index is explicitly within-stash and not a cross-revision semantic identity. The additional constructor associations do not alter these behaviors. Essential production helpers are all in the associated implementation file.

Captured the entire incremental.rs through review read to inspect the producer, consumer, database and input helpers. produce returns Stashed<Slice<Ptr<u32>>> from ordinary node allocations, and consume is a separate tracked scalar semantic query over that tree. The annotated test directly asserts initial result 21 with consume/produce execution; warm demand with no execution; a layout-only edit causing no eager execution then produce-only execution and unchanged result; a reachable value edit causing result 41 and produce/consume execution; and an unrelated input edit causing neither execution nor result change. The producer layout variant adds unreachable data and reverses child allocation order, making the equal-root assertion meaningful despite changed handles. Thus comparison by handle/layout would fail the backdating assertion, and always returning unchanged would fail the reachable-content result and execution assertion. The absence of independent node tracking is supported by direct structural inspection as well as this root/query separation. Meaningful expected values and execution assertions are visible in the test body rather than hidden in a verification wrapper.

All claim aspects are accounted for by current source and test assertions; no changes requested. This refresh is a source review, not a new test run: the coordinator runs suites centrally. The incremental test file requires the salsa feature. Executed review start and dependency reads, and submit through review record; no Rust or specification files were modified. The assessment does not rely on the earlier approval or claim that its prior test execution validates this refreshed state.

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