fix: reject fractional --zoom values that break Rust u32 deserialization#1275
Open
LuisMIguelFurlanettoSousa wants to merge 1 commit into
Open
Conversation
e09eb9d to
ac10579
Compare
The --zoom argParser used Number.isFinite, so a fractional in-range value like 99.5 passed validation and was forwarded verbatim to pake.json. The Rust WindowConfig declares zoom as u32, and serde_json refuses to deserialize a non-integer float into u32, producing a config the packaged app cannot load. Switch the guard to Number.isInteger (which also rejects NaN/Infinity) and clarify the error message accordingly.
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.
Closes #1274
What
--zoomaccepted fractional in-range values like99.5. They pass theNumber.isFiniteguard, get forwarded intopake.json, and then break at runtime because the Rustzoom: u32field (src-tauri/src/app/config.rs) cannot deserialize a non-integer float (serde_json:invalid type: floating point ..., expected u32).Change
bin/helpers/cli-program.ts—Number.isFinite→Number.isIntegerin the--zoomargParser, and reword the message to--zoom must be an integer between 50 and 200.Number.isIntegerreturnsfalseforNaN/Infinity/fractional, so it subsumes the previous finite check while also rejecting99.5.tests/unit/cli-options.test.ts— update the message assertion and add a regression case for99.5.dist/cli.js— rebuilt viapnpm run cli:buildper the tracked-artifact rule inAGENTS.md.Verify
All 205 unit/integration tests pass;
pnpm run format:checkis clean. Behaviour is unchanged for valid integer zoom values (80→80).