Skip to content

fix(cli): stop restating schema defaults in help descriptions - #9278

Merged
morluto merged 1 commit into
morluto:mainfrom
Shelden-Hao:fix/cli-help-duplicate-defaults
Nov 7, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
Shelden-Hao:fix/cli-help-duplicate-defaults

Conversation

@Shelden-Hao

@Shelden-Hao Shelden-Hao commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7306.

rea <command> --help printed the same default twice for eleven options, for
example (default 4096) (default: 4096). The help renderer already appends
(default: X) when the option field declares a schema default, so a description
that also spells the default out duplicated it.

Problem and expected behavior

Smallest trigger: rea inspect-byte-entropy --help on main (c5301e6) prints

--block-size <value>  Power-of-two block size from 256 to 65536 bytes (default 4096) (default: 4096)

Violated invariant: cliDecimalField's documented contract in
src/cli/options.ts states the domain field owns bounds, defaults, nullability
and help. The CLI description restated a fact the schema already owns, so the
rendered help carried it twice. Expected: each option states its default once.

Change and scope

I removed the hand-written default from the eleven options whose field declares
a schema default, across six commands: inspect-byte-entropy (--block-size,
--offset), inspect-devicetree (--max-file-bytes, --max-nodes,
--max-properties, --max-depth), inspect-packet-capture (--match_offset),
inspect-packet-fields (--kind, --offset), inspect-signal-decoders
(--offset) and decode-signal-recording (--line_offset).

I deliberately left the options untouched where the description is the only place
the effective value appears:

  • --match_limit and --line_limit are nullable().default(50); the renderer
    emits no annotation for them, so their prose keeps default 50.
  • --limit, --packet_limit and the --all* flags declare no schema default.

Maintainer scope decision: not applicable — help text within existing boundaries,
no new provider or capability, no target interaction.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the domain schemas in
    src/domain/captures/ and src/domain/signals/, plus the CLI option
    descriptions in src/cli/binaryDiagnosticsCommands.ts. Defaults stay owned by
    the schemas; only the duplicated prose is removed. No superseded path remains:
    the renderer is now the single producer of the annotation.
  • Contribution scope fit and linked maintainer decision: focused fix within the
    existing contract; scope decision not applicable.
  • CLI and MCP/tool-catalog contract: CLI help text changes. Option names, types,
    bounds, defaults and JSON Schemas are unchanged; descriptions are identical
    apart from the removed restatement. MCP clients keep the default keyword in
    the schema and the nullable-field prose.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none; no catalog or
    skills/ output is committed.

Expected effects:

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

Evidence and regression coverage

  • Tests I added: tests/boundary/cli/cliHelpDefaultAnnotations.test.ts opens the
    real CLI via createCli({}), renders --help for the six commands and fails
    when an option line carries zero or more than one default statement. It also
    fails when an expected option line is missing, so a renamed flag cannot silently
    skip the assertion.
  • Base reproduction: executed --help on main (c5301e6) produced
    (default 4096) (default: 4096); the new test fails on that revision with two
    default statements per line.
  • User-visible CLI output after the change (executed, compiled dist):
inspect-byte-entropy
  --block-size <value>  Power-of-two block size from 256 to 65536 bytes (default: 4096)
  --offset <value>      Window start as a decimal file byte offset (default: 0)

inspect-devicetree
  --max-file-bytes <value>     Maximum FDT file size in bytes (default: 4194304)
  --max-depth <value>          Maximum device-tree nesting depth (default: 64)

inspect-packet-fields
  --kind <protocols|fields>  Return protocol registrations or field definitions (default: protocols)
  --offset <value>           Number of matching records to skip (default: 0)
  • Remaining proof gaps: the renderer's own annotation code lives in the incur
    dependency and is not covered by this repository's tests; this change asserts
    the rendered output instead of that implementation detail.

Boundary regressions: the applicable case is the CLI help surface in
docs/testing.md; lifecycle regressions are not affected because no resource
ownership or process supervision changes.

Validation performed

  • npm run test:focused -- tests/boundary/cli/cliHelpDefaultAnnotations.test.ts — could not run in my checkout: node_modules/.package-lock.json was missing after an interrupted npm ci. I ran the same test file directly with node node_modules/vitest/vitest.mjs run tests/boundary/cli/cliHelpDefaultAnnotations.test.ts — 1 passed
  • node scripts/run-typescript.mjs --noEmit — no diagnostics
  • node scripts/ci/static-check-report.mjs lint — 6626 files, 0 errors (3332 pre-existing warnings)
  • node scripts/rea.mjs <six commands> --help — each option states its default exactly once, output quoted above

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Help text only; no option name,
    type, bound, default or schema changes.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable to a help-text fix.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none; no secrets, no
    process interaction.

Author readiness

Human owner: @Shelden-Hao

I completed these declarations before marking this PR ready for review.

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

The help renderer appends "(default: X)" whenever the option field declares a
schema default, so descriptions that also spell the default out print it twice:

  --block-size <value>  Power-of-two block size from 256 to 65536 bytes
                        (default 4096) (default: 4096)

Remove the hand-written default from the eleven options that own a schema
default across inspect-byte-entropy, inspect-devicetree,
inspect-packet-capture, inspect-packet-fields, inspect-signal-decoders and
decode-signal-recording, matching the rule in cliDecimalField's contract that
the domain field owns bounds, defaults and help.

Options without a schema default keep their prose: --match_limit, --line_limit,
--limit and --packet_limit are nullable or optional, so the renderer emits no
annotation and the description is the only place the effective value appears.

Add a boundary test asserting each such option states its default exactly once,
so a restated default cannot come back unnoticed.
@Shelden-Hao
Shelden-Hao marked this pull request as ready for review November 7, 2026 14:27
@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Low impact] The PR appears safe to merge; no blocking issue was found.

Summary

Removes repeated default values from eleven option descriptions across six commands.

  • CLI help shows each schema default only once.

Reviews (2) · Last reviewed commit: "fix(cli): stop restating schema defaults..." · Reviewed by Greptile

@morluto
morluto merged commit f8bb792 into morluto:main Nov 7, 2026
6 of 9 checks passed
@morluto

morluto commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Glad to welcome you to REA, @Shelden-Hao! Thanks for cleaning up the repeated defaults in CLI help and covering the affected options; it makes those command descriptions easier to read.

@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 22, 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] Several CLI option help lines print the same default twice

2 participants