code-review-graph icon indicating copy to clipboard operation
code-review-graph copied to clipboard

Reduce MCP review latency via shared changed-file resolution and safe cache invalidation

Open Bakul2006 opened this issue 5 months ago • 0 comments

Pull Request

Addressed Review Feedback

Thanks for the detailed review. I've updated this PR to address the concerns raised while preserving the original optimization intent of reducing repeated changed-file detection across MCP review workflows.

What changed

  • Added validation for Git refs before subprocess invocation using the existing safe ref checks.

  • Routed changed-file resolution through VCS detection to preserve SVN compatibility.

  • Avoided caching timeout/empty detection results to prevent cache poisoning across subsequent calls.

  • Revisited untracked file handling so newly added files are included in review workflows.

  • Resolved merge conflicts against the latest main.

  • Added focused unit tests covering:

    • cache hit and expiry behaviour,
    • cache invalidation paths,
    • invalid Git refs,
    • timeout handling,
    • SVN compatibility,
    • untracked file handling.

Original intent preserved

This optimization is still designed specifically for short-lived MCP review orchestration bursts where multiple tools execute against effectively identical repository state.

The goal remains to avoid repeated changed-file detection during multi-tool review flows while failing fast when automatic detection is slow.

Validation

  • Rebased/merged with the latest main.
  • Resolved the reported conflicts.
  • Verified the updated test suite after conflict resolution.

Thanks again for the review and guidance. I'd appreciate another pass whenever you have time.

Linked issue

#457

Closes #457

What & why

How it was tested

uv run pytest tests/ --tb=short -q
uv run ruff check code_review_graph/
uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional

Checklist

  • [x] Tests added for new functionality
  • [ ] All tests pass: uv run pytest tests/ --tb=short -q
  • [ ] Linting passes: uv run ruff check code_review_graph/
  • [ ] Type checking passes: uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional
  • [ ] Lines are at most 100 characters
  • [ ] Docs updated where behavior changed (README, docs/, docstrings)

Bakul2006 avatar Jun 11 '26 20:06 Bakul2006