Skip to content

Fix three ways an install can silently run wrong or lose its settings - #38

Open
CSSFrancis wants to merge 2 commits into
mainfrom
fix/silent-env-failures
Open

CSSFrancis wants to merge 2 commits into
mainfrom
fix/silent-env-failures

Conversation

@CSSFrancis

Copy link
Copy Markdown
Member

#25 — a same-version rebuild ran the old Python. The env stamp was only uv.lock plus extras, so a rebuild that left both alone put new wheels on disk and never installed them. The stamp now adds a sha256 over every staged wheel's name and bytes (envStamp, stagedWheelsDigest). That alone was not enough: uv skips a wheel whose name and version are already installed, so installAppWheel now passes --reinstall (with --no-deps it touches only that wheel). Existing installs see a new stamp and re-sync once after upgrading de-shell.

#24 — settings.json.

  • Saves write a temporary file, fsync it, and rename over the old one, so a backend killed mid-save keeps the previous file.
  • A file that won't parse, or isn't a JSON object, is moved to settings.json.bad-<time> and logged as a warning, instead of being overwritten with defaults on the next save.
  • Save failures log at WARNING instead of DEBUG.

#27 — PYTHONPATH and PYTHONHOME. Removed (case-insensitively) from the environment the backend starts with, and from uv's. Removing them, rather than running python -E, keeps PYTHONUNBUFFERED and any variable a user sets on purpose, and covers worker processes, which inherit the environment. This applies in development too. Not run in a packaged app with the variables set; the filter is unit-tested.

Typecheck, 186 unit tests and 133 pytest tests pass locally.

Closes #25, closes #24, closes #27.

CSSFrancis added a commit that referenced this pull request Nov 7, 2026
- The environment stamp includes a digest of the staged app and member
  wheels, and they are installed with --reinstall, so a rebuild that keeps
  uv.lock and the version no longer keeps running the previous build's
  Python (#25). Existing installs re-sync once after upgrading.
- settings.json is written atomically (temporary file, then rename), an
  unreadable file is moved aside to settings.json.bad-<time> instead of
  being overwritten with defaults, and save failures log as warnings (#24).
- PYTHONPATH and PYTHONHOME are removed from the environment of the
  backend and of uv, so another Python's settings cannot shadow the app's
  dependencies or stop the interpreter starting (#27).
@CSSFrancis
CSSFrancis force-pushed the fix/silent-env-failures branch from 338962e to 30500e5 Compare November 16, 2026 17:45

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

1 participant