Skip to content

closure-Debug: transitive has_fn_fields closure → algebra tower derives Clone-only (E0277 −322) - #5583

Merged
briansrls merged 8 commits into
mainfrom
emitter/closure-debug-derive
Jun 23, 2026
Merged

briansrls merged 8 commits into
mainfrom
emitter/closure-debug-derive

Conversation

@briansrls

@briansrls briansrls commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

closure-Debug: transitive has_fn_fields closure (Lane A, carrier-independent emit-tail)

has_fn (04_emit_info.dag build_type_summary) only flagged a direct arrow field,
so it caught Magma { op: fn } but missed the tower that embeds it —
Semigroup{magma} → Monoid{semigroup} → CommutativeMonoid → Group — each of which still
transitively carries dyn Fn and therefore cannot #[derive(Debug/PartialEq/serde)].

Fix: transitive closure close_fn_fields (DFS over field_type_map edges, cycle-guarded),
applied in build_emit_graph_info (04_infer.dag). After it, the whole algebra tower emits
#[derive(Clone)] only — verified by execution (805 files emitted, 0 diagnostics; all five
tower structs Magma/Semigroup/Monoid/CommutativeMonoid/Group now #[derive(Clone)]).
.dag authority + hand-mirrored Rust seed (no regen gate yet, #5514 deferred).

Scoreboard (HostNative seed census, by execution)

  • E0277 (trait-not-satisfied on derive): 982 → 660 (−322) — the closure-tower derives that
    could never hold are no longer emitted.
  • total cargo errors 15,642 → 15,353 on the same forced-HostNative tree.
  • E0119/E0392 deltas are main-merge drift, not this change: removing a derive can only drop
    E0277 or surface an E0369 ==; it cannot create a conflicting-impl (E0119) or unused-param
    (E0392). (Clean attribution via a same-tree control bypassing the close_fn_fields call.)

Honestly re-surfaced: cross-representation == on the closure-tower (E0369)

Removing the (always-broken) PartialEq derive turns its == call-sites from
E0277-on-derive into E0369-on-==. These are pre-existing — the impl never held — now
visible at the call site. They belong to the value-grounding == class (same family as the
operator's Value::Null / numeric-tower cross-representation-equality thread), and need a value
owner (stern-bat-782 is archived; capturing here so they have a home).

35 sites, all on CommutativeSemiring<Magnitude>-bearing types, 9 files:

  • std_measure.rs:127,139,149
  • std_approximate_field.rs:36,37,40,41
  • std_realization_measurement.rs:56,85,90,144
  • std_realization_schedule.rs:38,39
  • std_realization_width.rs:73,92,112,116
  • extdeps_cpu_types.rs:59,60,62,67
  • product_compute_fabric.rs:250,314,321,585,591,597,602,1444,1451,1466
  • product_placement_supply.rs:21,22,23
  • v2_workflow_ci_floor_plan.rs:371

(The v2_*/openapi == E0369 deltas in the raw census diff embed no closure and are
baseline drift, not attributable to this change.)

CI

fmt gate fix folded in: the hand-written close_fn_fields fold closure in the seed mirror was
not rustfmt-canonical (block-match → expr-match); logic byte-identical.

@gunbai-bot gunbai-bot Bot changed the title Section 5 self-host execution manager: Lane A drive the emitted rust crate to cargo-green building (Route-A last mile) — CONTINUE the existing emitter/seed-green-integration branch which is mid-flight clearing compile errors, do NOT start fresh; Lane C TypeScript emit to first-class beyond the add s closure-Debug: transitive has_fn_fields closure → algebra tower derives Clone-only (E0277 −322) Jun 23, 2026
@gunbai-bot

gunbai-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

CI red is 100% inherited main breakage — not introduced by this PR

This PR changes exactly 4 files (04_emit_info.dag, 04_infer.dag, and their two Rust seed mirrors) — the transitive has_fn_fields closure. It touches none of the files the failing tests exercise. Verified by execution with a local cargo nextest run -p v1-compiler-tests (matching the CI gate exactly), then re-run of the 4 failures in isolation:

test isolation cause
parse::source_text_at_lookup_flat_in_file_size FAIL (det., 0.011s) #5567 (85a1e8b8f3, "Strip comments from .dag tree") made 02_parse.dag pure-ASCII → the test's assert!(!source.is_ascii()) non-ASCII-fixture precondition is now unsatisfiable
parse::tokenizer_non_ascii_performance_regression FAIL (det., 0.012s) same — #5567 ASCII-strip breaks the non-ASCII fixture precondition
source_audit::emit_handles_for_loop FAIL (det., 0.010s) #5575 (e2533bf58c, value-grounding Empty{} → Rc::new(vec![])) removed iter().cloned() from 05_emit_rust.dag, but the audit still asserts source.contains("iter().cloned()")
interp_recorded_fixture_test::clock_now_record_then_hermetic_replay_holds PASS (36s) load-induced Clock.Now freshness flake under the full-suite 47-slow-test contention (614s run); passes deterministically in isolation

All three deterministic failures reproduce on origin/main itself (confirmed via git show origin/main:…): origin/main's 02_parse.dag is ASCII and its 05_emit_rust.dag lacks iter().cloned() while the audit still asserts it. So the v1-compiler-tests nextest gate is red on main independent of this branch — a fleet-wide blocker that needs a dedicated test-drift fix (owners of #5567 / #5575), not a change here.

This PR's own change is green by execution: 761/765 pass, the algebra tower (Magma/Semigroup/Monoid/CommutativeMonoid/Group) now emits #[derive(Clone)] only, E0277 982→660 (−322) on the HostNative census. fmt (cargo fmt --all --check) and clippy (--all-targets -D warnings, whole workspace) both clean.

@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 23, 2026 01:13
@briansrls
briansrls merged commit abd1309 into main Jun 23, 2026
2 checks passed
@briansrls
briansrls deleted the emitter/closure-debug-derive branch June 23, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant