Skip to content

fix(desktop): install real project deps; smoke test the frozen sidecar - #239

Merged
robcohen merged 4 commits into
mainfrom
fix/desktop-sidecar-deps
Jul 4, 2026
Merged

robcohen merged 4 commits into
mainfrom
fix/desktop-sidecar-deps

Conversation

@robcohen

@robcohen robcohen commented Jul 4, 2026

Copy link
Copy Markdown
Member

Fixes #233 — the v1.31.0 desktop app cannot open any ledger on any platform.

Root cause

The sidecar build pip-installed a hand-maintained dependency list that drifted from pyproject.toml twice:

  1. simplejson — core dep since feat(json): emit Decimals as exact number literals (frontend-decimal epic, step A) #215, imported unconditionally at charts.py:16 in the startup chain → the reporter's crash
  2. wasmtime — core dep since the component engine became the only backend; the list's stale comment still called it "an optional dependency (the component extra)" → a second crash waiting behind the first

Nothing in the pipeline ever executed the frozen binary, so it shipped.

Fix

  • pip install pyinstaller . — the frozen build now gets exactly pyproject's dependencies; the drift class is structurally gone
  • New smoke step in the matrix: run the frozen sidecar against a mini ledger and require an HTTP response before upload, on all four platforms (including the Rosetta x64 binary). This PR's own build-sidecar checks are the live validation — on unfixed main this step would fail exactly as Unable to open a file due to missing simplejson module #233 does.

Follow-up after merge: cut v1.32.0 so desktop users get a working app; interim workaround for v1.31.0 desktop users is pipx install rustfava (the PyPI wheel's dependencies are correct).

🤖 Generated with Claude Code

Fixes #233. The sidecar build pip-installed a hand-maintained package list
that drifted from pyproject.toml twice: simplejson (core since #215,
imported at charts.py:16 in the startup chain) and wasmtime (core since the
component engine became the only backend; the list's comment still called
it an optional extra). Result: the v1.31.0 desktop sidecar crashed on
startup on every platform, and nothing in the pipeline ever executed the
binary to notice.

- Install `pyinstaller .` so the frozen build gets exactly pyproject's
  dependencies; the drift class is gone.
- Add a functional smoke step to the matrix: run the frozen sidecar against
  a mini ledger and require an HTTP response. Catches the #233 failure
  class (missing bundled module, startup crash) on all four platforms
  before release, including the Rosetta x64 binary.
robcohen added 3 commits July 4, 2026 03:17
All four runners reproduced the pip BackendUnavailable against the custom
build backend (same as local). uv drives the backend fine, so: uv builds
the pure-Python wheel natively (arch-independent), then the arch-pinned
pip installs the wheel, keeping dependency resolution under the target
arch for the Rosetta x64 build.
Round 2's smoke caught the next layer on all four platforms: the sidecar
started but every engine call 500'd because PyInstaller never bundled
wasmtime's _libwasmtime native library (leading-underscore name in a
platform subdir defeats collect_dynamic_libs' default lib*.so pattern;
explicit patterns fix it — verified present in the local build TOC).

The smoke step now also requires an engine-backed API endpoint, so a
Flask shell that starts without a working engine can never pass again.
Round 3 proved the dynlib fix (sidecar starts and serves everywhere);
the engine probe 404'd only because the hardcoded slug guess was wrong.
Derive the API URL from the / redirect instead, and log it.
@robcohen
robcohen merged commit 4722143 into main Jul 4, 2026
29 checks passed
@robcohen
robcohen deleted the fix/desktop-sidecar-deps branch July 4, 2026 03:51
robcohen added a commit that referenced this pull request Aug 22, 2026
…303)

The v1.32.0 desktop release failed on every platform:

    Error: Invalid value for '--version': '1.32.0' is not a valid boolean.
    ##[error]frozen sidecar failed to start or serve (the #233 failure class)

Not a packaging problem. `desktop-release.yml` writes
RUSTFAVA_VERSION=<tag> into $GITHUB_ENV so the PyInstaller spec can bake
the version into rustfava/_version.py (#191). $GITHUB_ENV leaks into
every later step of the job, including the one that actually runs the
frozen binary — and the CLI is declared with
`auto_envvar_prefix: "RUSTFAVA"` (cli.py:51), so click reads
RUSTFAVA_VERSION as `--version`, a boolean flag. The sidecar exited on a
usage error before serving anything, and the smoke test correctly
reported it as dead.

Only tag builds set the variable, so this could not appear on a PR or on
main. v1.32.0 was the first tagged release since the smoke test was
added in #239, which is exactly when it fired: a check that only runs in
the situation nobody could test.

Renamed to FROZEN_APP_VERSION at both sites, deliberately outside the
RUSTFAVA_ prefix so no future internal variable can be re-read as a CLI
option. Verified both directions:

    RUSTFAVA_VERSION=1.32.0  rustfava --port … ledger  -> usage error, exit 120
    FROZEN_APP_VERSION=1.32.0 rustfava --port … ledger  -> serves normally

Also corrects RELEASING.md, which named a workflow that does not exist
(`build-publish.yml`, actually `publish.yml`) and stated that PyPI needs
no manual approval. The `pypi` environment has protection rules, so the
`publish` job sits in `waiting` until a reviewer approves — observed on
this very release, where build/docker/smoke-wheel completed unattended
and only PyPI stopped.
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.

Unable to open a file due to missing simplejson module

1 participant