Add robust external response.schema_ref support (JSON + Zod modules) with metadata, validation, and tests#19
Merged
PredictabilityAtScale merged 1 commit intoMay 18, 2026
Conversation
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.
Motivation
Description
src/parser/response-schema-ref.tsand wired it into the prompt loader soresponse.schema_refis resolved relative to the prompt and normalized intoresponse.schemawithresponse.schema_refremoved..json(parsed as JSON Schema) and.js/.mjs/.cjs(imported modules exporting a Zod schema converted to JSON Schema viazod-to-json-schema), and enforced a whitelist of allowed extensions;.ts/.tsxare intentionally not supported by default.response.schema_sourcemetadata (mode,ref,resolved_path,hash) soinspectand compiled artifacts can show schema provenance.response.schemaandresponse.schema_refin runtime schema definitions and validation (ResponseSchemaWithValidation).POK050for JSON ref errors,POK051for module/ref import/export/extension issues) and added provider-sensitive schema keyword warnings (POK052/POK053/POK054).docs/schema-dx.md,docs/schema.md,README.md,docs/index.md,docs/overrides.md) to documentschema_refusage, constraints, and the executable-module trust boundary; fixed apromptops→promptopskitwording drift.zod-to-json-schemadependency and comprehensive tests covering happy paths and negative cases (invalid JSON, missing module file, module without Zod export, unsupported extensions), and fixed related test organization/regressions.Testing
npm test(Vitest); all tests passed: 13 test files, 221 tests (all green).npm run lint(tsc --noEmit); the command completed successfully.inspectexposesresponse.schema_source,validate/compileresolve prompt-relative JSON refs,compileinlines resolvedresponse.schemaand removesschema_ref, and failure modes for invalid JSON, missing Zod modules, modules without a Zod export, and unsupported extensions cause the expected CLI validation errors.Codex Task