Skip to content

tooling: Run one command per invocation - #1691

Merged
chfast merged 2 commits into
masterfrom
tooling/one-subcommand
Sep 1, 2026
Merged

tooling: Run one command per invocation#1691
chfast merged 2 commits into
masterfrom
tooling/one-subcommand

Conversation

@chfast

@chfast chfast commented Sep 1, 2026

Copy link
Copy Markdown
Member

CLI11 lets a subcommand's own name appear among another subcommand's
arguments and parses it as a second command. Both then match, and the
dispatch tries run first, so a trailing run silently replaced
whatever was asked for:

$ evmone t8n --state.fork Cancun run 6000
Result:   success        <- executed bytecode, exit 0

The t8n was discarded without a word. require_subcommand(0, 1) makes
the stray name an argument again, which fails to parse and says so.

Two tests cover it, one per direction. Each asserts the error and, more
importantly, that Result: success does not appear, so a regression
which runs the wrong command is caught even if the wording changes.
Both fail when the fix is reverted.

@codspeed-hq

codspeed-hq Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 129 untouched benchmarks


Comparing tooling/one-subcommand (a1ba4cc) with master (c795076)

Open in CodSpeed

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.98%. Comparing base (c795076) to head (a1ba4cc).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1691   +/-   ##
=======================================
  Coverage   97.98%   97.98%           
=======================================
  Files         181      181           
  Lines       16211    16212    +1     
  Branches     3729     3729           
=======================================
+ Hits        15884    15885    +1     
  Misses        248      248           
  Partials       79       79           
Flag Coverage Δ
eest-develop 87.10% <ø> (ø)
eest-develop-gmp 26.17% <ø> (ø)
eest-legacy 16.94% <0.00%> (-0.01%) ⬇️
eest-libsecp256k1 28.37% <ø> (ø)
eest-stable 87.06% <ø> (ø)
evmone-unittests 94.24% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 96.19% <ø> (ø)
tooling 94.05% <100.00%> (+<0.01%) ⬆️
tests 99.81% <ø> (ø)
Files with missing lines Coverage Δ
tools/evmone/main.cpp 96.35% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents multiple CLI subcommands from being parsed and dispatched in one invocation.

Changes:

  • Limits parsing to one subcommand.
  • Adds tests for both mixed-command orders.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tools/evmone/main.cpp Enforces at most one subcommand.
test/integration/CMakeLists.txt Tests mixed-command rejection.
Suppressed comments (1)

test/integration/CMakeLists.txt:39

  • This reversed case also uses PASS_REGULAR_EXPRESSION, which causes CTest to ignore the exit status. A regression that emits this text but exits 0 would therefore pass; pair it with a WILL_FAIL invocation so both command-order error paths verify nonzero status.
    set_tests_properties(
        ${PREFIX}/one_command_per_invocation_reversed PROPERTIES
        PASS_REGULAR_EXPRESSION "argument was not expected: t8n"
        FAIL_REGULAR_EXPRESSION "Result: *success")

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/integration/CMakeLists.txt
A subcommand's own name among another's arguments parsed as a second
command, and the dispatch tries run first, so a trailing "run" silently
replaced the command asked for: "evmone t8n --state.fork Cancun run
6000" executed bytecode and exited 0.

Claude-Session: https://claude.ai/code/session_016UHPAGwcwXMjqhTLpT31K7
stops_at_one_test pinned that the test after the one which gave up still
reports, but not that the one which gave up stopped: dropping the return
after the block-validity failure kept it running and the ctest passed.
Every failure repeats the test name, so a second one means it did not
stop.

Claude-Session: https://claude.ai/code/session_016UHPAGwcwXMjqhTLpT31K7

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused parser constraint is correct and comprehensively covered by integration tests.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chfast
chfast merged commit c2447d0 into master Sep 1, 2026
26 checks passed
@chfast
chfast deleted the tooling/one-subcommand branch September 1, 2026 21:53
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.

2 participants