Skip to content

fix(claude-code): typed response schemas + strip the $schema meta-ref - #322

Merged
rohitg00 merged 1 commit into
mainfrom
fix/claude-code-schema-gates
Jun 25, 2026
Merged

fix(claude-code): typed response schemas + strip the $schema meta-ref#322
rohitg00 merged 1 commit into
mainfrom
fix/claude-code-schema-gates

Conversation

@rohitg00

@rohitg00 rohitg00 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Pre-empts the two registry gates pi hit (#317, #319), so claude-code can be released. claude-code declares only request_format and emits $schema via z.toJSONSchema, so it would fail both gates on its next release.

  • Typed response_format on every claude:: function + a typed request / null response on claude::on-config-change.
  • A jsonSchema() helper strips the draft-2020-12 $schema key from every request and response format; runtimeJsonSchema strips it too.

typecheck clean, lint clean, 75 tests pass.

Summary by CodeRabbit

  • Bug Fixes
    • Improved schema handling so generated interfaces validate correctly in the registry.
    • Fixed issues that could prevent commands and configuration changes from being recognized reliably.
    • Added clearer response definitions for several user-facing commands, making interactions more consistent.

Pre-empt the two registry gates pi hit. Declare a typed response_format
on every claude:: function (and a typed request/null response on
claude::on-config-change), and add a jsonSchema() helper that strips the
draft-2020-12 $schema key z.toJSONSchema stamps at the root, which the
registry publish validator cannot resolve. runtimeJsonSchema strips it
too. 75 tests pass.
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jun 24, 2026 9:35am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 25 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 02b5d17a-39c3-49a5-a1a6-3c7e6c4ae288

📥 Commits

Reviewing files that changed from the base of the PR and between 6b8c600 and 4d3c0e6.

📒 Files selected for processing (3)
  • claude-code/src/config.ts
  • claude-code/src/configuration.ts
  • claude-code/src/run.ts

📝 Walkthrough

Walkthrough

runtimeJsonSchema() and a new jsonSchema helper now strip the top-level $schema key from Zod-generated JSON schemas before use. Response format constants are defined for all public functions and wired into their iii.registerFunction calls. bindConfigTrigger also receives explicit request/response schema metadata.

Changes

Registry Schema Metadata

Layer / File(s) Summary
$schema stripping helper and format constants
claude-code/src/config.ts, claude-code/src/run.ts
runtimeJsonSchema() deletes $schema from its output. run.ts adds a jsonSchema helper doing the same, rebuilds RunPayload/SessionId request format constants through it, and defines new response format constants (RUN_RESPONSE_FORMAT, START_RESPONSE_FORMAT, STOP_RESPONSE_FORMAT, STATUS_RESPONSE_FORMAT, SESSIONS_RESPONSE_FORMAT) from UsageSchema and SessionRecordSchema.
response_format wired into registerFunction calls
claude-code/src/configuration.ts, claude-code/src/run.ts
bindConfigTrigger now registers CONFIG_FN_ID with description, empty-object request schema, and null response format. All six iii.registerFunction calls in run.ts gain the matching response_format constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • iii-hq/workers#317: Directly related — also expands bindConfigTrigger and iii.registerFunction calls with explicit request_format/response_format metadata for the same registry validation goal.

Poem

🐇 Hop, hop — the schema's too strict,
A $schema key had registry tricked!
I snipped it away with one little delete,
Now response_format makes the contract complete.
Every function dressed up just right — how neat! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding typed response schemas and stripping the $schema meta-ref.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/claude-code-schema-gates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rohitg00
rohitg00 merged commit e10483b into main Jun 25, 2026
12 checks passed
@rohitg00
rohitg00 deleted the fix/claude-code-schema-gates branch June 25, 2026 09:33
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