Skip to content

fix(slots): repair POST /api/slots ImportError from #281#320

Merged
thinmintdev merged 1 commit into
mainfrom
fix/slots-port-import-aa03d71
May 25, 2026
Merged

fix(slots): repair POST /api/slots ImportError from #281#320
thinmintdev merged 1 commit into
mainfrom
fix/slots-port-import-aa03d71

Conversation

@thinmintdev
Copy link
Copy Markdown
Contributor

Summary

  • PR fix(slots): POST normalizes Lemonade-shape model + auto-assigns port (#275 bugs 1+2) #281 (aa03d71) added _next_free_slot_port() in src/hal0/api/routes/slots.py that imports hal0_etc_dir from hal0.config.paths — but no such symbol exists.
  • Every POST /api/slots from the dashboard 500s with ImportError: cannot import name 'hal0_etc_dir' from 'hal0.config.paths'.
  • The existing slots_config_dir() helper already returns etc() / "slots", exactly what the new code wants. Two-line swap.

Repro

  1. Open dashboard at https://hal0.thinmint.dev/
  2. Add a new slot via the UI
  3. POST /api/slots → 500 (ImportError in hal0-api logs)

Test plan

  • ruff check src/hal0/api/routes/slots.py clean
  • ruff format --check src/hal0/api/routes/slots.py clean
  • Hot-patched + restarted hal0-api on the LXC. curl POST /api/slots returned 201 with correct auto-assigned port 8086 (lowest free in 8081–8099)
  • Test slot deleted via DELETE /api/slots/<name> → 200

🤖 Generated with Claude Code

PR #281 (aa03d71) introduced `_next_free_slot_port()` importing
`hal0_etc_dir` from `hal0.config.paths` — but no such symbol exists,
breaking every POST /api/slots with a 500 ImportError.

The existing `slots_config_dir()` helper returns `etc() / "slots"`,
exactly what the new code wants. Swap the import; the function body
becomes a no-op simpler.

Hot-patched + smoke-tested on hal0 LXC: POST /api/slots → 201 with
correct auto-assigned port 8086 (lowest free in 8081-8099).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thinmintdev thinmintdev merged commit ba19e4b into main May 25, 2026
4 checks passed
@thinmintdev thinmintdev deleted the fix/slots-port-import-aa03d71 branch May 25, 2026 21:31
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