-
Notifications
You must be signed in to change notification settings - Fork 309
feat: Allow configuring schedule start and end times #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Allow configuring schedule start and end times #1487
Conversation
c11c8c9 to
b2ab3c1
Compare
There was a problem hiding this 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.
add calendar
…SQLAlchemy column types
5b1f7f8 to
0fbbd3f
Compare
|
@cubic-dev-ai rereview |
@daryllimyt I've started the AI code review. It'll take a few minutes to complete. |
There was a problem hiding this 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', |
There was a problem hiding this comment.
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() -> None:
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.alter_column('schedule', 'start_at',
+ existing_type=postgresql.TIMESTAMP(),
+ type_=sa.TIMESTAMP(timezone=True),
</file context>
| if (startAt && endAt) { | ||
| const start = parseDate(startAt) | ||
| const end = parseDate(endAt) | ||
| if (start && end && start > end) { |
There was a problem hiding this comment.
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 && endAt) {
+ const start = parseDate(startAt)
+ const end = parseDate(endAt)
+ if (start && end && start > end) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
</file context>
| if (start && end && start > end) { | |
| if (start !== null && end !== null && start > end) { |
| } | ||
|
|
||
| if (endAt) { | ||
| if (!parseDate(endAt)) { |
There was a problem hiding this comment.
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>
| if (!parseDate(endAt)) { | |
| if (parseDate(endAt) === null) { |
| } | ||
|
|
||
| if (startAt) { | ||
| if (!parseDate(startAt)) { |
There was a problem hiding this comment.
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>
| if (!parseDate(startAt)) { | |
| if (parseDate(startAt) === null) { |
Summary
Testing
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.