Skip to content

refactor: move the harness text dispatch out of the wasm module - #93

Open
malihashar wants to merge 1 commit into
skillsynchq:mainfrom
malihashar:feat/dispatch-module
Open

malihashar wants to merge 1 commit into
skillsynchq:mainfrom
malihashar:feat/dispatch-module

Conversation

@malihashar

@malihashar malihashar commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

In short

txcript check is 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.rs into 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 HarnessId at run time. src/wasm.rs now 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.rs just imports them.

How to review

It is a small diff: one new file (src/dispatch.rs, 77 lines), a 3-line addition to src/lib.rs, and the matching removal in src/wasm.rs.

Tests

  • The test suite gives the same numbers as main before and after (100 unit, 242 integration, 10 regression, 119 CLI, 5 CLI integration, 2 doctests).
  • cargo fmt, cargo clippy (0 warnings) and cargo check -p txcript --no-default-features --features wasm pass.

What I could not test

The real WASM build, because the WASM target is not installed on my machine. The change in src/wasm.rs is a plain removal plus one use line, but please let CI or a maintainer confirm it.

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 branch has not been deployed

No deployments
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