Skip to content

Remove transitional any types from timestamp fields #7

Description

@dylanroscover

Context

As part of the timestamp migration (commit 48bb97f, 2026-04-03), all Firestore writes were standardized from Date.now() / new Date() to proper Firestore server timestamps. Read-side TypeScript types were temporarily loosened to any to handle both legacy numeric and new Timestamp values during the transition period.

What needs to happen

  1. Verify all legacy numeric timestamps have aged out — short-TTL collections (commands, device_codes, mfa_pending, etc.) are already clean. Long-lived collections (sites, users, webhooks, apiKeys, chats) may still have old numeric values.
  2. Run a one-time migration script for long-lived collections — read each doc, rewrite any numeric timestamp fields as proper Firestore Timestamps. Should be a few dozen documents at most.
  3. Tighten types back to Timestamp in these files:
    • web/hooks/useDeployments.ts
    • web/hooks/useProjectDistributions.ts
    • web/hooks/useFirestore.ts
    • web/hooks/useScreenshotHistory.ts
    • web/components/machines/ScreenshotDialog.tsx
  4. Remove defensive read fallbacks (the ?.toMillis?.() ?? value ?? 0 patterns) once all data is confirmed Timestamp-typed.

Target date

June 2, 2026 — 60 days from migration. By then, all medium-TTL data (deployments, logs, screenshots) will have naturally cycled. Only the long-lived collections need the migration script.

Related

  • Timestamp migration commit: 48bb97f
  • Data model docs: docs/reference/firestore-data-model.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions