Skip to content

feat(rules): preview - #607

Open
ccf-lisa[bot] wants to merge 1 commit into
effectors/13-rules-evaluatefrom
effectors/13b-rules-preview
Open

ccf-lisa[bot] wants to merge 1 commit into
effectors/13-rules-evaluatefrom
effectors/13b-rules-preview

Conversation

@ccf-lisa

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

Copy link
Copy Markdown
Contributor

What

rules.Preview evaluates a rule's when and its actions' targets against the evidence source's subjects without writing anything (user interface, preview):

  • how many subjects were evaluated and how many match now, the first matching subjects (100) and every matching subject's document (for effect documents);
  • per action: targets by identity with the subjects behind each, the reason when the effector action rejects an identity, and how many matching subjects resolved to nothing;
  • evaluation errors (subject, action or when, expression, error);
  • bounded: 10000 subjects, 100 listed subjects, errors and targets per action (options), with truncation flags.

In the PoC this lived in the HTTP handler; the evaluation core moves here so it is tested without routes. The preview route (stack 3) adds validation, effector status, warnings and the effect document of each allowed target on top of it.

Why

Plan: stack 2, PR 13 ("evaluation, targets and preview"), second half.

Test evidence

preview_integration_test.go (Postgres): matches, allowed and rejected targets with their subjects, no-target counts, when and target errors, fixed targets, nothing written (no matches, no rule errors); every limit and truncation; an empty source.

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/rules/ pass.

Size

Counted: 348 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: ec63f394-e698-408f-aca6-c05d8493d0af

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

rules.Preview evaluates a rule's when and its actions' targets against
the evidence source's subjects without writing anything: how many
subjects were evaluated and match, the matching subjects and their
documents, each action's targets with the subjects behind them (and why
the effector action rejects an identity), subjects that resolved to no
target, and evaluation errors. It is bounded (10000 subjects, 100
listed subjects, errors and targets per action, all configurable) and
reports truncation.

The preview route (stack 3) builds effect documents and effector status
on top of it.

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