Skip to content

fix(design-mcp): declare pageMap object schema so hosts can send it - #98

Merged
7shep merged 1 commit into
mainfrom
fix/pagemap-schema
Aug 1, 2026
Merged

fix(design-mcp): declare pageMap object schema so hosts can send it#98
7shep merged 1 commit into
mainfrom
fix/pagemap-schema

Conversation

@7shep

@7shep 7shep commented Aug 1, 2026

Copy link
Copy Markdown
Owner

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

  • `pnpm --filter @7shep/universal-mcp typecheck` and lint: clean.
  • `pnpm --filter @7shep/universal-mcp` unit/golden test suite (index, art-director, art-director-golden, art-director-phase3-golden, runtime-build-mcp): 14/14 pass.
  • The package-boundary smoke test (`test:package`) wasn't run in this environment due to a local Windows `tar` drive-letter-path quirk unrelated to this change; it's covered by the Windows runner in the existing CI matrix (see PR Phase 4: cross-platform release gate and packaging decision #97).

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

`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>
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
universal Skipped Skipped Aug 1, 2026 6:36pm

@7shep
7shep merged commit 4cc9f6e into main Aug 1, 2026
7 checks passed
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