Commit ae50c73
committed
fix(metadata): collapse four isoFromValidDate call sites onto the shared canonical-ISO spelling (#16422)
The per-site `isoFromValidDate` helper rewrote exactly one shape (a valid JS
`Date` becomes ISO text) and handed every other input back untouched, so four
adapter boundaries fed a `null`, a `number`, an opaque column and an Invalid
`Date` into fields declared `z.string()` / `z.string().datetime()`, each behind
an `as string` cast asserting the opposite. Measured over the seven inputs that
distinguish the two helpers, the declared schemas refused 21 of 35 values.
Those four sites now read `canonicalIsoInstant`, whose return type IS
`string | undefined`, so all four casts are deleted rather than restated, and
both sibling definitions of the retired helper are gone. The terminal value is
chosen per site from that site's declared schema: `undefined` for the two
`.optional()` fields on `MetadataRecord`, and the epoch (`recordedAtFallback`)
for the REQUIRED `MetadataHistoryRecord.recordedAt`, which had no legal answer
at all before this change. Refusals over the same inputs: 21 -> 8.
`listCommits` in metadata-protocol keeps its copy on purpose — it promises
callers the RAW value back, and the shared spelling would erase an Invalid
`Date` from the response and reorder the commit timeline. That site is
byte-identical on all seven inputs. `SqlDriver`'s same-named helper takes
`Date`, not `unknown`, and is the producer-side fold ADR-0053 D-F3 governs; it
is not part of this family and is untouched.
The three neutrality pins are dispositioned individually: two rewritten as
ruled pins, the `listCommits` one kept verbatim because its behaviour did not
move. A fourth section the card did not name (`database-loader-14078`'s
composition pin) is rewritten too, and records the one composed behaviour that
changed: `stat()`'s `updatedAt ?? createdAt` now falls through for an
unreadable `updated_at`, publishing a stored `created_at` instead of a
fabricated `new Date()`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU1 parent 8838301 commit ae50c73
1 file changed
Lines changed: 80 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments