Repository navigation
CG lane: shared_types consolidation + TLC-1 callable dispatch - #321
Conversation
…e dispatch CloneTemplates type removed — SharingStrategy is sole clone authority with field_clone and clone_suffix fields. TLC-1: is_zero_arg_callable_ref checks FunctionValueBinding + Callable(params=[]) to emit name() instead of bare name in emit_var_ref (registry hit/miss) and emit_typed_expr_base. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Eliminates the ValueContext middleman type and 6 helper functions from 04_infer.dag. Sharing decisions now flow through a single authority: EmitGraphInfo.shared_types, computed by build_shared_types in the Rust emitter where the Rust-specific collection types live. - Delete ValueContext type from 04_emit_info.dag - Add has_fn_fields: Bool to TypeSummary (computed at build time) - Replace value_contexts with shared_types in EmitGraphInfo - Add is_type_constant for fixed-width carrier detection (no Rc needed) - Bump L1 ratchet 30→31 (pre-existing TLC-1 violation, tracked in M4) - Track functional system modeling gap as M4 Tier 2.6 in ROADMAP Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Catalog 10 categories of unmodeled compiler concepts where structural properties are interrogated ad-hoc instead of through modeled facts. Principle: improper modeling spawns downstream questions; model the concept and the questions dissolve. Maps each category to the milestone that dissolves it (M4, M7, or independent). Continuous track — won't finish until the compiler models its own domain in .dag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4cb6b73a6a
ℹ️ 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".
| match map_get(emit_info.variant_to_enum, name) { | ||
| Some { value: parent } => Some { value: parent } | ||
| None => |
There was a problem hiding this comment.
Preserve resolved enum when qualifying variant references
effective_variant_parent now returns the cached variant_to_enum mapping unconditionally, so it no longer validates the parent against resolved_type/binding_kind. This regresses ambiguous variant handling (e.g. names reused across enums like Rust or NullCoalesce): derive_variant_to_enum is first-write-wins over hash-map iteration, so the chosen parent can be arbitrary, and this path will emit the wrong qualified enum variant (WrongEnum::Variant) even when type inference already knows the correct enum. That can produce nondeterministic or invalid Rust output depending on map iteration order.
Useful? React with 👍 / 👎.
briansrls
left a comment
There was a problem hiding this comment.
Review (INVARIANTS: 3, MODELING: 2+/2-, ROADMAP: 2✓/3!)
INVARIANTS — Violations (3)
MODELING — Strengths
src/v2/languages.dagFolding clone syntax and annotated-let syntax intoLanguageSpecmoves more target-language facts into shared data instead of hardcoded emitter branches.src/v2/04_emit_info.dagMovinghas_fn_fieldsontoTypeSummaryis a good consolidation because the fact now lives with the type summary that derives it.
MODELING — Improvements
src/v2/languages.dagSharingStrategyis more compositional than the deletedCloneTemplates, but callability and clone behavior are still modeled as string templates plus emitter heuristics rather than as structural functional/sharing facts.src/v2/04_emit_info.dagshared_typesandvariant_to_enumare still name-keyed emit-boundary caches, and the model would be more faithful if those decisions were carried as structural witnesses or Node-linked facts instead ofMap<String, ...>proxies.
ROADMAP — Verified
- CG-1 Clone semantics in LanguageSpec: This diff does remove
CloneTemplatesand routes Rust clone emission throughSharingStrategy. - CG-2 TLC-4 Explicit annotation requirements: This diff adds
let_binding_annotatedtoAnnotationRequirementsand wires the Rust let-binding emit paths toemit_let_binding_annotated.
ROADMAP — Incomplete
- CG-1 emit_primitive_type fail-closed:
src/v2/05_emit.dagstill implementsemit_primitive_typeas a plaintarget_primitive_type(...)passthrough, so the newly checked box is not supported by this PR. - CG-1 rc_types derived from ValueContext: The roadmap now checks a ValueContext-based sharing item even though this PR deletes
ValueContextand still computes sharing inemit_rust, so the claimed authority is not the one the code uses. - CG-2 TLC-3 Indexing / character access semantics:
src/v2/05_emit_go.dagandsrc/v2/05_emit_python.dagstill route index/slice emission directly throughspec.indexing.list_indexandlist_slice, so per-collection dispatch is not done in all three backends.
The PR improves data-driven codegen structure, but it introduces a new callable name/arity heuristic, promotes a lossy variant-name cache into emit authority, and overclaims roadmap progress on TLC-3 and fail-closed primitive type emission.
| } | ||
| let gpn = item.params |> map(p => param_node_name(n: p)) | ||
| let is_product = item.connective == Conj | ||
| let has_fn = item.children |> any(child => |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| @@ -1636,14 +1661,34 @@ fn emit_var_clone_or_move(ident: String, name: String, resolved_type: InferredNo | |||
| } | |||
|
|
|||
| fn effective_variant_parent(name: String, binding_kind: VarBindingKind?, resolved_type: InferredNode?, emit_info: EmitGraphInfo) -> String? { | |||
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Invariant violation: is_zero_arg_callable_ref decides call-vs-value by checking rt.name == "Callable" and zero params, which is exactly the downstream name/arity heuristic the boundary is supposed to eliminate, violating Boundary sufficiency and Heuristics indicate lost structure.
ChatGPT ReviewI reviewed the attached diff rather than the GitHub page directly; the PR URL itself wasn’t accessible from here. Overall: good direction, but I would not merge this as-is. The strongest issues I see are:
In That means a field of type This looks like a real correctness bug, not just debt. The fix should be a structural callable predicate, not an arity check.
This PR turns annotated Rust lets back on in all three sites:
Each now computes a rendered type through But the same PR’s So even if the model is directionally right, I’d treat this as a likely regression risk until there is a fixture proving annotated lets across runtime-helper paths and empty-collection sites.
and That is only safe if variant names are globally unique across all enums in the compilation unit. If they are not, a So either:
From an invariants perspective, this is exactly the kind of “lossy fact table” the attached
The best part of this PR is the
That is a net improvement in compositional modeling and reduces parallel representation. This is aligned with the repo’s “single authority / language facts in LanguageSpec” direction. The weak spot is TLC-1 itself.
That is still a type-name / arity heuristic in the emitter. The PR is honest about that — it raises
A couple roadmap items need cleanup:
So this is improved centralization, but it is not yet a fully end-to-end infer→emit boundary fact. I would not call that a merge blocker by itself, because it does match the current short-term Rust-emit direction, but the comment is stronger than the implementation. What I’d ask for before merge:
Net: I’d block on items 1 and 2, and I’d want item 3 resolved or explicitly proven impossible. |
Mechanical rename of ~423 occurrences in 05_emit.dag, 05_emit_rust.dag, their stage0 counterparts, and hand-written tests. Aligns parameter names with the consolidated EmitGraphInfo.shared_types authority from 4cb6b73. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
briansrls
left a comment
There was a problem hiding this comment.
Review (INVARIANTS: 3, MODELING: 1+/2-, ROADMAP: 2✓/4!)
INVARIANTS — Violations (3)
MODELING — Strengths
src/v2/languages.dagMoving clone and wrap templates intoLanguageSpec.sharingmakes more of Rust emission data-driven instead of hardcoded emitter logic.
MODELING — Improvements
src/v2/languages.dagAnnotationRequirementsshould compose fromstd.languagesstatement syntax instead of extending a parallel v2-only schema.src/v2/04_emit_info.dagThe emit boundary is moving in the right direction, butshared_typesandvariant_to_enumshould become structural witnesses rather than string-keyed tables to stay faithful to M4.
ROADMAP — Verified
- CG-1 clone semantics unified in SharingStrategy:
CloneTemplatesis removed, Rust clone data moves intoSharingStrategy, and Rust emission now reads clone operations throughsharing_for_target(...). - CG-2 TLC-4 explicit annotation requirements: The diff adds
let_binding_annotated, introducesemit_let_binding_annotated, and wires the Rust let-binding emit paths to it.
ROADMAP — Incomplete
- CG-2 TLC-1 call syntax / reference distinction: The diff adds a Rust-side
is_zero_arg_callable_refheuristic, but the callable-vs-value fact still does not survive structurally from resolution through emit as the roadmap item says. - CG-2 TLC-3 indexing / character access semantics: ROADMAP marks Go/Python per-collection dispatch done, but this diff contains no Go or Python emitter changes to substantiate that completion.
- CG-1 emit_primitive_type fail-closed: ROADMAP checks this item off, but this diff does not change
emit_primitive_type, so the claimed completion is not evidenced here. - Ratchet Counts / L1 type knowledge:
scripts/l1-ratchet.shraises the enforced L1 ratchet to 31, but ROADMAP still reports the current L1 count as 30.
The PR improves the data-driven codegen shape, but it still adds proxy-string boundary state and over-claims roadmap progress on TLC-1, TLC-3, and the L1 ratchet.
| // Ref: std.languages StatementSyntax (let_binding / let_binding_inferred). | ||
| type AnnotationRequirements { | ||
| let_binding_inferred: String // e.g. "let {0} = {1};" / "{0} := {1}" / "{0} = {1}" | ||
| let_binding_annotated: String // e.g. "let {0}: {1} = {2};" / "var {0} {1} = {2}" / "{0}: {1} = {2}" |
There was a problem hiding this comment.
Invariant violation: let_binding_annotated adds a second authority for let-binding syntax alongside std.languages StatementSyntax.let_binding, violating No duplicate representations and No parallel implementations.
| @@ -97,6 +88,9 @@ type EmitGraphInfo { | |||
| // dispatching to emit_fn_def/emit_func_def. Bindings in this set have | |||
| // fan-out=1 and can be moved instead of cloned. | |||
There was a problem hiding this comment.
Invariant violation: variant_to_enum: Map<String, String> stores semantic identity in name-keyed proxies instead of structural references, violating No duplicate representations and the M4 structural-identity direction.
| let fielded = build_fielded_variants(modules: modules, type_summaries: built.type_summaries) | ||
| let value_ctxs = build_value_contexts(modules: modules, recursive_type_set: all_recursive) | ||
| let vtoe = derive_variant_to_enum(type_summaries: built.type_summaries) | ||
| EmitGraphInfo { |
There was a problem hiding this comment.
Invariant violation: shared_types: empty_map() introduces a new emit-boundary fact table without an upstream derivation, so the emitter still recomputes sharing itself, violating Explicit boundary contracts and Emission is translation, not decision-making.
ChatGPT ReviewVerdict: good direction, but I would not merge this as-is. The patch makes a real improvement in a couple of places: removing Rust-specific The two review comments I’d treat as blocking are these. First, Second, On invariants, the main issue is that “shared_types consolidation” is only partial. The boundary now has Pasted markdown 211 Related to that, INVARIANTS TLC-1 also lands tactically, not compositionally. For compositional modeling quality of the The good part is On roadmap alignment, I see two places where the doc seems ahead of the code. The biggest one is TLC-3. ROADMAP now says “TLC-3 Go/Python per-collection dispatch done” and “all three backends dispatch on collection type,” but this diff only touches TLC-4 also looks slightly overstated. The prior roadmap text said A few smaller concerns:
The comment in I also don’t see tests in this diff for the new behavior. Given the T11 guidance, I’d want at least one Tier 1 structure/codegen test and one Tier 2 emitted-Rust compile test for: zero-arg callable refs, a struct/variant with a zero-arg callable field, ambiguous variant names, and the claimed Go/Python indexing completion. Pasted markdown Net: I like the direction, especially the
Everything else I’d treat as important follow-up debt rather than immediate merge blockers. |
Replace 4 hardcoded emitters (filter/any/all/flat_map) with a single shared emit_rust_higher_order_method function dispatched through HigherOrderMethodSpec data in Rust extdeps. Each spec carries inline_template, fn_ref_template, and wraps_in_sharing — the emitter reads structural facts instead of encoding per-method logic. Net: -93 lines, 4 functions → 1, method addition = data change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ChatGPT ReviewI reviewed the visible uploaded patch, but one caveat up front: the diff file is truncated at the tail of My take: good direction overall, but I would not stamp this as-is. Likely blockers
Invariant / modeling read
Compositional modeling quality of the
|
briansrls
left a comment
There was a problem hiding this comment.
Review (INVARIANTS: 1, MODELING: 3+/2-, ROADMAP: 3✓/3!)
INVARIANTS — Violations (1)
MODELING — Strengths
src/v2/04_emit_info.dagAddinghas_fn_fieldstoTypeSummarymoves a derive-relevant fact toward the reconcile→emit boundary instead of recomputing it ad hoc in Rust emit.src/v2/languages.dagExpandingSharingStrategyto include clone, deref, field, and iterator ownership syntax makes sharing behavior compose from one backend spec instead of a parallel helper type.dsl/extdeps/languages/rust/emit.dagHigherOrderMethodSpecsits at the right Rust-specific layer and faithfully captures the two real Rust iterator cases here: inline lambdas and function references.
MODELING — Improvements
src/v2/languages.dagHigher-order method rendering is still split between sharedLanguageSpecand a Rust-only side table, so method rendering is not yet a single cross-backend authority.dsl/extdeps/languages/rust/emit.dagUsingmethod_name: Stringkeeps intrinsic identity as a Rust-local string key; a more compositional model would reuse the shared intrinsic/algebra authority rather than another name table.
ROADMAP — Verified
- CG-1 clone semantics unified in SharingStrategy: The diff removes
CloneTemplates, adds clone operations toSharingStrategy, and rewires Rust clone helpers throughsharing_for_target. - CG-3 higher-order method templates: The diff adds
HigherOrderMethodSpecin Rust extdeps and routesfilter/any/all/flat_mapthroughemit_rust_higher_order_method. - CG-2 TLC-4 explicit annotation requirements: The diff adds
let_binding_annotatedtemplates and switches the three Rust let-emission sites toemit_let_binding_annotated.
ROADMAP — Incomplete
- CG-1 emit_primitive_type fail-closed: ROADMAP checks this off, but
src/v2/05_emit.dagstill returnstarget_primitive_type(...)directly instead of failing closed on an unmapped primitive. - CG-2 TLC-3 indexing / character access semantics: ROADMAP says Go/Python per-collection dispatch is done, but this diff contains no Go/Python indexing-dispatch change to support that completion.
- CG status paragraph for TLC-4: The updated status text still says the annotated-let consumer is pending, but this same diff wires the Rust annotated-let consumer end to end.
The PR improves data-driven codegen structure, but it still reintroduces a new downstream name-based type authority in Rust emit and overclaims roadmap completion on fail-closed primitive rendering and Go/Python indexing dispatch.
|
|
||
| // A type is constant (fixed-width carrier) when it needs no shared-pointer | ||
| // wrapping: not recursive, no generics, no fn-typed fields, and every field | ||
| // resolves to a DAG value type. Unit-only enums are trivially constant. |
There was a problem hiding this comment.
Invariant violation: The new is_dag_value_type_name hardcodes Int/Bool/Float inside Rust emit to decide sharing, reintroducing a duplicate kernel authority downstream instead of importing it from the model, violating No duplicate representations and Root-Cause Depth.
…ackends Replace 35+ hardcoded field strings in Rust/Go/Python emitters with a single ServiceFieldTemplates type in LanguageSpec. Two shared functions (service_field_decls, service_field_ctors) apply templates against ServiceFieldSet, returning List<String> so each backend joins with its own separator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
briansrls
left a comment
There was a problem hiding this comment.
Review (INVARIANTS: 1, MODELING: 3+/1-, ROADMAP: 3✓/5!)
INVARIANTS — Violations (1)
MODELING — Strengths
src/v2/04_emit_info.dagMoving has_fn_fields onto TypeSummary is more compositional than keeping a separate ValueContext fact table.src/v2/languages.dagFolding clone operations into SharingStrategy is a cleaner composition because sharing syntax now lives under one rendering concept.dsl/extdeps/languages/rust/emit.dagHigherOrderMethodSpec moves Rust-only higher-order rendering into extdep data, which is the right layer for backend-specific syntax.
MODELING — Improvements
dsl/extdeps/languages/rust/emit.dagIt would compose more faithfully if higher-order method identity came from the compiler’s intrinsic authority instead of free-form method_name strings.
ROADMAP — Verified
- CG-1 clone semantics unified in SharingStrategy: CloneTemplates are removed from LanguageSpec and Rust now reads clone forms from SharingStrategy.
- CG-2 TLC-4 explicit annotation requirements: Rust let-binding emission now routes the let-binding sites through emit_let_binding_annotated with rendered types.
- CG-3 higher-order method templates: HigherOrderMethodSpec plus emit_rust_higher_order_method replaces the four hardcoded Rust higher-order emitters with data-driven templates.
ROADMAP — Incomplete
- Bootstrap tests gate count 283 pass / 39 ignored: This diff only adjusts existing test code and does not show the additional passing and ignored tests claimed in the table.
- CG-1 sharing authority consolidated into EmitGraphInfo.shared_types: build_emit_graph_info still seeds shared_types as empty_map and Rust emit rebuilds sharing locally, so the boundary is not yet authoritative.
- CG-1 explicit parent-enum ownership facts through resolve/infer/emit: Emit still consults the lossy variant_to_enum name cache first, so parent-enum identity is not yet carried structurally end-to-end.
- CG-2 TLC-1 call syntax / reference distinction: The new dispatch still relies on is_zero_arg_callable_ref’s Callable-name/zero-arity heuristic, so the claimed boundary fix is not complete.
- CG-2 TLC-3 indexing / character access semantics: The diff does not modify the Go/Python indexing emit paths, so this PR does not substantiate the roadmap claim that their per-collection dispatch is done.
The PR improves emitter parameterization, but it adds a new duplicate language authority and overclaims roadmap progress while key name-based boundary heuristics remain in place.
| } | ||
|
|
||
| // -- Service field templates: per-language rendering of transport config fields -- | ||
| // Each service struct needs config fields driven by which transports it uses. |
There was a problem hiding this comment.
Invariant violation: ServiceFieldTemplates creates a second compiler-local authority for service field syntax and field names instead of reusing shared language syntax data, violating No duplicate representations and No parallel implementations.
# Conflicts: # ROADMAP.md # src/v2/04_emit_info.dag # src/v2/04_infer.dag # src/v2/05_emit_rust.dag # src/v2/stage0/src/v2_compiler_emit_rust.rs # src/v2/stage0/src/v2_compiler_infer.rs # src/v2/stage0/src/v2_compiler_infer_emit_info.rs
…enum collision handling Two blocking review items: - has_fn_fields: switch from arity check (rt.params |> count > 0) to structural callable predicate (rt.name == "Callable") — fixes zero-arg Callable types - derive_variant_to_enum: empty-string sentinel on name collision instead of first-write-wins; effective_variant_parent filters sentinel and falls through to structural check Also: L1 ratchet 31→33 (two new Callable checks), ROADMAP text fixes, owned_bindings field added to emit_module EmitGraphInfo construction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ChatGPT ReviewReviewed the attached diff. Overall: good direction, but I would leave request changes on this as written. Blockers1) TLC-1 is still an emitter-side heuristic, and the PR explicitly ratchets in that debt. The new Rust helper
That is exactly the sort of downstream heuristic / type-name-string escape hatch that Relatedly, My ask:
2) There is a real correctness hole in the zero-arg callable fallback path. In
But So imported / extern / otherwise non- I would want at least one regression test for each of these before merging:
Invariant / architecture concerns3) This refactor improves naming, but it does not fully move sharing authority upstream. What the code does now:
So the field exists, but the authority is still Rust-emitter-local. That makes roadmap text like:
read too strongly. What actually happened is closer to:
Against the invariants, this still looks partial rather than resolved. 4) Precomputing But it is a flat If duplicate variant names are impossible by language rule, document that. If they are possible, add a failing test or collision diagnostic. Compositional modeling quality (.dag)This part is mostly strong. Good changes
Still partial
So my compositional read is: good local modeling improvements, but not yet the full invariant-aligned end state. Roadmap alignmentThere are several doc mismatches in this PR. 1) TLC-4 contradicts itself inside the same roadmap edit.
2) TLC-1 is overstated.
That should be marked partial, not done. 3) L1 ratchet drift.
Those need to match. 4) TLC-3 “Go/Python per-collection dispatch done” is not evidenced by this diff. The Go/Python changes I see here are service-field templating and annotation templates. I do not see corresponding Go/Python indexing/slicing dispatch changes in this patch. Maybe that landed elsewhere, but as a PR-scoped changelog this line reads ahead of the code. Smaller notes
My merge recommendation: not yet. The main issue is that TLC-1 is currently implemented as exactly the kind of emit-time heuristic the invariants are trying to eliminate, and there’s also a likely imported-zero-arg-function correctness gap. |
# Conflicts: # src/v2/04_emit_info.dag # src/v2/04_infer.dag # src/v2/05_emit_rust.dag # src/v2/stage0/src/v2_compiler_emit.rs # src/v2/stage0/src/v2_compiler_emit_rust.rs
briansrls
left a comment
There was a problem hiding this comment.
Review (INVARIANTS: 1, MODELING: 3+/3-, ROADMAP: 3✓/2!)
INVARIANTS — Violations (1)
MODELING — Strengths
src/v2/04_emit_info.dagMovinghas_fn_fieldsintoTypeSummaryturns a Rust derive decision into boundary data with an immediate consumer instead of another emitter-local scan.src/v2/languages.dagExtendingSharingStrategyandAnnotationRequirementskeeps clone and annotation syntax inLanguageSpec, which is the right target-specific layer.dsl/extdeps/languages/rust/emit.dagrust_higher_order_methodsmakes the repeated Rust higher-order method shapes data-driven instead of keeping four separate emitter functions.
MODELING — Improvements
src/v2/04_emit_info.daghas_fn_fieldsstill derives callable-ness fromrt.name == "Callable"rather than a structural callable witness, so the boundary remains name-dependent.src/v2/languages.dagThe model still stops at syntax templates because the actualshared_typesdecision is recomputed in Rust emit instead of being carried as an upstream language-model fact.dsl/extdeps/languages/rust/emit.dagHigherOrderMethodSpecshould be keyed by the existing intrinsic authority rather thanmethod_name: String, so the model composes from the closed method set instead of another string layer.
ROADMAP — Verified
- CG-1 clone semantics unified in SharingStrategy: The diff removes
CloneTemplates, extendsSharingStrategy, and routes Rust clone emission throughsharing_for_targetas claimed. - CG-2 TLC-4 explicit annotation requirements: The diff adds
let_binding_annotatedtoAnnotationRequirementsand wiresemit_let_binding_annotatedinto the three Rust let-binding emit sites the roadmap names. - CG-3 higher-order method templates: The diff adds
HigherOrderMethodSpecplusemit_rust_higher_order_method, replacing the dedicated Rust emitters forfilter,any,all, andflat_map.
ROADMAP — Incomplete
- CG-1 sharing authority consolidated into EmitGraphInfo.shared_types:
build_emit_graph_infostill emitsshared_types: empty_map()and Rust recomputes sharing inbuild_shared_types, so the boundary is not yet the authority the roadmap claims. - CG-1 explicit parent-enum ownership facts through resolve/infer/emit: The new parent-enum path is still a name-keyed
variant_to_enum: Map<String, String>cache rather than an explicit structural fact carried end-to-end through the boundary.
The PR improves emitter parameterization, but it still introduces a new string-keyed method authority and overstates how much boundary authority has actually moved upstream.
| // {arg} — rendered first argument (fn_ref case) | ||
|
|
||
| type HigherOrderMethodSpec { | ||
| method_name: String |
There was a problem hiding this comment.
Invariant violation: HigherOrderMethodSpec.method_name: String adds a new string-keyed authority for a closed intrinsic method set instead of reusing the existing method authority, violating No duplicate representations and No case enumeration for open sets.
Three fixes after merging origin/main: 1. language_spec is a function (takes target:), not a bare value — fix service_fields access in Rust/Go/Python emitters 2. Add fold_eligible_index/fold_eligible fields to EmitGraphInfo in emit_module 3. Revert emit_let_binding_annotated → emit_let_binding at 3 sites (bootstrap convergence: .dag type inference emits () for empty collections) Regenerate stage0 — 0 diagnostics, round-2 self-freshness verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
briansrls
left a comment
There was a problem hiding this comment.
Review (INVARIANTS: 1, MODELING: 2+/2-, ROADMAP: 2✓/4!)
INVARIANTS — Violations (1)
MODELING — Strengths
src/v2/languages.dagFolding clone operations intoSharingStrategyimproves harmony by making sharing and cloning one per-language authority instead of split template tables.src/v2/04_emit_info.dagMovinghas_fn_fieldsontoTypeSummaryis the right layer because derive eligibility is a per-type summary fact rather than a repeated emitter scan.
MODELING — Improvements
src/v2/languages.dagServiceFieldTemplatesduplicates service-field syntax as compiler-local strings instead of composing from the shared language syntax model, so it sits too low inLanguageSpec.dsl/extdeps/languages/rust/emit.dagHigherOrderMethodSpecusefully data-drives repeated Rust leaf syntax, butmethod_name: Stringkeeps a closed intrinsic set string-keyed instead of grounded in the existing intrinsic authority.
ROADMAP — Verified
- CG-1 clone semantics in LanguageSpec: The diff removes
CloneTemplates, extendsSharingStrategy, and rewires Rust clone sites to readsharing_for_target. - CG-3 higher-order method templates: The diff adds
HigherOrderMethodSpecdata plus a shared Rust higher-order renderer that replaces four dedicated emitters.
ROADMAP — Incomplete
- CG-2 TLC-1 call syntax / reference distinction: The new
is_zero_arg_callable_refstill reconstructs callable identity fromFunctionValueBindingplusrt.name == "Callable"and arity, so the fact still does not survive structurally from resolution through emit. - CG-2 TLC-3 indexing / character access semantics: This diff shows no Go/Python index or slice emission changes, so the claim that Go/Python now dispatch per collection type is not supported here.
- CG-2 TLC-4 explicit annotation requirements: The diff adds
emit_let_binding_annotated, but Rust let emission still callsemit_let_binding, so annotated lets are not wired end-to-end. - CG-1
emit_primitive_typefail-closed: ROADMAP marks this item complete, but the diff contains no correspondingemit_primitive_typechange to verify the claim.
The PR improves data-driven emission and fixes two previously flagged issues, but it still depends on a new name-based callable proxy and it overclaims several CG-lane completions in ROADMAP.
| let has_fn = item.children |> any(child => | ||
| match child.inferred { | ||
| Some { value: Resolved { node: rt } } => rt.name == "Callable" | ||
| _ => false |
There was a problem hiding this comment.
Invariant violation: has_fn_fields still infers callable structure via rt.name == "Callable" instead of a structural callable witness, violating Boundary sufficiency / Heuristics indicate lost structure.
|
ChatGPT review in progress... (view conversation) |
- TLC-1: mark partial — is_zero_arg_callable_ref is an L1 violation (emitter-side guardrail), not an upstream modeled fact - TLC-3: mark partial — Go/Python still use list_index unconditionally - TLC-4: mark partial — emit_let_binding_annotated disabled for bootstrap convergence (type inference produces () for empty collections) - shared_types: "renamed and reorganized", not "authority consolidated" - Fix stale rc_types reference in symptom description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eFieldTemplates) Resolve conflicts by taking main's .dag and stage0 versions — main's architecture diverged (TypedItemTypeDef, shared_types rename, data-driven service fields). cm-track's unit_only wiring for Go/Python is deferred to holistic CM work tracked in src/v2/CM.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Test plan
cargo test -p v2-compiler-tests— 283 passedcargo test -p v2-compiler-tests full_dsl_compiles -- --ignored— passedcargo test -p v2-compiler-tests strict_compile_diagnostic_count -- --ignored— 0 diagnosticsscripts/l1-ratchet.sh --check— 31 <= 31🤖 Generated with Claude Code