Skip to content

chore(api): Parse response schemas only in jsonResponse - #3818

Merged
BYK merged 5 commits into
mainfrom
chore/no-response-schema-parse
Nov 19, 2026
Merged

BYK merged 5 commits into
mainfrom
chore/no-response-schema-parse

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

jsonResponse parses every REST response against its schema. Many api/ readers parsed the same value first, so each of those responses was validated twice.

Rule

junior/no-response-schema-parse (tools/oxlint/junior/rules/, with a RuleTester test):

  • It reports .parse / .safeParse / .parseAsync / .safeParseAsync on a value import from @/api/schema or @/api/schema/*, or from a relative path that resolves there.
  • It is on for packages/junior/src/api/**/*.ts.
  • api/http.ts does not trigger it, because it parses a schema parameter, not an imported schema.
  • Schemas from other modules, such as acpInboundMessageSchema or userSchema, are not checked.

Removed parses (16)

  • code/overview.ts (overview and person), code/repository.ts, cache-warming/savings.ts, stats.ts, notifications/routes.ts, people/code.ts.
  • conversations/{child-agents,plan,watches,pending-messages,event-list,detail}.ts, locations/{detail,list}.ts, people/profile.ts.

Each removed parse was followed by a jsonResponse parse with the same or a wider schema. None of these schemas has a transform, pipe, default or catch. The detail, event page, location detail and actor profile schemas have only idempotent trim() checks, which jsonResponse still applies, so the response does not change.

Other callers:

  • MCP getConversation reads readConversationDetail.
  • MCP readMcpPendingWork reads readConversationPendingMessages.
  • Both tools declare an outputSchema, and the MCP SDK checks structuredContent against it. They do not read annotations. Each detail event is still parsed in events.ts.

The detail parse had its own Validate conversation detail span. That span is gone with it.

Readers that had no declared return type now declare their report type. After the change, locations/detail.ts, locations/list.ts and people/profile.ts were only pass-throughs, so they are deleted and the routes call read*FromSql directly.

Edges kept behind a disable comment

  • conversations/events.ts: stored read. It checks each stored event payload, and MCP readers use the result with no other parse.
  • conversations/feed-brief.ts: stored read of the Brief JSON.
  • mcp/tools/search-automations.ts: request input. These are MCP tool arguments, and the schema sets defaults.

list.ts

readConversationFeed in conversations/list.ts is left as is, because #3808 removes that parse. A file-level .oxlintrc.json override turns the rule off for list.ts. Whichever of this PR and #3808 merges second removes the override.

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 2 commits November 19, 2026 18:32
Add junior/no-response-schema-parse. It reports a parse of an api/schema
schema under packages/junior/src/api, because jsonResponse already
parses every REST response. Remove the readers' own parses, and keep
the real edges behind a disable comment that names the edge.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot requested a review from BYK November 19, 2026 18:34
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 19, 2026 9:49pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

8 screenshot changes — 8 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automation Skill Editor · Desktop
Automation Skill Editor · Desktop
Changed
Automation Skill Editor · Mobile
Automation Skill Editor · Mobile
Changed
Automations Runs Filters · Desktop
Automations Runs Filters · Desktop
Changed
Conversation Attachment Zoom · Mobile
Conversation Attachment Zoom · Mobile
Changed
Conversation Event Log · Mobile
Conversation Event Log · Mobile
Changed
Show 2 more changed screenshots
Conversation Object Attached · Desktop
Conversation Object Attached · Desktop
Changed
System Cache Warming · Desktop
System Cache Warming · Desktop
Changed

@BYK
BYK enabled auto-merge (squash) November 19, 2026 22:02
@BYK
BYK merged commit dd4122e into main Nov 19, 2026
53 checks passed
@BYK
BYK deleted the chore/no-response-schema-parse branch November 19, 2026 22:02

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 8931d65b Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant