Skip to content

fix(updater): remove unused factory Spoolman install leftovers - #423

Merged
gmmcosta15 merged 3 commits into
devfrom
fix/spoolman-factory-leftovers
Nov 19, 2026
Merged

gmmcosta15 merged 3 commits into
devfrom
fix/spoolman-factory-leftovers

Conversation

@gmmcosta15

@gmmcosta15 gmmcosta15 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • Bug Fix

Factory images leave about 210 MB of unused Spoolman install leftovers in ~/Spoolman, and git reports them as untracked. Once the new install is confirmed healthy, the Spoolman hook now removes them.

Changes

  • updater/hooks/Spoolman.sh: after the health check passes, remove ~/Spoolman/Spoolman/ (a v0.26.0 release zip with its own .venv, about 167 MB) and ~/Spoolman/uv/ (the "temporary uv" from upstream scripts/install.sh, about 46 MB). Each path is removed only when all of these hold:
    • it is a real directory, not a symlink;
    • git does not track it;
    • it is not Spoolman.service's WorkingDirectory;
    • it carries the exact installer fingerprint: release_info.json with "project_name": "Spoolman" for the zip, only uv/uvx for the uv dir;
    • it holds no Spoolman data: no *.db* file (database or backups) and no .env setting SPOOLMAN_DIR_DATA/SPOOLMAN_DIR_BACKUPS.
  • Every check fails closed: a git or find error (for example a corrupt index or "dubious ownership") keeps the folder.
  • A failed removal only logs a warning; it never fails the hook or rolls back the install.
  • tests/updater/test_hooks_unit.py: TestSpoolmanHook runs the real hook with stubbed uv/curl/systemctl/sudo/sleep. It covers:
    • removal;
    • keeping dirs without the fingerprint;
    • keeping a tracked dir and the unit's dir;
    • keeping a symlinked dir;
    • keeping both when git fails;
    • keeping a dir that holds a database, a backup or a data-dir .env setting;
    • an unhealthy install keeping both.

Motivation

Upstream scripts/install.sh (lines 31-50) installs uv into $(pwd)/uv via UV_UNMANAGED_INSTALL. The factory image ran it twice: once in ~/Spoolman and once in a release zip unpacked inside it. The service runs ~/Spoolman/scripts/start.sh from ~/Spoolman/.venv, so nothing uses either leftover. The updater never deletes untracked files, and on a reclone _carry_untracked moves them into the fresh tree, so without this they stay forever.

The hook runs whenever Spoolman is updated or provisioned. Field boxes therefore clean up on their next Spoolman update, for example the move onto the ff8efd51 pin. Boxes already on the pin clean up at the next pin bump.

Tests

  • make check: format-check, lint and security pass, and docstrcov is 84.6%. The local test-fast failures are only the sandbox's blocked git commit in git-fixture tests: the same 35 tests fail on untouched dev. The new tests stage with git add only, so they also run locally.
  • pytest tests/updater/test_hooks_unit.py -k Spoolman: 10 passed. shellcheck is clean.

@gmmcosta15
gmmcosta15 requested a review from a team November 19, 2026 16:23
@gmmcosta15 gmmcosta15 self-assigned this Nov 19, 2026
@gmmcosta15
gmmcosta15 merged commit f8d6e81 into dev Nov 19, 2026
14 of 15 checks passed
@gmmcosta15
gmmcosta15 deleted the fix/spoolman-factory-leftovers branch November 19, 2026 17:39
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.

2 participants