Skip to content

Lane A Family-A: map-literal String-key coercion (type-derived) — clears HashMap<&str> E0308 family - #5714

Closed
briansrls wants to merge 6 commits into
emitter/seed-green-integrationfrom
emitter/family-a-map-key-coercion
Closed

briansrls wants to merge 6 commits into
emitter/seed-green-integrationfrom
emitter/family-a-map-key-coercion

Conversation

@briansrls

@briansrls briansrls commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Family-A: map-literal String-key coercion (type-derived)

The single biggest E0308 lever in the Route-A re-baseline. A data NAME: Map<String,V> = { k: v, ... } declaration emits as a thread_local! { static CACHED = { let mut __m = HashMap::new(); __m.insert(<key>, <val>); ... } }. The key was emitted via the host→dag text seam without .to_string(), so the literal inferred HashMap<&str, V> and mismatched the declared HashMap<String, V>.

Fix (single authority: src/v1/05_emit_rust.dag)

  • New emit_rust_map_literal_key(field_name, key_is_string, corpus_repr) — appends .to_string() to the key literal only when the declared key type is String-like, then routes through the existing host→dag seam.
  • New map_literal_key_is_string(map_type_node, source_indices) — reads the map's declared key type (first type arg, via children |> first with the __applied_type_args fallback, mirroring the proven rust_host_text_carrier_elem_name idiom) and tests is_rust_string_like. The coercion is DERIVED from the declared key type, not a blanket keys → to_string — a non-String key is left bare.
  • emit_data_def_body computes key_is_string once per map literal and threads it to the key emitter.

The committed Route-A seed (src/v1/stage0/src/v1_compiler_emit_rust.rs) is the hand-synced mirror; the corrected map_literal_key_is_string body is spliced in to match.

Proof by execution

  • (a) String key coerces + clears the family. dag_keywords (HashMap<String,String>) now emits __m.insert("true".to_string(), …). Fresh regen_stage0 --emit-fresh build: the HashMap<&str, V> family went 24 → 0.
  • (b) Non-String key stays bare (not blanket). Witness non_string_key_is_left_as_literal (key_is_string=false → key emitted without .to_string()). No live corpus map literal has a non-String key (0 non-string-key inserts emitted), and no new "expected non-String key" errors appeared — confirming the coercion is per-slot type-derived, not blanket.
  • 4 witnesses green (map_literal_string_key_test.rs): host-repr coerce, faithful-repr seam routing, non-String control, and an end-to-end Map<String,Int> source fixture (String key coerced, Int value left bare).
  • Committed seed builds green.

Out of scope (documented, not regressions)

The wider --emit-fresh wiring unmasks a separate pre-existing emitter family: |> first emits as .first().cloned() (Option) where consumers expect the unwrapped element (633 expected String/Rc, found Option). Confirmed pre-existing — the committed seed carries the identical a.clone().first().cloned() bug in extdeps_version_semver.rs:81 but leaves that module unwired in lib.rs. Family B (Box/Rc auto-wrap, ~7) and E0560 measure-tower also remain. These are tracked for follow-on lanes, not this PR.

— sent from deep-wolf-695

Brian Searls and others added 5 commits June 24, 2026 03:54
emit_rust_map_literal_key applies .to_string() to a map-literal key iff the
declared key type is String-like (key_is_string, derived at the call site from
is_rust_string_like over the map's declared key type). Fixes the coercion
asymmetry where the value slot was type-coerced but the key slot emitted a bare
&str literal -> HashMap<&str,V> vs declared HashMap<String,V> (Family-A E0308).

Authority edit only; emitted-seed splice + witnesses follow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gunbai-bot gunbai-bot Bot changed the title Lane A E0308 re-baseline (Route-A last mile): CONTINUE emitter/seed-green-integration (do NOT start fresh). Assemble the REAL crate — emitted seed closure + the ~20 hand-written periphery modules (v1_interpreter/cli_run/v1_rt/lens kernel) — cargo-build it, and produce a CATEGORIZED E0308 count by va Lane A Family-A: map-literal String-key coercion (type-derived) — clears HashMap<&str> E0308 family Jun 24, 2026
@gunbai-bot
gunbai-bot Bot changed the base branch from main to emitter/seed-green-integration June 24, 2026 04:46
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 24, 2026 04:47
briansrls added a commit that referenced this pull request Jun 24, 2026
…E0433-masked), pole moved to first-Option family (633/647); Family A cleared by #5714

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot force-pushed the emitter/family-a-map-key-coercion branch from c6dce78 to e7d837f Compare June 24, 2026 05:07
@gunbai-bot

gunbai-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Superseded by #5716. #5716 (base=main) is a strict superset of this branch (head e7d837f is an ancestor; the Family-A map-key commits and both Family-A witnesses are byte-identical inside it) and additionally carries the first-Option renderer fix + residual-3 fail-closed unwraps. #5716 is read-ready and CI-green, so the whole Route-A E0308-clearing delta lands to main via #5716. Closing this to keep a single clean merge path. — sent from deep-wolf-695

@gunbai-bot gunbai-bot Bot closed this Jun 24, 2026
briansrls added a commit that referenced this pull request Jun 24, 2026
…sedes stale ~12,600) (#5713)

* ROADMAP §5: Lane A cargo-green re-baseline (execution-grounded, supersedes stale ~12,600)

deep-wolf (#5705) assembled the real emitted crate (108 modules + 22 periphery)
and cargo-built it: 73 errors / 38 E0308, where 38 is a LOWER BOUND (8 E0433
wiring failures mask further E0308). 89% of E0308 = two emitter root causes
(Family A map-key to_string = 66% from one fix; Family B Box/Rc/Option auto-wrap),
not the stale ~12,600 / ~150-latent estimate (~4x over).

Enriches the bare §5 `5-cargo-green` Route-A-last-mile item with the grounded
shape + the pole (Family A → B) + the §5 honesty bound: unmask E0433 early so
the true ceiling surfaces; "done" is a re-measure-after-unmask, not 38→0.

ROADMAP.md regenerated (drift-gate green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* WIP: ROADMAP planning

* ROADMAP §5: re-measure-after-unmask — true E0308 ceiling 647 (38 was E0433-masked), pole moved to first-Option family (633/647); Family A cleared by #5714

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ROADMAP §5: correct root cause by execution — pole is Optional-on-String-carrier RENDERING (638), faithful-rendering fix 647→9 (#5716); refutes the pipe-first-unwrap premise; residual 9 = out-of-scope tail + 3 model-hole consumers

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ROADMAP §5: pin Route-A tail — pole CLEARED 647→9→6 (#5716 faithful rendering + 3 fail-closed unwraps); residual 6 all pre-existing out-of-scope, separately owned

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ROADMAP §5: reframe finish-line — 0 E0308 is a MILESTONE not cargo-green; full build shows 32 other pre-existing errors (measure-tower 19 dominant, gated); done = 0 TOTAL errors

Refutes the '0 E0308 = done' pin by full-cargo execution (deep-wolf). Measure full-cargo, never a grep of one error family.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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