Skip to content

fix: correct scale_id lookup in HTTP endpoints - #5

Merged
larsrollik merged 1 commit into
mainfrom
fix/api-scale-id-keyerror
Jun 21, 2026
Merged

fix: correct scale_id lookup in HTTP endpoints#5
larsrollik merged 1 commit into
mainfrom
fix/api-scale-id-keyerror

Conversation

@larsrollik

Copy link
Copy Markdown
Member

The /weight, /tare, /zero handlers referenced instance_info['id'] - the wrong key (the dict uses scale_id, per the docstring and /status) and the wrong object (the closure var, not app.state.instance_info), so every call raised KeyError. /info separately returned the entire instance_info dict as scale_id. All four now use app.state.instance_info['scale_id']. Found by the 2026-06-21 fleet sweep. 14 tests pass; lint clean.

The /weight, /tare, /zero handlers referenced the closure var
instance_info['id'] - wrong key (it is 'scale_id') and the wrong object
(app.state.instance_info), so every call raised KeyError. /info also
returned the whole dict as scale_id. All now read
app.state.instance_info['scale_id'].
@larsrollik
larsrollik requested a review from a team as a code owner June 21, 2026 08:17
@larsrollik
larsrollik merged commit a80f3eb into main Jun 21, 2026
9 checks passed
@larsrollik
larsrollik deleted the fix/api-scale-id-keyerror branch June 21, 2026 11:10
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