Skip to content

perf: parallelize sequential findByRole queries in GetContextTool#45

Merged
jpicklyk merged 3 commits intomainfrom
chore/parallelize-health-check-queries
Mar 5, 2026
Merged

perf: parallelize sequential findByRole queries in GetContextTool#45
jpicklyk merged 3 commits intomainfrom
chore/parallelize-health-check-queries

Conversation

@jpicklyk
Copy link
Owner

@jpicklyk jpicklyk commented Mar 5, 2026

Summary

  • Health-check mode: 3 sequential findByRole calls (WORK, REVIEW, BLOCKED) now run concurrently via coroutineScope { async { ... } }
  • Session-resume mode: 2 sequential findByRole calls (WORK, REVIEW) parallelized similarly
  • Error handling preserved — Result.Error still maps to emptyList()
  • New test verifying all three role queries combine correctly in health-check mode

Test Results

All tests pass (BUILD SUCCESSFUL). New test added: health check parallel queries return correct combined results

Review

Independent review agent verdict: Pass with observations

  • Plan alignment confirmed — only health-check and session-resume modes changed
  • Correctness verified — structured concurrency pattern is idiomatic Kotlin
  • Minor observations: partial-failure test coverage and repeated when pattern (non-blocking)

MCP Items

  • 0499a6aa — Parallelize sequential findByRole queries in health-check mode

🤖 Generated with Claude Code

jpicklyk and others added 3 commits March 5, 2026 15:48
Health-check mode (3 queries: WORK, REVIEW, BLOCKED) and session-resume
mode (2 queries: WORK, REVIEW) now launch findByRole calls concurrently
via coroutineScope/async instead of sequentially, reducing latency when
the database supports concurrent reads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add getOrElse(default) extension to Result sealed class, replacing
verbose when-expression unwrapping with one-liner calls. Applied to
all 6 instances in GetContextTool (5 from parallelization + 1 bonus).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds direct unit tests for getOrElse, getOrNull, map, isSuccess,
isError, onSuccess, and onError — previously only exercised indirectly
through tool integration tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jpicklyk jpicklyk merged commit a460c4e into main Mar 5, 2026
2 checks passed
@jpicklyk jpicklyk deleted the chore/parallelize-health-check-queries branch March 5, 2026 21:23
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