Skip to content

feat(rustledger): make the component engine the default#183

Merged
robcohen merged 2 commits into
mainfrom
feat/component-default
Jun 18, 2026
Merged

feat(rustledger): make the component engine the default#183
robcohen merged 2 commits into
mainfrom
feat/component-default

Conversation

@robcohen

Copy link
Copy Markdown
Member

Closes #173. Flips the default rustledger backend from the legacy JSON-RPC engine to the in-process WASI Preview 2 / Component-Model component (rustledger beancount#1384).

Changes

  • backend.py: default → component; RUSTFAVA_RUSTLEDGER_BACKEND=jsonrpc (or json-rpc/json) opts back into the JSON-RPC engine. The ImportError→JSON-RPC fallback stays, so a missing/broken wasmtime degrades gracefully.
  • pyproject.toml: wasmtime moves from the optional component extra to a core dependency — the component is the default, so it ships for every install. uv.lock regenerated (via uv 0.11).
  • Docstrings updated.

Validation

  • Full suite via the component (the new default), on the released v0.16.5 wasm: 497 passed, 0 failed — completing the arc from 114 → 0.
  • This PR's CI runs test-py via the component by default (wasmtime is now a core dep installed by the test group), so the component path is validated end-to-end in CI.
  • jsonrpc opt-out routing verified; mypy + ruff clean on changed files.

Notes

robcohen and others added 2 commits June 18, 2026 06:41
Flip the default backend from the legacy JSON-RPC engine to the in-process
WASI Preview 2 / Component-Model component (rustledger beancount#1384). Closes #173.

- backend.py: default -> component; `RUSTFAVA_RUSTLEDGER_BACKEND=jsonrpc`
  (or `json-rpc`/`json`) opts back into the JSON-RPC engine. The ImportError
  fallback to JSON-RPC stays, so a missing/broken wasmtime degrades rather than
  crashes.
- pyproject: `wasmtime` moves from the optional `component` extra to a core
  dependency (the component is now the default, so it ships for every install);
  uv.lock regenerated.
- docstrings updated to reflect the new default.

The component backend passes the full suite (verified on the released v0.16.5
wasm): 497 passed, 0 failed — the arc from 114 failures is complete. CI's
test-py now exercises the component path by default (wasmtime is a core dep).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`title` is `option<string>` on the component (present-but-None when no
`option "title"`); `BeancountOptions.title` is `str`, so a None value trips
typeguard's runtime check (CI's test-py-typeguard). Default on falsy, like the
other option<string> fields. Caught by CI running the component path now that
it's the default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@robcohen robcohen merged commit 465cad0 into main Jun 18, 2026
28 checks passed
@robcohen robcohen deleted the feat/component-default branch June 18, 2026 07:03
robcohen added a commit that referenced this pull request Jun 18, 2026
…184)

The component engine is now the default (#183), so the wasmtime *Python
package* ships as a dependency and the default backend needs no extra setup.
The wasmtime *CLI* is only required for the legacy JSON-RPC backend
(RUSTFAVA_RUSTLEDGER_BACKEND=jsonrpc) — including the ImportError fallback —
which was previously documented as an unconditional requirement.

- README: reframe the wasmtime note as the JSON-RPC opt-out requirement; PyPI
  install no longer lists wasmtime as a manual prerequisite.
- deployment.md: add a "Backends" section covering the env var, the default,
  and the CLI requirement for the fallback.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
robcohen added a commit that referenced this pull request Jun 19, 2026
,#120)

macOS users hit cryptic failures ("Server failed to start", "Empty response:
rustledger-ffi-wasi") because the *legacy* JSON-RPC backend spawns a `wasmtime`
CLI subprocess that macOS Gatekeeper blocks. The real fix is the in-process
component backend, now the default (#183) — these reports predate that release.

Make the remaining failure modes actionable rather than cryptic:
- The "Empty response" error now explains the subprocess/Gatekeeper cause and
  points at the component backend.
- The "wasmtime CLI not found" error explains the component backend needs no
  external binary.
- `get_engine` no longer silently falls back from the unavailable component
  backend to the JSON-RPC engine (which needs a `wasmtime` CLI binary users
  don't have, producing exactly those cryptic errors). It falls back only if
  the CLI is actually present, else raises a clear "reinstall rustfava" error.

This doesn't change the default path; it just makes the legacy/fallback path
fail with guidance. The substantive fix for the reporters is shipping the
component default in a release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
robcohen added a commit that referenced this pull request Jun 19, 2026
,#120) (#187)

macOS users hit cryptic failures ("Server failed to start", "Empty response:
rustledger-ffi-wasi") because the *legacy* JSON-RPC backend spawns a `wasmtime`
CLI subprocess that macOS Gatekeeper blocks. The real fix is the in-process
component backend, now the default (#183) — these reports predate that release.

Make the remaining failure modes actionable rather than cryptic:
- The "Empty response" error now explains the subprocess/Gatekeeper cause and
  points at the component backend.
- The "wasmtime CLI not found" error explains the component backend needs no
  external binary.
- `get_engine` no longer silently falls back from the unavailable component
  backend to the JSON-RPC engine (which needs a `wasmtime` CLI binary users
  don't have, producing exactly those cryptic errors). It falls back only if
  the CLI is actually present, else raises a clear "reinstall rustfava" error.

This doesn't change the default path; it just makes the legacy/fallback path
fail with guidance. The substantive fix for the reporters is shipping the
component default in a release.

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.

Design: redesign the rustfava↔rustledger boundary around the typed contract

1 participant