Repository navigation
fix(cli): reject non-decimal byte-entropy window options - #7877
Plastic-time wants to merge 1 commit into
Conversation
Parse --offset, --length and --block-size as decimal tokens, so an empty --length= no longer becomes a zero-byte window and hex or exponent tokens no longer select a different window. The advertised option schema is unchanged. Fixes morluto#7376
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Low impact] The changes appear safe to merge. SummaryTightens
No actionable issues or security vulnerabilities were identified. Tests were not run during this review. Checking whether another PR supersedes this one was blocked by unavailable GitHub authentication. Reviews (1) · Last reviewed commit: "fix(cli): reject non-decimal byte-entrop..." · Reviewed by Greptile |
|
Superseded by #8598, the same change rebased onto |
Problem and outcome
Fixes #7376.
inspect-byte-entropycoerced CLI tokens before validation:--length=selected an empty window,--offset=0x10selected offset 16, and--offset=1e2selected offset 100. These invocations returned successful inspection results despite the documented decimal-byte-count contract.Parse
--offset,--lengthand--block-sizethroughcliIntegerArgument. Empty and non-decimal tokens now returnVALIDATION_ERRORnaming the option. Omitted defaults, leading-zero decimal tokens and explicit--length=0remain supported.Evidence and validation
Hosted validation for head
6745b8ed68903af9c6cec1f3e1663f8f662b3b8e: CI required passed (2026-10-28 19:10:38 UTC). This is the existing completed run, rechecked on 2026-10-30; editing this description did not rerun the code tests.On a real 256-byte fixture, the new cases cover empty, whitespace, hexadecimal, binary, exponent, signed, fractional and unsafe tokens, plus decimal/default controls. On base
e79ad6ca: 27 failed / 60 passed; with the fix: 87/87 passed. The compiled CLI schema output was byte-identical before and after.Recorded local commands, results and baseline controls
Windows 11 x64 (10.0.26200), Node 24.22.1, npm 11.19.1, base
e79ad6ca. The Windows native addon and manifest came from the[email protected]tarball, as CONTRIBUTING describes.npm run test:focused -- tests/boundary/cli/cliIntegerArguments.test.ts: base 27 failed / 60 passed; with the fix 87/87 passed.npm run test:focused --withcliIntegerArguments,cliInputSchemaRequired,referenceSourceSummary(othercliIntegerArgumentcallers),binaryDiagnosticsMcp,analysisSummaryDetailMcp,markdownMissingSelectionWindow,localPathAdmissionCli,byteEntropy.test.tsandByteEntropyService.test.ts: 164 passed, 4 skipped, 1 failed. The failure isByteEntropyService.test.ts > reports a changed artifact when its parent directory moves during streaming. It fails the same way on cleane79ad6cawith every change stashed; it renames a parent directory while a file is open, which Windows refuses ([Bug] Windows: five artifact tests fail because they rename a parent directory while its admitted file is open #7846).rea inspect-byte-entropy --schema --format json: identical on base and with the fix.npm run check:fast: typecheck and lint 2/2 passed.npx oxfmt --checkon the changed files: passed.Remaining limits: Local validation was on Windows and synthetic input; the related suite has one Windows open-file rename failure reproduced on untouched base. Hosted CI is reported separately above.
Contract and boundary impact
The change is owned by CLI argument admission. The shared parser gains an optional maximum, defaulting to
Number.MAX_SAFE_INTEGER; block size uses 65536 to preserve its advertised schema. Power-of-two and EOF validation remain with their existing owners. MCP numeric inputs, provider behavior, dependencies and execution authority are unchanged. Ordinary correction within existing scope; no separate maintainer scope decision is required.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Prepared with AI assistance.
Author readiness
Human owner: @Plastic-time
Before merge
type(scope): outcome.