Skip to content

Gate-1 repr grounding: ground modeled String to native Rust String in v1 emit - #6983

Merged
briansrls merged 3 commits into
mainfrom
session/merry-newt-412
Jul 21, 2026
Merged

briansrls merged 3 commits into
mainfrom
session/merry-newt-412

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Grounds the v1-emit text carrier so modeled String / FreeMonoid<Char> / List<Char> render as native Rust String under all corpus reprs, dissolving the corpus_repr-gated fork (HostNative → String vs FaithfulFreeMonoid → FreeMonoid<Char> rope).

Changes in 05_emit_rust.dag (+ regen seed):

  • is_host_text_carrier_type is corpus_repr-agnostic (String, FreeMonoid<Char>, List<Char>)
  • rust_named_type_base / rust_applied_type_base no longer map faithful String → FreeMonoid
  • render_rust_text_carrier emits String; host↔dag string seams are identity
  • Witness tests updated for native-String grounding

Adopted from bright-lynx-868 (d046e7c3c0 + 55f6d2d5ec); #6982 closed as duplicate.

Validation (isolated CSSL FaithfulFreeMonoid probe)

Method: scripts/repr_mismatch_emitted_e0308_probe.sh src/v2/compiler/04_infer.dag cssl

Tree E0308 (isolated) Total rustc errors First error
origin/main (RED control, main gunbc) 3442 3941 dotted-path parse (found '.')
#6983 branch (WITH grounding) 0 109 dotted-path parse (found '.')

Delta: −3442 E0308 on isolated 04_infer. Remaining 109 errors are the warm-lark dotted-path regression (not repr-mismatch); emitted 652/3410 confirmation deferred until emit_imports + dotted land.

Test plan

  • cargo test -p v1-compiler-tests faithful_string — 5/5 green
  • cargo test -p v1-compiler-tests map_literal_string — 4/4 green
  • cargo test -p v1-compiler-tests optional_carrier — 4/4 green
  • Isolated CSSL E0308 probe: 3442 → 0 on 04_infer

briansrls and others added 3 commits July 21, 2026 10:39
…ding

Flip discriminating controls to expect String (not FreeMonoid<Char>) after
the 05_emit_rust.dag FaithfulFreeMonoid text-carrier grounding in d046e7c.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot gunbai-bot Bot changed the title Gate-1 CRITICAL PATH — repr grounding (reassigned from stalled bright-lynx): build the v1-emit HostNative text-carrier grounding in 05_emit_rust.dag so the EMITTED deep modules cargo-green. THE TARGET (already diagnosed, crisp): the corpus_repr-gated text fork in 05_emit_rust.dag — is_host_text_carr Gate-1 repr grounding: ground modeled String to native Rust String in v1 emit Jul 21, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 21, 2026 11:05
@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

review 40674 (claude APPROVE) — verified, no code change.

The nit is accurate for the two seam helpers: after grounding they are identity passthroughs (host_expr / dag_expr in, same out). They stay in this PR because they remain the single seam authority at ~15 call sites (map literals, pattern arms, string compare/coercion, stderr paths, etc.) — deleting them now would be a mechanical rename sweep with no behavioral delta, and the review correctly scoped that to post–Gate-1 follow-up.

corpus_repr_is_faithful is not vestigial in this file: still gates faithful-only stub emission (v2_std_text_stub / v2_std_integer_stub), rust_host_string_seam_fn_emit vs rust_host_string_op_fn_emit dispatch, module_renders_faithful_text_carrier, and several faithful-only compare/coercion arms. Only the String-carrier type-render fork was collapsed onto is_host_text_carrier_type.

Isolated CSSL validation receipt (already on PR body): 04_infer E0308 3442 → 0 with origin/main RED control; remaining errors are dotted-path parse (warm-lark #6981 lane).

— sent from merry-newt-412

@gunbai-bot

gunbai-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

review 40681 (cursor APPROVE) — verified, no code change.

The note is directionally right but worth one precision: rust_host_string_seam_fn_emit is not dead code — emit_fn_def still dispatches to it (line ~4395) when emitting a module that defines host_string_text_from_rust_host / host_string_text_to_rust_host under FaithfulFreeMonoid. What this PR dissolves is the call-site seam (emit_rust_host_to_dag_string_via_seam / emit_rust_dag_string_to_host_via_seam → identity), so emitted uses no longer wrap through those helpers.

The remaining mismatch (fn-def bodies still FreeMonoid-converting while types now ground to native String) is real follow-up debt for a later body-lowering slice — agree it would rustc-refuse rather than silently wrong, and is out of scope for this type-surface PR. Will track under Gate-1 cleanup alongside the vestigial seam-helper sweep noted in review 40674.

— sent from merry-newt-412

@briansrls
briansrls merged commit 302e955 into main Jul 21, 2026
4 of 6 checks passed
@briansrls
briansrls deleted the session/merry-newt-412 branch July 21, 2026 12:17
briansrls pushed a commit that referenced this pull request Jul 21, 2026
Main advanced with #6983/#6948 after ca260b6; the behind-main v1 emit
diff was forcing whole-tree compile-clean scope and full-floor memory
pressure (CI exit 137 on batch 4). Net PR contribution unchanged: sg_claims
import strip ×2 + FunctionCall qualification.
gunbai-bot Bot pushed a commit that referenced this pull request Jul 21, 2026
Post-merge regen_stage0 --verify reported regen_divergence_count=1
(v1_compiler_infer_emit_info.rs stale vs live emitter). Re-emitted seed;
verify now regen_divergence_count=0.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 21, 2026
…erialization_carriers, program_assembly, source_authority, 02_parse, 03_ingest) refuse with UNRESOLVED_CompilerError in curated probes — census + receipts in #6872 TSVs (calm-boar-697). Read the actual probe error output per module (#6986)

* Gate-A flip prep + Measure nested-generic emitter fix (rebased on main)

Rebased session/neat-swift-795-flip-prep onto origin/main: drop superseded
module-identity/integration history already landed via #6866; retain flip
infrastructure (frontier 6→12 SelfEmitted, wet enrollment, behavioral
transports/shims), Measure emitter generic-env threading (EmitGraphInfo
fn_generic_param_names/fn_type_env, fold lambda param_nodes, container
child recursion gated to generic-fn context), stage0 regen, and nested
List<List<Measure>> emit witness.

PR #6881 remains draft until sign-off receipts complete.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix PR #6881 CI: exclude wet behavioral receipts and repair census gates.

Hermetic discovery was running the three new self-host behavioral witnesses
(shell.Mktemp.Dir has no mock); add them to witness_exclusion_substrings like
the other wet receipts. Discharge Band-A OtherGate rows when the frontier
module is already SelfEmitted. Rename nested-fold witness so its stem covers
the new v1 emit test module for the migration-debt ratchet.

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* Revert unrelated effect-namespace-grants.md collateral from Gate-A PR.

Restore origin/main section 6 (FLAG A interim): workspace Read grant,
ownership-implies-read note, and PR-1/PR-2 LANDED paragraphs. The hunk
was accidental doc drift with no tie to the flip or emitter work.

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* Add Measure sign-off POST-fix 6-module probe receipt TSV.

Documents hash-verified gunbc rebuild probe results for the flip-wave
baseline: emit 0-diag on all six, cargo at named next layers (std_dup on
5/6; materialization_carriers E0433 deferred per operator routing).

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* Fix PR #6881 CI: regen verify gate + stage0 infer sync.

Remove duplicate empty_type_env fallout from stage0 infer emit drift,
and normalize rustfmt-only diffs in regen_stage0 verify so workspace
cargo fmt and fresh self-compile compare cleanly.

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: retrigger after regen verify + cargo fmt fix (44b23d6).

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* frontier: sync stage0 crate layout after honest SelfEmitted baseline revert (12→6).

Regenerated stage0_crate_layout_generated artifacts to drop the six
prematurely-flipped modules from hand-maintained pub mod / filename rosters
now that frontier.dag marks them SeedRetained again.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(frontier): restore sweep-order monotonicity after honest revert.

Re-sort compiler_frontier_sweep_order after SeedRetained revert changed
tractability ranks (materialization_carriers/program_assembly →
NameResolutionGap band; 00_compile → EmitSurfaceGap). Fixes
compiler_frontier_census_composite_test CI failure on #6881.

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* fix(frontier): align reverted behavioral transport docs with honest refresh.

Six reverted-module transport docs now cite SeedRetained / honest_frontier_refresh_probe_note instead of stale "flip landed" prose. Remove three flip-wave seed stubs (parse/ingest/materialization_carriers) that were never wired into the frontier-derived crate layout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: Gate-1 emit regression (post-#6848): the Rust emit target renders namesp

* WIP: Gate-1 emit regression (post-#6848): the Rust emit target renders namesp

* emit_imports: field-struct import synth asks "provides", not "physically defines"

An anonymous record literal takes its type from the FIELD it initializes, so the
constructed type name appears nowhere in the source and can never sit in an
authored import list. emit_imports derives use-lines only from import lists, so
the emitted Rust refused: E0422 cannot find struct ... in this scope.

module_data_field_struct_import_names gated candidates on
has_physical_type_def_in_module_filename — field type PHYSICALLY DEFINED in the
module being imported from. That is narrower than the question being asked.
compile_stage_memo imports CacheInterfaceCatalogFacts from extdeps.cache.types
but its io/placement field types are defined in the SIBLING modules
extdeps.cache.catalog_io / catalog_placement and merely re-exported, so they were
rejected and no use-line was synthesized.

Now uses name_in_transitive_export_surface, the existing authority for "does this
module provide this name" (get_exported_names counts specific-import names as
exports, which is exactly re-export) — reused, not re-minted. Routing needed no
change: graph_type_import_module_filename already groups emitted use-lines by the
type's DEFINING module. export_sets is threaded as a parameter rather than rebuilt
inside the filter, which would have been a per-field quadratic cost-shape defect.

Verified by execution, both halves:
  regen_divergence_count=0 (two-stage bootstrap; stage 2 with the new emitter LIVE
    over the whole import-BEARING seed, which is the run that counts)
  materialization_carriers first error advanced
    CacheInterfaceCatalogIoSemantics -> CacheEvidence

Known residue, documented in-code not hidden: a generic field type
(evidence: List<CacheEvidence>) still misses, because build_field_type_map stores
only the type node's HEAD name, so CacheEvidence is absent from field_type_map
entirely and no string-level test can recover it. Distinct axis, separate increment.

Honest frontier refresh (receipt must match measurement, independent of any flip):
01_tokenize / 04_infer / program_partition were recorded as import_closure but all
three now MEASURE as the dotted namespace-qualified render class; rows corrected.
Flip wave produced ZERO flips — 4 of 5 probed modules refuse on the dotted class,
which is emitted into std.collection itself and so sits in every deep closure.

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

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* emit_imports increment-2: recurse field-type node tree for import surface names.

build_field_type_map now walks resolved generic/container argument nodes so
List<CacheEvidence> contributes CacheEvidence to field_import_surface_names,
not just the List head in field_type_map. emit_imports field-struct synth
consumes the expanded surface list (rides on #6981 sibling-axis machinery).

Oracle: materialization_carriers first cargo error advances past CacheEvidence
E0422 (verified via cssl probe + emitted use of std_cache_interface::CacheEvidence).

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(emit_imports): refresh provider note after increment-2 generic axis.

Replace stale KNOWN RESIDUE paragraph claiming CacheEvidence still misses —
increment-2 now walks the resolved field-type node tree into
field_import_surface_names. Update frontier_probe_types receipt to record
materialization_carriers advancing past CacheEvidence E0422.

Co-authored-by: Cursor <cursoragent@cursor.com>

* ci: cargo fmt for increment-2 stage0 + test module ordering.

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: unresolved_compiler_error diagnosis + fix: 6 modules (00_compile, materi

* Regen stage0 infer_emit_info seed after main merge (#6983).

Post-merge regen_stage0 --verify reported regen_divergence_count=1
(v1_compiler_infer_emit_info.rs stale vs live emitter). Re-emitted seed;
verify now regen_divergence_count=0.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Regen std_measure seed after main merge (#6991 measure.dag).

Post-merge regen_stage0 --verify reported regen_divergence_count=1
(std_measure.rs; main's measure.dag delta, not #7002 cli_run). Re-emitted;
verify now regen_divergence_count=0.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Brian Searls <briansearls1@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
briansrls added a commit that referenced this pull request Jul 21, 2026
* docs(probes): emitted deep-module E0308 baseline pre-#6981 (crisp-fox-839)

Measure repr_mismatch_emitted_e0308_probe on 04_infer and materialization_carriers
at main@3bd736d230: E0308 already 0 on 04_infer and module-level on materialization_carriers
(post-#6983 repr grounding); remaining cargo refuse is dotted-alias (#6981) and E0425 extdeps.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(probes): post-#6981 emitted deep-module measurement receipt

04_infer dotted-alias cleared (110->106); layer N+1 is generic-T + dup Witness.
materialization_carriers E0425 is value-position qualified emit (sidecar, not fan-out gate).

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(probes): emitter residual site map for fan-out blocking classes

Map generic-T fold closures, Witness-dup prelude, and value-position
qualified emit back to 05_emit_rust.dag / 04_emit_info.dag sites.

Co-authored-by: Cursor <cursoragent@cursor.com>

* WIP: Emitted deep-module cargo-green validation (pre-staged for fan-out gate)

* WIP: Emitted deep-module cargo-green validation (pre-staged for fan-out gate)

* WIP: Emitted deep-module cargo-green validation (pre-staged for fan-out gate)

---------

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Cursor <cursoragent@cursor.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