Mandatory first step: 00_MASTER_IMPLEMENTATION_CONTRACT.md (read and applied).
Build the recommendation-focused experience on top of the governed recommendation APIs (Prompts 17 and 18): a reviewer can see what the platform suggested, why, on what evidence, and act on it — accept, reject, partially useful, resolve, assign an owner, add notes — with every action governed, tenant-scoped, rate-limited, logged, and recorded in an append-only trail.
recommendation/governance.py (lifecycle states, transition table), governance_policy.py (RBAC + ABAC), models.py (Recommendation, ProvenancedClaim-shaped evidence)identity/models.py (RecommendationRecord, RecommendationFeedbackEvent), migration f3a6b9c2d8e1 and head a4c7e2b9d6f5identity/repositories/recommendation_governance.py, identity/repositories/semantic_catalog.py::_apply_transition (Prompt 27’s race-safe transition helper)api/recommendation_governance.py, its schemas, api/recommendation_persistence.py (the only creation path), api/rate_limit.pysecurity/audit_log.py (log_security_event), identity/repositories/audit.py (persisted audit table)tests/test_api_recommendation_governance.py, the repository and policy suitesSemanticReview.tsx (review-dashboard pattern), TruthLevelBadge (Prompt 30), tenantAdminApi.ts/queries.ts (the only prior consumers of the recommendation list and metrics), AppShell.tsx review-tab gating, the i18n locale filessubmit_feedback validated the in-memory status and then committed an unconditioned UPDATE. Two reviewers acting on the same record could both succeed. The same bug class Prompt 27 fixed for the semantic catalog.recommendation/governance.py) — unchanged.authorize_recommendation_action) — extended with two actions only.RecommendationRecord / RecommendationFeedbackEvent tables and the append-only audit trail — extended, not replaced.UPDATE race fix, applied to this table (the same pattern, written for recommendation_records).enforce_api_action_rate_limit, log_security_event, resolve_actor_tenant_id, require_local_user.TruthLevelBadge from the analytics panels (Prompt 30) — shared, not duplicated.useTenantUsers for the admin owner picker.tenantAdminApi’s two read calls now re-export from the new recommendationApi.ts (single home for the endpoint wrappers).Created
identity/migrations/versions/b7e2d4a1c9f0_recommendation_actions.pytests/test_api_recommendation_actions.py, tests/test_recommendation_actions_repository.pyfrontend/src/lib/recommendationApi.ts, frontend/src/lib/recommendationDisplay.ts (+ test)frontend/src/components/recommendations/RecommendationList.tsx, RecommendationDetail.tsxfrontend/src/pages/Recommendations.tsx (+ test)31_RECOMMENDATION_ACTION_DASHBOARD_CONTRACT.mdModified
identity/models.py — RecommendationRecord.owner_user_id; RecommendationFeedbackEvent.event_type, detailidentity/repositories/recommendation_governance.py — conditional transitions; add_note, assign_owner, owner_display_names; list filtersrecommendation/governance_policy.py — ADD_NOTE, ASSIGN_OWNER (analyst+, tenant-gated)api/recommendation_governance.py, api/recommendation_governance_schemas.py — new routes, filters, owner display names, logging, rate limitsfrontend/src/lib/types.ts, frontend/src/lib/tenantAdminApi.ts, frontend/src/hooks/queries.tsfrontend/src/App.tsx, frontend/src/components/layout/AppShell.tsx (nav tab gated on the existing admin/analyst check), five i18n/locales/*/translation.json (nav label)docs/navigation-and-actions.md, README.md, CLAUDE.md| Route | Change |
|---|---|
GET /recommendations |
New optional owner_user_id and unassigned query params. Response gains owner_user_id, owner_display_name |
GET /recommendations/{id} |
Response gains the same two owner fields |
GET /recommendations/{id}/events |
Each event gains event_type (default status_change) and detail |
POST /recommendations/{id}/notes |
New. Body {note} (1–4000 chars). Never changes status |
POST /recommendations/{id}/owner |
New. Body {owner_user_id} (null clears). Missing, inactive, cross-tenant, or non-reviewer owner → the same 404 |
POST /recommendations/{id}/feedback, /resolve, /expire |
Unchanged contract. Now rate-limited and logged |
No existing field was removed or renamed. Existing clients ignore the new fields.
Migration b7e2d4a1c9f0 (revises a4c7e2b9d6f5), purely additive:
recommendation_records.owner_user_id (nullable FK to users, ON DELETE SET NULL, indexed)recommendation_feedback_events.event_type (NOT NULL, server default status_change, so every existing row is valid)recommendation_feedback_events.detail (nullable JSON)Apply with alembic -c identity/alembic.ini upgrade head. downgrade() removes only what upgrade() added.
No new settings. Relevant existing ones:
API_ACTION_RATE_LIMIT_PER_MINUTE (default 20) — per-IP, per-action budget. Applies independently to recommendation_feedback, recommendation_resolve, recommendation_expire, recommendation_note, recommendation_owner.ENABLE_RECOMMENDATION_PERSISTENCE — unchanged; still the only way a record is created.authorize_recommendation_action, and only then consumes rate-limit budget. A denied caller cannot exhaust a reviewer’s budget (tested).warning (event=recommendation_owner_rejected), including the requested user id, so operators can see probing attempts.resolve_actor_tenant_id), never from the request. The frontend sends no tenant id (asserted in a test).users.tenant_id with the record’s tenant_id, so the check does not depend on the session’s view of the caller./tenant-admin/users, already tenant-scoped).IN query for owner names, regardless of list size. Unchanged limit=200 cap.UPDATE plus one INSERT plus one COMMIT. The conditional WHERE uses the primary key and the status column (indexed).refresh read each (to capture the current status for the audit row).Backend (tests/test_api_recommendation_actions.py, tests/test_recommendation_actions_repository.py) — 46 tests:
null (never an email), clear with null, previous-owner recorded, non-reviewer refused, cross-tenant and nonexistent indistinguishable, extra fields rejected.unassigned precedence and malformed UUID → 422), batched owner names.accepted record; one resolves; the other’s stale attempt is refused by the conditional UPDATE, and exactly one resolved event exists.WHERE status = expected guard makes the race test fail. Restored afterward.Frontend (lib/recommendationDisplay.test.ts, pages/Recommendations.test.tsx):
require_local_user. OIDC-authenticated reviewers get 401 — the same disclosed limitation as the rest of the governance API.owner_assigned event records the owner’s id, not their name, because the event row stores ids only.api/rate_limit.py’s existing keying for these routes). Users behind one NAT share a budget of 20 actions a minute per action type.operations category never fires live (inherited from Prompt 14/17). Its recommendations are shown if they exist, but this dashboard does not manufacture them.Prompt 32 (final in the series) should close the remaining operational gaps across the platform: a cursor-paginated recommendations list, OIDC support for the governance routes, and an end-to-end browser test of the lifecycle with a real database.