Skip to content

fix(installer): uninstall.sh dev mode + hal0-caddy unit cleanup#18

Merged
thinmintdev merged 1 commit into
mainfrom
fix/uninstall-dev-and-caddy-clean
May 16, 2026
Merged

fix(installer): uninstall.sh dev mode + hal0-caddy unit cleanup#18
thinmintdev merged 1 commit into
mainfrom
fix/uninstall-dev-and-caddy-clean

Conversation

@thinmintdev
Copy link
Copy Markdown
Contributor

Summary

Two related defects in installer/uninstall.sh:

#22 — missing hal0-caddy.service in unit-removal loop (install.sh:439 writes it on --auth=basic). After uninstall, hal0-caddy is orphaned — failed-to-start unit pointing at deleted binary.

#21 — no --dev mode. Uninstaller hardcoded FHS paths; running it after install.sh --dev would wipe the host's /etc/hal0, /var/lib/hal0, /usr/lib/hal0, and systemd units. Now mirrors install.sh:89-100's PREFIX / ETC_DIR / VAR_DIR / UNIT_DIR / LIB_DIR computation behind a --dev flag (HAL0_PREFIX honored the same way). --dev also skips root-escalation, systemctl, docker-stop, the /usr/local/bin/hal0 PATH symlink, and the system-user removal.

Closes tasks #21 + #22. Harness FINDINGS.md #3 + #4.

Note on branch hygiene

This was cherry-picked from Team M's original branch (which was inadvertently based on the FLM toolbox branch instead of main) onto a fresh main checkout. The 196-line uninstall.sh diff is the only real change.

Test plan

  • bash -n installer/uninstall.sh — syntax OK
  • HAL0_PREFIX=$(mktemp -d) HAL0_FORCE=1 bash installer/uninstall.sh --dev — only touches tmp tree, exits clean
  • Real install.sh --dev + uninstall.sh --dev round-trip on hal0-test LXC
  • install.sh --auth=basic + uninstall.sh — confirm hal0-caddy unit removed

🤖 Generated with Claude Code

Two related defects in installer/uninstall.sh that together let a
developer's `install.sh --dev` get torpedoed by a follow-up `uninstall.sh`
that hardcoded the host FHS layout, and left an orphan hal0-caddy.service
behind on real installs that used --auth=basic.

Findings #3+#4 / tasks #21+#22:

* Mirror install.sh:89-100's PREFIX / ETC_DIR / VAR_DIR / UNIT_DIR / LIB_DIR
  computation behind a new --dev flag (HAL0_PREFIX honored the same way),
  and route every path reference through the computed vars instead of
  /etc/hal0, /var/lib/hal0, /usr/lib/hal0, /etc/systemd/system literals.
  --dev also skips root-escalation, systemctl, docker-stop, the
  /usr/local/bin/hal0 PATH symlink, and the system-user removal — exactly
  the operations install.sh --dev never performed.
* Add hal0-caddy.service to both the stop/disable list and the unit-file
  removal loop so --auth=basic installs uninstall cleanly.
* Help text now documents --dev and HAL0_PREFIX.

Smoke-tested with HAL0_PREFIX=$(mktemp -d) HAL0_FORCE=1 ./uninstall.sh --dev:
only touches the tmp tree, leaves the host alone, exits clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@thinmintdev thinmintdev merged commit 83e275e into main May 16, 2026
thinmintdev added a commit that referenced this pull request May 21, 2026
…18) (#69)

Two harness findings on the OpenAI-compatible audio routes:

- #14: POST /v1/audio/transcriptions with a non-audio body could leak
  the moonshine container's ffmpeg argv + tempfile path through the
  proxy when an out-of-tree / older upstream returned a raw
  CalledProcessError repr. The dispatcher forwards upstream bodies
  verbatim by design, so the audio route now scrubs the response for
  the leak markers ("ffmpeg" / "CalledProcessError") and substitutes a
  clean 415 envelope with code=audio.unsupported_format. New
  UnsupportedMediaType subclass added to hal0.errors so other 415 call
  sites have an ergonomic on-ramp.

- #18: POST /v1/audio/speech with a body missing the 'model' field
  previously fell through the dispatcher's default-model + no-route
  path and surfaced a misleading 404. The route now raises BadRequest
  up front with code=request.missing_model so OpenAI clients see the
  real problem (matching field added on /v1/audio/transcriptions for
  consistency). Existing tests' code assertion updated from
  validation.invalid to request.missing_model.

Tests
=====
- tests/api/test_v1_audio.py (new) covers:
  * non-audio multipart → 415 audio.unsupported_format, no "ffmpeg" or
    "CalledProcessError" substring in the response body
  * clean upstream 5xx body passes through untouched (scrubber narrowness)
  * /v1/audio/speech missing model → 400 request.missing_model
  * /v1/audio/speech empty/whitespace model → 400 request.missing_model
  * happy-path STT + TTS via httpx.MockTransport round-trip
  * sanity: scrubber leaves non-audio routes alone

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thinmintdev thinmintdev deleted the fix/uninstall-dev-and-caddy-clean branch May 21, 2026 20:11
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.

1 participant