Commit 24a1777
fix: remove validation on reads, matching documented behavior (#16)
* fix: remove validation on reads, matching documented behavior
The README states "Zod validation happens on writes, never on reads" but
validation was running during normalize() via buildEntityMap().
This caused ValidationError when reading data written with an older schema
version, breaking the forward-only migration pattern.
Changes:
- Remove validateWithStandardSchema call in buildEntityMap
- Update tests to use z.date()/z.boolean()/z.number() instead of z.coerce.*
- Zen's decodeData handles DB→JS type conversion (dates, booleans, JSON)
- Zod coerce/transform only runs on writes, not reads
Fixes #14
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* style: fix prettier formatting
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 4ed9ca9 commit 24a1777
2 files changed
+28
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 7 | + | |
14 | 8 | | |
15 | 9 | | |
16 | 10 | | |
| |||
482 | 476 | | |
483 | 477 | | |
484 | 478 | | |
485 | | - | |
| 479 | + | |
| 480 | + | |
486 | 481 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
492 | 485 | | |
493 | 486 | | |
494 | 487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
527 | | - | |
528 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
529 | 533 | | |
530 | 534 | | |
531 | 535 | | |
532 | | - | |
533 | | - | |
| 536 | + | |
| 537 | + | |
534 | 538 | | |
535 | 539 | | |
536 | 540 | | |
| |||
547 | 551 | | |
548 | 552 | | |
549 | 553 | | |
550 | | - | |
| 554 | + | |
551 | 555 | | |
552 | 556 | | |
553 | 557 | | |
554 | | - | |
555 | | - | |
556 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
557 | 561 | | |
558 | 562 | | |
| 563 | + | |
559 | 564 | | |
560 | 565 | | |
561 | 566 | | |
562 | 567 | | |
563 | | - | |
564 | | - | |
| 568 | + | |
| 569 | + | |
565 | 570 | | |
566 | 571 | | |
567 | 572 | | |
| |||
573 | 578 | | |
574 | 579 | | |
575 | 580 | | |
576 | | - | |
| 581 | + | |
577 | 582 | | |
578 | 583 | | |
579 | 584 | | |
580 | | - | |
581 | | - | |
| 585 | + | |
| 586 | + | |
582 | 587 | | |
583 | 588 | | |
584 | 589 | | |
| |||
601 | 606 | | |
602 | 607 | | |
603 | 608 | | |
604 | | - | |
| 609 | + | |
605 | 610 | | |
606 | 611 | | |
607 | 612 | | |
| |||
611 | 616 | | |
612 | 617 | | |
613 | 618 | | |
614 | | - | |
615 | | - | |
| 619 | + | |
| 620 | + | |
616 | 621 | | |
617 | 622 | | |
618 | 623 | | |
| |||
621 | 626 | | |
622 | 627 | | |
623 | 628 | | |
624 | | - | |
| 629 | + | |
625 | 630 | | |
626 | 631 | | |
627 | 632 | | |
| |||
0 commit comments