Skip to content

Conversation

@daryllimyt
Copy link
Contributor

@daryllimyt daryllimyt commented Oct 2, 2025

Summary

  • add start and end time pickers to the schedule creation form with validation
  • include start and end information in the schedule table display
  • send the configured start_at and end_at values when creating schedules

Testing

  • pnpm --dir frontend lint

Screens

Screen.Recording.2025-10-02.at.20.29.43.mov

https://chatgpt.com/codex/tasks/task_e_68de9e08dd688320b6caa2a083b45148


Summary by cubic

Add optional start and end times to schedules so users can control when a schedule begins and stops running. Includes validation and displays these times in the schedules table; values are sent to the API in ISO format.

  • New Features
    • Added “Start after” and “End by” datetime inputs with validation (valid dates, end after start).
    • Display start and end times in the schedules table with readable formatting.
    • Send start_at and end_at (ISO) when creating schedules.

@daryllimyt daryllimyt changed the title feat(frontend): allow configuring schedule start and end times feat(ui): Allow configuring schedule start and end times Oct 2, 2025
@daryllimyt daryllimyt changed the title feat(ui): Allow configuring schedule start and end times feat: Allow configuring schedule start and end times Oct 2, 2025
@daryllimyt daryllimyt force-pushed the codex/extend-schedule-implementation-for-time-limits branch from c11c8c9 to b2ab3c1 Compare October 2, 2025 18:19
Copy link
Contributor

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

Choose a reason for hiding this comment

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

3 issues found across 1 file

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="frontend/src/components/builder/panel/trigger-panel.tsx">

<violation number="1" location="frontend/src/components/builder/panel/trigger-panel.tsx:611">
`parseDate` returns 0 for valid epoch timestamps, so this falsy check rejects a legitimate start time. Please compare against null instead so zero values pass.</violation>

<violation number="2" location="frontend/src/components/builder/panel/trigger-panel.tsx:621">
`parseDate` can return 0 for valid timestamps, so the falsy check erroneously rejects a legitimate end time. Compare against null instead.</violation>

<violation number="3" location="frontend/src/components/builder/panel/trigger-panel.tsx:633">
Because `parseDate` can return 0 for a valid start time, this truthiness guard skips the comparison and lets an end time precede the start. Check against null explicitly so zero values are still validated.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@daryllimyt daryllimyt force-pushed the codex/extend-schedule-implementation-for-time-limits branch from 5b1f7f8 to 0fbbd3f Compare October 3, 2025 00:29
@daryllimyt
Copy link
Contributor Author

@cubic-dev-ai rereview

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Oct 3, 2025

@cubic-dev-ai rereview

@daryllimyt I've started the AI code review. It'll take a few minutes to complete.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

4 issues found across 6 files

Prompt for AI agents (all 4 issues)

Understand the root cause of the following 4 issues and fix them.


<file name="alembic/versions/2c5027c52107_make_schedule_start_at_and_end_at_.py">

<violation number="1" location="alembic/versions/2c5027c52107_make_schedule_start_at_and_end_at_.py:24">
Altering schedule.start_at to timestamptz without a USING clause causes Postgres to reinterpret existing timestamps in the migration session’s timezone; on non-UTC connections every saved schedule time will shift by that offset. Please add a USING cast (e.g. treating the previous values as UTC) here and in the matching end_at migration so existing data keeps the intended instant.</violation>
</file>

<file name="frontend/src/components/builder/panel/trigger-panel.tsx">

<violation number="1" location="frontend/src/components/builder/panel/trigger-panel.tsx:647">
`parseDate` already returns `null` for invalid input, but this falsy check also rejects valid values like 1970-01-01T00:00:00Z (timestamp 0). Compare against `null` so epoch start times pass validation.</violation>

<violation number="2" location="frontend/src/components/builder/panel/trigger-panel.tsx:657">
This falsy check misclassifies epoch datetimes as invalid because timestamp `0` is falsy. Compare the parse result against `null` instead to avoid blocking valid inputs.</violation>

<violation number="3" location="frontend/src/components/builder/panel/trigger-panel.tsx:669">
When either parsed timestamp is `0`, this truthy test short-circuits and skips the ordering validation. Check the values against `null` instead so epoch datetimes still participate in the comparison.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('schedule', 'start_at',
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 3, 2025

Choose a reason for hiding this comment

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

Altering schedule.start_at to timestamptz without a USING clause causes Postgres to reinterpret existing timestamps in the migration session’s timezone; on non-UTC connections every saved schedule time will shift by that offset. Please add a USING cast (e.g. treating the previous values as UTC) here and in the matching end_at migration so existing data keeps the intended instant.

Prompt for AI agents
Address the following comment on alembic/versions/2c5027c52107_make_schedule_start_at_and_end_at_.py at line 24:

<comment>Altering schedule.start_at to timestamptz without a USING clause causes Postgres to reinterpret existing timestamps in the migration session’s timezone; on non-UTC connections every saved schedule time will shift by that offset. Please add a USING cast (e.g. treating the previous values as UTC) here and in the matching end_at migration so existing data keeps the intended instant.</comment>

<file context>
@@ -0,0 +1,45 @@
+
+def upgrade() -&gt; None:
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.alter_column(&#39;schedule&#39;, &#39;start_at&#39;,
+               existing_type=postgresql.TIMESTAMP(),
+               type_=sa.TIMESTAMP(timezone=True),
</file context>
Fix with Cubic

if (startAt && endAt) {
const start = parseDate(startAt)
const end = parseDate(endAt)
if (start && end && start > end) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 3, 2025

Choose a reason for hiding this comment

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

When either parsed timestamp is 0, this truthy test short-circuits and skips the ordering validation. Check the values against null instead so epoch datetimes still participate in the comparison.

Prompt for AI agents
Address the following comment on frontend/src/components/builder/panel/trigger-panel.tsx at line 669:

<comment>When either parsed timestamp is `0`, this truthy test short-circuits and skips the ordering validation. Check the values against `null` instead so epoch datetimes still participate in the comparison.</comment>

<file context>
@@ -560,6 +634,46 @@ const scheduleInputsSchema = z
+    if (startAt &amp;&amp; endAt) {
+      const start = parseDate(startAt)
+      const end = parseDate(endAt)
+      if (start &amp;&amp; end &amp;&amp; start &gt; end) {
+        ctx.addIssue({
+          code: z.ZodIssueCode.custom,
</file context>
Suggested change
if (start && end && start > end) {
if (start !== null && end !== null && start > end) {
Fix with Cubic

}

if (endAt) {
if (!parseDate(endAt)) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 3, 2025

Choose a reason for hiding this comment

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

This falsy check misclassifies epoch datetimes as invalid because timestamp 0 is falsy. Compare the parse result against null instead to avoid blocking valid inputs.

Prompt for AI agents
Address the following comment on frontend/src/components/builder/panel/trigger-panel.tsx at line 657:

<comment>This falsy check misclassifies epoch datetimes as invalid because timestamp `0` is falsy. Compare the parse result against `null` instead to avoid blocking valid inputs.</comment>

<file context>
@@ -560,6 +634,46 @@ const scheduleInputsSchema = z
+    }
+
+    if (endAt) {
+      if (!parseDate(endAt)) {
+        ctx.addIssue({
+          code: z.ZodIssueCode.custom,
</file context>
Suggested change
if (!parseDate(endAt)) {
if (parseDate(endAt) === null) {
Fix with Cubic

}

if (startAt) {
if (!parseDate(startAt)) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 3, 2025

Choose a reason for hiding this comment

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

parseDate already returns null for invalid input, but this falsy check also rejects valid values like 1970-01-01T00:00:00Z (timestamp 0). Compare against null so epoch start times pass validation.

Prompt for AI agents
Address the following comment on frontend/src/components/builder/panel/trigger-panel.tsx at line 647:

<comment>`parseDate` already returns `null` for invalid input, but this falsy check also rejects valid values like 1970-01-01T00:00:00Z (timestamp 0). Compare against `null` so epoch start times pass validation.</comment>

<file context>
@@ -560,6 +634,46 @@ const scheduleInputsSchema = z
+    }
+
+    if (startAt) {
+      if (!parseDate(startAt)) {
+        ctx.addIssue({
+          code: z.ZodIssueCode.custom,
</file context>
Suggested change
if (!parseDate(startAt)) {
if (parseDate(startAt) === null) {
Fix with Cubic

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants