You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Pol roster_excluded policy layer and API enforcement
Store exclusion on Pol, filter GET /api/congress roster, block celebration
and payment intent before Stripe when roster_excluded is true. Extend vest
query for payment validation without changing watcher has_stakes jobs.
- `Pol.js` - Politicians and candidates (includes `has_stakes` from watchers and policy `roster_excluded` / `roster_exclusion_*`; do not use `has_stakes` for policy exclusion — see `42-pol-roster-exclusion.mdc`)
description: Pol roster exclusion policy (separate from has_stakes watcher logic)
3
+
globs:
4
+
- 'models/Pol.js'
5
+
- 'services/congress/polRosterEligibility.js'
6
+
- 'controller/congress/pols.js'
7
+
- 'controller/congress/vest.js'
8
+
- 'services/celebration/orchestrationService.js'
9
+
- 'routes/api/payments.js'
10
+
alwaysApply: false
11
+
priority: 3
12
+
---
13
+
14
+
# Pol roster exclusion (policy layer)
15
+
16
+
## Separation from has_stakes
17
+
18
+
- `has_stakes` is computed by watcher jobs (e.g. `challengersWatcher`). Do not flip or overload it for policy exclusions (Speaker, left office, data holds, etc.).
19
+
- Use `roster_excluded` and related fields on `Pol` for POWERBACK policy exclusions.
20
+
21
+
## Pol schema (see `models/Pol.js`)
22
+
23
+
- `roster_excluded` (Boolean, default false)
24
+
- `roster_exclusion_reason` (String)
25
+
- `roster_exclusion_category` (String; conventions listed in `ROSTER_EXCLUSION_CATEGORIES` in `services/congress/polRosterEligibility.js`)
- `controller/congress/vest.js` requires both `has_stakes` and not `roster_excluded` for payment validation.
34
+
35
+
## User-facing errors
36
+
37
+
- HTTP 400 with `code: POL_ROSTER_EXCLUDED` and plain-language `message` from `polRosterEligibility.js`. Client surfaces via `usePaymentProcessing` rejection reasons.
Copy file name to clipboardExpand all lines: docs/API.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,18 +41,20 @@ Each category is a link to its [`Routes`](../routes/) or relevant folder.
41
41
-[`resolveDonation`](../controller/celebrations/resolve.js) converts a Celebration into a donation by updating the document
42
42
-[`sendReceipt`](../controller/celebrations/receipt.js) emails Celebration receipt to user (uses refactored email system)
43
43
-[`getWhatPolsHaveInEscrow`](../controller/celebrations/find/params/escrowed.js) sums all donation amounts for each politician from across the userbase
44
+
-**Roster exclusion**: HTTP `400` with `code: POL_ROSTER_EXCLUDED` when `pol_id` is a `Pol` with `roster_excluded: true` — enforced in [`orchestrationService`](../services/celebration/orchestrationService.js) before create. See [`specs/pol-roster-exclusion.md`](../specs/pol-roster-exclusion.md).
44
45
45
46
### **[`Congress`](../routes/api/congress.js)**
46
47
47
-
-[`getPolsByIds`](../controller/congress/methods/put/pols.js) returns a group of **Politicians** based on the ID(s) provided
48
-
-[`getPol`](../controller/congress/methods/get/pol.js) returns a single **Politician's** document
49
-
-[`getBill`](../controller/congress/methods/get/bill.js) returns a single **Bill's** document
48
+
-`GET /api/congress/` — List politicians for the **selectable roster** (lobby carousel, search). [`getPols`](../controller/congress/pols.js): `has_stakes: true` and `roster_excluded` not true.
49
+
-`GET /api/congress/members/:pol` — Single politician document ([`getPol`](../controller/congress/pol.js)); requires authentication.
-**[Donation Limits](./donation-limits.md)** - Annual and election cycle resets
33
33
-**[Donor Validation](./donor-validation-comprehensive.md)** - FEC "best efforts" validation system
34
+
-**[Pol roster exclusion](../specs/pol-roster-exclusion.md)** - Policy exclusions from selectable roster and new Celebrations (vs `has_stakes` watchers)
Copy file name to clipboardExpand all lines: docs/background-jobs.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,7 @@ All background jobs are orchestrated through the `runWatchers` system, which:
66
66
- Tracks challenger status changes (appeared, disappeared, reappeared)
67
67
- Tracks incumbent dropouts
68
68
- Updates `has_stakes` flags based on competitive race status
69
+
-**Policy note**: POWERBACK exclusions from the selectable roster use `Pol.roster_excluded`, not watcher toggles on `has_stakes` alone. See [`specs/pol-roster-exclusion.md`](../specs/pol-roster-exclusion.md).
69
70
- Sends email alerts to users in affected districts
Copy file name to clipboardExpand all lines: docs/docking-pols-runbook.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,4 +90,4 @@ If Senators appear in the docking collection, the Congress.gov API's `currentMem
90
90
-`scripts/add-members-to-docking.js` -- Staging script for specific members
91
91
-`services/utils/dockingManager.js` -- DockingManager class and CLI
92
92
-`jobs/houseWatcher.js` -- Background job that auto-stages new members
93
-
-`models/Pol.js` -- Pol schema definition
93
+
-`models/Pol.js` -- Pol schema definition (`has_stakes`, policy `roster_excluded`; see [`specs/pol-roster-exclusion.md`](../specs/pol-roster-exclusion.md))
0 commit comments