Skip to content

feat(website): create a one-shot job from the schedule form - #31291

Merged
bolichen97 merged 1 commit into
mainfrom
fix/9836-jobform-once-mode
Nov 6, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/9836-jobform-once-mode

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A user can schedule a job that runs once, at a date and time they pick, from the Schedule page's job form.

The cron backend already takes one-shot jobs over REST (at / delay / at_time on POST /api/crons), and the form already shows an existing one-shot's run time when editing it. But the create form's schedule picker offers only Every interval, Weekly schedule and Cron expression, so a one-shot job cannot be created from the dashboard at all; it takes a chat request or the CLI.

Why it matters

"Remind me at 3pm on Friday" and "run this check once after the release" are ordinary schedules. Without a Once option the only dashboard route is a recurring job the user has to remember to delete after it fires.

Not a goal

  • The chat composer's send-later shortcut (the issue's second surface). It needs a delivery target on create and is carried separately.
  • Changing when an existing job runs, or switching a recurring job to a one-shot: the update route takes no run time, so editing keeps today's read-only display.
  • A relative delay or free-text time ("in 2 hours", "tomorrow 9am") in the form.

What changed (motivation → approach → change)

The schedule picker on a new job (components/JobForm.tsx) gains a Once option. Choosing it shows a date-and-time field and the same zone picker the weekly and cron modes use. On Create the form sends the picked wall clock as at_time (and the zone as timezone when the picker was touched) to the existing POST /api/crons route. The backend's shared one-shot parser reads it in that zone, exactly as cron_add and kirocrew cron add --at do, and refuses a time already past or one the zone's clocks skip. An empty field stops the save and says "Pick a date and time for this job to run" as plain text beside the field, marked aria-invalid, the way the auto-pause field shows its hint. It is a hint, not an error notice, because nothing failed.

Reading the time in the job's zone, not the browser's, keeps one rule for the whole form: 09:30 means 09:30 in the zone shown beside it, whichever mode is chosen, and the job's "at …" label shows that same zone. An existing job never offers Once, because the update route cannot take a run time; an existing one-shot still opens showing its stored time, as before.

The three new strings are in every shipped catalog (en.json, en.manual.json, the eleven translations and the generated en-XA), with translator context for the two short ones in en.context.json. The cron spec (learn-cron-dashboard.md) records what the form creates.

Backwards compatibility

Compatible: the form only gains an option for new jobs; every existing request shape, and the edit form, is unchanged.

Removes nothing: no field, option, key or route is taken away.

Tests

website/src/test/JobForm.oneShot.test.tsx gains three tests:

  • on a new job, picking Once and a date and time sends at_time: "2030-01-02T09:30", with no cron or every. It fails on main, which has no Once option.
  • Once with no date sends nothing and describes the field with the hint, not through an error alert. It fails when the hint goes through the form's error notice.
  • editing a recurring job never offers Once, so a user cannot pick a mode whose save would leave the job recurring.

The existing three one-shot edit tests still pass unchanged. Determinism: no new test reads a clock or waits on a timer. The file passed 20 runs in a row with --sequence.shuffle and a fixed, printed seed per run.

Related suites run locally: before the last change, the 77 frontend spec files that name or reference a changed file and the 19 backend test files that reference one, all green; after it, every JobForm.* spec and the i18n style suites (the Hindi one with I18N_BASE_REF set); plus tsc -p tsconfig.app.json, eslint on the changed files, i18n:check, i18n:render, gen:ui --check, jscpd, semgrep on the diff, docs lint, and the file-line-cap, brand-name and comment-history checks.

Manual verification

Ran the built dashboard against stubbed API routes in Chromium (Los Angeles time zone): opened Add Job, chose Once, entered 2 January 2030 09:30 with the zone picker on its Local default, and pressed Create. The captured POST /api/crons body carried at_time: "2030-01-02T09:30" and no at, cron or every, in both the dark and light themes.

Screenshots / video

The schedule picker on a new job, with Once listed:

Schedule picker listing Every interval, Weekly schedule, Cron expression and Once

Once chosen, with its date-and-time field filled and the zone picker beside it (dark and light):

New Job form in Once mode with a date and time, dark theme

New Job form in Once mode with a date and time, light theme

Related Issues

Part of #9836

The composer shortcut half of that issue stays open; #11397 carries it.

Sibling sweep

N/A: a feat PR, not a fix.

Pattern harvest

N/A: a feat PR, not a fix.

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 6, 2026 08:45
@bolichen97
bolichen97 requested a review from Zedmor November 6, 2026 08:45
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. Once reuses the existing POST /api/crons at_time path and parse_time_string, which already parses YYYY-MM-DDTHH:MM. It is offered only on create, and the rendered evidence matches the surface the diff adds.

[DESIGN-REVIEWED] 8f7481b

Description read

[DESCRIPTION-READ] 6265387639169ee0f0f8872a8c66a7e25203c88a649b9b392821e31219f64d4d

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 8f7481b881bf5929abd1f17b5b029802afb9ac59 — 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. The PR adds a Once option to the new-job form and sends it through the existing POST /api/crons at_time route. The default schedule mode is still Every interval.

What this change ships

Inventory (6 items) — 6 justified

Intent: let a user create a job that runs once, at a date and time they pick, from the dashboard's job form. ADDITION.

  1. The new-job schedule picker offers a fourth option, Once — justified
  2. Choosing Once shows a date-and-time field next to the existing zone picker — justified
  3. Create sends the picked wall clock as at_time, plus timezone if the zone was changed, to the existing route — justified
  4. An empty date stops the save and shows a plain hint beside the field — justified
  5. The edit form never offers Once, and an existing one-shot still shows its stored time as before — justified
  6. The cron spec says the form now creates one-shot jobs, with three new strings in every catalog — justified

[FIRST-PRINCIPLES-REVIEWED] 8f7481b

Description read

[DESCRIPTION-READ] 59bf0710cf10df09d472de76fc1ad6eef57f2542d848d4c5b7bfb46433465a90

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

cannot evaluate: missing the empty-date hint state. If someone picks Once and presses Create with no date, a hint appears that none of the three screenshots shows.

Evidence gaps

  • Once with no date, after pressing Create. The diff adds {onceHint && <span id="jobform-once-hint" className="text-[11px] text-text">{onceHint}</span>} with the text "Pick a date and time for this job to run". It also marks the field aria-invalid. shot-01 to shot-03 all show the menu open or a filled date, and the blind read never mentions the hint. So nobody has seen where the hint lands in the wrapping schedule row, how readable it is at 11px, or whether it reads as a hint and not an error. Fix: attach a screenshot of the New Job form with Once selected, the date field empty, and Create pressed.

Notes

  • When Once is picked, the schedule subtitle still says "How often this job runs" (how_often_this_job_runs). The blind reader noticed: "reads oddly when 'Once' is picked". Use wording that fits a one-time run too, e.g. "When this job runs".

[UX-REVIEWED] 8f7481b

Description read

[DESCRIPTION-READ] 285c7e77666de7964c902762a4bf363fe9c387e8957b1c28ee516f4d77ff5f19

That sha256 names everything this verdict read: the PR description, plus the 6 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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 8f7481b

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

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

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8f7481b

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 6, 2026 09:13
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@bolichen97
bolichen97 force-pushed the fix/9836-jobform-once-mode branch from 440c8a8 to fdc680f Compare November 6, 2026 14:24
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 6, 2026
The Schedule page's job form could edit an existing one-shot job but
not create one: its schedule picker offered only an interval, a weekly
schedule or a cron expression. A new job now gets a Once option with a
date-and-time field and the zone picker the other modes use; the form
sends the wall clock as at_time to POST /api/crons, where the shared
one-shot parser reads it in the job's zone. An existing job never
offers Once, since the update route takes no run time.

Part of #9836
@bolichen97
bolichen97 force-pushed the fix/9836-jobform-once-mode branch from fdc680f to 8f7481b Compare November 6, 2026 16:04
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 6, 2026

@chenmingwei23 chenmingwei23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving: green board, no conflicts, no outstanding change requests.

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

Approved for the on-call. Review lanes pass on 8f7481b, no conflict, no open change request.

@bolichen97
bolichen97 merged commit 34bba41 into main Nov 6, 2026
99 of 122 checks passed
@bolichen97
bolichen97 deleted the fix/9836-jobform-once-mode branch November 6, 2026 23:42
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 6, 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.

3 participants