Skip to content

fix(iterate): reject non-decimal numeric interval values#807

Open
kairoships-ui wants to merge 1 commit into
profullstack:masterfrom
kairoships-ui:fix/iterate-decimal-interval
Open

fix(iterate): reject non-decimal numeric interval values#807
kairoships-ui wants to merge 1 commit into
profullstack:masterfrom
kairoships-ui:fix/iterate-decimal-interval

Conversation

@kairoships-ui

Copy link
Copy Markdown

Summary

  • parsePositiveSafeInteger used Number(value), which coerces scientific (1e2 -> 100), hexadecimal (0x10 -> 16), binary/octal, signed (+60), and whitespace-padded strings into numbers. Those were incorrectly accepted as --interval values.
  • Added a strict ^\d+$ decimal guard before Number(), keeping plain positive safe-integer parsing unchanged.
  • Added regression coverage for the non-decimal forms (1e2, 0x10, 0b10, 0o10, +60, 60, 60 , 1_000).

Verification

  • vitest run packages/cli/src/commands/iterate.test.ts -> 26 passed (8 new)
  • tsc -p packages/cli/tsconfig.json --noEmit -> no new errors in the cli package
  • git diff --check -> clean

Closes #803

Number() coerces scientific (1e2), hexadecimal (0x10), binary/octal,
signed (+60), and whitespace-padded strings into numbers, so those
were incorrectly accepted as --interval values. Guard parsePositiveSafeInteger
with a strict ^\d+$ decimal check before Number(), and add regression
coverage for the non-decimal forms.

Closes profullstack#803

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant