Skip to content

fix(app): warn before invalidating policy acknowledgments#2980

Merged
tofikwest merged 3 commits into
mainfrom
tofik/warn-policy-ack-reset
May 30, 2026
Merged

fix(app): warn before invalidating policy acknowledgments#2980
tofikwest merged 3 commits into
mainfrom
tofik/warn-policy-ack-reset

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented May 30, 2026

Summary

  • Fix ENG-217 by adding a shared DS AlertDialog that warns before policy publishing invalidates existing employee acknowledgments.
  • Bulk publish now sums signedBy counts across affected policies and skips the warning when the count is zero.
  • Approval publish now captures the approver comment, warns when existing acknowledgments would be cleared, and only calls accept-changes after confirmation.
  • Removed the old one-off overview confirmation dialog and moved quick-action publish logic into a focused helper so touched files stay below 300 lines.

Verification

  • bunx vitest run "src/components/policies/PolicyAcknowledgmentInvalidationDialog.test.tsx" "src/app/(app)/[orgId]/overview/components/ToDoOverview.test.tsx" "src/app/(app)/[orgId]/policies/[policyId]/components/PolicyAlerts.test.tsx"
  • git diff --check
  • diff audit: no new @trycompai/ui or lucide-react imports added
  • bunx turbo run typecheck --filter=@trycompai/app still fails on existing baseline errors outside this change; no touched files appear in the final failure list.

Summary by cubic

Warn before publishing policies when it would invalidate existing acknowledgments, covering bulk publish and approval flows (ENG-217). No warning is shown when there are zero acknowledgments, and duplicate bulk publish submissions are blocked.

  • New Features

    • Added shared PolicyAcknowledgmentInvalidationDialog using @trycompai/design-system AlertDialog, plus helpers getPolicyAcknowledgmentCount and getPolicyAcknowledgmentTotal.
    • Bulk publish: sums signedBy across all unpublished policies, shows the dialog only when >0, posts to /api/policies/publish-all after confirm, and blocks in-flight duplicate submits.
    • Approval flow: preserves the approver comment, warns if acknowledgments will be cleared, and calls accept only after confirmation.
  • Refactors

    • Removed ConfirmActionDialog and moved quick-action logic into overview-quick-actions.tsx (usePublishAllPoliciesAction, status formatting, progress calc).
    • Added focused tests for the dialog, overview publish-all flow, duplicate-submission guard, and approval warnings.

Written for commit 8b0b863. Summary will update on new commits.

Review in cubic

@linear
Copy link
Copy Markdown

linear Bot commented May 30, 2026

ENG-217

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment May 30, 2026 9:10pm
comp-framework-editor Ready Ready Preview, Comment May 30, 2026 9:10pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped May 30, 2026 9:10pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 8 files

Confidence score: 3/5

  • There is a concrete user-impact risk in apps/app/src/app/(app)/[orgId]/overview/components/overview-quick-actions.tsx: the publish flow without confirmation can be clicked repeatedly while a request is in flight, which may trigger duplicate submissions.
  • Given the issue’s medium severity (6/10) and high confidence (8/10), this looks like more than a cosmetic edge case, so merge risk is moderate rather than minimal.
  • Pay close attention to apps/app/src/app/(app)/[orgId]/overview/components/overview-quick-actions.tsx - ensure publish actions are gated/disabled during in-flight requests to prevent duplicate publishes.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

@tofikwest
Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review it

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 30, 2026

@cubic-dev-ai review it

@tofikwest I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit f618429 into main May 30, 2026
11 checks passed
@tofikwest tofikwest deleted the tofik/warn-policy-ack-reset branch May 30, 2026 21:13
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