Repository navigation
fix(rustledger): complete the v0.19.0 upgrade — host-side GPG decryption (WIT 3.2.0) - #219
Merged
Merged
Conversation
…T 3.2.0) rustledger v0.19.0 makes the FFI component delegate decryption of encrypted ledgers to the host (rustledger#1667, WIT 3.2.0): the component now imports `rustledger:ledger/[email protected]` with a single `decrypt: func(ciphertext: list<u8>) -> result<string, string>` and calls it when it detects a `.gpg`/`.asc` input. - engine: RUSTLEDGER_VERSION -> v0.19.0; vendored component refreshed from the release asset (sha256-verified). - component engine: _WIT_VERSION -> 3.2.0; the linker now defines the host interface, implementing `decrypt` with the system `gpg --batch --decrypt` (keyring + gpg-agent), mirroring rustledger's native loader semantics. Errors surface as the WIT `err` case, so hosts without usable keys still fail cleanly. - tests: encrypted-ledger suite rewritten for the new capability — adds an end-to-end round-trip (throwaway keyring, encrypt, load through the component, entries produced) plus direct err-branch coverage (gpg missing, non-UTF-8 plaintext); component api_version assertion 3.1 -> 3.2. Encrypted ledgers now load end-to-end on the default component backend — previously they were detect-only with a clean failure. 560 passed, 100% branch coverage maintained.
…directly The end-to-end round-trip needs a system gpg (absent on macOS CI runners — FileNotFoundError). Skip it cleanly when gpg is not installed, and cover _host_decrypt's ok/gpg-failure branches with monkeypatched units so the 100% branch-coverage gate holds on gpg-less platforms too.
shutil.which found gpg on the runner's full PATH but the subprocess env restricted PATH to /usr/bin:/bin, hiding Homebrew's gpg on macOS — FileNotFoundError despite the skip guard. Resolve the absolute gpg path once (skip when absent) and invoke it directly; inherit PATH for gpg's own helpers.
This was referenced Jul 2, 2026
robcohen
added a commit
that referenced
this pull request
Jul 2, 2026
Closes #220. The bot auto-merged v0.19.0 as a version-string chore despite the release carrying a breaking FFI change (feat(ffi)!, WIT 3.1.0 -> 3.2.0 with a new mandatory host import), leaving main unable to instantiate the component until #219. The bump workflow now: - downloads the release's FFI component, verifies its sha256, and refreshes the vendored artifact (previously the bot only edited the version string and left the vendored wasm stale); - extracts the component's actual WIT package version with wasm-tools and compares it against _WIT_VERSION in component_engine.py. ANY difference (minor bumps can add mandatory imports, as 3.2.0 did) or a conventional- commit breaking marker in the release notes (`!:` / BREAKING CHANGE) marks the bump as needs-review; - needs-review bumps open as a DRAFT PR with no auto-merge and a checklist (new imports to bind, tests to run), with the mechanical _WIT_VERSION bump pre-applied; clean bumps keep today's auto-merge behaviour. Gate logic validated against the real v0.19.0 artifacts: matched-WIT -> auto path; the v0.19.0 release notes trip the breaking grep; the exact #218 scenario (bindings 3.1.0 vs component 3.2.0) -> held for review.
robcohen
added a commit
that referenced
this pull request
Jul 2, 2026
…#223) Closes #220. The bot auto-merged v0.19.0 as a version-string chore despite the release carrying a breaking FFI change (feat(ffi)!, WIT 3.1.0 -> 3.2.0 with a new mandatory host import), leaving main unable to instantiate the component until #219. The bump workflow now: - downloads the release's FFI component, verifies its sha256, and refreshes the vendored artifact (previously the bot only edited the version string and left the vendored wasm stale); - extracts the component's actual WIT package version with wasm-tools and compares it against _WIT_VERSION in component_engine.py. ANY difference (minor bumps can add mandatory imports, as 3.2.0 did) or a conventional- commit breaking marker in the release notes (`!:` / BREAKING CHANGE) marks the bump as needs-review; - needs-review bumps open as a DRAFT PR with no auto-merge and a checklist (new imports to bind, tests to run), with the mechanical _WIT_VERSION bump pre-applied; clean bumps keep today's auto-merge behaviour. Gate logic validated against the real v0.19.0 artifacts: matched-WIT -> auto path; the v0.19.0 release notes trip the breaking grep; the exact #218 scenario (bindings 3.1.0 vs component 3.2.0) -> held for review.
3 tasks
This was referenced Jul 2, 2026
robcohen
added a commit
that referenced
this pull request
Jul 2, 2026
…227) * test(holdings): regression for the cost_date aliased ORDER BY (#190) The Holdings query orders by cost_date, a raw column aliased in SELECT. rustledger dropped the hidden sort column for that shape and every Holdings render 500'd (rustledger#1627, fixed in rustledger#1631, shipped v0.17.0; delivered to rustfava by the v0.19.0 upgrade in #219). Pins the exact issue repro — two cost-dated lots of the same commodity — so a future engine or query-layer change can't silently rebreak the report. Closes #190 * test(holdings): narrow query-result types for mypy execute_query_serialised returns QueryResultTable | QueryResultText and row values are a wide union — assert the table case and isinstance-narrow the inventory cell before reading lots.
This was referenced Jul 3, 2026
3 tasks
3 tasks
robcohen
added a commit
that referenced
this pull request
Aug 21, 2026
Two defects in the same PR body, both found reviewing #284. 1. The "why this is held" line lost its values. `${{ steps.gate.outputs.reasons }}` was interpolated into an unquoted heredoc. A `${{ }}` expression is pasted into the script text before bash parses it, so the backticks inside the reason string were parsed as command substitution: their contents were executed and replaced with the empty output. #284's body reads - WIT package version changed: -> (host bindings in likely need changes) losing precisely the two versions and the filename the reviewer needs. `set -euo pipefail` does not catch it, because the substitution's exit status is never examined — it fails silently. Fixed by passing the values through `env:` and referencing them as shell variables. A variable's value is not re-scanned for substitutions, so backticks in it stay literal; the escaped static backticks elsewhere in the heredoc were never affected. This is also the standard remedy for the script-injection surface that `${{ }}`-into-`run` carries. Verified by executing the step with the env the workflow supplies: the body now renders the versions and the filename. The same harness run against the pre-fix step reproduces the blanked line exactly, so the check can report dirty as well as clean. 2. The body claimed a vendored artifact that has never existed. It advertised "refreshed the vendored component (sha256-verified)". The download step did `cp component.wasm src/rustfava/rustledger/rustledger_ffi_component.wasm`, added by #219/#220 to stop a committed artifact going stale — but that path is gitignored (.gitignore:52) and absent from add-paths, so it was never once committed: `git log --all` on the path is empty. The cp wrote into the runner's workspace and was discarded. #243 had already settled the question the other way round: committing the wasm shipped ~6 MB of unconsumed sdist weight per release, so the component is downloaded at runtime against the pinned version instead (#286). Removed the dead cp rather than resurrect vendoring, and made the body describe what actually happens. The download and sha256 verification stay — the WIT gate reads component.wasm from the workspace. Also corrected the checklist's "wasm-tools component wit the vendored file", which pointed at a file that is never there. No functional change to what the bot commits.
3 tasks
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.
Completes #218, which bumped
RUSTLEDGER_VERSIONto v0.19.0 but didn't adapt to the release's breaking FFI change (rustledger#1667, WIT 3.2.0). As of #218, a fresh install that downloads the v0.19.0 component cannot instantiate it:v0.19.0 delegates decryption of encrypted ledgers to the host: the component imports
rustledger:ledger/[email protected]withdecrypt: func(ciphertext: list<u8>) -> result<string, string>and calls it on.gpg/.ascinputs.Changes
_WIT_VERSION→3.2.0; the wasmtime linker now defines the host interface, implementingdecryptwith the systemgpg --batch --decrypt(keyring + gpg-agent) — mirroring rustledger's native loader semantics. Failures surface as the WITerrcase, so hosts without usable keys still fail cleanly.api_versionassertion3.1→3.2.Net effect
Encrypted ledgers now load end-to-end on the default component backend — previously detect-only with a clean failure.
Validation
560 passed, 1 skipped(pre-existing), 100% branch coverage maintained; component smoke: instantiates,api_version 3.2, loads plaintext + encrypted ledgers.🤖 Generated with Claude Code