Repository navigation
fix(knx-gui): reject unparseable integer input instead of resetting to minimum - #110
Closed
detail-app[bot] wants to merge 1 commit into
Closed
detail-app[bot] wants to merge 1 commit into
detail-app[bot] wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #110 +/- ##
==========================================
+ Coverage 61.46% 61.56% +0.09%
==========================================
Files 156 156
Lines 11088 11088
Branches 1490 1490
==========================================
+ Hits 6815 6826 +11
+ Misses 4111 4098 -13
- Partials 162 164 +2
🚀 New features to boost your workflow:
|
kewde
force-pushed
the
detail/bug-fix/fix-knx-gui-reject-unparseable-integer-input-inste-a2b997
branch
from
September 23, 2026 10:22
5623d7d to
bd00b63
Compare
Contributor
Author
|
Closing this pull request because it has had no human activity in 26 days (since 2026-09-23) and was opened 30 days ago. Detail closes its pull requests once they are more than 30 days old and have had no human activity for 14 days. If this change is still useful, reopen the pull request and Detail won't close it again. To keep a Detail pull request open, add the |
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.
Detail bug report: View on Detail
Closes #73
Bug
_render_int_paraminapps/knx-gui/src/knx_gui/widgets/parameter_widgets.pyrenders integer parameters (NumberWidget/NumberSliderWidget) as a free-text field withimgui.InputTextFlags_.chars_decimal, which admits.+-*/(not just digits). On blur, theexcept ValueErrorbranch silently overwrote the bound value withmin_value(commonly0) and pushed it throughon_change— propagating toProjectService.set_parameter→EventStore.append(SetParameter(...)), persisted to the SQLite event history and replayed on reopen (SetParameter.applyre-assignsparam.value). Typing5.5into a50-valued parameter reset it to0.Introduced in
09f4904, which switched the control fromimgui.drag_int(int-only slider) toinput_text+chars_decimal(free-text) but kept the oldValueError → min_valuefallback — changing its meaning from "recover from a malformed loaded default" to "silently overwrite invalid user input with the minimum."Fix
On
ValueError,returnearly instead of substitutingmin_value. The boundvalueis already the prior valid value; preserving it rejects the unparseable input and resyncs the buffer via imgui's controlled-buffer semantics on the next frame.try: clamped = int(new_text) except ValueError: - clamped = min_value if min_value is not None else 0 + returnTesting
Added e2e tests (Dear ImGui Test Engine) to
apps/knx-gui/src/knx_gui/testing/tests/test_configure_panel.py, driving the realrender_param_widget/render_ui_treepaths:test_render_int_param_rejects_unparseable_input_keeps_prior_value— parametrized over the six unparseable buffers the report enumerates (5.5,1+2,3*4,3/4,0.,""); each assertson_changedoes not fire and the prior value is preserved.test_render_int_param_clamps_valid_within_range/_above_max/_below_min— guard the happy-path and both clamp arms aren't regressed by the fix.test_render_int_param_accepts_signed_integer— guards that legitimate+5/-5(whichint()accepts) still parse and clamp, so a future input-filter narrowing can't over-correct.test_render_int_param_number_slider_widget_rejects_invalid— covers theNumberSliderWidgetmatch arm (same code path asNumberWidget).test_render_ui_tree_rejects_invalid_int_input— end-to-end through the real Configure-panel render path (render_ui_tree→_render_children→_render_param_table→render_param_widget→_render_int_param), the report's exact reproduction.Bug-catch verified: reintroducing the
min_valuefallback makes the rejection and end-to-end tests fail with['0'] == []/[('p0', '0')] == [](matching the report's50 → 0symptom); restoring the fix makes all pass.Routine checks clean:
uv run pyright,uv run ruff check,uv run ruff format --check(repo root) all pass; full e2e suite underxvfb-run(30 tests: 17 pre-existing + 13 new), knx-gui unit tests (54), and packages unit tests (666) all pass unchanged.Automatic Fixes PRs can be configured here.