Skip to content

fix(cli): reject empty decompile-all targets - #7284

Closed
ducanhnguyen223 wants to merge 1 commit into
morluto:mainfrom
ducanhnguyen223:codex/fix-7280-empty-target
Closed

ducanhnguyen223 wants to merge 1 commit into
morluto:mainfrom
ducanhnguyen223:codex/fix-7280-empty-target

Conversation

@ducanhnguyen223

Copy link
Copy Markdown
Contributor

Summary

Fixes #7280 by rejecting an empty decompile-all target before resolving it against the working directory.

Problem and expected behavior

The CLI accepted "" as a target, which made path resolution select the current working directory. In the reported app-bundle case, REA analyzed the bundle executable and wrote pseudocode even though the caller supplied no path. Empty input should fail validation before resolution or export; an explicit . should continue to select the current directory.

Change and scope

Use the existing localPathStringSchema for the command's path argument. This rejects empty and NUL-containing local paths at the CLI boundary, before analysis or provider work. No provider, MCP, target-execution, or generated-metadata behavior changes.

Evidence and regression coverage

  • Added a compiled CLI-boundary regression with a synthetic app bundle and the offline fake Kuna provider.
  • The regression failed on the base revision: decompile-all "" exited successfully in the reproducing setup.
  • After the fix, the empty target returns VALIDATION_ERROR and leaves the output directory absent; the explicit . control still exports 0x1000.c.
  • Real providers and the packaged dispatcher were not exercised.

Validation performed

  • npm run test:focused -- tests/boundary/cli/decompileAllCli.test.ts — 2 tests passed.
  • npm run check:fast — typecheck and lint passed.
  • npm run format:check — passed.
  • Pre-push check:fast — passed.

Author readiness

Human owner: @ducanhnguyen223

  • 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.

@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

decompile-all now uses the shared localPathStringSchema to reject empty targets before the command runs.

  • The decompile-all command rejects empty target paths before analysis.

Reviews (1) · Last reviewed commit: "fix(cli): reject empty decompile-all tar..." · Reviewed by Greptile

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: I ran the PR's test file at draft head e14bbfd on Node 22, 24 and 26, and the new test passes with the fix and fails without it. CI and PR title wait for a maintainer to approve them.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head e14bbfd, tests/boundary/cli/decompileAllCli.test.ts pass: 1 file, 2 tests pass: 1 file, 2 tests pass: 1 file, 2 tests
Red run: same file, src/cli/decompileDirectoryCommand.ts swapped back to merge base 0d1a454 fail: 1 test failed, 1 passed fail: 1 test failed, 1 passed fail: 1 test failed, 1 passed

The merge base is the commit where this branch left main. In the red run, rejects an empty target before resolving or exporting the working directory fails. maps filters, limit and a relative output directory to the export still passes. So the new test fails without the fix and passes with it.

On e14bbfd, CI and PR title wait for a maintainer to approve them (action_required). Greptile Review and Validate author declaration passed. The PR readiness workflow passed, but its commit status is pending.

The head is 1,030 commits behind main b81da90. GitHub says the PR is mergeable, and its merge state is blocked.

Not run

  • rea decompile-all against a real binary.
  • A merge with current main, b81da90.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: e14bbfd / 0d1a454 (merge base with main)
  • Red run: e14bbfd with src/cli/decompileDirectoryCommand.ts from 0d1a454
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1, exit 0, for both trees
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/cli/decompileAllCli.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thank you for working on this. The issue it addresses, #7280, is already resolved on main: 25d3c72 (#9465): src/cli/decompileDirectoryCommand.ts:30 path: localPathStringSchema; src/domain/localPath.ts:26-27 nulFreeStringSchema.min(1). Closing this PR as superseded; please reopen or comment if it covers behavior main still lacks.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@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] decompile-all accepts an empty target and exports the working directory

4 participants