Skip to content

Decode each serialized token once - #12570

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

gunbai-bot[bot] merged 1 commit into
mainfrom
jolly-bee-43/serialize-decode-once

Conversation

@gunbai-bot

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

Copy link
Copy Markdown
Contributor

Small local defect found while re-deriving the generic serializer's per-token cost for #12482. v2.compiler.target_serialize token_sequence_item_kind decoded every token node only to classify it, and token_text_from_model then decoded the same node again to spell it. Now the classification carries the decoded token, and std.compilers.target_model token_text_from_decoded spells it. token_text_from_model had no other caller and is deleted. Refusals are unchanged: a malformed token still refuses at the one decode.

Bytes: identical to 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 this tree.

Cost: claim_batch eval_steps, main vs this head. Dark-install render: 1,000,496 to 995,957. One-word command: 11,797 to 11,790. Eight-word command: 39,146 to 39,147. The gain is small. It is a correctness-of-shape fix (§6 bare minimum cost), not the #12482 lever. That lever is removing the per-emit target-model validation, as a separate PR.

🤖 Generated with Claude Code

target_serialize token_sequence_item_kind decoded every token node
(concrete_syntax_token_from_node) only to classify it, then
token_text_from_model decoded the same node again to spell it. The
classification now carries the decoded token (TokenSequenceConcreteToken
{ token }) and std.compilers.target_model token_text_from_decoded spells
that value; token_text_from_model, whose only caller this was, is deleted.
The refusals are unchanged: a malformed token still refuses at the one
decode. Emitted bytes are unchanged (dark-install, apply, retract scripts
and a quoting-edge argv compare identical against main).

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 0d39e7e Sep 29, 2026
6 checks passed
@gunbai-bot
gunbai-bot Bot deleted the jolly-bee-43/serialize-decode-once branch September 29, 2026 05:42
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