Skip to content

fix(tables): harden timezone and expiration handling - #7291

Open
j15z wants to merge 11 commits into
stagingfrom
fix/ttl-and-timezone-fixes
Open

fix(tables): harden timezone and expiration handling#7291
j15z wants to merge 11 commits into
stagingfrom
fix/ttl-and-timezone-fixes

Conversation

@j15z

@j15z j15z commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bug-bot fixes

  • Preserve years 0000–0099 when resolving timezone wall clocks instead of allowing JavaScript to remap them to 1900–1999.
  • Keep invalid saved timezones from crashing Date and Expiration cell rendering.
  • Report invalid non-empty Expiration values as rejected during CSV import instead of silently blanking them.
  • Reject empty timezone identifiers instead of falling back to the server runtime timezone.
  • Dispatch row-delete triggers asynchronously so slow webhook preparation cannot delay DELETE requests.
  • Cap accepted row sizes at the delete-snapshot byte budget so a single trigger payload cannot exceed the claimed limit.
  • Emit table-change notifications for successful TTL cleanup work even when a later table cleanup fails.
  • Wait for timezone settings before Date and Expiration editors capture their wall-clock interpretation.
  • Preserve null, undefined, and blank Expiration values instead of coercing them to the Unix epoch.

Further hardening from code review

  • Distinguish loading, unset, invalid, and failed timezone settings throughout the table editor.
  • Show raw stored timestamps or epoch seconds when a saved timezone is invalid or unavailable, and block only Date and Expiration edits with actionable guidance.
  • Represent an unset timezone in General Settings as Auto: <browser timezone> while preserving the existing browser-timezone fallback.
  • Add regression coverage across timezone conversion, DST ambiguity, CSV import, grid and row-modal editing, row deletion, snapshot limits, and TTL cleanup.

Babysit and review follow-ups

  • Enforce the delete-snapshot byte budget from the actual stored JSONB size under row locks. Bulk deletes and TTL cleanup split before crossing the budget; a pre-existing oversized legacy row is deleted alone and logged.
  • Keep any valid saved timezone selectable even when it is absent from the curated dropdown, instead of showing an empty placeholder.
  • Render the exact stored Date timestamp or Expiration epoch seconds while timezone settings are still loading, avoiding a temporary browser-timezone conversion.
  • In mixed-schema row modals, block only Date and Expiration fields when timezone settings are unavailable. Unrelated fields remain editable, and blocked datetime fields are omitted from the update so their stored values remain unchanged.
  • Forward field descriptions to blocked datetime controls so the disabled editing state remains accessible.

Type of Change

  • Bug fix

Testing

  • bun run agent-stream-docs:generate
  • bun run skills:sync
  • bun run lint
  • bun run apps/sim/scripts/check-block-registry.ts origin/staging
  • bun run check:audits (39 audits)
  • bun run type-check
  • Focused Vitest review suites (6 files, 61 tests)
  • GitHub Build App and Lint and Test checks

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 Aug 31, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 31, 2026 3:23am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens table timezone, expiration, deletion-trigger, snapshot-budget, and TTL-cleanup behavior while adding regression coverage.

  • Distinguishes loading, unset, invalid, and failed timezone settings across table rendering and editing.
  • Preserves raw date and expiration values when timezone conversion is unavailable and permits unrelated row-modal edits.
  • Tightens expiration import coercion and timezone/date conversion behavior.
  • Makes delete-trigger dispatch asynchronous and constrains snapshot batches by byte size.
  • Ensures successful TTL cleanup work emits table-change notifications before later failures propagate.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/row-modal/row-modal.tsx Replaces the modal-wide timezone gate with per-date-field blocking while preserving unrelated edits through partial updates.
apps/sim/hooks/queries/general-settings.ts Exposes explicit timezone-setting states so consumers can distinguish ready, loading, invalid, and failed preferences.
apps/sim/lib/core/utils/timezone.ts Hardens timezone validation and wall-clock conversion, including preservation of years 0000–0099.
apps/sim/lib/table/rows/service.ts Dispatches row-delete triggers asynchronously and applies the snapshot byte budget to accepted row sizes.
apps/sim/background/cleanup-table-row-ttl.ts Adds byte-budgeted TTL deletion batches and promptly signals successful cleanup work.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Load timezone setting] --> B{Timezone ready?}
  B -->|Yes| C[Format and edit Date or Expiration fields]
  B -->|No| D[Render raw stored values]
  D --> E[Block Date or Expiration edits]
  D --> F[Keep unrelated row fields editable]
  F --> G[Submit partial row update]
  G --> H[Preserve omitted date values]
Loading

Reviews (2): Last reviewed commit: "fix(tables): address timezone and delete..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 30 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/table/constants.ts
@j15z

j15z commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

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