crates.sage_inspector.inspection.derive_reflection

Representation growth flows through the derive. Product producers do not hand-serialize Sage CST, type, signature, or Typed-IR structures. Adding an ordinary field or variant changes reflected output through the Reflect implementation unless an explicit semantic override is documented.

Read in specification context · design/crates/sage_inspector/inspection.sage

Implementation

Implemented crates/sage-reflect/src/lib.rs:12–17

sage_reflect · lib:sage_reflect

#![allow(unused)]
fn main() {
// {anchor}`crates.sage_inspector.inspection.derive_reflection`
pub use sage_reflect_derive::Reflect;

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "kebab-case")]
#[sage::item(crate::reflection::ValueNode)]

}

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_inspector_inspection_derive_reflection

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

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_inspector.inspection.derive_reflection)]
    fn crates_sage_inspector_inspection_derive_reflection() {
        // TODO: Associate and review the complete evidence for Compile/shape tests cover named, tuple,
        // and unit forms, real products retain their wrappers and nested type trees, and continuation
        // limits retain an explicit resumable boundary.
    }
}

See more source ↗

Implemented sage_reflect::tests::derive_preserves_every_enum_payload_shape

crates/sage-reflect/src/lib.rs · lib:sage_reflect

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_inspector.inspection.derive_reflection)]
    fn derive_preserves_every_enum_payload_shape() {
        assert!(
            matches!(Choice::Unit.reflected(), ValueNode::Variant { variant_name, fields, .. } if variant_name == "Unit" && fields.is_empty())
        );
        assert!(
            matches!(Choice::Tuple(1, true).reflected(), ValueNode::Variant { variant_name, fields, .. } if variant_name == "Tuple" && fields.len() == 2)
        );
        assert!(
            matches!(Choice::Record { value: "x".to_owned() }.reflected(), ValueNode::Variant { variant_name, fields, .. } if variant_name == "Record" && fields[0].name == "value")
        );
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Implemented sage_reflect::tests::derive_preserves_fields

crates/sage-reflect/src/lib.rs · lib:sage_reflect

#![allow(unused)]
fn main() {
#[test]
    #[sage::test(crates.sage_inspector.inspection.derive_reflection)]
    fn derive_preserves_fields() {
        let value = Example {
            label: "value".to_owned(),
            values: vec![1, 2],
        };
        let ValueNode::Record { fields, .. } = value.reflected() else {
            panic!("expected record")
        };
        assert_eq!(fields[0].name, "label");
        assert_eq!(fields[1].name, "values");
        assert!(matches!(
            &fields[0].value,
            ValueNode::Scalar { type_name, value: ScalarValue::String(value) }
                if type_name == "String" && value == "value"
        ));
        assert!(matches!(
            &fields[1].value,
            ValueNode::Sequence { type_name, items }
                if type_name == "Vec" && items.len() == 2
        ));
    }
}

Conditional source: #[cfg(test)]

See more source ↗

Review: Accepted · Codex anchor_029 independent reviewer.

Fresh assessment of the complete derive_reflection claim and all one implementation/three test entries. I independently verified exact byte equality of the current sage-reflect implementation/test source and service_spec test source with the supplied historical snapshots; their prior report is context, not the verdict. Current claim requires representation growth through Reflect, no producer hand-serialization of CST/types/signatures/Typed IR, ordinary fields/variants appearing automatically, and documented explicit semantic exceptions. The sole ordinary implementation association exports the derive; its captured whole file defines owned Record/Variant/Sequence/Scalar/Reference output, Reflect::reflected dispatch through default context and finish, and recursive String/Vec reflection. This is meaningful infrastructure but not a universal producer/derive audit.

Both ordinary tests have visible assertions and cfg(test) metadata. derive_preserves_fields derives Example with label and values and asserts both field names, actual String scalar value/type, and Vec type plus two items. derive_preserves_every_enum_payload_shape derives Choice and checks Unit name/empty fields, Tuple name/two fields, and Record name/value field. These catch missing fields and variant-shape losses in these examples; neither establishes every production representation, all nested scalar payloads, all compile forms, or the semantic-override exception. Example/Choice definitions and invoked runtime helpers are in the captured whole-file fragment. I have not treated the exported macro alone as proof of its entire expansion implementation.

The service_spec entry is explicitly TODO (its containing todo module is additionally captured). Its comment defers association and review of complete named/tuple/unit compile/shape evidence, real-product wrappers/nested type trees and continuation boundaries. I accept the existing historical interpretation: the remaining prerequisite is a complete production evidence audit, including producer use of reflection instead of hand serialization and documentation of semantic overrides, followed by associated assertions across those representations. This is unfinished assurance, not implemented universal coverage. The current partial shape tests do not discharge it, and unrelated runtime tests in the whole file are not substituted for its missing associated evidence. There are no N/A entries or TODO implementation entries. All claim aspects are thus accounted for as either concrete partial infrastructure/shape coverage or the retained explicit TODO; no changes to that accounting are requested.

Commands I executed were review start/read, source reads and a Python exact-byte comparison; no behavioral test execution or Rust edits. Coordinator separately reports 321 sage-meta functional tests and cargo build passed; that is not execution performed by this reviewer. All source dependencies used for this limited assessment are in the initial whole implementation/test fragments plus the captured service_spec module context.

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