Skip to content

Capped number of automation actions to 20#27883

Merged
cmraible merged 1 commit into
mainfrom
ny-1285-cap-automation-actions
May 14, 2026
Merged

Capped number of automation actions to 20#27883
cmraible merged 1 commit into
mainfrom
ny-1285-cap-automation-actions

Conversation

@EvanHahn
Copy link
Copy Markdown
Contributor

@EvanHahn EvanHahn commented May 13, 2026

closes https://linear.app/ghost/issue/NY-1285

This was written entirely by GPT-5.5 with the following prompt:

Commit 63f353779c408ca781bd66ef9295f1f211c47cc2 added graph editing for automations. But you can pass an unlimited number of actions and edges.

Define a constant (called something like MAX_ACTIONS or MAX_AUTOMATION_ACTIONS), set to 20, that ensures that 20 is the maximum number of automation actions allowed in an edit request. In other words, you shouldn't be able to have more than 20 actions. You may also need to check the number of edges, or you may not—I'm not sure.

Use red/green TDD to verify this. You'll probably need to add one or two tests to ghost/core/test/e2e-api/admin/automations.test.js.

When you're done, create a branch and make the following commit:

Capped number of automation actions to 20

ref https://linear.app/ghost/issue/NY-1285

And then make a PR with the same title and description.

@EvanHahn EvanHahn requested a review from cmraible May 13, 2026 21:21
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6274bb43-3f46-44fb-b506-afe2ac992315

📥 Commits

Reviewing files that changed from the base of the PR and between 456e1fa and 914a36d.

📒 Files selected for processing (2)
  • ghost/core/core/server/services/automations/automations-api.ts
  • ghost/core/test/e2e-api/admin/automations.test.js

Walkthrough

This PR enforces a maximum of 20 automation actions by adding a MAX_AUTOMATION_ACTIONS constant and applying it as an upper bound in the zod validation schema for the actions array. The change includes E2E test coverage that verifies successful updates with exactly 20 actions and rejection of payloads with 21 actions, ensuring the constraint is properly enforced at the API boundary.

Possibly related PRs

  • TryGhost/Ghost#27878: Both PRs modify the automations edit payload validation in ghost/core/core/server/services/automations/automations-api.ts—the retrieved PR adds full graph/action/edge edit validation, and this PR extends it with an actions array length cap (20) plus corresponding E2E coverage.

Suggested reviewers

  • troyciesco
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a 20-action limit to automation actions, which matches the core implementation in the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation (closing NY-1285 issue) and the implementation approach (adding a MAX_AUTOMATION_ACTIONS constant and tests).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ny-1285-cap-automation-actions

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 and usage tips.

@cmraible cmraible merged commit ab3cb5b into main May 14, 2026
77 of 86 checks passed
@cmraible cmraible deleted the ny-1285-cap-automation-actions branch May 14, 2026 01:13
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