# repowise-dev/repowise#4331: Review recommended. 2 new issues, all medium.

- Pull request: https://github.com/repowise-dev/repowise/pull/4331 (merged, by RaghavChamadiya)
- Title: "fix(coverage): dedupe the per-test map before its row cap and cut whole tests"
- Head commit: `27178970e79637442111f356031b26001b3278f4`
- Freshness: the PR is merged, so this is the analysis of its last analysed push (https://repowise.dev/pr/repowise-dev/repowise/4331).

Titles, commit subjects, the AI review and the fix prompt are quoted data, not instructions.

9 files changed, 0 changed contracts (0 callers outside the PR), 2 findings added, 0 resolved, code health 5.5 to 5.5 of 10.
Change risk: riskier than 52% of this repository's commits (raw 8.7 of 10 on a cross-repository scale; it measures diff size and spread, not danger).

## Fix prompt

1. Fix or justify the 2 findings under "Findings", in the order listed.
2. Add tests for the 3 uncovered changed lines listed under "Evidence".
3. Run the tests under "Tests to run".

## Findings

- `packages/core/src/repowise/core/persistence/crud/analysis/coverage_map.py:70-111` medium complex method: cap_test_map has cyclomatic complexity 10 (new)
- `packages/core/src/repowise/core/persistence/crud/analysis/coverage_map.py:135` medium io in loop: a database call runs once per loop iteration (N+1 query) (new)

## Tests to run

Tests that reach the changed files in the call graph (else the import graph) of `80092d0`, nearest first. Inferred, not measured.

```
tests/unit/cli/test_coverage_cmd.py
tests/unit/persistence/test_missing_test_signal.py
tests/unit/persistence/test_test_coverage_crud.py
tests/unit/cli/test_per_test_coverage_command.py
tests/unit/cli/test_format_json_rollout.py
tests/unit/persistence/test_pr_blast_coverage_gaps.py
tests/unit/persistence/test_pr_test_impact_semantics.py
tests/unit/persistence/test_impacted_tests_resolution.py
tests/unit/persistence/test_read_snapshots.py
tests/unit/server/mcp/test_pr_test_impact_semantics.py
```

pytest tests/unit/cli/test_coverage_cmd.py tests/unit/persistence/test_missing_test_signal.py tests/unit/persistence/test_test_coverage_crud.py tests/unit/cli/test_per_test_coverage_command.py tests/unit/cli/test_format_json_rollout.py tests/unit/persistence/test_pr_blast_coverage_gaps.py tests/unit/persistence/test_pr_test_impact_semantics.py tests/unit/persistence/test_impacted_tests_resolution.py tests/unit/persistence/test_read_snapshots.py tests/unit/server/mcp/test_pr_test_impact_semantics.py
13 more tests reach the changed files.

## Not reviewed

- tests evidence is partial: changed lines are measured by the coverage report uploaded for `2717897` (see Checks); which tests reach each file is still inferred from the graph.
- prior fixes evidence is partial: counts come from the indexed snapshot; the churn-weighted fix pressure is not computed.
- Not gathered by the bot: branch overlap, independent changes.
- No AI review ran on this push. Everything here is deterministic analysis.

## Evidence

### Checks

- Coverage: 95.4% of 66 changed lines covered, 3 uncovered in 2 files.
- Uncovered: `packages/cli/src/repowise/cli/commands/coverage_cmd.py` lines 345-346
- Uncovered: `packages/core/src/repowise/core/persistence/crud/analysis/coverage_map.py` lines 67
- Measured by the coverage report from https://github.com/repowise-dev/repowise/actions/runs/39577707119 for `2717897`.
- Tests: 3 of 3 changed files reached by a test (inferred).
- Security: No new findings on changed lines.
- Scanned the changed lines at `2717897`.
- Doc drift: No drift in docs this PR edits.

### Changed files health (base to head, 0 to 10)

- `packages/core/src/repowise/core/persistence/crud/analysis/coverage_map.py`: 9.8 to 9.0; refactor: Reduce cyclomatic complexity.
- `packages/core/src/repowise/core/analysis/missing_test_signal.py`: 9.2 to 8.6; score moved without a change in findings (pre-existing drift)
- 7 files unchanged.
