Skip to content

Allow arming never-run one-shot routines - #327

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/once-arm-enable-6c65
Aug 28, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/once-arm-enable-6c65

Conversation

@elie222

@elie222 elie222 commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Re-lands only the @once enable fix that was lost when share (#302) was reverted.

Why: After the accidental share merge and revert (#326), Greptile correctly noted that never-fired inactive one-shots again cannot be activated (!nextRunAt was treated as already-fired).

What:

  • routines.update treats already-fired only when lastRunAt is set
  • Optional runAt arms never-run one-shots
  • Web routine panel shows Run at and sends active + runAt on save
  • Journey test covers arm / reject-after-fire

No share feature in this PR.

Do not auto-merge. Leave for Elie to decide.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • One-time routines can now be scheduled for a future date and time.
    • Routine editors display a date-and-time field when a never-run one-time routine is eligible for activation.
  • Bug Fixes

    • Prevented invalid, missing, past, or unsupported schedules from being activated.
    • Prevented one-time routines that have already run from being reactivated.

@vercel

vercel Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
rakazo-www Ready Ready Preview Aug 28, 2026 1:26am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 113bae58-1557-4c93-a57b-851eed71240f

📥 Commits

Reviewing files that changed from the base of the PR and between 17bffde and b993bca.

📒 Files selected for processing (4)
  • apps/api/src/router.ts
  • apps/web/src/pages/Shell.tsx
  • packages/contracts/src/rpc.ts
  • packages/testkit/src/journeys.test.ts

📝 Walkthrough

Walkthrough

Changes

One-shot routine arming

Layer / File(s) Summary
API contract and one-shot validation
packages/contracts/src/rpc.ts, apps/api/src/router.ts, packages/testkit/src/journeys.test.ts
routines.update accepts an optional ISO runAt. The API requires a future runAt for never-run one-shots and rejects invalid or repeated arming. Journey tests cover these cases.
Routine editor scheduling controls
apps/web/src/pages/Shell.tsx
The editor adds one-shot draft state, a conditional datetime-local input, local validation, and ISO runAt submission. Draft initialization uses shared helpers.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Editor as Routine editor
  participant API as routines.update
  participant Router as API router
  participant State as Routine state
  Editor->>API: Submit future runAt
  API->>Router: Validate update input
  Router->>State: Set active and nextRunAt
  State-->>Editor: Return updated routine
Loading

Suggested reviewers: bnsd55, cursoragent

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Playwright screenshots

Open screenshot gallery · Dashboard · CI run

Updated for commit b993bca.

@cursor
cursor Bot marked this pull request as ready for review August 28, 2026 01:22
@cursor
cursor Bot force-pushed the cursor/once-arm-enable-6c65 branch from f22046e to bbbaf5e Compare August 28, 2026 01:22
Treat @once as already-fired only when lastRunAt is set. Arm with optional
runAt on routines.update, and expose a Run at field in the web routine panel.

Co-authored-by: Elie Steinbock <elie222@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/once-arm-enable-6c65 branch from bbbaf5e to b993bca Compare August 28, 2026 01:25
@cursor
cursor Bot marked this pull request as draft August 28, 2026 01:26
@cursor
cursor Bot marked this pull request as ready for review August 28, 2026 01:27
@cursor

cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Keeping this as draft on purpose. Do not mark ready or merge until Elie asks. Share was reverted; this is only the once-arm fix.

@cursor
cursor Bot marked this pull request as draft August 28, 2026 01:27
@elie222
elie222 marked this pull request as ready for review August 28, 2026 01:28
@cursor
cursor Bot merged commit 4cd2564 into main Aug 28, 2026
13 of 14 checks passed
@cursor
cursor Bot deleted the cursor/once-arm-enable-6c65 branch August 28, 2026 01:29
@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores support for arming inactive, never-run one-shot routines with a future execution time.

  • Adds an optional runAt field to the routine update contract.
  • Validates and schedules never-run one-shots in the API while rejecting already-fired one-shots.
  • Adds a contextual datetime input to the web routine editor.
  • Adds a journey test covering successful arming and rejection after execution.

Confidence Score: 4/5

The unintended activation of inactive recurring routines should be fixed before merging.

The routine editor's new save payload activates any inactive routine that has never run, and the API consequently schedules recurring routines even though the user only edited them.

Files Needing Attention: apps/web/src/pages/Shell.tsx

Important Files Changed

Filename Overview
apps/api/src/router.ts Adds validation and scheduling for arming never-run one-shots with a future timestamp.
apps/web/src/pages/Shell.tsx Adds the one-shot arming UI, but its save payload also unintentionally activates inactive recurring routines.
packages/contracts/src/rpc.ts Extends routine updates with an optional ISO-formatted runAt field.
packages/testkit/src/journeys.test.ts Covers one-shot arming and post-execution rejection, but not preservation of inactive recurring routines during edits.

Reviews (1): Last reviewed commit: "Allow arming never-run one-shot routines..." | Re-trigger Greptile

Comment thread apps/web/src/pages/Shell.tsx

This branch was successfully deployed

1 active deployment
Preview — b993bca7 Deployed Aug 28, 2026 by vercel[bot]
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.

2 participants