Skip to content

feat(scheduled_actions): add nullable timezone column (chat#1881 3c) - #48

Closed
sweetmantech wants to merge 1 commit into
mainfrom
feat/scheduled-actions-timezone-column
Closed

feat(scheduled_actions): add nullable timezone column (chat#1881 3c)#48
sweetmantech wants to merge 1 commit into
mainfrom
feat/scheduled-actions-timezone-column

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What

Prerequisite migration for chat#1881 item 3c (timezone-aware weekly scheduling). Adds scheduled_actions.timezone so the weekly-report email can fire at 9am local instead of 9am UTC (currently the middle of the US night).

Change

ALTER TABLE public.scheduled_actions
ADD COLUMN IF NOT EXISTS timezone text DEFAULT NULL;

Additive, nullable, backwards-compatible — NULL means UTC, so existing rows keep their current behavior. IANA id (e.g. America/New_York). Mirrors the existing add_model_to_scheduled_actions / add_trigger_schedule_id column-add migrations.

Sequencing (docs → database → api)

Unblocks the api-side wiring: api#780 already ships the tested, DST-aware time-derivation core (getNextUtcRunForLocalCron); once this column lands, the api PR's follow-up threads timezone through the task contract → createSchedule/next_run. The chat-side timezone picker is a sibling PR. Tracking: chat#1881.


Summary by cubic

Add a nullable timezone text column to public.scheduled_actions to enable timezone‑aware weekly scheduling at 9am local time instead of 9am UTC. Backward‑compatible (NULL = UTC; IANA IDs like America/New_York) and supports chat#1881 item 3c.

Written for commit 20f3e0c. Summary will update on new commits.

Review in cubic

… 3c)

Adds scheduled_actions.timezone (text, default NULL; NULL = UTC) so the weekly
report can be scheduled at 9am LOCAL time instead of 9am UTC. Additive, nullable,
backwards-compatible — existing rows keep UTC behavior. Prerequisite for the
api-side timezone wiring (api#780 ships the DST-aware time-derivation core).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@sweetmantech, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2cc076a-5eea-4c38-be86-096f02e6561f

📥 Commits

Reviewing files that changed from the base of the PR and between 71dede1 and 20f3e0c.

📒 Files selected for processing (1)
  • supabase/migrations/20260722000000_add_timezone_to_scheduled_actions.sql
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/scheduled-actions-timezone-column

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 22, 2026

Copy link
Copy Markdown

Updates to Preview Branch (feat/scheduled-actions-timezone-column) ↗︎

Deployments Status Updated
Database Wed, 22 Jul 2026 13:36:18 UTC
Services Wed, 22 Jul 2026 13:36:18 UTC
APIs Wed, 22 Jul 2026 13:36:18 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Wed, 22 Jul 2026 13:36:26 UTC
Migrations Wed, 22 Jul 2026 13:36:31 UTC
Seeding Wed, 22 Jul 2026 13:36:31 UTC
Edge Functions Wed, 22 Jul 2026 13:36:31 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@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.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="supabase/migrations/20260722000000_add_timezone_to_scheduled_actions.sql">

<violation number="1" location="supabase/migrations/20260722000000_add_timezone_to_scheduled_actions.sql:7">
P2: Invalid timezone values can be persisted and reach timezone-aware `next_run` derivation once API wiring lands, producing errors or incorrect scheduling. Consider enforcing the documented IANA-ID contract at the database boundary (or add a validated timezone domain/function) rather than accepting arbitrary text.</violation>
</file>

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

Re-trigger cubic


-- Change: add optional IANA timezone column with default NULL (NULL = UTC).
ALTER TABLE public.scheduled_actions
ADD COLUMN IF NOT EXISTS timezone text DEFAULT NULL;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Invalid timezone values can be persisted and reach timezone-aware next_run derivation once API wiring lands, producing errors or incorrect scheduling. Consider enforcing the documented IANA-ID contract at the database boundary (or add a validated timezone domain/function) rather than accepting arbitrary text.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At supabase/migrations/20260722000000_add_timezone_to_scheduled_actions.sql, line 7:

<comment>Invalid timezone values can be persisted and reach timezone-aware `next_run` derivation once API wiring lands, producing errors or incorrect scheduling. Consider enforcing the documented IANA-ID contract at the database boundary (or add a validated timezone domain/function) rather than accepting arbitrary text.</comment>

<file context>
@@ -0,0 +1,10 @@
+
+-- Change: add optional IANA timezone column with default NULL (NULL = UTC).
+ALTER TABLE public.scheduled_actions
+ADD COLUMN IF NOT EXISTS timezone text DEFAULT NULL;
+
+COMMENT ON COLUMN public.scheduled_actions.timezone IS
</file context>

@sweetmantech

Copy link
Copy Markdown
Contributor Author

Closing as superseded (chat#1881 3c design change). We're reworking api#780 to pass the user's timezone straight to the Trigger.dev schedule (schedules.create/update({ cron, timezone })), which interprets the cron in that IANA zone (DST-aware) and is the source of truth for when the task fires. Storing a copy of the timezone in scheduled_actions would be a denormalization that has to be kept in sync and can diverge from the Trigger.dev schedule — so we're referencing the single source of truth instead of maintaining a second one. No scheduled_actions.timezone column needed.

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