Skip to content

feat(effects): timers, backfill and prune - #611

Open
ccf-lisa[bot] wants to merge 1 commit into
effectors/15b-effect-machinefrom
effectors/16-effect-backfill-prune
Open

ccf-lisa[bot] wants to merge 1 commit into
effectors/15b-effect-machinefrom
effectors/16-effect-backfill-prune

Conversation

@ccf-lisa

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

Copy link
Copy Markdown
Contributor

What

API LLD, timers and backfill and retention (operations):

  • Engine.Backfill(rule, action?): evaluates one rule, or one of its actions, against every evidence stream (500 per page), each subject in its own transaction with the same rule-then-subject locking as evaluations; it stops when the rule is disabled or deleted (or the action gone) meanwhile.
  • Engine.Sweep(skip): re-evaluates subjects whose result depends on now (matches flagged now-dependent, watched non-matches) of the enabled rules whose when reads now, against those rules only, skipping rules a backfill is about to evaluate.
  • Prune(olderThan): effect history and deliveries, processed outbox rows, inactive effects the agent no longer holds, and soft-deleted rules and rule actions with their effects, past the 24h retention; never an effect the agent still holds (nor its rule and action).

Why

Plan: stack 2, PR 16. Ticks themselves came with the machine (15b), whose tests need them.

Test evidence

  • engine_integration_test.go: backfill (and the document it leads to), a backfill of one action only (and of a gone action), the sweep (skipped rules, now-dependent matches and watches, status-only rules untouched, repeated sweeps).
  • prune_integration_test.go: retention of history, deliveries, outbox rows, deleted rules and actions; inactive and held effects (kept until applied, then pruned with their rule and action).

Gate on this branch: go build ./... pass; go vet -tags integration ./... pass; make lint (golangci-lint v2.15.0, CI config) 0 new issues; make test pass; make swag no diff; go mod tidy no diff; go test -tags integration -p 1 on ./internal/service/effects/ pass.

Size

Counted: 555 lines.

🤖 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: 330fbc5e-63eb-40b3-83b0-fdcd4e9ed70a

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

internal/service/effects:
- Backfill evaluates one rule, or one of its actions, against every
  evidence stream (500 per page), each subject in its own transaction
  with the same rule-then-subject locking as evaluations; it stops when
  the rule is disabled or deleted, or the action is gone, meanwhile.
- Sweep re-evaluates the subjects whose result depends on now (matches
  flagged now-dependent and watched non-matches) of the enabled rules
  whose when reads now, against those rules only, skipping rules a
  backfill is about to evaluate.
- Prune deletes, past the 24h retention: effect history and deliveries,
  processed outbox rows, inactive effects the agent no longer holds, and
  soft-deleted rules and rule actions with their effects, except those
  whose effects the agent still holds.

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