Repository navigation
Replace resolved Optional cardinality with canonical owner applications - #11387
gunbai-bot[bot] wants to merge 1 commit into
Conversation
Operator wind-down checkpoint: preserve accepted B source work as an explicitly incomplete draft. Generated mirrors are not installed; compose on landed B0 #11354 and regenerate to fixed point before readiness. Fixture route and native evidence remain pending as documented in the draft PR.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ffe73b1a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let resolved = resolve_scrutinee_type_node(env: env, n: base_type) | ||
| let normed = normalize_access_type_node(n: resolved) | ||
| let normed_opt = normed.return_cardinality == CardOptional | ||
| let normed_opt = node_is_optional_type(n: normed) |
There was a problem hiding this comment.
Unwrap canonical optionals before recursing
When accessing any field other than value through an optional record (for example, item?.name), node_is_optional_type now selects this branch for the canonical Optional<T> application, but the following with_required_cardinality is a no-op because that application is already Required. field_summary_for_type consequently recurses with the identical node until inference overflows the stack instead of examining T; this branch needs to pass extract_optional_inner_node(n: normed) as the other migrated lookup path does.
Useful? React with 👍 / 👎.
| if (n.return_cardinality == CardOptional) { | ||
| let inner = resolve_node_bounded(n: with_required_cardinality(n: n), env: env, | ||
| module_name: module_name, depth: depth + 1, masked: masked) | ||
| return NodeResolveResult { resolved: make_optional_type(element: inner.resolved), diagnostics: inner.diagnostics } |
There was a problem hiding this comment.
Migrate Go emission before changing the resolved shape
For any authored optional parameter, field, or return type emitted to Go, this conversion replaces CardOptional with a Required Optional<T> application. The Go emitter still sends these nodes to v1.compiler.emit.render_node_type, whose optional branch recognizes only CardOptional, so it emits Optional[T] rather than the language specification's *T; the generated Go therefore references an undefined or non-generic Optional type and fails to compile. The target-generic/Go consumers need to recognize and peel the canonical application as part of this migration.
Useful? React with 👍 / 👎.
|
review 66317 read against 7ffe73b. Finding 1 (mirrors not installed; no executing seed) is the declared wind-down checkpoint state — this draft is deliberately source-only until B0 (#11354) lands and the full atomic B regeneration installs its mirrors; it is not being landed. Finding 2 is a real defect independent of that and is recorded as the first resume item: at |
|
Closed under the operator wind-down (2026-09-16): this draft's remaining work is repair, not integration, and it is not being carried into the namespace integration branch. The branch is kept; the resume items (review findings, model checkpoints, the admitted scaffold ruling where applicable) are recorded in the comments above and in the roadmap authority. Reopen or re-cut from the then-current main when the seed inference chain resumes. — sent from swift-bat-902 |
Draft preserved for operator wind-down; no further implementation is running. This is the accepted Optional representation migration B, not a merge-ready candidate. It must compose/rebase on landed B0 #11354 before regeneration. #11277 remains parked at
cb9529347feand recomposes only after B lands. The original namespace work (#11267 prerequisite, then #11264) remains downstream.This draft commits existing source work only. Its generated mirrors are deliberately NOT installed: the committed seed is still the pre-B seed. Do not treat CI on this checkpoint as a fixed-point proof or admit it for landing. The source-only draft is the explicit wind-down preservation requested by eager-raven; normal source+adjudicated-mirror atomicity resumes at the next implementation transaction.
Observed draft CI: run
34868932927build job104059723933fails in the Rust semantic witness with E0432/E0425 formake_optional_type,kernel_optional_type_node, andapply_optional_owner; the new .dag declarations have no installed B seed mirrors yet. Dependent inference diagnostics follow. Build log. This is the documented incomplete source/mirror checkpoint, not a passing bootstrap. Resolve through the pending B0 composition and atomic B regeneration; do not add Rust stubs or remove controls to make this draft green.Accepted ruling and scope
Side-chat turn
832a0c6eapproves canonical resolved/inferred Optional as an application of the existingv2.std.optional.Optional<T> = Absent | Present { value: T }owner, with its instantiated payload and Required cardinality. AuthoredT?is ingested once atresolve_node_boundedbefore dispatch. Producers stop constructing resolved/inferred CardOptional; consumers read the canonical owner and ordered argument. Syntax/identity transport may preserve authored cardinality as syntax. There is no comparator equivalence bridge, emitter-site wrapping workaround, or #11277-only helper dependency.B is a standalone replacement migration from main. Its falsifier remains: if the actual main/B0-seed transaction requires #11277-only literal/generic canonicalization or an intermediate representation, B is falsified and the gatekeeper must rule on composed A. No alternate older seed may hide that failure. Attainable rung is mechanically prevented at the resolved-type producer boundary, NOT structurally impossible: Node still carries Cardinality. The next-rung trigger is a distinct resolved/inferred carrier unable to contain CardOptional.
Two bounded divergences are declared. Only
lookup_field_type_nodeandmap_lookup_result_typeretain main's idempotent flatten when their element is already Optional; nested Optional is admitted there once pattern elimination and emitter consumers are proven on the nested shape. The productioncollect_item_inductive_fieldsroute over unresolved module items retains authored-cardinality analysis yielding RecursionShape; this admission is call-path-specific, not a claim thatclassify_field_recursionnever sees inferred evidence. A future syntax/resolved carrier split puts that route on syntax by construction.Pending work — not claims of completion
node://adhoc-babdd2de-8dbowns required seed-rooted same-identity candidate-bound terminals. No root widening, marker removal, or per-claim exemption is authorized.interpreter_optional_value_representation_fork; the native route owes positive evidence. Do not patch the interpreter or add comparator unwrapping.Executed 12-site corpus census
Instrument:
regenA.ei3TxS, cb952 plus the accepted instantiated-owner payload correction, emitted by the 7de7 seed state and rebuilt. It closed all five prior method-surface refusals and exposed twelve Optional if-join refusals (seven previously visible, five newly reached). This is a diagnostic for the representation fork, NOT a B fixed point. Authoritative instrument. Locations are cited by the declaring symbols below; multiple sites in a declaration remain distinct obligations.v1.compiler.emit_rustdeclarationeffective_variant_parent_from_enum_lookupeffective_variant_parent_from_resolvedemit_rust_expr_record_litcontextual_variant_parent_absentrc_grouped_arm_planemit_typed_match_arm_strsrust_struct_field_type_node_variant_awareemit_field_value_with_contextoperation_response_200_resolved_typecompiler_pipeline_entry_declRefusal preservation
Gatekeeper ruling msg_1406f4c4 admits the general application comparison within B. The main reduction records the refusal previously supplied accidentally by CardOptional recursion: Int?/String? is incompatible. Applied Optional/Optional and Map<String,Int>/Map<String,String> are compatible on main because the comparison falls through to their shared name. Applied Optional/Optional is also unequal on main: equality lacks its ordinary application path.
The replacement uses type_application_arguments_match for both node_type_compatible and node_type_equals_core. It checks arity before walking all ordered arguments and applies the relation recursively. The old List and Map-specific comparison walks are deleted, including the Unit-element wildcard acceptance. No Optional spelling branch or CardOptional equivalence is introduced. Unexpected corpus refusals are defects to diagnose, never permission to restore acceptance.
This is a declared §3b divergence from the original accepted plan: simply deleting the marker branches would erase a required refusal. The minimum replacement must carry it through canonical arguments instead.
Main's make_container_type/make_map_type and resolve_node_bounded still transport collection arguments in named slots. The shared walk uses their existing child_type_node projection; other applications carry direct arguments. That is preservation of main's pre-existing producer protocol, not an intermediate Optional representation. There is no separate collection comparison policy. The later collection argument-carrier cut can delete this projection once those producers change together. Compatibility retains main's declared container alias head normalization; equality retains its authored-head relation.
Permanent controls exercise Optional mismatch/identity/arity, Map value mismatch/identity, List mismatch and nested Optional mismatch in both relations. The .dag comparison claim module uses real producers and is being run on the interpreter route; native semantic controls await regenerated mirrors. See comparator-main-matrix.log for exact-main baseline observations. No candidate GREEN is claimed by this checkpoint.
Producer disposition roster
Authority: existing v2.std.optional.Optional = Absent | Present { value: T }.
Three former kernel declaration sites (build_type_env, build_type_env_unresolved, compiler_kernel_type_env) consume kernel_optional_type_node with an authored-shaped generic parameter T. optional_application_node and apply_optional_owner share the declaration substitution used by resolve_node_bounded: substitute_type_slots/substitute_type_slots_scoped moved unchanged into infer_types to avoid an import cycle. No second substitution algorithm and no bind_type_variables special case.
Marker restorations are removed from declared_return_type_node, field_substitution_carrier, resolve_pattern_subject, bind_local_func_conformance, census_declaration_bound_formals, resolve_scrutinee_type_node_seen, resolve_scrutinee_type and preserve_nominal_brand_on_resolve. with_authored_identity copies the resolved structural cardinality. resolve_nominal_alias_rhs and rendered_use_site_type retain the canonical Optional result. Resolved scrutinee lookup preserves the application; pattern elimination reads its instantiated owner. annotate_pattern_parent_enums reads that owner instead of inventing an Optional parent from cardinality.
Node still permits authored CardOptional: this cut claims mechanical prevention at accepted resolved/inferred producer boundaries, not structural impossibility. Typed refusals remain refusals. Syntax fields/identity transports retain authored metadata only as syntax; their type evidence comes from the canonical boundary. classify_field_recursion is the explicitly admitted syntax-analysis divergence, with its caller chain and next-rung trigger in the consumer census.
Falsifier: main committed seed -> gen1 -> install/rebuild -> gen2 -> fixed point -> native observation. If this needs #11277's generic/literal canonicalization, B is falsified and the ruling switches to composed A. No mixed representation, comparator equivalence or emitter bridge may rescue B. The twelve Optional joins identified by regenA.ei3TxS must also disappear after #11277 recomposes.
Consumer disposition roster
Main-based Optional consumer disposition census
Base: ed853cf. Discovery: lexical reads of return_cardinality/CardOptional in all v1 inference modules and emit_rust; imports, comments and string literals excluded. This replaces the prior cb952 census: #11277-only declarations are absent on this base.
v1.compiler.infer_emit_info.field_value_shape_from_type_nodev1.compiler.infer_env.qualify_borrowed_type_namesv1.compiler.infer_env.node_with_childrenv1.compiler.infer_env.node_with_inferredv1.compiler.infer.classify_field_recursionv1.compiler.infer.variant_reference_inferred_nodev1.compiler.infer.declared_field_is_requiredv1.compiler.infer.conformance_ground_kernel_scalarv1.compiler.infer.conformance_ground_element_collectionv1.compiler.infer.declared_type_kernel_inhabitance_mismatchv1.compiler.infer.rejects_string_for_optional_coproduct_fieldv1.compiler.infer.field_type_admits_bare_nonev1.compiler.infer.field_type_is_optional_coproductv1.compiler.infer.record_lit_instantiated_fieldsv1.compiler.infer.match_arm_types_are_disjoint_coproductsv1.compiler.infer.equality_operand_admissionv1.compiler.infer.structured_application_lit_is_declared_optional_variantv1.compiler.infer.declared_type_inhabitancev1.compiler.infer.nominal_product_head_namev1.compiler.infer.applied_type_argument_conflictsv1.compiler.infer.coproduct_payload_where_parent_requiredv1.compiler.infer.direct_call_arg_type_mismatchv1.compiler.infer.optional_cast_diagsv1.compiler.infer.annotate_pattern_parent_enumsv1.compiler.infer.literal_boundary_elaborationv1.compiler.infer.infer_expr_bodyv1.compiler.infer.expand_alias_chain_for_field_accessv1.compiler.infer.infer_record_lit_structuralv1.compiler.infer.annotate_descentv1.compiler.infer.infer_property_valuesv1.compiler.infer.infer_service_config_propertiesv1.compiler.infer.infer_transport_nodev1.compiler.infer.infer_itemv1.compiler.infer.substitute_generics_applyv1.compiler.infer.local_binding_for_itemv1.compiler.infer.transparent_alias_target_namev1.compiler.infer.build_type_env_unresolvedv1.compiler.infer.typecheck_modulev1.compiler.infer_lookup.lookup_field_type_nodev1.compiler.infer_lookup.field_summary_for_typev1.compiler.infer_lookup.map_lookup_result_typev1.compiler.infer_patterns.expand_scrut_type_for_variant_lookupv1.compiler.infer_patterns.lookup_variant_in_typev1.compiler.infer_patterns.resolve_scrutinee_typev1.compiler.infer_patterns.constructor_roster_forv1.compiler.infer_resolve.with_authored_identityv1.compiler.infer_resolve.substitute_type_slots_scopedv1.compiler.infer_resolve.resolve_nominal_alias_rhsv1.compiler.infer_resolve.resolve_node_boundedv1.compiler.infer_resolve.rendered_use_site_typev1.compiler.infer_resolve.resolve_item_typesv1.compiler.infer_types.reground_alias_carrier_identityv1.compiler.infer_types.structural_carrier_template_namev1.compiler.infer_types.enrich_base_with_fieldsv1.compiler.infer_types.node_type_shapev1.compiler.infer_types.node_type_compatiblev1.compiler.infer_types.prefer_specific_typev1.compiler.infer_types.node_type_equalsv1.compiler.infer_types.extract_optional_inner_nodev1.compiler.emit_rust.rust_carrier_is_at_shared_layerv1.compiler.emit_rust.rust_carrier_optional_wrapv1.compiler.emit_rust.emit_inferred_type_leaf_namev1.compiler.emit_rust.collect_value_emit_type_surface_namesv1.compiler.emit_rust.needs_box_wrappingv1.compiler.emit_rust.inferred_expr_is_optionalv1.compiler.emit_rust.analyze_rc_matchv1.compiler.emit_rust.explicit_record_struct_namev1.compiler.emit_rust.effective_variant_parent_from_resolvedv1.compiler.emit_rust.emit_none_keyword_for_resolved_typev1.compiler.emit_rust.contextual_variant_parent_absentv1.compiler.emit_rust.rust_call_arg_fail_closed_unwrapv1.compiler.emit_rust.emit_rust_map_method_callv1.compiler.emit_rust.emit_typed_method_callv1.compiler.emit_rust.emit_typed_matchv1.compiler.emit_rust.is_already_optionalv1.compiler.emit_rust.emit_typed_record_litv1.compiler.emit_rust.is_optional_typed_exprv1.compiler.emit_rust.type_node_is_ordered_element_runv1.compiler.emit_rust.is_string_typed_exprv1.compiler.emit_rust.emit_rust_tco_matchv1.compiler.emit_rust.emit_dry_run_branch_from_propsv1.compiler.emit_rust.emit_shell_callv1.compiler.emit_rust.emit_cli_param_type_nodeObserved main population: 83 declarations. This census is a review artifact, not an execution receipt.
Next-rung trigger: separate resolved/inferred evidence into a carrier that cannot contain CardOptional. Present cut is mechanically enforced by producer construction, not structural impossibility.
Bounded lookup divergence: lookup_field_type_node and map_lookup_result_type alone preserve idempotent flattening. Admit nesting there only once nested pattern elimination and emission are proven.
Durable evidence and transaction history
Patch-only relay
session/crisp-carp-634-optional-relayretains all earlier inputs and receipts.regenB.hkdakprefused generation one for duplicate ownership use of normed; source corrected.regenB.EdGCFAproduced generation one but its candidate rebuild refused E0382 in rendered_use_site_type.regenB.o70L6Uwith the ownership source correction repeated E0382 because generation one was still emitted by the old seed, motivating standalone B0. Those are refusals, not successful B transactions. B0 subsequently reached its own fixed point, but B has not yet been regenerated with that seed. Latest complete source checkpoint before draft commit is the relay's optional-root-latest.patch; all reductions and producer/consumer rosters remain there.