Skip to content

Dashboard completeness: audit log, rollback UI, decision search #10

@jayzalowitz

Description

@jayzalowitz

Context

The dashboard covers the happy path but is missing the tools a user needs for daily oversight. Trust tier changes, spend tracking, and escalation events are logged to DB but have no viewer. The undo API exists but there's no button. Decisions can only be filtered by domain. For daily use, the user needs to audit, search, undo, and understand what happened — not just see a chronological list.

Claude Code estimate: ~3-4h

Current State (verified 2026-04-04)

Feature API DB UI
Decision list `GET /api/decisions/:userId?domain=X&limit&offset` `decisions` table Domain filter dropdown, inline expand
Decision explanation `GET /api/decisions/:decisionId/explanation` `explanation_records` Inline expand on click
Approval history `GET /api/approvals/:userId/history` `approval_requests` List with status badges
Undo/rollback `POST /api/feedback` with `type: "undo"` `feedback_events` + `execution_results.rollback_available` None
Trust tier audit `trust_tier_audit` table (migration 006) None
Spend tracking `spend_tracking` table (migration 008) None
Preference history `preference_history` table (migration 010) None
Skill gap log `GET /api/v1/skill-gaps/:userId` `skill_gap_log` table None

Proposed Change

1. Audit timeline page

New page at `/audit` — unified chronological feed of trust tier changes, spend events, escalation triggers, and preference changes. Each entry links to the decision that caused it.

2. Rollback button on executed decisions

"Undo" button on decisions where `rollback_available = true`. Modal with structured undo form. Disabled with tooltip for irreversible actions.

3. Advanced decision filtering

Date range, urgency, situation type, status, text search, sort options.

4. Decision detail page

Deep-linkable `/decisions/:id` with full explanation, candidate actions, execution result, feedback history, rollback button.

5. Skill gap visibility

Section on dashboard showing skills the twin wanted but couldn't use.

Acceptance Criteria

  1. Navigate to `/audit` → page loads with chronological feed of events from `trust_tier_audit`, `spend_tracking`, and `preference_history` tables
  2. Audit feed shows at least 3 event types with distinct visual indicators: tier change (shield icon or similar), spend event (dollar), preference learned (brain/lightbulb)
  3. Each audit entry includes timestamp, human-readable description, and clickable link to related decision (link resolves to `/decisions/:id`)
  4. Audit page supports filtering by event type (checkboxes for tier/spend/preference) and date range
  5. Decision card with `rollback_available: true` shows enabled "Undo" button
  6. Decision card with `rollback_available: false` shows disabled "Undo" button with tooltip "This action can't be undone"
  7. Click "Undo" → modal opens with 4 fields: what went wrong (required text), severity (dropdown: minor/moderate/severe), which step (optional text), preferred alternative (optional text)
  8. Submit undo form → `POST /api/feedback` called with `type: "undo"` and `undoReasoning` → success toast: "Action reversed. I'll remember this for next time." → button changes to "Undone"
  9. Filter decisions by date range → only decisions within range shown → result count displayed
  10. Filter decisions by situation type → dropdown shows all situation types present in data → results update immediately
  11. Filter decisions by status (auto-executed / approved / rejected / expired / pending) → results correct
  12. Text search across decision summaries → results highlight matching text → empty search returns all
  13. Navigate to `/decisions/:id` directly via URL → full detail page loads with explanation, candidates, execution result, feedback history
  14. Decision detail page shows all candidate actions that were considered with their risk assessments, not just the selected one
  15. Skill gap section on dashboard shows "Skills I wish I had" with action type, adapter, and frequency count — or "No skill gaps detected" if empty
  16. All 432 existing tests pass
  17. PR passes `/review` before merge

Testing Plan

Layer What Count
Unit Audit timeline query — merges 3 tables, sorts chronologically +3
Unit Decision filter query — each filter param independently +5
Unit Undo form validation (required fields, severity enum) +2
Integration Audit page loads with seed data events +1
Integration Undo flow: click → modal → submit → feedback recorded → UI updates +1
Integration Decision detail page: deep link loads all sections +1
Integration Filter combinations: domain + date range + status +1

Files Reference

File Change
`apps/web/public/js/app.js` Add `/audit` and `/decisions/:id` routes
`apps/web/public/js/pages/audit.js` New: audit timeline page
`apps/web/public/js/pages/decisions.js` Advanced filters, detail page, undo button
`apps/web/public/js/components/undo-modal.js` New: structured undo form modal
`apps/web/public/js/pages/dashboard.js` Skill gap section
`apps/api/src/routes/audit.ts` New: `GET /api/audit/:userId` merging 3 tables
`apps/api/src/routes/decisions.ts` Extended filters: from, to, urgency, situationType, status, search
`packages/db/src/repositories/audit-repository.ts` New: unified audit query
`packages/db/src/repositories/decision-repository.ts` Extended filter query

Out of Scope

  • Real-time audit feed via SSE (audit page is pull-based, refresh to see new events)
  • Bulk undo (one at a time)
  • Export audit log to CSV/PDF

Related


Working Context Protocol

During implementation, maintain two sources of truth to survive context compaction:

  1. Local context file: Write progress, decisions, and blockers to .context/issue-10-dashboard.md (gitignored). Update this file after each meaningful step. On compaction, re-read this file to restore state.
  2. GitHub issue: Post progress comments on #10 at key milestones (subtask complete, blocker hit, design decision made). Reference the issue URL in your conversation so it persists across compaction: Dashboard completeness: audit log, rollback UI, decision search #10

This ensures no quality loss across compaction events — the local file has granular state, the GitHub issue has durable history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions