Repository navigation
fix(web): accept numeric node capacity input values - #514
Merged
Merged
Conversation
The capacity fields are type=number with bind:value, so Svelte assigns a number (or undefined when cleared) to the bound state. parseCapacity assumed a string and threw raw.trim is not a function on any entry. Extract the parser to a pure util that accepts string, number, null and undefined while preserving blank=0 (unlimited), whole non-negative safe integers, and null for negative/fractional/invalid values. Add focused regression tests and verify by real-browser typing in both edit and add-dialog capacity fields.
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.
Defect
parseCapacityinnode-settings.sveltecalledraw.trim()on a value it assumed was a string. The capacity fields usetype="number"withbind:value, so Svelte assigns a number (orundefinedwhen cleared) at runtime. Typing any value into#edit-node-max-srv/#edit-node-max-mem(or the add-dialog equivalents) threwraw.trim is not a function. Pre-existing on main; reproduced by real-browser QA (14-S13-capacity-input-runtime-error.png,capacity-probe.json).Fix
parseCapacityto a pure util (src/lib/utils/node-capacity.ts) that acceptsstring | number | null | undefinedand rejects unexpected runtime types.'',null,undefined) ->0(unlimited); whole non-negative safe integers -> value; negative / fractional /NaN/Infinity/ unsafe / non-numeric ->null(invalid).Verification
bun test src/lib/utils/node-capacity.test.ts: 7 focused cases pass (string/number/null/undefined/invalid/negative).bun run check: 0 errors / 0 warnings (both tsconfigs).bun test: 286 pass / 0 fail.bun run lint: clean.go run ./cmd/knowledge-lint -root . -fixthen without-fix: queries 38/38 pass, indexes current (one pre-existingdata-safetyre-verify warning, unrelated).PLAYWRIGHT_SKIP_BROWSER_GC=1): typed16and-1into both edit capacity fields and both add-dialog fields — 5/5 scenarios PASS, 0 page errors, 0 console errors. Valid16shows no validation feedback;-1shows validation feedback instead of crashing. Evidence:browser-qa-2026-11-18/node-capacity-fix/capacity-fix-evidence.jsonplus screenshots.Scope note
Branch is based on
c15b8d7dand intentionally not rebased onto current main so it does not incorporate PR510's node-settings redaction work. The parser change is localized to the import/function removal and merges cleanly with that file's other changes. Do not merge until the publication gate is lifted.