feat(desktop): Cursor-style automation detail page with validated schedules and inline run errors

Merged
KI
4mo ago
+861-535

Summary

Two commits: a bug-fix pass on the automation detail page, then a Cursor-style UI/UX pass — both from the detail-page audit documented as Phase 5 in apps/desktop/plans/automations-ui-improvements.md (research reused the Cursor/Mobbin screenshot corpus from #6291/#6301).

Bug fixes

  • SchedulePicker persisted partial RRULEs per keystroke: in Custom mode every keystroke fired automation.update, so half-typed rules were persisted or bounced off the server (parseRrule throws) with a toast per keypress. Custom text now commits on blur/Enter only, gated by a new isValidRrule() in @superset/shared/rrule that mirrors the server check. Invalid drafts show a selectable inline error; valid drafts echo the human-readable schedule.
  • SchedulePicker never resynced on external rrule changes (state derived once in the useState initializer): it now re-derives when the prop changes underneath it while ignoring its own emissions echoing back through the Electric row. Switching to Custom seeds the field with the current rule.
  • Run errors were hover-only and uncopyable (max-w-xs tooltip, violating the selectable-error rule in AGENTS.md): failed runs now render the full error inline, select-text, below the row.
  • Breadcrumb back-link is a real router Link; dead onBack prop removed.

Cursor-style detail page (ref: Cursor's automation editor)

  • Identity row under the title: Active Switch + owner name — replaces the easy-to-miss pause icon in the header.
  • Instructions section label + centered max-w-3xl body (prompt lines no longer run the full window width).
  • Delete demoted from a bare header icon (next to Run now) to a ⋯ overflow menu.
  • Read-only mode disables instead of hides: non-owners keep visible (disabled) actions with explanatory tooltips.
  • Next run shows relative time ("in 12 hours") with absolute-in-timezone on hover; paused automations show "Would run in …" computed live from the schedule, so schedule edits are previewable before resuming. Redundant status-dot row removed.

Cursor-style single-column editor (3rd commit)

The right rail is gone — the page is now Cursor's exact anatomy (ref cursor2-editor-settings-pagerduty.png from the research corpus):

  • Settings | Run History tabs under the identity row
  • Triggers card: sentence-style "[Daily at 8:00 AM] [America/Los_Angeles]" with an indented scope line "in [project] on [device] · [workspace]" and a muted "Next run in 11 hours" line (absolute time on hover; "Would run …" when paused)
  • Instructions card hosts the prompt editor with the Agent picker bottom-left — the slot where Cursor puts its model picker
  • Run History tab shows the runs full-width with inline selectable errors

Testing

  • bun test packages/shared/src/rrule.test.ts — 52 pass (4 new isValidRrule cases)
  • turbo typecheck --filter=@superset/shared --filter=desktop + bun run lint — clean
  • CDP end-to-end against the dev desktop (this worktree's renderer on :4025, signed-in session verified via authClient.getSession): real journey — Automations sidebar click → dashboard → row click → detail page — with real mouse input. Verified the identity row renders ("Active | Kiet Ho"), toggling the switch flips to "Paused" and Next run becomes "Would run in 12 hours", state restored after. A real failed run ("target host offline…") renders its full error inline in the Previous-runs rail. Screenshots captured before/after toggle.

Summary by CodeRabbit

  • New Features

    • Added settings and run-history tabs to automation details.
    • Added trigger configuration for schedules, time zones, projects, devices, and workspaces.
    • Added Run now, version history, delete, and enabled/paused controls.
    • Added owner details, next-run previews, connectivity status, and missing-device warnings.
    • Added read-only access controls and clearer previous-run error messages.
  • Bug Fixes

    • Improved automation navigation, schedule validation, and custom schedule synchronization.
  • Documentation

    • Added a plan for future automation detail-page improvements.