Skip to content

Comments

Feat/unified-results#884

Merged
elie222 merged 4 commits intomainfrom
feat/unified-results
Nov 1, 2025
Merged

Feat/unified-results#884
elie222 merged 4 commits intomainfrom
feat/unified-results

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Nov 1, 2025

Note

Introduces a unified results display component and updates the history API/UI to group executed rules per message with statuses, replacing older components.

  • Assistant UI:
    • Unified results: Replace ProcessResultDisplay and ExecutedRulesTable with ResultsDisplay/ResultDisplayContent showing rule name, status, conditions, actions, and “View rule”.
    • Pages updated: Integrate in FixWithChat, ProcessRules, History, TestCustomEmailForm, and landing components.
    • Date cell: New DateCell component; reused in cold-email lists.
  • History API (api/user/executed-rules/history):
    • Response now returns results grouped by messageId with { message, executedRules[] }.
    • Expanded rule selection fields; preserves status, reason, automated, createdAt.
  • Rule execution:
    • RunRulesResult now includes status; server actions propagate status from stored executions.
    • run-rules sets status (APPLIED/SKIPPED) and batches by createdAt.
  • Misc:
    • Improve label name resolution in getActionDisplay.
    • Bump version to v2.17.20.

Written by Cursor Bugbot for commit 5f182b8. Configure here.

Summary by CodeRabbit

  • New Features

    • Enhanced rule results display with improved organization and visual clarity.
  • Improvements

    • Added execution status information to rule results for better visibility into rule application outcomes.
    • Optimized label lookup to handle edge cases more reliably.
  • Version

    • Updated to v2.17.20.

@vercel
Copy link

vercel bot commented Nov 1, 2025

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

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Nov 1, 2025 10:39pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR refactors the assistant rules display system by extracting DateCell into a standalone component, replacing the ProcessResultDisplay module with a new ResultDisplay module, updating the executed rules API response shape to group results by message, and adding status tracking to rule execution results.

Changes

Cohort / File(s) Summary
Component Extraction
apps/web/app/(app)/[emailAccountId]/assistant/DateCell.tsx
New component that renders a date value with a tooltip using EmailDate and localized string formatting.
Component Removal
apps/web/app/(app)/[emailAccountId]/assistant/ExecutedRulesTable.tsx
Removed file; previously exported EmailCell, RuleCell, ActionItemsCell, DateCell, and OpenInGmailButton components. Functionality distributed to new modules.
Component Replacement
apps/web/app/(app)/[emailAccountId]/assistant/ProcessResultDisplay.tsx
Removed file; replaced by new ResultDisplay.tsx module with redesigned ResultsDisplay, ResultDisplay, and ActionSummaryCard equivalents.
New Result Display Module
apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx
New component module exporting ResultsDisplay, ResultDisplay, ResultDisplayContent, Actions, and PrettyConditions for rendering AI rule evaluation results with grouping, sorting, and interactive details.
Component Updates
apps/web/app/(app)/[emailAccountId]/assistant/FixWithChat.tsx, ProcessRules.tsx, TestCustomEmailForm.tsx
Updated imports from ProcessResultDisplay to ResultsDisplay and adjusted component usage accordingly.
History Refactor
apps/web/app/(app)/[emailAccountId]/assistant/History.tsx
Restructured to use new data.results shape instead of data.executedRules, updated data extraction, and locally defined EmailCell, RuleCell, OpenInGmailButton components.
Import Path Updates
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/ColdEmailList.tsx, ColdEmailRejected.tsx
Updated DateCell import path from ExecutedRulesTable to new standalone DateCell module.
Landing Page
apps/web/app/(landing)/components/page.tsx
Added imports for ResultsDisplay and ResultDisplayContent; added sample UI blocks demonstrating new components.
API Response Shape
apps/web/app/api/user/executed-rules/history/route.ts
Changed response structure from { executedRules, totalPages } to { results: [{ message, executedRules }], totalPages }; refactored message fetching to group by messageId and expand rule query fields.
Utility Functions
apps/web/utils/action-display.tsx, actions/ai-rule.ts, ai/choose-rule/run-rules.ts
Updated getActionDisplay to guard label lookup with labels?.length; added status field propagation in RunRulesResult; narrowed Rule type to Pick of specific fields; added status handling in run-rules execution paths.
Version Update
version.txt
Updated version from v2.17.19 to v2.17.20.

Sequence Diagram

sequenceDiagram
    participant API as API Route
    participant RunRules as runRulesAction
    participant ProcessRules as ProcessRules
    participant Display as ResultsDisplay

    Note over API: Old Flow (executedRules)
    API->>API: Fetch executedRules[]
    API-->>ProcessRules: { executedRules, totalPages }

    Note over RunRules: New Flow (results)
    RunRules->>RunRules: Execute rules<br/>Add status field
    API->>API: Group by messageId<br/>Fetch messages once
    API-->>ProcessRules: { results: [{message,<br/>executedRules}],<br/>totalPages }
    
    ProcessRules->>Display: results[]<br/>(with status)
    Display->>Display: Group by createdAt<br/>Sort descending
    Display-->>Display: Render per result<br/>(badge + details)

    Note over Display: ResultDisplay now includes<br/>status tracking & expanded<br/>rule metadata
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

Areas requiring extra attention:

  • Type narrowing in RunRulesResult.rule field and impact on all consuming code paths
  • API response structure change from executedRules to results and data mapping logic in History.tsx
  • Refactored message fetching strategy using lodash/groupBy in the executed-rules history route
  • Status field propagation through RunRulesResult and its integration in UI rendering logic

Possibly related PRs

  • Allow multiple rule matches #854: Implements multi-result rule handling and updates the RunRulesResult array shape and result display components, directly aligned with this PR's ResultsDisplay/ResultDisplay refactoring.
  • Open rules in modal instead of switching page #516: Modifies ProcessResultDisplay linking and navigation; replaced entirely by this PR's new ResultDisplay module.
  • Show already tested #666: Merges and handles existing executed-rule results in ProcessRules.tsx, related to status propagation and rule metadata enrichment in this PR.

Suggested reviewers

  • edulelis

🐰 The rules display hops to a new design,
DateCell stands solo, components align,
ResultDisplay groups with status and pride,
AI results sorted, no more to hide!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/unified-results

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 111523a and 5f182b8.

📒 Files selected for processing (16)
  • apps/web/app/(app)/[emailAccountId]/assistant/DateCell.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/ExecutedRulesTable.tsx (0 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/FixWithChat.tsx (2 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/History.tsx (7 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessResultDisplay.tsx (0 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx (3 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/assistant/TestCustomEmailForm.tsx (2 hunks)
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/ColdEmailList.tsx (1 hunks)
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/ColdEmailRejected.tsx (1 hunks)
  • apps/web/app/(landing)/components/page.tsx (3 hunks)
  • apps/web/app/api/user/executed-rules/history/route.ts (2 hunks)
  • apps/web/utils/action-display.tsx (1 hunks)
  • apps/web/utils/actions/ai-rule.ts (2 hunks)
  • apps/web/utils/ai/choose-rule/run-rules.ts (4 hunks)
  • version.txt (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@elie222 elie222 merged commit 19b7699 into main Nov 1, 2025
15 of 16 checks passed
Copy link
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 16 files

@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2025
@elie222 elie222 deleted the feat/unified-results branch December 18, 2025 23:05
@coderabbitai coderabbitai bot mentioned this pull request Dec 19, 2025
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