Skip to content

fix(audit-sprint-5a): modal Phase 2 — 4 window.confirm migrations - #168

Closed
ejay-dev wants to merge 1 commit into
fix/audit-sprint-4c-modal-primitivesfrom
fix/audit-sprint-5a-modal-phase-2
Closed

fix(audit-sprint-5a): modal Phase 2 — 4 window.confirm migrations#168
ejay-dev wants to merge 1 commit into
fix/audit-sprint-4c-modal-primitivesfrom
fix/audit-sprint-5a-modal-phase-2

Conversation

@ejay-dev

Copy link
Copy Markdown
Owner

Summary

Builds on Sprint 4c's AlertDialog primitive (PR #167). Replaces 4 of the 7 remaining browser confirm() callers. Each migration also gains focus trap, ESC handler, aria-modal, and scroll lock — none of which the browser confirm provided.

Base branch: fix/audit-sprint-4c-modal-primitives (PR #167). Merge that one first.

Migrated

File Was Now
app/admin/sessions/page.tsx confirm('Revoke this session?') AlertDialog naming the user's display name
components/policies/policy-editor.tsx confirm('Are you sure?') for publish AlertDialog showing policy title + version
components/team/role-cell.tsx window.confirm for owner-involving role changes Tailored promote/demote AlertDialog; refactored handleChoose so optimistic-update logic is one path
components/vault/evidence-file-actions.tsx window.confirm for delete + window.alert for errors AlertDialog + toast.error (Sprint 4c's sonner Toaster)

Deferred to next Phase 2 PR / Phase 3

  • app/admin/components/member-management-actions.tsx — uses window.prompt for removal reason then window.confirm. Needs a Dialog with textarea (not AlertDialog), so it lands in form-modal phase.
  • app/admin/components/billing-action-buttons.tsx, app/admin/components/org-action-buttons.tsx, components/control-plane/admin-command-center.tsx — also window.confirm. All take a confirmText prop pattern with similar refactor.

Validation

  • npm run type-check clean
  • npm run lint 0 errors, 18 warnings (baseline)
  • npx jest 5319/5334 pass (no test changes — primitives covered by Sprint 4c's wrappers)

Test plan

  • After PR fix(audit-sprint-4c): modal primitives (Phase 1) + 2 proof migrations #167 + this merge: in /admin/sessions, click "Revoke" — AlertDialog appears with the user's name, ESC dismisses, focus traps
  • In /app/policies/[id]/edit, click Publish — AlertDialog appears with policy title + version
  • In team page, demote an owner to admin (or promote) — tailored AlertDialog appears
  • In vault, delete an evidence file — AlertDialog appears; force a delete error and verify the toast (not browser alert)

🤖 Generated with Claude Code

Builds on Sprint 4c's AlertDialog primitive. Replaces 4 of the 7
remaining browser confirm() callers. Each migration also gives the
surface focus trap, ESC, aria-modal, scroll lock — none of which
the browser confirm provided.

Migrated
  - app/admin/sessions/page.tsx — revoke session. Confirms with the
    user's display name, not just "Revoke this session?".
  - components/policies/policy-editor.tsx — publish gate. Shows the
    policy title + version in the dialog; the previous browser
    confirm only said "Are you sure?".
  - components/team/role-cell.tsx — owner-involving role change.
    Promotes/demotes get a tailored title. Refactored handleChoose
    into applyRoleChange + dialog opener so the optimistic-update
    logic stays in one place.
  - components/vault/evidence-file-actions.tsx — evidence delete +
    bonus: replaced two window.alert() calls with sonner toast.error
    (one in openFile error path, one in delete-failure path).

Deferred to Sprint 5b/Phase 3
  - app/admin/components/member-management-actions.tsx — uses
    window.prompt for the removal reason then window.confirm.
    Needs a Dialog with a textarea (not AlertDialog), so it lands
    in the form-modal phase.
  - app/admin/components/billing-action-buttons.tsx,
    app/admin/components/org-action-buttons.tsx,
    components/control-plane/admin-command-center.tsx — also use
    window.confirm. All take a confirmText prop pattern and follow
    a similar refactor; bundled into the next Phase-2 PR.

Validation
  - tsc -p tsconfig.typecheck.json: clean
  - eslint: 0 errors, 18 warnings (baseline)
  - jest: 5319/5334 pass (no test changes)

Built on top of fix/audit-sprint-4c-modal-primitives; merge that
first so the AlertDialog primitive is on main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 23, 2026 14:25
@vercel

vercel Bot commented May 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
forma-os Ready Ready Preview, Comment May 23, 2026 2:29pm

Request Review

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: aeb4f5a0-56f8-4e88-8b33-21999d371305

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/audit-sprint-5a-modal-phase-2

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the modal migration by replacing selected browser confirmation/alert flows with the shared AlertDialog and toast primitives introduced in the prior modal-primitives work.

Changes:

  • Migrates admin session revocation, policy publishing, owner role changes, and evidence deletion to AlertDialog.
  • Replaces evidence-file browser alerts with sonner toast errors.
  • Refactors role-change handling so owner-involving changes are staged before confirmation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
app/admin/sessions/page.tsx Adds pending revoke state and AlertDialog confirmation for session revocation.
components/policies/policy-editor.tsx Adds AlertDialog confirmation around policy publishing.
components/team/role-cell.tsx Adds owner role-change confirmation flow using AlertDialog.
components/vault/evidence-file-actions.tsx Adds delete confirmation dialog and toast-based error reporting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +109 to +110
in the organisation. The current version
({policy.version}) becomes the active one.
@ejay-dev
ejay-dev deleted the branch fix/audit-sprint-4c-modal-primitives May 23, 2026 16:55
@ejay-dev ejay-dev closed this May 23, 2026
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.

2 participants