Skip to content

fix(tables): use explicit timestamps for expiration - #7689

Open
j15z wants to merge 6 commits into
stagingfrom
fix/ttl-switch-to-timestamptz
Open

fix(tables): use explicit timestamps for expiration#7689
j15z wants to merge 6 commits into
stagingfrom
fix/ttl-switch-to-timestamptz

Conversation

@j15z

@j15z j15z commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Expiration has not been released, so these changes define its initial timestamp contract. There are no production Expiration tables requiring a numeric-value migration.

  • Store Expiration values as explicit ISO timestamps, preserving numeric offsets and spelling Z as -00:00; retain microseconds across writes, imports, editors, and exports.
  • Validate input with Zod and use PostgreSQL 16+ native timestamp validation before SQL casts, with JSONB storage and the explicit-offset/precision rules preserved.
  • Compare expiration filters and uniqueness by instant. Cleanup skips a failed table, continues healthy tables, and retries from fresh discovery on the next run.
  • Add acceptance and failure-injection coverage, including bounded cleanup, offset-equivalent values, and database recovery.

Type of Change

  • Bug fix

Testing

4,056 regression tests and 38 cleanup tests pass, including 24 real PostgreSQL scenarios. A separate million-row run drained in 124 bounded passes and retained future/null sentinels. Native SQL projections agree with 892 offset, date-boundary, and precision samples. Type checking, lint, all 46 audits, and generated artifacts 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)

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 10, 2026 2:59am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule issue was established.

Summary

  • Replaces numeric epoch expiration values with explicit-offset ISO timestamps while preserving offsets and microsecond precision.
  • Uses guarded PostgreSQL timestamp projections for filtering, sorting, uniqueness, and cleanup.
  • Makes cleanup resilient to individual table failures and adds extensive unit and PostgreSQL integration coverage.
  • Updates table editors, calendar parsing, generated tool schemas, and user documentation for the new contract.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Input[API, import, or editor input] --> Validate[Validate explicit offset and precision]
  Validate --> Store[(JSONB timestamp string)]
  Store --> UI[Render and edit with stored offset]
  Store --> SQL[Guarded PostgreSQL timestamptz projection]
  SQL --> Compare[Filter, sort, and uniqueness by instant]
  SQL --> Cleanup[Bounded expiration cleanup]
  Cleanup --> Delete[Delete expired rows]
  Cleanup --> Retry[Skip failed table and rediscover next run]
Loading

Reviews (5) · Last reviewed commit: "fix(calendar): validate date and time wi..."

Comment thread apps/sim/lib/table/column-types/ttl.ts
@j15z

j15z commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@j15z I have started the AI code review. It will take a few minutes to complete.

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@j15z I have started the AI code review. It will take a few minutes to complete.

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@j15z I have started the AI code review. It will take a few minutes to complete.

@j15z
j15z requested a review from a team as a code owner September 10, 2026 02:57
@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@j15z I have started the AI code review. It will take a few minutes to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant