Repository navigation
Conversation
The add-session endpoint only mapped ValueError to an HTTP error, but every eval sets manager raises NotFoundError when the eval set does not exist, so the request failed with a 500. Map NotFoundError to 404, the same way the update and delete eval case endpoints already do.
yang0228
left a comment
There was a problem hiding this comment.
Reviewed 579d501eed34823e99b6c0c6af415421639cc388. No blocking correctness findings. Catching NotFoundError matches the local, GCS and in-memory managers' contracts and the adjacent update/delete handlers; the existing duplicate-case ValueError handling remains intact.
Independent validation on Python 3.12.13:
- Parent commit: the existing regression fails with uncaught
NotFoundErrorwhen run with--runxfail; PR head: both add-session tests pass. - Four additional TestClient probes pass: canonical and legacy routes return exactly 404 for a missing eval set, while successful insertion returns 200 and duplicate insertion remains 400.
- CLI + eval-set-manager suites: 1,548 passed, 7 skipped, 2 xfailed, 5 setup errors. All five errors also reproduce on the parent commit (
agentplatform.frameworksis unavailable in my environment), so this is not an all-green suite claim. - Pre-commit passes for both changed files, with no changes to the checkout.
I did not run the full Python-version matrix or a live adk web server. One non-blocking test-strengthening suggestion is attached.
yang0228
left a comment
There was a problem hiding this comment.
Re-reviewed ce679d03762df5315ad44c0470d26029cd829a44 following your update. The regression now asserts exactly 404, addressing my earlier suggestion. The production fix is unchanged from my previous review; no blocking findings.
Fresh validation on Python 3.12.13:
- Both add-session tests pass (2 passed).
- Four additional TestClient contract probes pass: canonical and legacy routes return exactly 404 for a missing eval set; successful insertion remains 200 and duplicate insertion remains 400.
- Pre-commit passes for both changed files, with no changes made by the hooks.
This is a focused follow-up review. I did not rerun the full suite, the Python-version matrix, or a live adk web server.
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
POST /dev/apps/{app_name}/eval-sets/{eval_set_id}/add-sessionreturns a 500 when the eval set doesn't exist. The endpoint only catchesValueErroraroundadd_eval_case, but every eval sets manager (local, GCS, in-memory) raisesNotFoundErrorfor a missing eval set, as documented onEvalSetsManager.add_eval_case.NotFoundErrorisn't aValueError, so it goes unhandled.This is already tracked by
test_add_session_to_eval_set_unknown_eval_set_is_a_client_error, which was added as a strict xfail in 4912a08 with the reason "add-session maps ValueError, but the managers raise NotFoundError".Solution:
Catch
NotFoundErrorand return a 404, the same way the update and delete eval case endpoints already do. The existingValueError-> 400 handling for a duplicate eval case is unchanged. The xfail marker is removed since the test now passes (it's strict, so leaving it would fail the run).Testing Plan
Unit Tests:
With the xfail removed and without the fix, the test fails with:
With the fix:
Manual End-to-End (E2E) Tests:
Not run against a live
adk webserver. The regression test drives the real FastAPI app throughTestClient, which covers the endpoint's error mapping.Checklist