migrate scheduling from zod/3 to zod#889
Conversation
🦋 Changeset detectedLatest commit: 9e85dd7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
|
/bonk review please |
|
All 28 test files pass, 458 tests pass. Now I have a thorough understanding of the PR. Here's my review: Review SummaryThis is a clean, well-scoped migration. Two changes:
What's good
Issue: Missing changesetThis PR modifies Before (Zod v3): type Schedule = {
description: string;
when: {
type: "scheduled" | "delayed" | "cron" | "no-schedule";
cron?: string;
date?: Date;
delayInSeconds?: number;
};
};After (Zod 4): type Schedule = {
description: string;
when:
| { type: "scheduled"; date: Date }
| { type: "delayed"; delayInSeconds: number }
| { type: "cron"; cron: string }
| { type: "no-schedule" };
};This is a breaking change for any user code that accesses Per the repo's AGENTS.md: "Changes to Minor nitThe eval file comment VerdictApprove with one required action: add a changeset ( |
|
Could you test that this actually works with models from openai/gemini(this one caused problems last time I tried a discriminated union)/and maybe something good from workers ai? |
Thanks for calling that out, switching from OpenRouter to OpenAI did error. I tried a bunch of ways to get around OpenAI's strict schema but no luck, so I've added |
|
Gemini passed? |
Yep, Gemini passes fine. One possible solution would be to make all fields nullable instead of optional (which is what OpenAI doesn't allow), but that makes the type of all fields be |
|
/bonk do a review and leave a compliment for @deathbyknowledge |
ReviewSolid PR. Here's the breakdown: What changed:
What's good:
One thing to flag: The Verdict: The code changes are correct and an improvement. The changeset description could be more detailed about the breaking type changes, but that's minor. And @deathbyknowledge -- genuinely nice work iterating on this. You tested against multiple providers (OpenAI, Gemini, Workers AI) after @threepointone flagged compatibility concerns, identified the OpenAI strict schema limitation, and made a practical call to keep |
|
please update the changeset before landing this |
Co-authored-by: deathbyknowledge <deathbyknowledge@users.noreply.github.com>
Migrate scheduling from zod/3 to zod.
a8a405c to
bb41d3c
Compare
7487889 to
806013a
Compare
scheduleSchemaimport fromzod/v3tozod. The/v3subpath only exists in zod 4's compat layer and would break for users on zod 3 (which the peer dep allows)scheduleSchemafrom a flat object with optional fields to az.discriminatedUniononwhen.type, so each variant only has the fields it needsI haven't found a way to remove
providerOptionsthat satisfies OpenAI's strict schema :/closes #816