Repository navigation
chore(deps): migrate to zod 4 - #683
Merged
Merged
Conversation
Supersedes #613, which fails Frontend Tests on two zod 4 breaking changes. Both are in our code, not in the bump. 1. `SafeParseReturnType` is gone. zod 4 exports `ZodSafeParseResult<T>`, with ONE type parameter where the old one took two. Eleven entity `validate()` methods declared `SafeParseReturnType<TX, unknown>`. THE PARAMETER THAT SURVIVES IS THE SECOND ONE. zod 3 read `SafeParseReturnType<Input, Output>` as `SafeParseSuccess<Output> | SafeParseError<Input>`, so these methods have always returned `unknown` on success. Translating them to `ZodSafeParseResult<TX>` looks like the obvious move and is wrong: it tightens the success type, and tsc rejected it because the schemas do not match their entity types — `id` is optional in the schema and required in `TZaak`. `ZodSafeParseResult<unknown>` is the faithful translation and leaves every caller reading exactly what it read before. Whether those annotations SHOULD be tightened is a separate question from a dependency bump. 2. `z.record()` now requires an explicit key type. One site, `z.record(z.any())` -> `z.record(z.string(), z.any())`. Found by the compiler, not by reading release notes: the first attempt went 18 failing suites -> 12, and the remaining 24 diagnostics were all TS2554 on that one `z.record` line. Verified locally rather than left to CI: `npm test` (jest, the runner that was failing) — 24 suites, 43 tests, all passing, exit 0.
Contributor
Quality Report — ConductionNL/zaakafhandelapp @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-manifest | ✅ | ||||
| test-l10n | ✅ | ||||
| format | ✅ | ||||
| composer | ✅ | ✅ 100/100 | |||
| npm | ✅ | ✅ 546/546 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ❌ | ||||
| PHPUnit | ✅ | ||||
| Newman | ✅ | ||||
| Playwright | ✅ | ||||
| Hydra gates | ✅ |
Quality workflow — 2026-09-08 16:45 UTC
Download the full PDF report from the workflow artifacts.
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.
Supersedes #613, which fails
Frontend Tests (unit)on two zod 4 breaking changes. Both are in our code, not in the bump.1.
SafeParseReturnTypeis gonezod 4 exports
ZodSafeParseResult<T>— one type parameter where the old one took two. Eleven entityvalidate()methods declaredSafeParseReturnType<TX, unknown>.The parameter that survives is the second one. zod 3 read
SafeParseReturnType<Input, Output>asSafeParseSuccess<Output> | SafeParseError<Input>, so these methods have always returnedunknownon success.Translating them to
ZodSafeParseResult<TX>looks like the obvious move and is wrong — it tightens the success type, and tsc rejected it:The schemas do not match their entity types.
ZodSafeParseResult<unknown>is the faithful translation and leaves every caller reading exactly what it read before. Whether those annotations should be tightened is a real question, but it is a separate one from a dependency bump.2.
z.record()now requires an explicit key typeOne site:
z.record(z.any())→z.record(z.string(), z.any()).How these were found
By the compiler, not by reading release notes. The first attempt took the suite from 18 failing to 12, and the remaining 24 diagnostics were all
TS2554pointing at that singlez.recordline.Verification
npm test— the jest runner that was actually failing, not the vitest one — 24 suites, 43 tests, all passing, exit 0.🤖 Generated with Claude Code