fix(db): coerce Mongo ObjectId _id to str in statements docs #80

Merged
gertjan merged 1 commit from fix/statements-objectid into main 2026-07-09 12:04:26 +00:00
Owner

The period-vocabulary fix (#79) made statements queries match the
2026-03-09 refetch docs for the first time — and every one of them
carries a Mongo-generated ObjectId _id, which fails FinancialStatement's
id: str | None validation. All four read paths crashed (ERP refresh,
scores fundamentals, both statements API endpoints).

_doc_to_statement now stringifies _id without mutating the input doc.

Also updates the two repo integration tests broken by #79's
upsert-then-prune semantics: snapshot replacement is keyed on a strictly
increasing computed_at (as in production), so the second save in the
atomic-overwrite tests now carries a later timestamp. Removes a stray
'UTC = UTC' left in the statements repo.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01JRnthdVhGGt5FeSQ8m3aUA

The period-vocabulary fix (#79) made statements queries match the 2026-03-09 refetch docs for the first time — and every one of them carries a Mongo-generated ObjectId _id, which fails FinancialStatement's id: str | None validation. All four read paths crashed (ERP refresh, scores fundamentals, both statements API endpoints). _doc_to_statement now stringifies _id without mutating the input doc. Also updates the two repo integration tests broken by #79's upsert-then-prune semantics: snapshot replacement is keyed on a strictly increasing computed_at (as in production), so the second save in the atomic-overwrite tests now carries a later timestamp. Removes a stray 'UTC = UTC' left in the statements repo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JRnthdVhGGt5FeSQ8m3aUA
fix(db): coerce Mongo ObjectId _id to str in statements docs
All checks were successful
Deploy / check (pull_request) Successful in 4m37s
Deploy / deploy (pull_request) Has been skipped
4539e4f8d1
The period-vocabulary fix (#79) made statements queries match the
2026-03-09 refetch docs for the first time — and every one of them
carries a Mongo-generated ObjectId _id, which fails FinancialStatement's
id: str | None validation. All four read paths crashed (ERP refresh,
scores fundamentals, both statements API endpoints).

_doc_to_statement now stringifies _id without mutating the input doc.

Also updates the two repo integration tests broken by #79's
upsert-then-prune semantics: snapshot replacement is keyed on a strictly
increasing computed_at (as in production), so the second save in the
atomic-overwrite tests now carries a later timestamp. Removes a stray
'UTC = UTC' left in the statements repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JRnthdVhGGt5FeSQ8m3aUA
gertjan deleted branch fix/statements-objectid 2026-07-09 12:04:26 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gertjan/bodega!80
No description provided.