fix(design-mcp): declare pageMap object schema so hosts can send it - #98
Merged
Conversation
`pageMap` was declared `z.unknown()` in start_art_direction, submit_discovery_answers, and revise_creative_brief. Zod compiles that to an empty JSON Schema, and MCP hosts serialize untyped parameters as strings, so the value reached the engine as a string and `validatePageMap` rejected it on its `isRecord` check every time. The error surfaced as "Page map must declare single-page or multi-page kind", pointing at the page map contents rather than at the wire format, which reads as a malformed payload when the object never arrived as an object at all. Because `topicResolved` requires a valid `session.pageMap` for the page-map topic and has no fallback path, this made the topic unresolvable and blocked the Phase 2 workflow past discovery for every MCP host. Declaring the object shape keeps the payload structured over the wire. The design engine still owns full validation. `interpretations`, `answers`, and `decisions` were unaffected because `z.array()` emits a real type. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
Fixes a blocking bug found while auditing unpushed local commits during Phase 4 cleanup — this fix existed only on a local branch and was never on any remote.
The bug
`pageMap` is declared `z.unknown()` in `start_art_direction`, `submit_discovery_answers`, and `revise_creative_brief`. Zod compiles `z.unknown()` to an empty JSON Schema, and MCP hosts serialize untyped parameters as strings — so the value reaches the engine as a string, and `validatePageMap`'s `isRecord` check rejects it every time.
The error surfaces as
"Page map must declare single-page or multi-page kind", which reads like a malformed page-map payload rather than a wire-format problem. Because `topicResolved` requires a valid `session.pageMap` for the page-map topic with no fallback path, this makes the topic unresolvable and blocks the Phase 2 workflow past discovery for every MCP host.The fix
Declares the actual object shape (`kind`, `pages`, passthrough for the rest) instead of `z.unknown()`, so the payload stays structured over the wire. The design engine still owns full validation — `interpretations`, `answers`, and `decisions` were unaffected since `z.array()` already emits a real type.
Verification
Co-Authored-By: Claude Opus 5 noreply@anthropic.com