Skip to content

fix: reject fractional --zoom values that break Rust u32 deserialization#1275

Open
LuisMIguelFurlanettoSousa wants to merge 1 commit into
tw93:mainfrom
LuisMIguelFurlanettoSousa:fix/zoom-reject-fractional
Open

fix: reject fractional --zoom values that break Rust u32 deserialization#1275
LuisMIguelFurlanettoSousa wants to merge 1 commit into
tw93:mainfrom
LuisMIguelFurlanettoSousa:fix/zoom-reject-fractional

Conversation

@LuisMIguelFurlanettoSousa

Copy link
Copy Markdown

Closes #1274

What

--zoom accepted fractional in-range values like 99.5. They pass the Number.isFinite guard, get forwarded into pake.json, and then break at runtime because the Rust zoom: u32 field (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.tsNumber.isFiniteNumber.isInteger in the --zoom argParser, and reword the message to --zoom must be an integer between 50 and 200. Number.isInteger returns false for NaN/Infinity/fractional, so it subsumes the previous finite check while also rejecting 99.5.
  • tests/unit/cli-options.test.ts — update the message assertion and add a regression case for 99.5.
  • dist/cli.js — rebuilt via pnpm run cli:build per the tracked-artifact rule in AGENTS.md.

Verify

npx vitest run tests/unit/cli-options.test.ts

All 205 unit/integration tests pass; pnpm run format:check is clean. Behaviour is unchanged for valid integer zoom values (8080).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant