Skip to content

🧪 Improve test coverage for LMCacheConnectorV2 exception handling#82

Closed
SuarezPM wants to merge 4 commits into
mainfrom
jules-improve-lmcache-connector-tests-13039725683639478265
Closed

🧪 Improve test coverage for LMCacheConnectorV2 exception handling#82
SuarezPM wants to merge 4 commits into
mainfrom
jules-improve-lmcache-connector-tests-13039725683639478265

Conversation

@SuarezPM

@SuarezPM SuarezPM commented Jun 4, 2026

Copy link
Copy Markdown
Owner

🎯 What: This PR addresses the untested exception handling in LMCacheConnectorV2 (specifically in apohara_context_forge/serving/lmcache_connector.py).

📊 Coverage: The following scenarios are now covered with automated tests:

  1. engine.retrieve() throwing an exception (returns None, bumps miss stat).
  2. mask.any() throwing an exception (treats it as a hit if mask exists, without crashing).
  3. engine.lookup() throwing an exception (returns 0 without crashing).
  4. engine.close() throwing an exception (is safely caught and continues).

Result: Test coverage in apohara_context_forge/serving/lmcache_connector.py has been significantly improved by adding safety-net tests around previously untested except Exception: blocks, allowing for confident and reliable execution of the fallback and error paths.


PR created automatically by Jules for task 13039725683639478265 started by @SuarezPM

…, lookup, and close

- Injects fault directly into `engine.retrieve()` to assert it returns `None` and increments the miss stat without crashing.
- Adds test cases for exceptions raised inside `mask.any()`, `lookup()`, and `close()`.
- Uses `_BrokenRetrieve`, `_BrokenMask`, `_BrokenLookup`, and `_BrokenClose` engines.

Co-authored-by: SuarezPM <110942776+SuarezPM@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 3 commits June 4, 2026 03:42
…, lookup, and close

- Injects fault directly into `engine.retrieve()` to assert it returns `None` and increments the miss stat without crashing.
- Adds test cases for exceptions raised inside `mask.any()`, `lookup()`, and `close()`.
- Uses `_BrokenRetrieve`, `_BrokenMask`, `_BrokenLookup`, and `_BrokenClose` engines.

Co-authored-by: SuarezPM <110942776+SuarezPM@users.noreply.github.com>
…, lookup, and close

- Injects fault directly into `engine.retrieve()` to assert it returns `None` and increments the miss stat without crashing.
- Adds test cases for exceptions raised inside `mask.any()`, `lookup()`, and `close()`.
- Uses `_BrokenRetrieve`, `_BrokenMask`, `_BrokenLookup`, and `_BrokenClose` engines.

Signed-off-by: Pablo <suarezpm@csnat.unt.edu.ar>

Co-authored-by: SuarezPM <110942776+SuarezPM@users.noreply.github.com>
- Injects fault directly into engine.retrieve() to assert it returns None and increments the miss stat without crashing.
- Adds test cases for exceptions raised inside mask.any(), lookup(), and close().
- Uses _BrokenRetrieve, _BrokenMask, _BrokenLookup, and _BrokenClose engines.

Signed-off-by: Pablo <suarezpm@csnat.unt.edu.ar>

Co-authored-by: SuarezPM <110942776+SuarezPM@users.noreply.github.com>
SuarezPM added a commit that referenced this pull request Jun 4, 2026
Consolidates Jules PR #82 (lookup, retrieve x2, close) + #71 (engine build).
Dropped: #62 (subset of #82), #45 (close test redundant with #82). uv.lock
and stray commit_msg.txt dropped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Pablo <suarezpm@csnat.unt.edu.ar>
@SuarezPM

SuarezPM commented Jun 4, 2026

Copy link
Copy Markdown
Owner Author

Applied to main in a3f7764 — lmcache exception-path coverage consolidated from #82 (lookup/retrieve/close) + #71 (engine build). uv.lock + stray commit_msg.txt dropped. Thanks!

@google-labs-jules

Copy link
Copy Markdown
Contributor

Applied to main in a3f7764 — lmcache exception-path coverage consolidated from #82 (lookup/retrieve/close) + #71 (engine build). uv.lock + stray commit_msg.txt dropped. Thanks!

Understood. Acknowledging that this work is now merged to main via a3f7764. Stopping work on this task.

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