Skip to content

feat(api): change rules and rule actions - #622

Open
ccf-lisa[bot] wants to merge 2 commits into
effectors/22b-rules-createfrom
effectors/22c-rule-changes
Open

ccf-lisa[bot] wants to merge 2 commits into
effectors/22b-rules-createfrom
effectors/22c-rule-changes

Conversation

@ccf-lisa

@ccf-lisa ccf-lisa Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

What

Rule routes, part 2: everything that lists or changes a saved rule, each change applied to its effects through the rule lifecycle (#612) in the transaction that saves it.

Route Lifecycle
GET /api/rules Paginated, newest first; source, enabled (true/false, else 400)
PUT /api/rules/{id} Name, description, trigger (the source can't change); a changed when/for re-evaluates (RuleTriggerChanged) and a changed when clears its errors
PUT /api/rules/{id}/enabled RuleDisabled / RuleEnabled; the same state again is a no-op
DELETE /api/rules/{id} Soft-deletes the rule and its actions (RuleDeleted: effects cleared as removed)
POST /api/rules/{id}/actions Validated like a new rule's actions (422 paths without the actions[i]. prefix); ActionCreated
GET /api/rules/{id}/actions/{actionId} One action
PUT /api/rules/{id}/actions/{actionId} ActionRepointed (agent or effector action), ActionChanged (target or timing), ActionParamsChanged (only params: redelivered); errors cleared when the target changes
DELETE /api/rules/{id}/actions/{actionId} ActionDeleted

Changing a rule or its actions needs the source read like creating one; deleting doesn't.

Why

Plan: stack 3, PR 22 (second part).

Test evidence

rule_changes_integration_test.go: pagination and the enabled filter (400 on another value), create disabled (no lifecycle), ambiguous agent name, stale agent saved degraded, 403s without the source read (update, enable, add action; delete allowed), trigger update (name only: nothing; when: re-evaluated, errors cleared, actions kept; 422/404), enable/disable/delete (soft-deleted actions kept), action create/get/timing change/repoint/no-op/422/delete with the change kinds in order, params on the action routes (paths, params-only change, same params no-op, params with timing, clearing params, locked field, schema removed).

Gate on this branch: go build ./... pass; go vet -tags integration ./... pass; golangci-lint v2.15.0 (shared CI config, incl. unconvert) 0 new issues; make test pass; make swag no diff (regenerated docs/ committed here); go mod tidy no diff; go test -tags integration -p 1 on ./internal/api/handler/... pass.

Size

Counted: 810 lines (added + removed, tests included; docs/docs.go and docs/swagger.* excluded).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

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: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5a88a60a-5ac4-42ed-bebf-30b157e5bd1c

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

ccf-lisa Bot and others added 2 commits December 2, 2026 11:04
GET /api/rules (paginated), PUT /api/rules/{id}, PUT
/api/rules/{id}/enabled, DELETE /api/rules/{id} and the rule action
routes (POST, GET, PUT, DELETE /api/rules/{id}/actions/{actionId}),
each change applied to effects through the rule lifecycle in the same
transaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gusfcarvalho gusfcarvalho left a comment

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.

ccf-review: APPROVE

no findings.

Stack (gh stack 604): #592 → #593 → #594 → #595 → #596 → #597 → #598 → #599 → #600 → #601 → #602 → #603 → #605 → #606 → #607 → #608 → #609 → #610 → #611 → #612 → #613 → #614 → #615 → #616 → #617 → #618 → #619 → #620 → #621 → #622 → #623 → #624 → #625 → #626 → #627 → #628 → #629 → #630

This branch has not been deployed

No deployments
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.

1 participant