fix(knowledge): serialize chunk date tags on the internal chunk read
Merged
WA
14d ago+137+137+012345678901234567890123456789-4-4-0123456789
Summary
GET /api/knowledge/[id]/documents/[documentId]/chunks/[chunkId]returned 500 for any chunk whosedate1/date2tag was set: the chunk context loads the fullembeddingrow (date slots areDate), buttoInternalKnowledgeChunkonly serializedcreatedAt/updatedAtbefore parsing withchunkDataSchema, whose date slots are stringstoInternalKnowledgeChunknow serializesdate1/date2with the same helper the document mapper uses, only when the row carries them, so the projected list/create/update responses keep their exact keys- Dropped the
chunk as ChunkDatacast inresolveActiveKnowledgeChunkContextand typed the context chunk as the real row, which is what hid theDateslots from the compiler - v2 chunk read is unchanged:
toV2KnowledgeChunkprojects explicit fields and never included date slots
Type of Change
- Bug fix
Testing
- New
chunk-read-tags.integration.tsruns the real read/list use cases against Postgres with a date-tagged chunk: the internal read failed with the exactexpected string, received Dateerror before the fix and passes after; the listing keeps its key set and the v2 projection is byte-identical - Existing knowledge context/chunk/internal-route/v2 unit tests pass
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)