Repository navigation
feat(api): group automations (setGroup, CLI --group, MCP group) - #9209
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
[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. FindingsFix 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.SummaryAdds automation groups across the API, CLI, and MCP.
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]
Reviews (1) · Last reviewed commit: "feat(api): group automations (setGroup, ..." · Reviewed by Greptile |
| ...(options.clearGroup | ||
| ? { group: null } | ||
| : options.group | ||
| ? { group: options.group } | ||
| : {}), |
There was a problem hiding this 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
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.| const group = options.group?.trim().toLowerCase(); | ||
| if (!group) return rows; | ||
| return rows.filter((row) => row.group?.toLowerCase() === group); |
There was a problem hiding this 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.
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.
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
|
Review: minor issues. The change is additive and tRPC-compatible. CLI, tRPC (
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.
19f7d21 to
2197d1c
Compare
Stack (merge in order)
Summary
automation.setGroup({ id, group }): owner-only and cheap. It writes only the group column, unlikeupdate, which re-resolves the target and resyncs schedules.grouponautomation.createandautomation.update.listandgetnow returngroup.@superset/shared/automation-groupnormalizes names: trims, collapses spaces, keeps case, max 64 characters, and treats blank as ungrouped.automations create/update --group <name>,update --clear-group,list --group <name>(case-insensitive), plus a GROUP column inlist.groupon the automations create and update tools.tRPC compatibility (
packages/trpc/AGENTS.md)group, typedstring | null).--group.setGroupand readsgroup.Testing
bun test packages/shared/src/automation-group.test.ts: normalizing, blank means ungrouped, length limit, matching an existing group without regard to casebun test packages/trpc/src/router/automation,packages/cli,packages/mcp: all passbunx tsc --noEmitin trpc, cli, mcp, sharedlist --group growthfilters to that group.update --group " Launch watch "stores "Launch watch".--groupwith--clear-groupis refused.--clear-groupsets the group to null.createwithgroupthrough 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.updateso edits that leave the schedule alone no longer drop schedules.automation.setGroupwrites only the group column and is owner-only, much cheaper thanupdatefor single-field changes.groupis now an optional input on create and update (null ungroups) and an output of list and get.@superset/shared/automation-grouphelper 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.--groupon create/update/list,--clear-groupon update, and a GROUP column inlist.group.Bug Fixes
automation.updateonly re-syncs the schedule when rrule, dtstart, or timezone change, so updates like rename or--groupkeep every schedule.list --groupnormalizes the filter like create and update do.Compatibility
Written for commit 2197d1c. Summary will update on new commits.