Repository navigation
fix(validation): accept ISO sourceAddedAt in documents-with-memories responses - #1867
Closed
abhisheksharma001 wants to merge 1 commit into
Closed
abhisheksharma001 wants to merge 1 commit into
abhisheksharma001 wants to merge 1 commit into
Conversation
…responses MemoryEntryAPISchema required sourceAddedAt to be a Date, but the API sends it as an ISO string like every other timestamp, so $fetch rejected every /v3/documents/documents and /by-ids response that contained a memory entry. Coerce it the same way the neighbouring createdAt and updatedAt already are. Fixes supermemoryai#1847 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Author
|
#1932 removed |
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.
Bug
DocumentsWithMemoriesResponseSchemadeclaresmemoryEntries[].sourceAddedAtasz.date(), but the API returns it as an ISO string, like every other timestamp in the response.$fetch("@post/documents/documents", ...)and the/by-idsvariant therefore fail validation on any document that has memory entries:createdAtandupdatedAton the same entry already usez.coerce.date(), so this field was the odd one out.Fix
sourceAddedAt: z.coerce.date().nullable(). Consumers keep getting aDate, as the inferred type already promised, andnullstill passes through.Verification
sourceAddedAtbecomes aDatefor the same instant, andnullstaysnull.mainwithExpected date, received stringand passes here.bun testoverpackages/validation(zod 3.25.76 and zod-openapi 4.2.4, as pinned inbun.lock): 31 pass.tsc --noEmitoverpackages/validationandpackages/libis clean, and so is Biome on the changed files.CI - Type Check, Format & Lint, the only workflow this change triggers.Fixes #1847. Overlaps with #1848, which was opened for the same issue; happy to close either one.
🤖 Generated with Claude Code