Skip to content

feat: add MR/issue grouping view to approval dashboard#8

Merged
andyxhadji merged 21 commits into
mainfrom
tortoiseshell-hydrangea
May 30, 2026
Merged

feat: add MR/issue grouping view to approval dashboard#8
andyxhadji merged 21 commits into
mainfrom
tortoiseshell-hydrangea

Conversation

@andyxhadji
Copy link
Copy Markdown
Owner

Summary

Add "By Source" tab to the approval dashboard that groups related approvals by their originating MR or issue. This allows engineers to review all work from a single MR/issue in one place, see all diffs together via a tabbed viewer, and batch approve/reject with an option to review individually.

Changes

Backend

  • Source metadata schema: Added SourceMetadata model to nd/schemas.py
  • Worker agent integration: Extract source URL, type, and identifier from task metadata in all app.pause() calls
  • Comprehensive tests: 5 new unit tests covering MR and issue metadata extraction

Frontend

  • Type definitions: Added GroupedApproval and DiffTab interfaces
  • Parser with fallback: Extracts source metadata from pause context (new executions) or parses URLs (old executions)
  • Grouping utilities: groupApprovalsBySource() and aggregateDiffs() functions
  • React hooks: useGroupedApprovals() and useGroupedApprovalSubmit() for data fetching and batch submission
  • UI components:
    • TabbedDiffViewer - Combined + individual diff tabs
    • GroupedApprovalCard - Displays grouped approvals with batch actions
    • GroupedApprovalList - Container with empty/ungrouped states
  • App integration: "By Source" tab added as first/default tab
  • Tests: 7 unit tests for grouping/diff utilities, 3 E2E tests for UI structure

Features

Source Grouping: Approvals grouped by originating MR/issue
Tabbed Diff Viewer: Combined diff + individual tabs for each execution
Batch Approval: Approve/reject all with single click
Individual Review Mode: Mix decisions within a group
Backward Compatible: Fallback parsing for old executions without metadata

Test Results

  • Backend: 143/143 unit tests passed
  • Frontend: All grouping-related tests passed
  • TypeScript: Compiles without errors
  • Production build: Successful

Screenshots

The "By Source" tab is now the default view, grouping all approvals by their originating MR or issue:

  • Header shows source identifier with link
  • Approval count badges (Spec, Roborev, Post)
  • Tabbed diff viewer with Combined + individual tabs
  • Batch actions: Approve All, Reject All, Review Individually
  • Optional feedback textarea for batch submissions

Documentation

  • Design spec: docs/superpowers/specs/2026-05-30-mr-issue-grouping-design.md
  • Implementation plan: docs/superpowers/plans/2026-05-30-mr-issue-grouping-plan.md
  • README updated with new features and UI tabs section

🤖 Generated with Claude Code

fh-ahadjigeorgiou and others added 20 commits May 30, 2026 09:18
Add comprehensive design document for grouping approvals by their originating
MR or issue in the approval dashboard. The spec covers backend source metadata
extraction, frontend grouping logic, tabbed diff viewer with combined view,
and batch approval workflow with individual review mode.

Key features:
- Group related approvals (spec, roborev, response) by source
- Tabbed diff viewer showing all changes in one place
- Batch approve/reject with "Review Individually" toggle
- Backward compatible with existing executions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive 18-task implementation plan for the grouped approval view.
Covers backend source metadata extraction, frontend grouping/diff aggregation,
UI components, testing, and integration.

Each task broken into 2-5 minute steps with actual code, test commands,
and expected outputs. Follows TDD with frequent commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SourceMetadata model with source_url, source_type, and source_identifier
fields to support grouping approvals by their originating MR or issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add _extract_source_metadata helper to derive source URL, type, and identifier
from task metadata. Include in all app.pause() calls for grouping support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix bug in _parse_task_body: issue tasks now correctly set issue_number
  and issue_url instead of mr_number and mr_url (line 946-947)
- Move _extract_source_metadata to module level to make it testable
- Add comprehensive unit tests for _extract_source_metadata covering:
  - MR comment case with mr_number and mr_url
  - Issue case with issue_number and issue_url
  - Fallback construction cases (mr_number/issue_number without URL)
  - Edge case with no source data at all
- Fix process_task to use source_url variable instead of context.get("mr_url")
  when calling publish_changes, ensuring issue_url is used for issue tasks
- Apply ruff formatting to fix long line wrapping violations

All unit tests pass (143 passed). Fixes code quality issues identified
in review of commit dda6e2d.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add sourceUrl, sourceType, sourceIdentifier to ApprovalContext.
Add GroupedApproval and DiffTab interfaces for grouping view.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add extractSourceMetadata helper to parse source URL/type/identifier from
pause context (new) or approval_request_url (fallback for old executions).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix GitLab nested group URL regex to support paths like gitlab.com/group/subgroup/project/-/merge_requests/123
- Add explicit null check for source_type in primary extraction path
- Add validation for source_identifier format with fallback to URL parsing
- Extract regex patterns as constants for better maintainability
- Add JSDoc documentation for extractSourceMetadata function

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add groupApprovalsBySource function to group approvals by sourceIdentifier
and sort by most recent activity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add aggregateDiffs function to combine diffs from multiple approvals
with separators and tab metadata, including truncation for large diffs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify groupApprovalsBySource correctly groups by source identifier,
sorts by most recent activity, and tracks latest timestamp.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify aggregateDiffs combines diffs with separators, truncates large
diffs, creates correct tab metadata, and handles missing diffs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap useApprovals with grouping logic, memoized to avoid recomputation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add mutation hook for batch approval submission with parallel requests
and result tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tabbed interface for viewing combined and individual diffs.
Reuses existing DiffViewer component for rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add card component for displaying grouped approvals with batch actions,
tabbed diff viewer, and expandable individual approval list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add list container for grouped approval cards with empty state and
ungrouped section for approvals without source metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 'By Source' as first tab, wire up useGroupedApprovals hook and
GroupedApprovalList component. Set as default active tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add basic E2E tests verifying 'By Source' tab structure and UI elements.
Full integration tests require mocked AgentField data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add documentation for grouped approval view features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andyxhadji andyxhadji force-pushed the tortoiseshell-hydrangea branch from 770d924 to 9a7f207 Compare May 30, 2026 13:18
Resolved conflicts by:
- Adopting main's simplified two-gate approval workflow (spec + review)
- Adding source metadata extraction to both approval pauses
- Maintaining backward compatibility with source URL/type/identifier

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andyxhadji andyxhadji merged commit aa2a2eb into main May 30, 2026
1 of 3 checks passed
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