Skip to content

fix(test): repair trix test expect/balance phase + modernize utxorpc utxo parsing#123

Merged
scarmuega merged 2 commits into
mainfrom
fix/expect-at-prefix-and-daemon-leak
Jun 16, 2026
Merged

fix(test): repair trix test expect/balance phase + modernize utxorpc utxo parsing#123
scarmuega merged 2 commits into
mainfrom
fix/expect-at-prefix-and-daemon-leak

Conversation

@scarmuega

@scarmuega scarmuega commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

trix test resolves and submits the scaffolded transfers fine, but its expect/balance phase never worked against the released cshell — it errored with CShell failed to get wallet utxos and, on that error path, leaked the Dolos devnet daemon. Reproduces on both stable (trix 0.25.1) and beta (0.26.0), with cshell 0.14 / utxorpc 0.13.

It turned out to be four layered bugs, each only visible once the prior is fixed:

  1. @-prefix not stripped — the expect path passed the literal @bob placeholder to cshell wallet utxos, but wallets are named bob. The tx path already strips it (replace_placeholder_args); the expect path now mirrors that via a small, unit-tested wallet_name helper.
  2. Wrong cshell store — expect queried devnet.home (the dolos store), which holds neither the wallets nor the provider. It now queries wallet.target_dir — the same cshell home the invoke path submits against.
  3. Missing providercshell wallet utxos <NAME> <PROVIDER> falls back to the default provider when the positional is omitted, but the generated cshell.toml marks its sole provider is_default = false. Expect now passes the provider name explicitly (same as invoke), fixing Wallet and provider not found.
  4. Stale utxo deserialization — cshell emits utxorpc AnyUtxoData via pbjson (camelCase keys, bytes as base64, the parsed_state oneof flattened to cardano, BigInt coin as { "int": "..." }), but the UTxO struct expected a flat hex shape and failed with missing field tx.

Also: tear the devnet down unconditionally so a failed/early-exiting test never leaves a daemon running, and surface cshell's stderr in the utxos error.

Two commits

  • fix(test): … — fixes bugs 1–3 + the daemon leak, and (bug 4) replaces the stale UTxO deserializer. This commit couldn't reuse trix's own utxorpc types: the pinned spec (0.17) modeled cardano coin as plain uint64, which won't parse cshell's BigInt-shaped coin — so it landed a self-contained wire deserializer.
  • refactor(test): deserialize cshell utxos via utxorpc AnyUtxoData — bumps utxorpc 0.12 → 0.13 (matching cshell, spec 0.18, which models coin as BigInt) and deserializes straight into utxorpc::spec::query::AnyUtxoData. pbjson handles the camelCase / base64 / oneof / BigInt shaping, so the hand-rolled wire structs, the base64 decode helper, and the direct base64 dep all go away (net −63 lines). The bump is otherwise transparent — the only other utxorpc consumer, devnet/copy.rs, compiles unchanged.

Testing

  • New unit tests for the @-strip; full lib suite (55) green; clippy clean.
  • Verified end-to-end against the installed beta channel via the umbrella DX e2e harness (e2e/, journey 01-basic-init) after both commits: trix test on the default scaffold prints Test Passed, and no Dolos daemon survives the run.

Surfaced by the umbrella DX e2e harness (tx3-lang/toolchain e2e/), which had this round-trip bracketed as an xfail on exactly this signature.

🤖 Generated with Claude Code

…hell

The `trix test` expect phase never worked against the released cshell — it
errored with `CShell failed to get wallet utxos` and, on that error path,
leaked the Dolos devnet daemon. Four layered bugs:

1. `@`-prefix not stripped: the expect path passed the literal `@bob`
   placeholder to `cshell wallet utxos`, but wallets are named `bob`. The tx
   path already strips it (`replace_placeholder_args`); the expect path now
   mirrors that via a small, unit-tested `wallet_name` helper.

2. Wrong cshell store: expect queried `devnet.home` (the *dolos* store), which
   holds neither the wallets nor the provider. It now queries
   `wallet.target_dir` — the same cshell home the invoke path submits against.

3. Missing provider: `cshell wallet utxos <NAME> <PROVIDER>` falls back to the
   *default* provider when the positional is omitted, but the generated
   cshell.toml marks its sole provider `is_default = false`. Expect now passes
   the provider name explicitly (same as invoke), fixing "Wallet and provider
   not found".

4. Stale utxo deserialization: cshell emits utxorpc `AnyUtxoData` via pbjson
   (camelCase, base64 bytes, oneofs flattened to `cardano`, `BigInt` coin as
   `{ "int": "..." }`), but the `UTxO` struct expected a flat hex shape and
   failed with `missing field tx`. Replaced with wire structs matching cshell's
   actual output, decoded into a flat view. Deserializing into trix's own
   `utxorpc` types won't work — its pinned spec models `coin` as plain `uint64`,
   not the BigInt cshell now emits.

Also: tear the devnet down unconditionally so a failed/early-exiting test never
leaves a daemon running, and surface cshell's stderr in the utxos error.

Verified end-to-end against the installed beta channel via the umbrella DX e2e
harness: `trix test` on the default scaffold now prints `Test Passed`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bump `utxorpc` 0.12 → 0.13 (matching cshell / spec 0.18) and deserialize the
`wallet utxos` output straight into `utxorpc::spec::query::AnyUtxoData` instead
of the hand-rolled wire structs the previous commit introduced. pbjson handles
the camelCase / base64 / oneof / BigInt-coin shaping, so the six `Wire*` structs,
the `decode_b64` helper, and the direct `base64` dependency all go away.

The earlier commit couldn't do this: trix's pinned spec (0.17) modeled cardano
`coin` as a plain `uint64`, which won't parse cshell's BigInt-shaped
`{ "int": "..." }`. Spec 0.18 models it as `BigInt`, matching cshell's output.
The bump is otherwise transparent — the only other utxorpc consumer
(`devnet/copy.rs`) compiles unchanged.

The flat `UTxO` view the `expect` checks read is preserved; it's now built by
`flatten_utxo` walking the typed `AnyUtxoData` (parsed_state → Cardano → coin /
assets / datum), with a shared `bigint_to_string` for lovelace and asset
quantities. Re-verified end-to-end against installed beta: `trix test` still
prints `Test Passed`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@scarmuega scarmuega changed the title fix(test): repair trix test expect/balance phase against shipped cshell fix(test): repair trix test expect/balance phase + modernize utxorpc utxo parsing Jun 16, 2026
scarmuega added a commit to tx3-lang/toolchain that referenced this pull request Jun 16, 2026
The expect path's stale utxo deserialization (bug 4) is fixed by bumping trix's
`utxorpc` 0.12 → 0.13 (spec 0.18) and deserializing into `AnyUtxoData` directly,
not by hand-rolled wire structs. Update the plan + README findings to match the
landed approach (tx3-lang/trix#123, second commit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@scarmuega scarmuega merged commit 0e9d854 into main Jun 16, 2026
6 checks passed
@scarmuega scarmuega deleted the fix/expect-at-prefix-and-daemon-leak branch June 16, 2026 19:22
scarmuega added a commit to tx3-lang/toolchain that referenced this pull request Jun 16, 2026
A README describes how the harness works, not which bugs it has surfaced, so
remove the "Findings" section and generalize the Hermeticity note (the daemon
reap is described as harness behavior, not a specific trix bug).

The DX e2e findings plan was fulfilled by the trix expect/balance fix
(tx3-lang/trix#123), so delete it rather than annotate it DONE. The one genuinely
open item it held — the feature-dense lowering latency — moves to a lean,
forward-looking plan.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scarmuega added a commit to tx3-lang/toolchain that referenced this pull request Jun 16, 2026
A README describes how the harness works, not which bugs it has surfaced, so
remove the "Findings" section and generalize the Hermeticity note (the daemon
reap is described as harness behavior, not a specific trix bug).

The DX e2e findings plan was fulfilled by the trix expect/balance fix
(tx3-lang/trix#123), so delete it rather than annotate it DONE. The one genuinely
open item it held — the feature-dense lowering latency — moves to a lean,
forward-looking plan.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scarmuega added a commit to tx3-lang/toolchain that referenced this pull request Jun 16, 2026
Point trix at main (0e9d854), which includes the `trix test` expect/balance
repair + utxorpc modernization (tx3-lang/trix#123). Not yet released, so the
journey 01 xfail stays until the fix ships in a channel manifest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scarmuega added a commit to tx3-lang/toolchain that referenced this pull request Jun 16, 2026
Drop the xfail bracket from 04-devnet-roundtrip — the round-trip is now a strict
`run_cmd ... trix test` + `assert_output_contains "Test Passed"`. On released
channels (which still carry the bug) the journey now *fails* instead of being
tolerated, so the broken state is a real, visible CI failure on the beta job
rather than a green xfail. It goes green automatically once the trix fix
(tx3-lang/trix#123) ships to a channel.

Verified both directions: fails (exit 1) on the released beta binaries; passes
strictly against trix main (the fix). Docs + skill updated to say "fails", not
"xfail".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scarmuega added a commit to tx3-lang/toolchain that referenced this pull request Jun 16, 2026
The roadmap predated 03-lang-edge / 04-devnet-roundtrip, so its planned
`03-codegen-consume` / `04-registry` collided with real journeys, it linked the
now-deleted findings plan, and it placed the round-trip in 01 (now 04).

- Drop fixed `NN-` prefixes from planned journeys — they're themes, numbered at
  authoring time (next free: 05) — so the roadmap stops colliding with real
  journeys.
- Fix references: round-trip machinery lives in 04-devnet-roundtrip; the trix
  test fix is merged (tx3-lang/trix#123) but unreleased; each journey ships its
  own README (no journey table to update); drop the dead findings-plan link.

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

1 participant