Repository navigation
refactor: move the harness text dispatch out of the wasm module - #93
Open
malihashar wants to merge 1 commit into
Open
malihashar wants to merge 1 commit into
malihashar wants to merge 1 commit into
Conversation
The two functions that parse or render a harness's native text by HarnessId lived privately in src/wasm.rs, so only the WASM bindings could use them. Move them to a new always-compiled txcript::dispatch module and make wasm.rs call them. No behaviour change. This lets other code (such as a conversion report) render a transcript into any harness's format and read it back without going through WASM. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In short
txcript checkis a new command that tells you what converting a session to another agent would lose, before you do it. This is step 1 of 3: a small preparation that moves two functions into their own module, so the next steps can use them. It changes no behaviour.Part 1 of 3 for #92
What this PR does
It moves two functions out of
src/wasm.rsinto a new module,src/dispatch.rs:parse_to_common(harness, text)reads a harness's native text into the common transcript.render_from_common(harness, transcript)writes the common transcript as a harness's native text.Both choose the right codec from a
HarnessIdat run time.src/wasm.rsnow calls them instead of owning them.Why
Until now these two functions were private to the WASM bindings, so no other code could use them. The next two PRs need them to render a session into any harness's format and read it back (that is how the fidelity report works).
What does not change
Nothing changes in behaviour. This is only a move: the function bodies are the same, and
src/wasm.rsjust imports them.How to review
It is a small diff: one new file (
src/dispatch.rs, 77 lines), a 3-line addition tosrc/lib.rs, and the matching removal insrc/wasm.rs.Tests
mainbefore and after (100 unit, 242 integration, 10 regression, 119 CLI, 5 CLI integration, 2 doctests).cargo fmt,cargo clippy(0 warnings) andcargo check -p txcript --no-default-features --features wasmpass.What I could not test
The real WASM build, because the WASM target is not installed on my machine. The change in
src/wasm.rsis a plain removal plus oneuseline, but please let CI or a maintainer confirm it.