Repository navigation
Commit 21146b1
authored
fix(core): use zod/v4 for the snapshot route schema so warm starts work on zod 3 projects (#4972)
## Summary
Deployments built with 4.6.0 to 4.6.3 in projects where `zod` resolves
to a 3.x release could not warm start. Every run handed to a warm runner
made the runner exit before it started the attempt; the run then waited
until the platform's heartbeat redrive requeued it and it started cold,
a few minutes late. Cold starts were unaffected, which is why this
surfaced as delayed starts rather than errors.
## Root cause
The zod v4 migration
([#4039](#4039)) moved
core's schemas to `zod/v4`. `snapshotRoute.ts` landed shortly after,
still importing the Zod 3 API from `"zod"`, and `SnapshotRouteWire` is
composed into `DequeuedMessage` and the worker attempt request bodies.
Zod 4 rejects a Zod 3 schema inside a Zod 4 object at parse time,
regardless of the input:
```
Invalid element at key "snapshotRoute": expected a Zod schema
```
Inside the monorepo the root `zod` resolves to 4.x, so nothing failed
here. In a user's image with zod 3.x installed, the warm-start client's
`DequeuedMessage.parse()` threw on every run and the controller exited.
## Fix
One import: `snapshotRoute.ts` now uses `zod/v4`. The existing Zod 3
root compatibility test gains a case that bundles `DequeuedMessage` and
`WorkerApiRunAttemptStartRequestBody` against a Zod 3 root and parses
them; it fails on `main` and passes here. Also verified by packing the
built package and parsing a `DequeuedMessage` with `zod@3.25.76`
installed.1 parent 562c943 commit 21146b1
3 files changed
Lines changed: 85 additions & 1 deletion
File tree
- .changeset
- packages/core/src/v3/schemas
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
94 | 173 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments