# Jube-Parity — Next Phases Roadmap (F–L)

**Base branch for all child branches**: `feat/fraud-rules-jube-parity` (commit `eb5ebd9`).
**Parent plan**: [../jube-rules-implementation-plan.md](../jube-rules-implementation-plan.md) (covered Phases A–E + adapter_fraud).

This roadmap segregates the seven "Out of scope" items from the parent plan
into **dependency-ordered, individually-shippable branches**. Each branch has
its own plan markdown in this folder.

---

## Dependency graph

```
                          ┌────────────────────┐
                          │  Phase E  (merged) │
                          │  MwRisk.Pipeline   │
                          │  + adapter_fraud   │
                          └─────────┬──────────┘
                                    │
       ┌────────────────┬───────────┼───────────┬────────────────┐
       ▼                ▼           ▼           ▼                ▼
┌──────────────┐ ┌─────────────┐ ┌──────┐ ┌────────────┐  ┌──────────────┐
│  F. Request  │ │  G. TTL     │ │  H.  │ │  J. Case   │  │  L. Maker-   │
│  XPath /     │ │  Counter    │ │ Rule │ │  Workflow  │  │  Checker     │
│  Search Keys │ │  mgmt       │ │ Data │ │  mgmt      │  │  approval    │
│  UI          │ │  UI         │ │ Nodes│ │  UI        │  │  flow        │
└──────┬───────┘ └──────┬──────┘ └──┬───┘ └──────┬─────┘  └──────────────┘
       │                │           │            │
       │                │           │            ▼
       │                │           │      ┌──────────────┐
       │                │           │      │ I. Activation│
       │                │           │      │   Watcher    │
       │                │           │      │   real-time  │
       │                │           │      └──────────────┘
       │                │           │
       └────────────────┴───────────┴────────────────────────┐
                                                             ▼
                                                      ┌──────────────┐
                                                      │ K. Reproc-   │
                                                      │   essing     │
                                                      │   runner     │
                                                      └──────────────┘
```

Legend: arrow = "depends on (or shares schema with)". F/G/H are independent.
J unlocks I (watcher links to cases). K reads from any rule type, ships last.

---

## Branch list

| # | Branch | Plan | Risk | Size estimate |
|---|---|---|---|---|
| F | `feat/fraud-xpath-search-keys`        | [F-request-xpath-search-keys.md](F-request-xpath-search-keys.md) | Low    | S — UI only, schema exists |
| G | `feat/fraud-ttl-counters`             | [G-ttl-counters.md](G-ttl-counters.md)                           | Low    | S — UI + Redis writer |
| H | `feat/fraud-rule-builder-data-nodes`  | [H-rule-builder-data-nodes.md](H-rule-builder-data-nodes.md)     | Medium | M — evaluator + UI extension |
| I | `feat/fraud-activation-watcher`       | [I-activation-watcher.md](I-activation-watcher.md)               | Medium | M — PubSub + LiveView feed |
| J | `feat/fraud-case-workflows`           | [J-case-workflows.md](J-case-workflows.md)                       | High   | L — 8 tables, multi-page UI |
| K | `feat/fraud-reprocessing`             | [K-reprocessing-runner.md](K-reprocessing-runner.md)             | Medium | M — Oban worker + admin page |
| L | `feat/fraud-maker-checker`            | [L-maker-checker.md](L-maker-checker.md)                         | Medium | M — review queue + state machine |

---

## Suggested merge order

1. **F → G → H** (independent, parallel-safe) — round out the rule-authoring UX.
2. **J** — case mgmt is the biggest data surface; merge before I so watcher rows can link to a real case_id.
3. **I** — depends on J (case link) + Phase E (`SideEffect{:case}` already broadcast).
4. **L** — touches every rule type's changeset/`status_id`; cleanest after F/G/H stabilise.
5. **K** — reprocessing replays old payloads through `MwRisk.Pipeline.run/2`; safest once the pipeline + rule UIs are mature.

---

## Conventions (apply to every phase plan)

- **Branch lifecycle**: cut off `feat/fraud-rules-jube-parity`; squash-merge back to it; that branch eventually rebases onto `feat/ai-agentic-phase1`.
- **Migrations**: numbered `priv/repo/migrations/<utc_ts>_phase_<letter>_*.exs`.
- **LiveViews**: `apps/gateway_web/lib/gateway_web_web/live/admin/fraud/<name>_live.ex` matching the `Lists` / `Dictionaries` slide-over pattern (`max-w-lg`).
- **Sidebar**: extend `apps/gateway_web/lib/gateway_web_web/components/admin_layout.ex` "Fraud" section.
- **Tests**: schema changeset tests in `apps/infra_repo/test/`, LiveView smoke tests in `apps/gateway_web/test/`, engine logic in `apps/mw_risk/test/`.
- **Telemetry**: every new dispatch path emits `[:mw_risk, :<feature>, :*]` events.
- **Seeds**: append demo rows to `priv/repo/seeds.exs` so a fresh dev DB demonstrates the feature.
- **Commit prefix**: `feat(<scope>): …` where scope is the kebab-case feature name (e.g. `feat(xpath)`, `feat(ttl-counters)`).

---

## Out-of-scope for this roadmap

- Visualisation Registry / Datasource / Parameter mgmt UI (schemas exist; UI is a separate effort).
- ML Trial / Model Checkpoint / Experiment UI.
- HTTP Adaptation mgmt (`risk_http_adaptations` — used by Activation `enable_response_elevation` but no UI yet).
- Preservation Policy mgmt UI.
- Inline Function / Script Param admin (`risk_inline_*` tables).

These can each follow the same per-branch plan pattern when prioritised.
