Skip to content

fix(setup): name invalid client configuration fields - #2153

Closed
Jax367 wants to merge 1 commit into
morluto:mainfrom
Jax367:codex/client-config-shape-diagnostics
Closed

Jax367 wants to merge 1 commit into
morluto:mainfrom
Jax367:codex/client-config-shape-diagnostics

Conversation

@Jax367

@Jax367 Jax367 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2152. When a client configuration contains a non-object root or MCP server table, setup and uninstall now name the rejected field instead of printing a Zod issue dump or claiming that valid JSON could not be parsed. Both commands continue stopping before configuration writes or removals.

Problem and expected behavior

For {"mcpServers":null,"keep":1}, setup previously displayed an invalid_type issue with an empty path, and uninstall said the document was not valid JSON. The shared parser now reports Configuration field "mcpServers" must be an object. A root such as [] reports The configuration root must be an object. OpenCode's nested table reports "mcp.servers".

Change and scope

Validate decoded roots and server tables once at the shared parsing boundary, using the existing tagged ConfigurationError with a named setting and the original validation cause. Setup's existing file-reader Result preserves that message; uninstall now preserves structural configuration errors. Syntax failures retain their format-specific diagnostics, including YAML for Hermes/DSH.

Contract and boundary impact

  • Semantic owner and earliest changed stage: ClientConfigurationDocument admission of decoded client settings.
  • CLI and MCP/tool-catalog contract: clearer setup/uninstall diagnostics; existing statuses, exit codes and JSON result shapes retained. No MCP tool or schema change.
  • Provider, bridge, target-format, or platform compatibility: no provider changes; existing JSON/JSONC, strict Pi JSON, TOML, Hermes YAML and OpenCode table admission preserved.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Process execution, authorization, cleanup, or containment impact: existing preflight refusal remains before mutation; no additional authority or process execution.
  • Generated metadata, package, or installation impact: diagnostic wording only; no package/dependency/version changes or generated outputs committed.

Evidence and regression coverage

  • Added ten compiled CLI scenarios covering non-object roots, null/string/array tables, OpenCode's nested table, TOML, YAML and genuinely invalid JSON. Each invokes setup and uninstall and verifies the original bytes and absence of backups or sibling files.
  • On base 60259a91d, the initial seven structural scenarios failed their diagnostic assertions; the syntax-error control passed. All ten final scenarios pass with this fix.
  • Representative uninstall detail: Configuration <selected path> is malformed: Configuration field "mcpServers" must be an object. It was not changed. Repair it, then rerun uninstall.
  • Existing successful configuration, special DSH document handling and setup refusal flows are exercised by the regression runs below.

Validation performed

Native Windows, pinned Node 24.18.0 / npm 11.16.0:

  • npm run test:focused -- tests/acceptance/setup/clientConfigurationDiagnosticsCli.test.ts tests/boundary/filesystem/dshClientConfiguration.test.ts src/application/Setup.configuration.test.ts — 103 passed, including all ten real CLI journeys.
  • Expanded run also included clientLifecycle.test.ts, hermesClientConfiguration.test.ts, and piClientConfiguration.test.ts — 189 passed, 14 failed. The same 14 test names fail on unmodified base code: five Windows symlink EPERM failures, six path spelling/drive assumptions, and three existing Pi alignment failures. No failures were added by this change; these remain outside this PR's scope.
  • npm run check — all six tasks and architecture guards passed (existing lint warnings).
  • npm run verify:test-discovery — all 916 test files discovered exactly once.
  • npm pack --dry-run --json — passed, including lifecycle checks.
  • npm run verify:package — attempted; its repository-skill stage failed at spawn npm ENOENT on this Windows host before installation/verification. Temporary workspace cleanup completed. Full packaged-install verification remains unverified.
  • git diff --check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; invalid configurations remain invalid.
  • Real Hopper/Ghidra, browser, or OS coverage: real compiled setup/uninstall on native Windows; no native analysis engine needed or exercised. Other hosts and the full package lane remain with CI.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: messages name only the selected configuration path and fixed field names; rejected setting values are not interpolated. Existing preflight and preservation behavior remains intact.

Review checklist

  • This PR addresses a concrete problem with one focused outcome and a conventional title.
  • Related issue is linked.
  • Tests cover changed observable behavior and failure paths through the compiled CLI.
  • Owning docs, contracts and generated metadata were assessed; no schema/documentation projection changes are needed.
  • Representative CLI output and unavailable verification are documented.
  • Final diff checked for secrets, unrelated cleanup and generated outputs.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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 ✅ Completed 2026-10-12T11:57:42.223987Z fc47bcc 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.

morluto added a commit that referenced this pull request Oct 12, 2026
Report malformed Hermes and DeepSeek Harness documents as YAML. Carry the
compiled setup/uninstall diagnostics coverage from #2153 onto the existing
validation from #2157, including unchanged files and no backup writes.
Add malformed YAML scenarios for both clients.

Validation: 174 focused tests, npm run check, test discovery, package
verification, and npm pack --dry-run.

Co-authored-by: Jax367 <[email protected]>
@morluto

morluto commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Thanks @Jax367 for the careful diagnostics work and CLI regression coverage!

The core configuration-shape fix is already on main through #2157. I carried the remaining changes into 94153f1: your compiled setup/uninstall tests, adapted to the current diagnostics, and the YAML syntax-error labels for Hermes and DeepSeek Harness. I also added malformed YAML regression cases for both clients and credited you as co-author.

All 174 focused tests, type checking/lint/architecture checks, test discovery, package verification, and the package dry run passed on macOS.

Closing this PR as superseded by #2157 and the follow-up above. Thank you for the contribution!

@morluto morluto closed this Oct 12, 2026
@morluto morluto added bug Something isn't working area: cli CLI adapter and one-shot commands labels Oct 14, 2026
@morluto morluto added the area: setup Setup, packaging, upgrade, install, Doctor, and client registration label 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 area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] setup and uninstall misdescribe a client config whose root or server table is not an object

2 participants