Skip to content

feat(email): the Email Actions screens and a Home card (EA-7) - #641

Open
privatejoel wants to merge 1 commit into
claude/email-ea6-escalationfrom
claude/email-ea7-ui
Open

privatejoel wants to merge 1 commit into
claude/email-ea6-escalationfrom
claude/email-ea7-ui

Conversation

@privatejoel

Copy link
Copy Markdown
Collaborator

Summary

EA-7 of the email accountability plan (#634, section 6.10). This PR adds the screens for the module in the existing design system and navigation. It adds no new API, only two small read fields.

Stacked on #640 (EA-6) ← #639 ← #638 ← #637 ← #636 ← #635 ← #619.

  • The new screen is screens/email-actions.tsx, under nav id email-actions in the Comms & Security group. Its tabs are on the hash (?sub=):
    • Dashboard: KPIs and lists for critical outstanding, high priority, overdue, awaiting verification, awaiting external response, escalated, and recently performed (the last 7 days).
    • My queue (scope=mine) and Review (awaiting_review).
    • Manager: only for email.view_all. It shows unassigned critical actions, workload and completion by owner (open, overdue, escalated, performed in 7 days), and the escalation history.
    • Mailboxes:
      • It shows when the module is off and when the tenant is in observe mode.
      • Connect Outlook or Gmail. A button is disabled when the tenant has no app registration for that provider.
      • It shows the health of each mailbox: the status or pause reason, the last success, the requests today against the budget, the failures and the last error.
      • Resume, Sign in again, Disconnect (with a confirm).
    • Rules: add, turn off and delete rules. The tenant scope shows only when the server says the user may edit tenant rules.
  • The action detail (?id=) shows:
    • the mail reference with a link that opens the original message;
    • the reasons, in two lists, Facts and Inferences;
    • the requested action, what completes it, and what happens if it is missed;
    • the customer and the sales order (links), the owner, the backup, and the due time with its source and timezone;
    • the evidence and the audit history.
  • The controls in the detail:
    • Confirm (after review), start, back to pending, record evidence, cancel or reopen (with a reason), the business outcome, priority and action-type corrections (with a reason), the forward target, and reassign. Confirm and reject on evidence are shown only with email.verify.
    • Every change sends the item version. The server decides each permission (403 or 404). The screen only hides what a role cannot use.
  • Filters go on the hash: priority, state (open, overdue, escalated, awaiting verification, pending, in progress, closed), mailbox and "no owner". customer and order come from links and show as removable chips.
  • A Home card, "My email actions", sits beside My Queue for roles that can open the screen. It shows the open count, the overdue count and the first 5 actions.
  • Wiring:
    • routes.ts, nav.ts.
    • An rbac.ts MATRIX row: writers yes, viewer no (the rows carry mail subjects).
    • The AnvilBackend.emailActions client namespace.
    • The OAuth callback now returns to #/email-actions?sub=mailboxes&mailbox=<result>.
  • Small API additions:
    • GET /api/email/connections returns actions_mode.
    • Closed actions are sorted with the latest first.

Deploy notes

  • No migration. npm run build makes the assets in the Vercel build. The built assets are not committed.
  • An admin can hide the new nav item for a role in Admin > Navigation, as for any other item.

Tests

  • src/v3-app/screens/email-actions.test.tsx (12 tests):
    • The dashboard sections, the list calls (open and closed), and a row with no owner.
    • The manager tab is hidden from a sales engineer and shown to a sales manager, with the unassigned and workload views.
    • The detail shows facts and inferences apart, the evidence and the history. Start sends the version. Cancel needs a reason, and with no reason it sends nothing. Record evidence sends the note.
    • Only email.verify shows confirm on evidence, and confirm sends the evidence ID and the reason.
    • An action that the server does not return shows "not found".
    • The mailboxes view shows observe mode, the pause and a disabled Gmail button. Connect, resume and disconnect call the API.
    • A rule for "my mailboxes" is added with its effect, and no tenant scope is offered to a non-admin.
    • A filter goes on the hash and into the list call.
  • src/v3-app/screens/home-email-actions.test.tsx (2 tests): the card lists the caller's actions (scope=mine) with the overdue count and opens one. A viewer gets no card and no call.
  • api-email-connections.test.js: actions_mode reads as observe when the setting is missing. api-email-actions-api.test.js: closed actions come with the latest first.
  • lib/nav.test.ts: the nav count is now 57. The test name said 52 and asserted 56, so I corrected both.

Mutation check: I broke each screen rule, ran the two screen test files, and restored the code. All 9 mutations failed the tests:

  • the manager tab shown to everyone;
  • the evidence decision shown to everyone;
  • start sent with no version;
  • cancel sent with no reason;
  • the Home card shown for every role;
  • a filter not put on the hash;
  • facts and inferences in one list;
  • connect enabled with no app registration;
  • the tenant rule scope offered to everyone.

Gates:

  • npm run check, including tsc: pass.
  • npm run lint: 0 errors. The repo's ESLint config does not lint .tsx files.
  • npm run build: pass.
  • npm run verify: pass.
    • The cross-screen audit first reported that fail and Filters are declared in this screen and used by other screens, so I renamed them to failNotice and ActionFilters.
    • I restored the unrelated rewrites of the audit docs.
  • npm run eval:golden: pass.
  • NODE_OPTIONS=--no-experimental-webstorage npx vitest run: 639 files, 7,676 tests, all pass.

Not covered

  • I did not open the screens in a browser. The tests render them with jsdom only.
  • The prompts for reasons and notes use window.prompt, as the stock-exceptions screen does. A modal form is a later polish.
  • No editor for the policy. PUT /api/email/policy exists, and EA-8 adds a read-only view.
  • The reassign list comes from GET /api/admin/members. A user who may not reassign gets a 403 message from the server.

🤖 Generated with Claude Code

One screen under Comms & Security: a dashboard (critical, high, overdue,
awaiting verification, awaiting external, escalated, recently performed),
my queue, review, a manager view (unassigned critical, workload and
completion by owner, escalation history), mailboxes (connect, health,
resume, disconnect) and rules. The action detail shows facts and
inferences apart, evidence and history, with state, correction,
reassignment and evidence controls. Filters ride on the hash. A Home card
lists the caller's open email actions. The OAuth callback returns to the
mailboxes view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
anvil Ready Ready Preview Oct 26, 2026 2:40am UTC

This branch was successfully deployed

1 active deployment
Preview — 643f1a43 Deployed Oct 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant