Skip to content

Delete the target model's serialize-source edge; the rules row is the sole authority - #12576

Merged
gunbai-bot[bot] merged 1 commit into
mainfrom
jolly-bee-43/delete-serialize-source
Sep 29, 2026
Merged

gunbai-bot[bot] merged 1 commit into
mainfrom
jolly-bee-43/delete-serialize-source

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Why

While re-deriving the generic serializer's per-emit cost for #12482, I found that every TargetModel bundle carried ^target_model_edge_serialize_source. It is a second encoding of its rules row's token sequence, plus a source-text binding and a production name. Its only reader in the corpus was v2.compiler.target_serialize grammar_inverse_source_validated. On every emit that function walked the serialize source for well_formed and zip_eq'd its tokens against the row: it proved that two encodings of one fact agree.

Census (before cutting): the ingest, coercion and seed paths do not read it. No .dag reads the edge or its serialize_source_field_* sub-fields other than that check, and no .rs file names either.

This is the design proud-deer-538 approved: delete-first, a single PR, and the row as the sole authority. With no second list to disagree with, "serialize source disagrees with its row" has no constructor (§4b rung 4).

What changed

Deleted:

  • the edge;
  • grammar_inverse_source_validated and grammar_serialize_source_matches_row, with their helpers;
  • 81 builder declarations across bash, bash_command_fold, c, cpp, dag, ecmascript, english, go, gha_workflow_yaml_fold, java, kotlin, python, rust, rust_test_fixtures, rust_wire_serde, swift, typescript, wasm, formats.sql_target and formats.sql_create_table_fold.

Signatures: the bundle constructors that took the serialize source as a parameter lose it: bash_target_model_bundle, sql_target_model_bundle, rust_target_model_bundle and rust_bool_fn_target_model_core_edges. The witness wrappers that only bound it are unwrapped: two in typescript, plus the sql, gha and bash-fold folds.

Where each refusal went

  • The agreement check. Its red cannot be authored any more, because the second list no longer exists. Per §4b's red-authorability test it is deleted rather than kept as a decoration.
  • The unwrapped witnesses refused only when:
    • (a) the relation row does not derive. The rules witness beside them requires the same derivation, so this still refuses.
    • (b) the row has no tokens field. The serializer still refuses there, via grammar_relation_row_tokens_root.
  • Row derivation keeps executing reds:
    • ts_lhs_exact_arrow_emitted_rejects and bash_emit_lhs_exact_arrow_emitted_rejects: a non-conj emitted node refuses.
    • ts_task_derive_row_surplus_conj_slot_rejects: a surplus slot refuses.
  • translate_grammar_inverse_not_realized is still produced by the other structural paths. No test asserted it specifically.

Tests deleted or re-pointed, and why

Deleted. Each of these asserted only that the deleted check accepted its fixture; its sibling claims in the same file still assert emitted bytes equal the authority and the ingest round trip:

  • execution/bind_round_trip_test bind_grammar_inverse_holds
  • execution/branch_if_then_else_round_trip_test branch_if_then_else_grammar_inverse_holds
  • execution/dag_add_emit_round_trip_test dag_add_grammar_inverse_holds
  • execution/loop_round_trip_test loop_grammar_inverse_holds
  • execution/match_bool_round_trip_test match_bool_grammar_inverse_holds
  • manual/field_access_emit_test field_access_grammar_inverse_holds
  • manual/record_construct_emit_test record_construct_grammar_inverse_holds

Re-pointed: manual/english_emit_add_test english_emit_add_ingest_round_trip_holds loses only its check conjunct. Its serialize and ingest conjuncts remain.

Whole file deleted: manual/typescript_eager_materialize_serialize_test. Its only subject was that the two TypeScript serialize-source witnesses hold. The rows those witnesses were built from stay exercised by the TypeScript translate tests.

Fixtures: four fixture bundles lose the edge only: add_body_emit_typescript, add_body_value_expression_fold_typescript, ingest_bridge and translate_underived_refusal.

Evidence

Bytes: unchanged against main. I dumped the srv1 dark-install, apply and retract scripts plus a quoting-edge argv (32,776 bytes) with gunbc run, using a binary built from main's seed; the two dumps are identical. The corpus-wide gates are this PR's CI: generated drift, self-host and v2-native-cli.

Cost, measured with claim_batch --functions eval_steps, main vs this head:

subject main this head
dark-install render 1,000,496 981,533
one-word command 11,797 11,686
eight-word command 39,146 39,035

This is not #12482's lever. I predicted that about 40% of per-emit serialize would disappear. That figure was measured on a 79-token row. The check scales with a row's token count, and today's scripts are made of three-token rows, so the gain here is about 2%. The prediction is falsified for #12482. The change stands on §2 and §3 alone: one encoding per fact, a check that could only fail if the two encodings disagreed deleted with it, and about 1,680 lines removed.

🤖 Generated with Claude Code

… sole authority

Every TargetModel bundle carried ^target_model_edge_serialize_source: a
second encoding of its rules row's token sequence (plus a source-text
binding and a production name). Its only reader in the corpus was
v2.compiler.target_serialize grammar_inverse_source_validated, which on
every emit walked it for well_formed and zip_eq'd its tokens against the
row -- proving two encodings of one fact agree. No ingest, coercion or
Rust seed path reads the edge or its fields.

Delete-first (DESIGN 3, replacement migrations): the edge, its per-language
builders (81 declarations across bash, bash_command_fold, c, cpp, dag,
ecmascript, english, go, java, kotlin, python, rust, rust_test_fixtures,
rust_wire_serde, swift, typescript, wasm, formats.sql_target,
formats.sql_create_table_fold, gha_workflow_yaml_fold), the check and its
matcher. With no second list, "serialize source disagrees with its row"
has no constructor (DESIGN 4b rung 4). Row-derivation refusals keep
executing REDs (ts_lhs_exact_arrow_emitted_rejects,
bash_emit_lhs_exact_arrow_emitted_rejects,
ts_task_derive_row_surplus_conj_slot_rejects); a row whose tokens field is
missing still refuses in the serializer.

Emitted bytes are unchanged against main (dark-install, apply, retract
scripts and a quoting-edge argv).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 8cadeb2 Sep 29, 2026
6 checks passed
@gunbai-bot
gunbai-bot Bot deleted the jolly-bee-43/delete-serialize-source branch September 29, 2026 05:42
@briansrls
briansrls restored the jolly-bee-43/delete-serialize-source branch September 29, 2026 05:48
gunbai-bot Bot pushed a commit that referenced this pull request Sep 29, 2026
…e five claims #12576 deleted (review 72700)

Co-Authored-By: Claude Opus 5.5 (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.

0 participants