mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 23:54:02 +00:00
1.5 KiB
1.5 KiB
HOUSEBOT-074 Temporal Migration
Goal
Move runtime time handling from ad-hoc Date usage to Temporal via @js-temporal/polyfill.
Why
- Bun does not provide native
Temporalyet, so the polyfill is the safe path. - The bot has already had production failures caused by
Datevalues crossing Bun/Postgres boundaries inconsistently. - Time handling should be explicit and deterministic at adapter boundaries.
Slice 1
- Add shared Temporal helpers in
@household/domain - Migrate anonymous feedback service and repository
- Migrate Telegram pending-action expiry handling
- Migrate mini app auth timestamp verification
Boundary Rules
- Business/application code uses
Temporal.Instantinstead ofDate - Database adapters convert
Temporal.Instantto SQL-compatible values on write - Database adapters normalize string/
Datetimestamp values back toTemporal.Instanton read - Telegram epoch timestamps remain numeric seconds at the API edge
Non-goals
- Full repo-wide
Dateremoval in one change - Database schema changes
- Billing-period model replacement
Follow-up Slices
- Finance command service and finance repository date handling
- Purchase ingestion timestamps
- Reminder job scheduling timestamps
- Test helpers that still construct
Datevalues for untouched paths
Acceptance
- No raw
Datevalues cross the anonymous-feedback, pending-action, or mini app auth application boundaries bun run typecheckbun run testbun run build