Skip to content

feat(api): group automations (setGroup, CLI --group, MCP group) - #9209

Merged
Kitenite merged 3 commits into
mainfrom
kiet/automation-groups-api
Oct 31, 2026
Merged

Kitenite merged 3 commits into
mainfrom
kiet/automation-groups-api

Conversation

@Kitenite

@Kitenite Kitenite commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Stack (merge in order)

  1. feat(db): add automations.group_name #9208: migration
  2. this PR: API, CLI, MCP
  3. Desktop UI (next PR, based on this branch)

Summary

  • New automation.setGroup({ id, group }): owner-only and cheap. It writes only the group column, unlike update, which re-resolves the target and resyncs schedules.
  • Optional group on automation.create and automation.update. list and get now return group.
  • @superset/shared/automation-group normalizes names: trims, collapses spaces, keeps case, max 64 characters, and treats blank as ungrouped.
  • CLI: automations create/update --group <name>, update --clear-group, list --group <name> (case-insensitive), plus a GROUP column in list.
  • MCP: group on the automations create and update tools.

tRPC compatibility (packages/trpc/AGENTS.md)

  • Additive only: a new procedure, new optional input fields, and a new output field (group, typed string | null).
  • No existing input is tightened, and no behavior or error code changes.
  • Older clients ignore the new field; older CLI builds simply don't send --group.
  • Ship the API before the desktop PR: it calls setGroup and reads group.

Testing

  • bun test packages/shared/src/automation-group.test.ts: normalizing, blank means ungrouped, length limit, matching an existing group without regard to case
  • bun test packages/trpc/src/router/automation, packages/cli, packages/mcp: all pass
  • bunx tsc --noEmit in trpc, cli, mcp, shared
  • Real CLI run against the dev API on this branch:
    • list --group growth filters to that group.
    • update --group " Launch watch " stores "Launch watch".
    • --group with --clear-group is refused.
    • --clear-group sets the group to null.
    • The table view shows the GROUP column.
  • create with group through the API. Two automations created this way were then bulk-deleted from the desktop UI.

Docs

  • apps/docs/content/docs/cli/cli-reference.mdx: new flags and the GROUP column.

Summary by cubic

Adds automation groups across the API, CLI, and MCP, and fixes automation.update so edits that leave the schedule alone no longer drop schedules.

  • New automation.setGroup writes only the group column and is owner-only, much cheaper than update for single-field changes.
  • group is now an optional input on create and update (null ungroups) and an output of list and get.
  • New @superset/shared/automation-group helper trims and collapses whitespace, keeps case, caps names at 64 characters, treats blank input as ungrouped, and resolves a name to the organization's existing spelling when it matches a group case-insensitively.
  • CLI gained --group on create/update/list, --clear-group on update, and a GROUP column in list.
  • The MCP create and update tools accept group.

Bug Fixes

  • automation.update only re-syncs the schedule when rrule, dtstart, or timezone change, so updates like rename or --group keep every schedule.
  • list --group normalizes the filter like create and update do.

Compatibility

  • All tRPC changes are additive — a new procedure, new optional inputs, and one new output field — so older clients are unaffected.

Written for commit 2197d1c. Summary will update on new commits.

View guided diff Turn on auto-fix

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b09f287a-4772-4adf-86b4-92591bf46d45

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR changes how automation groups are managed across the API and its command-line and MCP callers.

Fix group-only updates deleting extra schedules before merging.

Findings

  1. P1 Grouping deletes saved schedules ▶
  2. P2 Group filter misses saved names ▶
Fix with agent prompt
### Issue 1
packages/cli/src/commands/automations/update/command.ts:227-231
Changing only the group through the CLI or MCP sends the new field through `automation.update`. For an automation with several schedules, that procedure reads the soonest schedule and calls `syncScheduleTrigger`, which deletes the others. Users lose scheduled runs even though they requested no schedule change.

Use `setGroup` for group-only edits, or skip schedule writes when schedule inputs are absent.

### Issue 2
packages/cli/src/commands/automations/list/command.ts:17-19
`list --group` does not collapse spaces as create and update do. Creating with `--group "Daily   Ops"` stores `Daily Ops`, but listing with the same argument returns no matches. Normalize the filter with `normalizeAutomationGroup` before comparing names.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds automation groups across the API, CLI, and MCP.

  • API callers can set and read an automation’s group.
  • CLI commands create, update, and filter automation groups.
  • MCP automation tools accept group names on create and update.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[CLI or MCP group edit] --> B[automation.update]
  B --> C[Read saved schedule]
  C --> D[syncScheduleTrigger]
  D --> E[Delete extra schedules]
  F[automation.setGroup] --> G[Write group only]
Loading

Reviews (1) · Last reviewed commit: "feat(api): group automations (setGroup, ..." · Reviewed by Greptile

Comment on lines +227 to +231
...(options.clearGroup
? { group: null }
: options.group
? { group: options.group }
: {}),

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.

P1 Grouping deletes saved schedules

Changing only the group through the CLI or MCP sends the new field through automation.update. For an automation with several schedules, that procedure reads the soonest schedule and calls syncScheduleTrigger, which deletes the others. Users lose scheduled runs even though they requested no schedule change.

Use setGroup for group-only edits, or skip schedule writes when schedule inputs are absent.

Knowledge Base Used: API, SDK, and RPC contracts

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/commands/automations/update/command.ts
Line: 227-231

Comment:
**Grouping deletes saved schedules**

Changing only the group through the CLI or MCP sends the new field through `automation.update`. For an automation with several schedules, that procedure reads the soonest schedule and calls `syncScheduleTrigger`, which deletes the others. Users lose scheduled runs even though they requested no schedule change.

Use `setGroup` for group-only edits, or skip schedule writes when schedule inputs are absent.

**Knowledge Base Used:** [API, SDK, and RPC contracts](https://app.greptile.com/-/switch-tenant?tenant=personal-org-6810&next=%2Fcustom-context%2Fknowledge-base%2Fparadevai%2Fparadev%2F-%2Fdocs%2Fapi-sdk-and-rpc-contracts.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +17 to +19
const group = options.group?.trim().toLowerCase();
if (!group) return rows;
return rows.filter((row) => row.group?.toLowerCase() === group);

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.

P2 Group filter misses saved names

list --group does not collapse spaces as create and update do. Creating with --group "Daily Ops" stores Daily Ops, but listing with the same argument returns no matches. Normalize the filter with normalizeAutomationGroup before comparing names.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/commands/automations/list/command.ts
Line: 17-19

Comment:
**Group filter misses saved names**

`list --group` does not collapse spaces as create and update do. Creating with `--group "Daily   Ops"` stores `Daily Ops`, but listing with the same argument returns no matches. Normalize the filter with `normalizeAutomationGroup` before comparing names.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ❌ View Branch
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

Copy link
Copy Markdown
Contributor

Review: minor issues. The change is additive and tRPC-compatible. CLI, tRPC (setGroup, owner-only) and MCP all work against a local API at be10819c, and CI is green.

  • Case variants make two groups: packages/trpc/src/router/automation/automation.ts:599, :716, :819. The server stores Launch watch and launch watch as separate groups because nothing calls matchExistingAutomationGroup. list --group (packages/cli/src/commands/automations/list/command.ts:20) still treats them as one. Resolve the name on the server before writing, or make the filter an exact match.
  • No regression test for the schedule fix: packages/trpc/src/router/automation/automation.ts:747 (be10819c). Verified that two schedules now survive a --group update, but no test guards it. setGroup has no tests either.
  • Nit: list --group filters on the client (list/command.ts:18), so MCP automations_list has no group filter. An optional group input on automation.list would cover all clients.
  • Nit: the MCP schema doesn't advertise the 64-character limit (packages/shared/src/automation-group.ts:29, max sits after .pipe). Mention it in .describe().

Full report with command output: https://app.superset.sh/page/pr-9209-review-automation-groups-api-cinbwc

…nd MCP)

- automation.setGroup: owner-only, writes only the group column
- optional group on automation.create and automation.update; list and get return it
- @superset/shared/automation-group normalizes names (trim, collapse spaces, max 64)
- CLI: create/update --group, update --clear-group, list --group and a GROUP column
- MCP: group on the automations create and update tools
automation.update re-synced the schedule through the single-schedule shape
on every call, so an update without schedule fields (rename, --group, MCP
group) kept only the soonest schedule and deleted the rest. It now syncs
only when rrule, dtstart, or timezone is passed.

list --group normalizes the filter like create and update do.
create, update, and setGroup resolve the name to the organization's
existing spelling first (lower(group_name) = lower(input)), so
"launch watch" from the CLI or MCP joins "Launch watch" instead of
starting a second group. A new name is stored as typed.

MCP group descriptions mention the 64-character limit and the matching.
@Kitenite
Kitenite force-pushed the kiet/automation-groups-api branch from 19f7d21 to 2197d1c Compare October 31, 2026 22:52
@Kitenite
Kitenite changed the base branch from kiet/automation-groups-migration to main October 31, 2026 22:52
@Kitenite
Kitenite merged commit 193e45e into main Oct 31, 2026
11 checks passed
@Kitenite
Kitenite deleted the kiet/automation-groups-api branch October 31, 2026 22:53

This branch was previously deployed

1 inactive deployment
preview — 2197d1cf Deployed Oct 31, 2026 by Kitenite via Deploy Marketing #13470
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