fix(slots): repair POST /api/slots ImportError from #281#320
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aa03d71) added_next_free_slot_port()insrc/hal0/api/routes/slots.pythat importshal0_etc_dirfromhal0.config.paths— but no such symbol exists.POST /api/slotsfrom the dashboard 500s withImportError: cannot import name 'hal0_etc_dir' from 'hal0.config.paths'.slots_config_dir()helper already returnsetc() / "slots", exactly what the new code wants. Two-line swap.Repro
https://hal0.thinmint.dev/POST /api/slots→ 500 (ImportError in hal0-api logs)Test plan
ruff check src/hal0/api/routes/slots.pycleanruff format --check src/hal0/api/routes/slots.pycleancurl POST /api/slotsreturned 201 with correct auto-assigned port 8086 (lowest free in 8081–8099)DELETE /api/slots/<name>→ 200🤖 Generated with Claude Code