Skip to content

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

Merged
j15z merged 7 commits into
stagingfrom
fix/ttl-switch-to-timestamptz
Sep 14, 2026
Merged

j15z merged 7 commits into
stagingfrom
fix/ttl-switch-to-timestamptz

Conversation

@j15z

@j15z j15z commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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 14, 2026 8:21pm 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 because no new actionable regression remains after the previous review.

Summary

This PR establishes the initial Expiration-column contract around explicit ISO timestamps and instant-based database behavior.

  • Preserves explicit offsets and microsecond precision through validation, imports, storage, editing, and export paths.
  • Uses guarded PostgreSQL timestamp projections for expiration equality, uniqueness, and cleanup.
  • Adds bounded, failure-isolated cleanup processing with fresh discovery on later runs.
  • Expands unit and PostgreSQL integration coverage for offsets, precision, invalid data, concurrency, and recovery.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Input[API, import, or editor input] --> Validate[Validate and normalize explicit timestamp]
  Validate --> JSONB[(JSONB expiration value)]
  JSONB --> Compare[Validated instant comparison]
  JSONB --> Cleanup[Bounded expiration cleanup]
  Cleanup --> Delete[Delete expired row batch]
  Delete --> Trigger[Emit table delete trigger]
Loading

Reviews (6) · Last reviewed commit: "fix(docs): keep unreleased expiration hi..."

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

j15z commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

@j15z

j15z commented Sep 9, 2026

Copy link
Copy Markdown
Contributor 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
Contributor Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor 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
Contributor Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor 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
Contributor Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor 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 force-pushed the fix/ttl-switch-to-timestamptz branch from 6bc3e70 to 416a199 Compare September 14, 2026 20:19
@j15z

j15z commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

@j15z

j15z commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 14, 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 merged commit b2b9eed into staging Sep 14, 2026
36 checks passed
@j15z
j15z deleted the fix/ttl-switch-to-timestamptz branch September 14, 2026 22:31
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