Skip to content

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

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

fix(tables): use explicit timestamps for expiration#7689
j15z wants to merge 3 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.
  • 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

2,162 regression tests and 23 real PostgreSQL scenarios pass. Verified live API writes, filters, uniqueness, CSV export, and cron. Type checking, lint, all 46 audits, and generated-catalog parity pass. The review follow-up also passes 22 calendar tests and 108 table/search UI tests: date changes preserve seconds and microseconds, including across a daylight-saving gap, and the search setup test waits for its queued URL update. Chrome recheck was blocked by repeated automation timeouts; editor tests pass. See docs/testing/expiration-qa.md for coverage and operational limits.

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 9, 2026 11:00pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR establishes explicit-offset ISO timestamps as the Expiration storage contract and aligns editing, filtering, uniqueness, import/export, and cleanup behavior with that representation.

  • Preserves supplied numeric offsets and microseconds while spelling Z as -00:00.
  • Compares Expiration values and uniqueness constraints by instant.
  • Keeps cleanup progress bounded and isolates failures between tables.
  • Expands PostgreSQL, editor, calendar, import, filter, uniqueness, and recovery coverage.

Confidence Score: 5/5

The PR appears safe to merge, with no new actionable correctness or repository-rule violations identified.

The earlier legacy-data concern was withdrawn after confirming Expiration has not shipped, and its thread is resolved. The earlier calendar finding is also resolved, and current date-selection and Today paths retain seconds and fractional precision as claimed. No blocking failure remains in the recent offset-preservation, comparison, uniqueness, import/export, or cleanup changes.

Important Files Changed

Filename Overview
apps/sim/lib/table/ttl-values.ts Defines the offset-preserving Expiration representation, instant projection, and picker conversion helpers.
apps/sim/lib/table/column-types/comparison-sql.ts Adds guarded timestamp projection for instant-based equality and uniqueness checks.
apps/sim/lib/table/sql.ts Routes Expiration equality and membership predicates through instant-based comparison.
apps/sim/lib/table/validation.ts Aligns in-memory and database-backed uniqueness checks with the Expiration instant.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/inline-editors.tsx Preserves stored offsets during inline calendar date changes and Today interactions.
packages/emcn/src/components/calendar/calendar.tsx Retains literal seconds and fractional seconds when changing the date of an offset-free calendar value.
apps/sim/background/cleanup-table-row-ttl.ts Implements bounded, failure-isolated cleanup with fresh discovery on later retries.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Input[API, import, or editor input] --> Normalize[Validate explicit ISO timestamp]
  Normalize --> Store[(Store wall clock, fraction, and offset)]
  Store --> Display[Editor and export preserve stored representation]
  Store --> Compare[Project to timestamptz instant]
  Compare --> Filters[Equality and range filters]
  Compare --> Unique[Uniqueness checks]
  Store --> Cleanup[Expiration cleanup]
Loading

Reviews (2): Last reviewed commit: "fix(tables): preserve expiration precisi..." | Re-trigger Greptile

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.

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