Repository navigation
Typing a minus in a Pool's capacity no longer makes it unlimited - #658
Merged
Merged
Conversation
DraftNumberInput tells a half-typed number (-, 1e), which a number input also reports as an empty value, from a real blank by validity.badInput: it commits nothing and is marked invalid; a real blank still commits null where a blank is allowed. Part of #615.
Deploying cozy-loop-studio with
|
| Latest commit: |
4520b23
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f9041d84.cozy-loop-studio.pages.dev |
| Branch Preview URL: | https://half-typed-number-not-blank.cozy-loop-studio.pages.dev |
7 tasks done
This was referenced Nov 24, 2026
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.
Part of #615 (item 2 only; the trigger delay of item 1 is the next PR, see below).
What was wrong
Four Inspector number fields allow a blank and store what is typed as it is typed: a Pool's Capacity (blank = unlimited) and a Parameter's Min, Max and Step. A number input reports a half-typed
-or1eas the empty value, the same as a blank, andDraftNumberInputcommittednullfor it.Measured on main
b17aa721(each field from a set value, one key at a time):-: the value is cleared at once, the autosave writes it, and the run resets. Leaving the field keeps it cleared. For a capacity, cleared means unlimited, and-5ends unlimited, because5makes-5, which is refused.1e: the1stores 1, then theeclears it. It stays cleared.-and a blank stored nothing.The rule, and the check made before the change
validity.badInputis true while a number input's text cannot be read as a number, and false for a real blank.Measured in the app's four fields before any change (Chromium 151, the only engine my automated runs use):
-: badInput true;1e: badInput true;1e5: badInput false, value1e5;The change (
src/components/DraftNumberInput.tsx)An empty value with
badInputis an edit in progress:aria-invalid;A real blank still commits
nullwhere a blank is allowed. A valid number on the way, such as the1of1e, is still committed as typed, as in every such field.Tests (
e2e/number-field-blank.spec.ts), written firstThere is one test per field: capacity, Min, Max, Step.
-: the stored value and the autosave are unchanged, the run's step is kept, the field isaria-invalid(and for the capacity its hint shows), and on leaving the field shows the stored value again.1e: the value is the 1 stored by its1key, not cleared.A controls test covers the Pool starting amount and the Parameter value, for
-and a blank, with nothing stored as before.On main's code the four field tests fail on
-(their1epart is not reached) and the controls test passes. With the change all pass.Two of my test mistakes were corrected before the change; the earlier runs are kept:
1eexpectation first said "unchanged", but its1is a valid number and is stored.Checks
npx tsc -b: clean.npm run lint: 88 warnings, the baseline.All
check:*scripts: pass.Unit suite: 5758 passed, 4 skipped.
Related e2e, one worker, no retries:
None holds a screenshot comparison.
Not in this PR
Min, Max and Step have no visible hint for any invalid input,
1e400included. They have onlyaria-invalid, before and after this change. A hint there needs a new catalog key in every language.The trigger delay (item 1, next PR): its field (
Inspector.tsx:886-895) is a plain<input type="number">that storesNumber(v)on every keystroke, with no draft. It can reuse this rule:DraftNumberInputwithallowEmpty(a blank removes the delay);valid={(n) => Number.isInteger(n) && n >= 0};-, a-2and a1.5would store nothing.Its engine behaviour for an invalid delay (treated as 0 with a diagnostic) is known from the code (
step.ts:1064-1074), not measured.Items 5 and 3 of Number fields, drafts and import dialogs: five findings from the 2026-11-15 review #615.
What it touches
DraftNumberInputfield.commitOnConfirm(Seed, Runs, Steps, Base seed), behave as before. The existing Low findings (workbench UI / menus / a11y): four items from the 2026-10-29 review, re-evaluated 2026-10-30 #422 tests in the same spec still pass.