# DiffNote Coverage Map

- **Command:** `lore review-coverage <mr-iid>`
- **Confidence:** 75%
- **Tier:** 3
- **Status:** proposed
- **Effort:** medium — join DiffNote positions with mr_file_changes

## What

For a specific MR, show which files received review comments (DiffNotes) vs. which
files were changed but received no review attention. Highlights blind spots in code
review.

## Why

Large MRs often have files that get reviewed thoroughly and files that slip through
with no comments. This makes the review coverage visible so teams can decide if
un-reviewed files need a second look.

## Data Required

All exists today:
- `mr_file_changes` (new_path per MR)
- `notes` (position_new_path, note_type='DiffNote', discussion_id)
- `discussions` (merge_request_id)

## Implementation Sketch

```sql
SELECT
    mfc.new_path,
    mfc.change_type,
    COUNT(DISTINCT n.id) as review_comments,
    COUNT(DISTINCT d.id) as review_threads,
    CASE WHEN COUNT(n.id) = 0 THEN 'NOT REVIEWED' ELSE 'REVIEWED' END as status
FROM mr_file_changes mfc
LEFT JOIN notes n ON n.position_new_path = mfc.new_path
    AND n.note_type = 'DiffNote'
    AND n.is_system = 0
LEFT JOIN discussions d ON n.discussion_id = d.id
    AND d.merge_request_id = mfc.merge_request_id
WHERE mfc.merge_request_id = ?1
GROUP BY mfc.new_path
ORDER BY review_comments DESC;
```

## Human Output

```
Review Coverage for !234 — Refactor auth middleware

  REVIEWED (5 files, 23 comments)
    src/auth/middleware.rs        12 comments, 4 threads
    src/auth/jwt.rs               6 comments, 2 threads
    src/auth/session.rs           3 comments, 1 thread
    tests/auth/middleware_test.rs  1 comment, 1 thread
    src/auth/mod.rs               1 comment, 1 thread

  NOT REVIEWED (3 files)
    src/auth/types.rs             modified    [no review comments]
    src/api/routes.rs             modified    [no review comments]
    Cargo.toml                    modified    [no review comments]

  Coverage: 5/8 files (62.5%)
```

## Downsides

- Reviewers may have reviewed a file without leaving comments (approval by silence)
- position_new_path matching may not cover all DiffNote position formats
- Config files (Cargo.toml) not being reviewed is usually fine

## Extensions

- `lore review-coverage --all --since 30d` — aggregate coverage across all MRs
- Per-reviewer breakdown: which reviewers cover which files?
- Coverage heatmap: files that consistently escape review across multiple MRs
