Skip to content

fix(website): keep a one-shot job's run time when editing it - #25990

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/25898-one-shot-job-form
Oct 30, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/25898-one-shot-job-form

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A one-shot scheduled job can be opened and saved from the dashboard without losing its run time.

Opening a one-shot job (made with at, at_time or delay) shows the schedule as "Cron expression" with an empty field. Save then fails with "Enter a valid 5-field cron expression", even with no change. So the job's name, message or settings cannot be edited at all.

Why it matters

Anyone with a one-time reminder cannot edit it from the dashboard. The form also shows the wrong schedule, so a user could "fix" it by typing a cron expression and turn a one-time reminder into a recurring job without meaning to.

Not a goal

What changed (motivation → approach → change)

Symptom: the edit form opens a one-shot job in cron mode with an empty field, and Save is refused.

Cause: the form only knew three modes (interval, weekly, cron). A one-shot job has neither an interval nor a cron expression, so it fell through to cron mode with nothing in it.

Change: the form now recognises a one-shot job (no interval, no cron expression, and the server's schedule text starts with at). It shows that stored run time as plain text in place of the schedule picker. On Save it sends no schedule and no timezone. The update endpoint changes the schedule only when cron or every is sent, so the stored run time stays as it was.

Decision: the most conservative fix. The run time is shown read-only rather than adding a new one-shot editor, which would need new copy in every locale and is #9836's scope.

Backwards compatibility

Compatible: interval, weekly and cron jobs parse and save exactly as before; only a job that matched none of them now gets its own mode.

Removes nothing: the form gains a display for one-shot jobs and no field, key or path is taken away.

Tests

website/src/test/JobForm.oneShot.test.tsx:

  • a one-shot job parses to its own mode, not cron;
  • its save body carries no cron, every or timezone;
  • the rendered form shows the stored run time, has no empty cron field, and Save calls updateCron without a schedule.

All three fail on origin/main and pass with the fix. The nearby JobForm.timeLimit and JobForm.scriptCommand suites still pass, and tsc -p tsconfig.app.json is clean.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

Built the form alone with stubbed API calls, loaded it in headless Chromium, and clicked Save on a one-shot job. Before the fix, Save is refused and the form shows an empty cron field. After the fix, the form shows "at 09:00 AM PST, Nov 2" and Save completes.

Screenshots / video

Before (cron mode, empty field; Save refused):

before

After (stored run time shown; Save completes):

after

Related Issues

Closes #25898

Sibling sweep

Swept: git grep -nE "schedMode|cron_expr || ''" -- website/src
Sibling: website/src/components/WeekGrid.tsx:84 -- not affected -- it only draws the week view and never builds a save body
Sibling: website/src/utils/schedulePresets.tsx -- not affected -- presets seed new jobs only, and a new job is never one-shot here

Pattern harvest

Rule candidate: review-prompt
Pattern: "an edit form that parses a stored record into a fixed set of modes must give each stored kind its own mode, not fall back to an empty editable one"

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

🤖 AI-assisted PR 🤖

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 29, 2026 23:12
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of c7072131c2137722b0ad8afbd092994be5d8179b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design problem blocks this. It is a narrow, reversible frontend fix, the backend PATCH really does keep the schedule when neither cron nor every is sent (cron_jobs.py:865), and screenshots of this revision are attached.

Notes

  • The form spots a one-shot job by checking that the display text starts with ^at\s (from cron_service/schedule.py:158). If that text is ever reworded or translated, one-shot jobs will quietly open in cron mode again. Sending schedule.kind in the job's API data would be a safer signal.

[DESIGN-REVIEWED] c707213

Description read

[DESCRIPTION-READ] 0bc2090eaff3edcb74442fd910e1e1b55f06013fe812c4f092189a8a81a453f7

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of c7072131c2137722b0ad8afbd092994be5d8179b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader correctly read the new read-only "at 09:00 AM PST, Nov 2" as one fixed run time, and shot-02 shows it.

Notes

  • The run time is plain text with no hint that it can't be edited, so the reader was "unsure how I would change the time". Add a short line saying a one-time job's run time can't be changed here, once a localized string is allowed (or as part of Schedule a one-shot cron from the UI (Schedule tab once mode + composer shortcut) #9836).
  • The Schedule helper text still says "How often this job runs" above a job that runs once (shot-02). In once mode, hide components.jobForm.how_often_this_job_runs or swap it for one-time wording.

[UX-REVIEWED] c707213

Description read

[DESCRIPTION-READ] 26228503f4acded9741e09ee7d62544a2ddd7ffda32b56c42db699528e699740

That sha256 names everything this verdict read: the PR description, plus the 5 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c7072131c2137722b0ad8afbd092994be5d8179b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. It is a real fix for #25898, with tests that fail on base. Detecting a one-shot job from the start of the display text is fragile, but the API returns no at field to use instead.

Notes

  • Item 1 — inherited: the diff tells a one-shot job apart by the start of the display text it shows (/^at\s/.test(job.schedule || '')). cron_board.py:144-146 sends only cron_expr and every_secs. The at field declared at types/index.jobs.ts:11 is never filled for this list, so its 1 declared field has 0 populated consumers. There is no smaller signal to switch to today.

What this change ships

Inventory (3 items) — 3 justified

Intent: let a person edit a one-time scheduled job's name, message or settings from the dashboard without the save failing or quietly turning it into a recurring job. FIX.

  1. Editing a one-shot job shows its stored run time as read-only text instead of an empty cron field — justified
  2. Saving a one-shot job sends no schedule or timezone, so the stored run time is kept — justified
  3. New test test-id jobform-one-shot-schedule on the run-time text — justified

[FIRST-PRINCIPLES-REVIEWED] c707213

Description read

[DESCRIPTION-READ] 3ea2c422ddb0d5ba283f33d89d3f9081d01d2bc20df43ce65fbac2b245546ca5

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed c7072131c2137722b0ad8afbd092994be5d8179b — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c707213

Verdict parsed from the review's SHA-scoped output markers for commit c7072131c2137722b0ad8afbd092994be5d8179b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable c7072131c2137722b0ad8afbd092994be5d8179b false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of c7072131c2137722b0ad8afbd092994be5d8179b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c707213

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c7072131c2137722b0ad8afbd092994be5d8179b false-positive: <reason, 20 to 500 characters>

@iamwhatever
iamwhatever force-pushed the fix/25898-one-shot-job-form branch from 1cf04ca to c707213 Compare October 29, 2026 23:41
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main (fe68d8e -> e106845) to pick up #25944. On the old head, Frontend Tests (1) failed in src/test/kiroUsageRefetchInterval.test.ts (expected 'none' to be 'api-key'). That test is outside this PR, and #25944 fixed it on main. The related tests pass locally on the new head c7072131c213. CI is re-running.

🤖 AI-assisted comment 🤖

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 30, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready on head c7072131c213: all 93 checks pass, 0 running, 0 failing, and PR Readiness passed. Mergeable, with 0 open review threads. Design, First Principles and UX: PASS. GPT and Opus: reviewed this head. Only a maintainer review is left.

🤖 AI-assisted comment 🤖

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 30, 2026 01:08

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the job edit form keeps a one-shot job's stored run time instead of failing on an empty cron field, with tests.

@KiroCrewCaptain
KiroCrewCaptain merged commit 16b0e90 into main Oct 30, 2026
94 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/25898-one-shot-job-form branch October 30, 2026 01:29
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 30, 2026
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.

Editing a one-shot ("at") scheduled job opens in Cron mode with an empty expression, so Save fails

2 participants