Repository navigation
refactor(mcp): let the dialect projection own input patterns and dependency prose - #11238
Merged
morluto merged 2 commits intoNov 15, 2026
Merged
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
[Low impact] The PR appears safe to merge based on this re-review. SummaryThis PR separates input and output schema presentation.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
C[Canonical contracts] --> I[presentInputJsonSchema]
I --> D[projectToAdvertisedDialect]
D --> L[Listed input schema and tool guidance]
C --> O[presentOutputJsonSchema]
O --> R[Listed output schema]
Reviews (3) · Last reviewed commit: "refactor(mcp): drop the unused import fr..." · Reviewed by Greptile |
morluto
force-pushed
the
refactor/split-input-presentation
branch
from
November 15, 2026 14:42
155d1f8 to
8e549c4
Compare
19 tasks
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…ect projection (#11207) * refactor(mcp): leave input literal portability to the advertised dialect projection * test(mcp): leave listed-input literal portability to the dialect check * test(mcp): trigger normalization dependency cases with non-portable patterns * refactor(mcp): let the dialect projection own input patterns and dependency prose (#11238) * refactor(mcp): let the dialect projection own input patterns and dependency prose * refactor(mcp): drop the unused import from the output schema presentation * test(mcp): force the reduced form by depth now that the projection re-emits patterns * test(mcp): take advertised input from the one advertised-tool owner after #11268 * test(mcp): check the base64 pad-bit widening on the advertised input, not the registered one
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
inputSchemaPresentation.ts(1,105 lines on main) did two jobs. It presented input schemas (field descriptions, root-union flattening, discriminator roots), and it ran a dependency-tracking pattern normalization that input and output schemas shared. For input, the advertised dialect projection then rewrote the same schema again: it copied patterns verbatim, so it depended on the earlier pass, and it restateddependentRequiredas prose a second time. This PR makes the dialect projection the one owner of what a listed input schema may contain, and moves the normalization to the output schemas, its only remaining consumer. Part of W3. Stacked on #11207.Problem and expected behavior
normalizeAdvertisedSchemare-emitted them, andprojectToAdvertisedDialecttrusted the result. Dependency prose had two copies:presentInputJsonSchemafoldeddependentRequired/dependenciesinto the root description, and the projection'sdependencyGuidancedid it again.not,if/then/else,contains,unevaluated*, references (inlined first), andoneOf, which it widens toanyOf. For input, the dependency analysis therefore changed nothing a client receives.Change and scope
src/contracts/advertisedDialectProjection.ts:scalarBoundsre-emits each pattern throughprojectPortablePatternand drops a pattern that has no portable form.src/contracts/inputSchemaPresentation.ts(987 → 470 lines):presentInputJsonSchemaonly describes fields and presents the root as one object. The dependency-to-prose copy is removed.src/contracts/outputSchemaPresentation.ts:normalizeAdvertisedSchema, its dependency context andpresentOutputJsonSchema, moved unchanged except for two things. It uses the sharedisRecord. Its reduced-reference note no longer says "input": "This referenced schema is advertised in reduced form; the server validates the complete canonical value." No current output schema emits that note (see Evidence).presentInputJsonSchematopresentOutputJsonSchema, the owner (inputObservationPresentation.test.ts). InportablePattern.test.ts, the "input" presenter is now the listed presentation, with expectations for the two places where the dialect differs (it dropsnot, and it types a single-type union). The dependency tests assert the canonical keyword on the registered schema and the sentence in the listed guidance or description.advertisedDialectProjection.test.tsadds two rows, one for an exact portable re-emission and one for an omitted pattern; they fail on the base, which copied patterns verbatim.Not included:
EvidenceMcpServerCore.presentInput),catalogIdentityandscripts/verify-copilot-client.mjseach still composepresentAdvertisedInputover the registered projection, and served environment catalogs do not take the dialect projection at all. That is the remaining W3 "one function produces everything advertised" step.compactJsonSchema.ts.Contribution scope: not applicable (internal refactor within an existing boundary).
Contract and boundary impact
Semantic owner and earliest changed stage:
projectToAdvertisedDialectowns input pattern portability and dependency prose.outputSchemaPresentation.tsowns output pattern normalization.presentInputJsonSchemakeeps canonical patterns and dependency keywords in the registered schema.Contribution scope fit and linked maintainer decision: not applicable.
CLI and MCP/tool-catalog contract: listed input schemas and listed tool descriptions are byte-identical across all 255 contracts. The guidance is now separate sentences instead of one joined sentence, and
describeAdvertisedTooljoins it to the same text. Output schemas: 0 of 255 differ. The registered (pre-dialect) input projection keeps canonical patterns and dependency keywords, which changes the catalog identity digest.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.
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
presentAdvertisedInput(advertisedInputJsonSchema(c), COMPACT_INPUT_SCHEMA_PRESENTATION)before and after. Listed schemas were identical, and guidance joined with a space was identical. The only guidance array that differed wasinspect_sqlite_database(sentences split, same joined text).advertisedOutputJsonSchema(c)showed 0 differences.Validation performed
npm run test:focused -- <18 files using the presentation functions> tests/boundary/mcp/advertisedDialect.test.ts src/contracts/advertisedDialectProjection.test.ts tests/boundary/mcp/serverIdentity.test.ts tests/boundary/mcp/javascriptFactsViewMcp.test.ts tests/boundary/mcp/serverWorkflowMcp.test.ts tests/boundary/mcp/browserScenarioMcp.test.ts tests/boundary/mcp/applicationEvidenceMcp.test.ts src/contracts/enhancedInputs.test.ts: 25 files passed, 417 tests. One failure, inapplicationEvidenceMcp.test.ts(ZodErroratexclusions[0].entry_kind), also fails on main and is unrelated.isRecord:npm run test:focused -- src/contracts/portablePattern.test.ts src/contracts/inputObservationPresentation.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts tests/boundary/mcp/outputSchemaSemanticConstraints.test.ts: 4 files, 119 tests passed. Output schemas were re-compared: 0 differences.npm run check:fast: passed (typecheck, lint, architecture guards).npx oxfmton the changed files.npm run verify:advertised-schemas(macOS, engines: V8 plain/u/v, Go RE2, Pythonre, C++ RE2; Rustregex,fancy-regexandjsonschemanot verified becausejsonschema_rsis not installed): 31/31 patterns accepted by every installed engine. The summary comparison reportssummary.jsonstale, and it reports the same on this PR's base (104b1a3), whose committed summary records another host's absolute-path patterns.--update-summaryoutput from this branch is byte-identical to the output from the base, so every listed schema in every profile is unchanged.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.