Skip to content

refactor(mcp): make analysis states unrepresentable - #468

Merged
morluto merged 13 commits into
mainfrom
agent/make-invalid-states-unrepresentable
Aug 9, 2026
Merged

refactor(mcp): make analysis states unrepresentable#468
morluto merged 13 commits into
mainfrom
agent/make-invalid-states-unrepresentable

Conversation

@morluto

@morluto morluto commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Description

Replace permissive intermediate states with boundary-parsed, discriminated values across configuration, provider selection, binary targets, replay/process outcomes, managed workflows, browser capture, and native API evidence. Contradictory states are rejected as inputs instead of surviving into application logic.

MCP registration now gives the canonical Zod input and output contracts directly to the 2.0 SDK. The SDK owns request parsing, output validation, registered-tool advertisement, per-request client metadata, connection lifetime, and list-change behavior. The generated catalog is captured through a real SDK client/server connection, so it cannot drift from tools/list. This removes the parallel input parser, manual JSON Schema override layer, server-global metadata fallbacks, and transport-level live-server bookkeeping.

The contract cleanup also closes three concrete invalid states found while reviewing the SDK projection:

  • web capture comparison is an exact passive-or-scenario union;
  • browser script-source capture requires a separate explicit approval and records that approval in Evidence;
  • Node characterization plans and native ABI return/parameter records use field-specific effect and role variants.

No tool names or provider authorities are added or removed. Setup behavior and provider mutation boundaries are unchanged.

Suggested review order:

  1. Configuration and runtime state parsing (79cc9df3, 63b0b1c1).
  2. Provider, target, workflow, and integrity unions (21501091).
  3. SDK-owned MCP registration and deleted parallel catalog machinery (ade56a6e, 04c198e7, 410569f0).
  4. Exact build and package verification (ba7327d9, 20dba840, 85d27fb7, 7b00579e).
  5. Centralized contract drift boundary (33a0f627).

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (no functional change)
  • Tool contract change (MCP schema modification)

Testing Performed

  • Unit tests added or updated
  • TypeScript typecheck passes (npm run typecheck)
  • Linting passes (npm run lint)
  • Full test suite passes (npm test)
  • Real Hopper verification performed (npm run verify:hopper)
  • Linux real Hopper verification performed (npm run verify:hopper:linux) or unavailability explained
  • Real browser verification performed (npm run verify:browser) or unavailability explained
  • Package verification performed (npm run verify:package)

Validation performed on the final local tree:

  • npm run check:pr — 329 test files and 1,697 tests passed; typecheck, lint, formatting, Knip, metadata, SDK-derived catalog, generated docs, documentation facts, and error-schema checks passed.
  • Focused MCP/browser/native regression suites — 21 tests passed, covering SDK output validation, catalog identity, modern request metadata, incomplete browser comparisons, explicit source approval, Evidence provenance, Node effect narrowing, and native ABI roles.

Real Hopper, Linux Hopper, Ghidra, browser, and package verification were not run locally. Provider execution and bridge semantics are unchanged; the PR workflows remain the source of cross-platform and real-provider evidence.

Tool Contract Impact

The canonical 116-tool inventory remains complete and stable. Tool schemas now come from the same registered SDK contracts that parse calls and validate successful structured output. The caller-visible changes reject incomplete browser comparison pairs, unapproved browser source capture, invalid Node characterization effects, and mismatched native ABI roles.

Generated product, skill, Evidence manifest, and MCP catalog metadata were regenerated and verified.

Related Issues

No linked issue.

@morluto
morluto marked this pull request as ready for review August 9, 2026 17:40
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@morluto

morluto commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 410569f02a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/toolRegistrationOptions.ts Outdated
@morluto
morluto merged commit b8a9da0 into main Aug 9, 2026
18 checks passed
@morluto
morluto deleted the agent/make-invalid-states-unrepresentable branch August 9, 2026 18:28
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.

1 participant