feat(targeting): manage rules and guard activation - #181
joshdholtz wants to merge 12 commits into
Conversation
e5a622b to
e4f88c5
Compare
e4f88c5 to
8d83a6c
Compare
3630e6b to
fb80102
Compare
fb80102 to
b3f2d89
Compare
b3f2d89 to
6f0e951
Compare
6f0e951 to
7ff26bc
Compare
c54b62d to
c6da01f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6da01f. Configure here.
| Placements any `json:"placements,omitempty"` | ||
| FlowID string `json:"flow_id,omitempty"` | ||
| Checkpoints []any `json:"checkpoints,omitempty"` | ||
| } |
There was a problem hiding this comment.
Targeting responses drop rule position
Medium Severity
TargetingRule has no position field, so list/show --json drop the API's priority and the human views never show it. Reorder writes position, and active rules are first-match-wins, so agents and users cannot see current order before changing it.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit c6da01f. Configure here.
| if body.State != "inactive" && body.State != "active" && !(body.RuleType == "checkpoint" && body.State == "scheduled") { | ||
| return fmt.Errorf("state must be inactive or active (checkpoint rules also support scheduled)") |
There was a problem hiding this comment.
We support scheduled offering rules according to the docs… shouldn't we support them here too?
https://www.revenuecat.com/docs/tools/targeting#scheduling-targeting-rules
c6da01f to
86c6fdc
Compare


Why
Expose targeting rules alongside experiments and make JSON config discoverable for agents.
Third PR in the stack: #179 → #180 → #181.
Changes
rc targeting list|show|create|update|deletefor legacy rules and checkpoint creation, with API methods in the development overlay.config_fieldstorc schema targeting create|update, including required legacy schedule and placement fields plus condition operators, values, and context.--forceas well as confirmation to delete active or scheduled rules.Review note
Create, activation, and delete were exercised on a disposable project. The activation preview was checked without approving the write. Reorder still needs a live run; the agent permission layer blocked it during the manual pass.
Verification
go test ./...,go vet ./...,make gen, andmake previewpassed locally after rebasing onto current main.Note
Medium Risk
Mutations can change which Offering or Flow customers receive; guards reduce accidental live changes but misconfiguration still has production impact.
Overview
Adds
rc targeting(list,show,create,update,delete) wired to development v2/targeting_rulesvia a new API client service, command-surface docs, CLI coverage, and beta overlay entries.Create/update support legacy Offering rules (flags or
--config) and checkpoint rule creation;rc schema targeting create|updatedocuments schedule, placements, audiences vs conditions, and per-field condition rules. Human output shows audience, placements, schedule, and checkpoints; activation/update previews use readable condition summaries.Safety: non-inactive creates, activations, changes to active rules (including reorder via
position), and deletes require confirmation/--yes; deleting active or scheduled rules also requires--force. Client-side validation blocks conflictingaudience_idandconditions. Checkpoint updates are rejected on the update path.Tests cover API routes, CLI guards, schema content, and new output snapshots; the beta overlay seed script includes targeting paths.
Reviewed by Cursor Bugbot for commit 18c26be. Bugbot is set up for automated code reviews on this repo. Configure here.