mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 21:04:03 +00:00
refactor(time): migrate runtime time handling to Temporal
This commit is contained in:
45
docs/specs/HOUSEBOT-074-temporal-migration.md
Normal file
45
docs/specs/HOUSEBOT-074-temporal-migration.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# 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 `Temporal` yet, so the polyfill is the safe path.
|
||||
- The bot has already had production failures caused by `Date` values 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.Instant` instead of `Date`
|
||||
- Database adapters convert `Temporal.Instant` to SQL-compatible values on write
|
||||
- Database adapters normalize string/`Date` timestamp values back to `Temporal.Instant` on read
|
||||
- Telegram epoch timestamps remain numeric seconds at the API edge
|
||||
|
||||
## Non-goals
|
||||
|
||||
- Full repo-wide `Date` removal 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 `Date` values for untouched paths
|
||||
|
||||
## Acceptance
|
||||
|
||||
- No raw `Date` values cross the anonymous-feedback, pending-action, or mini app auth application boundaries
|
||||
- `bun run typecheck`
|
||||
- `bun run test`
|
||||
- `bun run build`
|
||||
Reference in New Issue
Block a user