Skip to content

fix(cli): reject non-decimal byte-entropy window options - #7877

Closed
Plastic-time wants to merge 1 commit into
morluto:mainfrom
Plastic-time:claude/fix-byte-entropy-decimal-window
Closed

Plastic-time wants to merge 1 commit into
morluto:mainfrom
Plastic-time:claude/fix-byte-entropy-decimal-window

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem and outcome

Fixes #7376. inspect-byte-entropy coerced CLI tokens before validation: --length= selected an empty window, --offset=0x10 selected offset 16, and --offset=1e2 selected offset 100. These invocations returned successful inspection results despite the documented decimal-byte-count contract.

Parse --offset, --length and --block-size through cliIntegerArgument. Empty and non-decimal tokens now return VALIDATION_ERROR naming the option. Omitted defaults, leading-zero decimal tokens and explicit --length=0 remain 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 -- with cliIntegerArguments, cliInputSchemaRequired, referenceSourceSummary (other cliIntegerArgument callers), binaryDiagnosticsMcp, analysisSummaryDetailMcp, markdownMissingSelectionWindow, localPathAdmissionCli, byteEntropy.test.ts and ByteEntropyService.test.ts: 164 passed, 4 skipped, 1 failed. The failure is ByteEntropyService.test.ts > reports a changed artifact when its parent directory moves during streaming. It fails the same way on clean e79ad6ca with 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 --check on 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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Prepared with AI assistance.

Author readiness

Human owner: @Plastic-time

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T17:56:21.838813Z
We couldn’t complete this review. Comment @codex review to try again.
6745b8e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The changes appear safe to merge.

Summary

Tightens inspect-byte-entropy options to reject empty and non-decimal byte counts.

  • Byte-entropy options reject non-decimal values before inspection.

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

@Plastic-time

Copy link
Copy Markdown
Contributor Author

Superseded by #8598, the same change rebased onto d3ab0faf5.

@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Byte-entropy CLI accepts empty and non-decimal window options

2 participants