Add MachineLibrary.get(name) public lookup method #45
Labels
No labels
blocked:children
blocked:depends-101
blocked:depends-103
blocked:depends-104
blocked:needs-attention
blocked:needs-decision
blocked:no-changes
blocked:preflight
bug
chore
feature-request
in-progress
lint-cleanup
needs-decompose
performance
quality
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
API gap
src/machine/machine_library.pyexposesself.machinesas a dict.Consumers (CLI, service, tests) reach into it directly:
This couples consumers to the internal storage shape. If the storage
changes (e.g. moves to a database, a config file, a per-machine JSON
file), every consumer breaks.
What to add
A public
get(name: str) -> MachineProfilemethod:Plus a
list_names() -> list[str]for introspection.Why it matters
The HTTP service (per "Add HTTP service layer") needs to resolve
machine_profile="brother-pr10"from the request into aMachineProfileobject. Going through
lib.machines["brother-pr10"]works today but:KeyError: 'brother_pr10').get()with an optional default would handle that cleanly.
Acceptance
MachineLibrary.get("brother_se600")returns the SE600 profile.MachineLibrary.get("nonexistent")raisesKeyErrorwith a messagelisting all available profile names.
MachineLibrary.list_names()returns a sorted list of all profile names.get()instead of direct dict access.Cross-link: ThreadCraft #11 — public MachineLibrary.get() is the lookup API the wrapper uses.