crates.sage_oracle_harness.crate.exact_comparison

Conformance is exact identity of independent emissions. Sage and rustc each produce and validate a complete value in the shared semantic schema, serialize it deterministically, and pass only when the serialized bytes are identical. A structural or textual diff may diagnose inequality but cannot decide equality.

Read in specification context · design/crates/sage_oracle_harness/crate.sage

Implementation

Implemented crates/sage-oracle-harness/src/lib.rs:169–174

sage_oracle_harness · lib:sage_oracle_harness

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_oracle_harness.crate.exact_comparison`
fn assert_serialized_text_eq(
    fixture_name: &str,
    lhs_text: &str,
    rhs_text: &str,
) -> Result<(), String> {

}

See more source ↗

TODO crates/sage-oracle-harness/tests/independent_coverage.rs:38–43

sage_oracle_harness::todo · test:independent_coverage

#![allow(unused)]
fn main() {
    // {anchor}`crates.sage_oracle_harness.crate.exact_comparison`
    // {anchor}`crates.sage_oracle_harness.crate.independent_coverage`
    // TODO: run_fixture has independent coverage checks for three named fixtures,
    // but lacks generic per-emitter source item/body inventories and rejection of
    // forbidden unsupported/debug placeholders. Implement shared coverage validation
    // and independent source inventories before requiring every fixture to reject

}

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::crates_sage_oracle_harness_crate_exact_comparison

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

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_oracle_harness.crate.exact_comparison)]
    fn crates_sage_oracle_harness_crate_exact_comparison() {
        // TODO: Associate and review the complete evidence for Harness tests perturb each side
        // independently, reject every byte difference, demonstrate that diagnostic diffing runs only
        // after inequality, and compare both emissions against a reviewed exact snapshot for pinned
        // slices.
    }
}

See more source ↗

Implemented sage_oracle_harness::comparison_tests::exact_text_is_the_conformance_boundary

crates/sage-oracle-harness/src/lib.rs · lib:sage_oracle_harness

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_oracle_harness.crate.exact_comparison)]
    fn exact_text_is_the_conformance_boundary() {
        assert!(assert_serialized_text_eq("same", "{\n  \"x\": 1\n}", "{\n  \"x\": 1\n}").is_ok());

        let error = assert_serialized_text_eq("spacing", "{\"x\":1}", "{ \"x\": 1 }")
            .expect_err("structurally equal JSON with different text must fail");
        assert!(error.contains("structurally equal but textually distinct"));
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Review: Accepted · Codex delegated reviewer ci_exact_comparison.

Reviewed the complete exact_comparison claim, its ordinary implementation in sage-oracle-harness/src/lib.rs, its explicit TODO implementation in tests/independent_coverage.rs, its two associated tests, and captured supporting schema/emitter/fixture-runner context. Requirements are: independent Sage and rustc emissions in the shared schema; complete independently validated values; deterministic serialization; equality decided exclusively by serialized byte identity; optional diffing used only to diagnose inequality.

The implemented comparison boundary is sound. assert_crates_eq takes two Crate<NormalizedDef> values and independently serializes each with serde_json::to_string_pretty, without sorting, renumbering, reparsing, or normalizing them before comparison. assert_serialized_text_eq returns Ok only when the Rust strings are equal, which is equality of their UTF-8 bytes. For unequal strings it parses JSON solely to generate diagnostics: both the structurally equal branch and structural-difference branch return Err. Thus diagnostic equality cannot override a byte mismatch. JSON parsing unwraps are consistent with its private production caller supplying serialized schema values; this helper is not an arbitrary untrusted-text comparison API. The single-file and directory Fixture entry points invoke distinct Sage and rustc paths and return the same typed schema. Captured rust-ref declarations establish the shared serialized representation; captured Sage and oracle entry points establish the separate producer boundaries. These are supporting context, not a new claim that all emitter semantics are complete.

The ordinary exact_text_is_the_conformance_boundary test explicitly accepts identical pretty-printed bytes, rejects whitespace-distinct but structurally identical JSON, and asserts the diagnostic for that case. It would detect replacing the equality decision with structural JSON equality. The other associated test is explicitly TODO, not passing behavioral coverage: it defers independent perturbations, more byte-difference cases, ordering of diagnostic execution, and reviewed snapshots for pinned slices until that complete evidence is associated and reviewed. Its empty body is not counted as verification. Source inspection establishes the structural-difference branch unconditionally rejects, but this review does not represent the existing ordinary test as exhaustive coverage of all byte differences.

The complete-value validation clause remains a prerequisite, not an accomplished consequence of byte equality. Captured independent_coverage.rs explicitly documents the already-deferred generic per-emitter source item/body inventories and shared validator rejecting unsupported/debug placeholders; its eligible TODO requires those components before enabling the ignored paired-unsupported-body regression and adding omission/debug-fallback cases. The captured run_fixture segment confirms fixture-specific checks for three named slices before exact comparison, rather than a generic validator. This existing explicit architectural deferral adequately accounts for the overlapping completeness requirement here; accepting the comparator evidence does not certify arbitrary fixtures as fully covered. At the coordinator's request, this existing implementation TODO now also carries the exact_comparison association so its missing validation prerequisite is visible directly in this anchor's generated status. The ordinary byte comparator remains ordinary; no implemented behavior was reclassified. Determinism is likewise producer-owned: the comparator preserves supplied ordering and serializes directly, while the associated TODO retains broader end-to-end evidence work. The report approves the current implemented exact-byte boundary and honestly preserves those existing deferrals, not the full destination as implemented.

Executed review start with the coordinator instruction file and review read commands to capture all supporting source consulted. The only source edit was the coordinated extra exact_comparison marker on the existing implementation TODO. Ran cargo fmt, restarted this review, inspected the fresh complete association set, and recaptured supporting dependencies. No behavioral tests were executed by this reviewer; root owns centralized build, test execution, and required delegated quality checks. Two out-of-bounds read attempts failed before capture and were retried with valid ranges/whole-file selection. No new behavioral defect is alleged, and no regression reproduction is claimed. All ordinary and TODO entries are accounted for; no requested source edits are needed.

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