Repository navigation
Conversation
Contributor
[Medium impact] The reviewed changes appear safe to merge. SummaryRejects unknown
Reviews (2) · Last reviewed commit: "fix(cli): redact marked values in regist..." · Reviewed by Greptile |
6 of 7 tasks
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7608.
rea mcp add --bogusand misspelled selectors such as--agents claude-codecurrently report success and can invoke registration with default clients. Reject unknown options withPARSE_ERRORand exit 1 before reading/backing up Amp settings or invoking registration.Problem and expected behavior
The built-in registration path manually consumes known options and silently ignores others. Invalid options must identify the unsupported flag and stop before client configuration changes. Representative piped JSON output:
{"code":"PARSE_ERROR","message":"Unknown flag: --bogus"}Change and scope
Validate the command tail in REA's existing
mcp addwrapper after shared global argument splitting and discovery handling. Preserve Incur's consumption of nonempty option values, including flag-shaped data. CSV/TSV requests receive a JSON error document so row selection cannot hide the diagnostic.This is a routine input-validation fix within existing contribution scope; a separate maintainer scope decision is not applicable. It does not implement the missing-value work in #7996/#8003 or surplus-positionals work in #7453. Existing binding issues, including
--command "--no-global"and non-Amp equals-form registration, remain outside this change; no claim that all registration parsing is fixed.Contract and boundary impact
Evidence and regression coverage
Current review follow-up addresses the marked-sensitive-value finding. The early unknown-option return bypassed the normal redaction wrapper. The diagnostic now applies the existing
declaredSensitiveValues(command)andredactExplicitTextowners before formatting the whole message; error codes remain unchanged and undeclared values are preserved. Regression cases cover all eight output modes, both declaration spellings and equals/spaced forms, overlapping literals, global splitting and declaration-shaped output values, with no runner/configuration side effects.The fix was developed and verified in the cloud before local publication. The cloud handoff reports 36 neighboring tests, 12 regression tests and 18 tests stacked with #8071 passed, plus
check:fast; these counts are reported cloud evidence, not Mac reruns. The exact incremental patch matched SHA-256c5b7103f21d47addc98884f950102572907a784c82d6c5cce69f3d6ce31be93e. On the Mac,npm run test:focused -- tests/boundary/cli/mcpAddUnknownOptions.test.tsrebuilt the runtime and passed all 12 current regression tests;npm run check:fastandgit diff --checkalso passed. Full check was not rerun for this follow-up; the baseline Knip limitation below remains disclosed.Initial implementation evidence (before this review follow-up):
Executed on macOS arm64 with Node 24.22.1 and npm 11.16.0 against main
317bf3fe235e655b2d752d3be261cc0da7d00f2b:mcp add --bogusreturned 0; malformed Amp settings were read and reported instead of rejecting the unknown flag first.Validation performed
The current follow-up checks are listed above; the following records the initial revision.
npm run build:cached— baseline build passed; fixed runtime rebuilt by focused tests.npm run test:focused -- tests/boundary/cli/mcpAddUnknownOptions.test.ts tests/boundary/cli/mcpAddDiscovery.test.ts tests/boundary/cli/ampRegistrationPreservation.test.ts tests/boundary/cli/packageRunnerRegistration.test.ts tests/acceptance/cliBuiltinDocumentTokens.test.ts— 7 neighboring tests passed; the new suite initially exposed a test expectation that did not account for Markdown colon escaping. After correcting that expectation,node node_modules/vitest/vitest.mjs run tests/boundary/cli/mcpAddUnknownOptions.test.tspassed all 3 tests.npm run check:fast— passed (typecheck, lint and module boundaries).npm run verify:test-discovery— all 2,866 test files discovered exactly once.npm run check— did not pass: Knip reported 4 unused exports, 3 unused exported types and 2 duplicate exports in untouched domain files. Re-running Knip with both changed production files restored to the base revision produced the identical findings. Full check stopped before later chained architecture/production/typed-lint checks. Format and metadata checks passed.git diff --check— passed.Compatibility, safety, and release
Previously accepted invalid options intentionally become errors; no migration for valid invocations. Real Hopper/Ghidra/browser coverage is not relevant to this input-only fix. Windows/Linux, the full repository test suite and full CI matrix were not run locally. No dependency or release metadata changes. No real client settings were changed during verification.
Author readiness
Human owner: @maxazure
Before merge
Resolution
Superseded by merged #9057, which fixes #7375 and #7608 together at the shared registration argument owner. Unknown options and surplus tokens fail before settings reads/backups or package-runner startup; missing-value priority, explicit redaction and discovery controls remain covered. Thirty-three focused tests, independent compiled-CLI before/after checks and all eight CI shards pass on the merged implementation.