crates.sage_test_harness.compile_tests.production_execution

Fixture evaluation uses the production workspace-loading, parsing, expansion, resolution, and checking paths with real dependency metadata. Inline sources and generated project configuration are inputs; expected types, diagnostics, and query logs are outputs, never providers of semantic answers. Invalid Rust must reach Sage even if it would fail rustc checking. Using rustc to provide standard-library metadata does not count as running a rustc conformance test. Setup and provider failures fail the test directly, not as expected source diagnostics.

Read in specification context · design/crates/sage_test_harness/compile-tests.md

Implementation

Implemented crates/sage-ir/src/parse/exprs.rs:2–7

sage_ir::parse::exprs · lib:sage_ir

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_test_harness.compile_tests.production_execution`
use sage_stash::{Ptr, Stash};

use crate::cst::Mutability;
use crate::cst::expr::*;
use crate::name::Name;

}

See more source ↗

Implemented crates/sage-test-harness/src/compile/observe.rs:1–6

sage_test_harness::compile::observe · lib:sage_test_harness

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_test_harness.compile_tests.production_execution`
// {anchor}`crates.sage_test_harness.compile_tests.project_isolation`
// {anchor}`crates.sage_test_harness.compile_tests.annotation_validation`
// {anchor}`crates.sage_test_harness.compile_tests.compiler_conditions`
// {anchor}`crates.sage_test_harness.compile_tests.fixtures`
use super::annotations::Compiler;

}

See more source ↗

Implemented crates/sage-test-harness/src/compile/rustc.rs:1–6

sage_test_harness::compile::rustc · lib:sage_test_harness

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_test_harness.compile_tests.production_execution`
//! Independent rustc diagnostics for the same materialized fixture.
// {anchor}`crates.sage_test_harness.compile_tests.fixtures`
use super::annotations::{Compiler, Marker};
use sage_ir::diagnostic::{DiagnosticSnapshot, Severity, SourceLocation};
use serde_json::Value;

}

See more source ↗

Implemented crates/sage-test-harness/src/compile/mod.rs:135–140

sage_test_harness::compile · lib:sage_test_harness

#![allow(unused)]
fn main() {
        // {anchor}`crates.sage_test_harness.compile_tests.production_execution`
        // {anchor}`crates.sage_test_harness.compile_tests.dependencies`
        // {anchor}`crates.sage_test_harness.compile_tests.rustc_execution`
        // {anchor}`crates.sage_test_harness.compile_tests.compiler_conditions`
        // Run rustc independently even when Sage will report source errors.
        // Keep its result until Sage has also completed preparation; neither

}

See more source ↗

Implemented crates/sage-host/src/driver.rs:9–14

sage_host::driver · lib:sage_host

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_test_harness.compile_tests.production_execution`
// {anchor}`crates.sage_test_harness.compile_tests.project_isolation`
// {anchor}`crates.sage_test_harness.compile_tests.edition`
// {anchor}`crates.sage_test_harness.compile_tests.query_capture`
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU64, Ordering};

}

See more source ↗

Implemented crates/sage-host/src/metadata.rs:3–8

sage_host::metadata · lib:sage_host

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_test_harness.compile_tests.production_execution`
// {anchor}`crates.sage_test_harness.compile_tests.edition`
// {anchor}`crates.sage_test_harness.compile_tests.project_isolation`
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
use std::process::Command;

}

See more source ↗

Tests and review

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

Implemented sage_host::driver::tests::failed_metadata_provider_replacement_preserves_the_live_host

crates/sage-host/src/driver.rs · lib:sage_host

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_test_harness.compile_tests.production_execution)]
    fn failed_metadata_provider_replacement_preserves_the_live_host() {
        let project = Path::new(env!("CARGO_MANIFEST_DIR"))
            .join("../../test-projects/semantic-inspector/db-drop-guard");
        let mut host = SageHost::try_open(&project, &[]).unwrap();
        let revision = host.salsa_revision();
        let source_paths = host.source_paths();

        let error = host
            .reload_with_args(|args| {
                args.push("--sage-intentional-invalid-option".to_owned());
            })
            .unwrap_err();

        assert!(error.contains("metadata provider"), "{error}");
        assert_eq!(host.salsa_revision(), revision);
        assert_eq!(host.source_paths(), source_paths);
        host.with_context(|context| {
            assert!(!context.root.expanded_module_items(context.db).is_empty());
        });
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Implemented sage_test_harness::compile::tests::completed_types_ignore_expected_text_and_use_later_constraints

crates/sage-test-harness/src/compile/mod.rs · lib:sage_test_harness

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_test_harness.compile_tests.completed_types)]
    #[sage::test(crates.sage_test_harness.compile_tests.production_execution)]
    fn completed_types_ignore_expected_text_and_use_later_constraints() {
        let source = "fn f() -> u16 {\n let value = 22; //# ty\n value\n}";
        let mut first = CompileTest::default();
        first.source(source);
        first.observations(expect!["invented bool answer"]);
        let first = first.prepare().unwrap();
        let mut second = CompileTest::default();
        second.source(source);
        second.observations(expect!["invented u64 answer"]);
        let second = second.prepare().unwrap();
        assert_eq!(first.observations, second.observations);
        assert_eq!(
            first.observations,
            "src/lib.rs: literal `22`\n  type: u16\n"
        );
        assert!(first.diagnostics.is_empty());
        assert!(second.diagnostics.is_empty());
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Implemented sage_test_harness::compile::tests::unknown_edition_fails_setup

crates/sage-test-harness/src/compile/mod.rs · lib:sage_test_harness

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_test_harness.compile_tests.edition)]
    #[sage::test(crates.sage_test_harness.compile_tests.production_execution)]
    fn unknown_edition_fails_setup() {
        let mut test = CompileTest::default();
        test.source("");
        test.edition("future");
        assert!(test.prepare().unwrap_err().contains("unknown edition"));
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Implemented sage_test_harness::invalid_source_reaches_sage

crates/sage-test-harness/tests/compile_tests.rs · test:compile_tests

#![allow(unused)]
fn main() {
#[test]
#[sage::test(crates.sage_test_harness.compile_tests.production_execution)]
#[sage::test(crates.sage_test_harness.compile_tests.diagnostic_counts)]
#[sage::test(crates.sage_test_harness.compile_tests.diagnostic_locations)]
#[sage::test(crates.sage_test_harness.compile_tests.rendering)]
fn invalid_source_reaches_sage() {
    compile_test! {
        source: indoc! {r#"
            fn example() -> u16 {
                true //# ERROR
            }
        "#},
        diagnostics: expect![[r#"
            error: type mismatch: expected `u16`, found `bool`
             --> src/lib.rs:1:21
              |
            1 |   fn example() -> u16 {
              |  _________________---_^
              | |                 |
              | |                 expected `u16` because of return type
            2 | |     true //# ERROR
            3 | | }
              | | ^
              | |_|
              |   found `bool`"#]],
    }
}
}

See more source ↗

Review: Accepted · Codex anchor_014 refreshed review.

Assessed the current complete production_execution claim, all six ordinary implementation associations and all four ordinary test associations after a fresh start. No TODO/N/A evidence is present. This is a source assessment; root owns current suite execution, and I did not rerun tests during this refresh.

Production routing: compile/mod.rs materializes the inline sources and generated standalone Cargo manifest, invokes SageHost::try_open, then observe::collect. driver.rs uses metadata::load_workspace, a production Database with the real metadata proxy, source registration and setup_root_module/parse_str_to_cst. metadata.rs obtains Cargo target information and the pinned sysroot, skips compiling the selected fixture when it has no Cargo dependencies, and supplies real metadata rather than expectations. The generated inline manifest currently has no third-party dependencies, so the standard library is its external metadata source. parse/exprs.rs constructs CST expressions from actual syntax; it never accepts expected answers. observe.rs forces expanded module items, function signatures and checked bodies, collects their real diagnostics and uses the resulting typed trees for observations. This establishes production-path reuse, not universal support for every Rust construct.

Inputs versus outputs: prepare uses only the presence of observation/diagnostic/query expectations to control required output and capture, never their text. collect receives source markers and a query-capture boolean, derives types from checked bodies, diagnostics from production results and query logs from actual inspection events. run applies expect.assert_eq only after prepare succeeds. completed_types_ignore_expected_text_and_use_later_constraints provides contradictory invented bool/u64 expectation texts for identical source; it asserts identical u16 observations, reflecting the later return constraint, and empty diagnostics. That test exercises the semantic independence boundary; source inspection confirms the same boundary excludes diagnostic and query expectation text.

Negative Rust fixtures and separate conformance: invalid_source_reaches_sage supplies true in a u16-returning body and asserts the precise Sage mismatch rendering/location. driver.rs constructs a separate extern-only metadata stub rather than passing that body to the embedded compiler; metadata.rs does not compile the dependency-free selected fixture. compile/mod.rs saves the result of independent rustc::check and still executes Sage before combining results. compile/rustc.rs executes the real fixture separately with the pinned compiler, parses its diagnostics and validates exit status; the current execute/validate_output helper split preserves that separation. Therefore metadata-provider success is not mistaken for conformance, and a rustc-invalid fixture reaches Sage.

Failure classification: unknown_edition_fails_setup asserts a direct preparation error for invalid configuration. failed_metadata_provider_replacement_preserves_the_live_host injects an invalid compiler option into the same try_open_with_args initialization path and asserts a metadata-provider error plus preservation and usability of the old host. The fixture manifest and source were captured with review read. The provider readiness channel carries Result independently of source diagnostics; failed startup/expansion and disconnected readiness are returned as errors. CompileTest propagates host setup errors before invoking observation and source-marker matching. run panics on preparation errors before expectations can accept or update them. The current independent rustc execute helper likewise returns spawn errors directly, and validate_output rejects malformed/abnormal output before source matching.

All requirements and qualifications are accounted for by the current implementation and visible assertions. No source changes were made in this refresh and no edits are requested.

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