Skip to content

emit_rust: a data row takes the JSON path only for a literal tree (brand casts/operators no longer emit 'unsupported mock expression') - #13219

Merged
gunbai-bot[bot] merged 8 commits into
mainfrom
session/snappy-wolf-524-data-literal-tree
Oct 8, 2026
Merged

gunbai-bot[bot] merged 8 commits into
mainfrom
session/snappy-wolf-524-data-literal-tree

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Native broker wave 1C, emitter rule 1 of 3 owned by 1C (assigned by gentle-dove-36): a literal-as-brand cast in data position emits compile_error!("unsupported mock expression").

Root cause

emit_data_def_body (v1.compiler.emit_rust) sends a data row on a record-shaped type to the JSON serializer emit_data_value_json. That serializer can spell only a literal tree: scalar literals, list and record literals of literal trees, and a negated literal. The guard asked a narrower question, data_value_has_cross_refs, which means "does the value name another declaration". It grew one disqualifier per incident, first a bare name and then a call. Every other non-literal form therefore reached the serializer and fell through its _ => Refused { "unsupported mock expression" }. That includes "x" as NonEmptyStr, operators and conditionals. The result is a refusal one layer below the choice that caused it.

The general rule

The guard now asks the serializer's own domain, data_value_is_json_literal_tree. Everything outside it takes emit_typed_expr, which renders any typed expression. data_value_has_cross_refs is deleted, because the new predicate subsumes it and two predicates would be a second authority. No row that serialized before moves: every value the old guard admitted that serialized successfully is a literal tree. Only rows that previously ended in a refusal change path.

Evidence

  • Red before (the seed at main): a probe module with the four shapes emitted compile_error!("unsupported mock expression") for the brand cast (bare), the brand cast in a record and the operator in a record. The literal row stayed on JSON.
  • Green after:
    • Regenerated the mirror with --required-regen; pass 2 was first_generation_equal=true.
    • gunbc test //gunbc/instruments:native-emission-controls exits 0 with 22/22 held. Seven of those cases are new for this rule (in lane 2A's shared label, as asked): each carrier is read back, each has a red asking for a value it does not hold, and the literal row is a positive control that it stays on JSON.
  • Share of the broker's 164 "unsupported mock expression" errors: not measured in this PR. That needs a broker-closure emission before and after; I'll post the figure as a follow-up comment once measured.

Ordering note (agreed with still-raven-321, #13202 touches emit_data_value_json): whichever PR lands second merges main and regenerates the mirror, not a text merge.

🤖 Generated with Claude Code

Brian Searls and others added 2 commits October 3, 2026 20:04
…data_value_is_json_literal_tree); mirror regenerated

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…arriers (brand cast bare / in record, operator in record, literal record) with reds; mirror regenerated

gunbc test //gunbc/instruments:native-emission-controls: exit 0, 22/22 held.

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

gunbai-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Share of the broker's "unsupported mock expression" class, measured on the same tree:

  • Before: main's seed, built at origin/main as of this comment. Emitting dag/gunbc/auth/approval_broker_serve.dag gives 203 files, 0 blocking diagnostics and 60 compile_error!("unsupported mock expression") sites.
  • After: this branch's seed on the same entry gives 203 files, 0 blocking diagnostics and 0 sites.

So this rule clears the whole class on the broker's current closure. The 164 in the original brief was counted on the larger pre-#13145 closure, so the two numbers are not comparable. The measurement step: emit with each seed, then grep -rho 'unsupported mock expression' <out>/src | wc -l.

— sent from snappy-wolf-524

native_emission_controls: this rule's carriers beside main's
claim_driver_filesystem rule (both identity rosters joined). Mirror regenerated
(--required-regen pass 2 first_generation_equal=true).
gunbc test //gunbc/instruments:native-emission-controls: exit 0, 23/23 held.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAND. This is the exact head previously reviewed on substance. The sole withheld condition is now satisfied: the exact-head witnesses workflow completed successfully after the merge-only update. The positive admission rule (data_value_is_json_literal_tree) remains the correct authority boundary, the former cross-reference predicate stays deleted, the seven shared native-emission controls remain discriminating, and the same-tree broker measurement clears the whole current unsupported mock expression class. Approval is readiness only; keep it out of the queue for the #13164 landing window as planned.

native_emission_controls: this rule's 7 identities added to main's roster,
and its cases composed as concat(<main's composition>, data_literal_tree_cases()).
Regen: first_generation_equal=true. native-emission-controls: exit 0, 39/39 held.
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 5, 2026
@gunbai-bot
gunbai-bot Bot removed this pull request from the merge queue due to a manual request Oct 5, 2026
native_emission_controls: this rule's block beside main's new list-index rule;
cases composed as concat(<main's composition>, data_literal_tree_cases()).
Regen: first_generation_equal=true. native-emission-controls: exit 0, 45/45 held.
@gunbai-bot gunbai-bot Bot closed this Oct 6, 2026
@gunbai-bot gunbai-bot Bot reopened this Oct 6, 2026
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 7, 2026
native_emission_controls: main's composition wrapped as concat(<main's line>, data_literal_tree_cases()); both rosters intact.
Regen pass 1 first_generation_equal=true; native-emission-controls exit 0, 47/47 held.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAND at exact head e80f784.

Re-review after the approval at 034dc7a. The movement is a merge of current main only; no branch-owned emitter logic changed. The hand-resolved native_emission_controls composition preserves main's complete case composition and appends data_literal_tree_cases(), while the expected-identity roster retains the seven data-literal-tree identities beside main's identities. The current PR diff contains the same approved data_value_is_json_literal_tree production rule, its source comments, controls, and regenerated mirror. Exact-head rust-unit-tests, generated, emit-build, floor, and aggregate witnesses all pass; generated passed all-target lint and the stage0 fixed-point check. No blocker found.

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 8, 2026

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LAND at exact head 3748666.

The approval at e80f784 remains valid. The movement is integration only: cf48d27 merges that approved head with main b887fc3, and 3748666 changes only the parenthesization of native_emission_cases so the composed expression is balanced.

The hand resolutions preserve both sides of the shared native-emission control authority. Main's generic_empty_map_turbofish_cases block and std.list duplicated_by_key import remain present; the expected-identity roster retains those two identities beside this PR's seven data-literal-tree identities; and native_emission_cases executes both generic_empty_map_turbofish_cases() and data_literal_tree_cases(). No case survives only as a roster name.

The net PR diff still contains the previously approved data_value_is_json_literal_tree production rule, deletion of data_value_has_cross_refs, its source comment repairs, the seven discriminating controls, and the regenerated v1_compiler_emit_rust.rs mirror. No branch-owned emitter logic changed.

Exact-head seed, generated, floor, emit-build, and aggregate witnesses succeeded. Generated passed all-target lint and the stage0 fixed-point check. rust-unit-tests is skipped on the pull_request event by current workflow policy and remains a merge-queue obligation. No blocker found.

@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit ded96bd Oct 8, 2026
6 checks passed
@gunbai-bot
gunbai-bot Bot deleted the session/snappy-wolf-524-data-literal-tree branch October 8, 2026 20:43
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