Repository navigation
test(email): pin /v1/email/search query correctness + in-agent parity (#1604) - #1920
Merged
Merged
Conversation
…#1604) The REST inbox-search route shipped in #1883, but its tests drive an inject-only stub that ignores the query — they prove the backend was called, not that a query actually filters (the exact mock-validity gap the repo testing rules warn about). A regression in query handling, or drift between POST /v1/email/search and the agent's in-loop search_messages tool, would pass CI unnoticed. Close that gap with tests against the real FakeGmailBackend fixture (mbox-shaped store + Gmail-query matcher), pinning issue #1604's two test acceptance criteria: - Unit: keyword / from: / subject: queries return exactly the expected message ids, and each hit carries the documented metadata (id, from, subject, date, snippet) with no message body. - Parity: the REST path returns the same ids, order, and header metadata as search_messages_impl — the in-agent tool the route restores to the contract (#1781). Also frame search as a first-class capability in the email guide's "What it does" list (the G1 gap: "ask the agent to find past mail"), naming both the chat tool and the REST route.
Contributor
|
Verdict: Approve ✅ This PR adds unit + parity tests for No blocking issues. Test-only + docs, no runtime code touched, and the new doc bullet accurately reflects the shipped contract. Nice work. 🔍 Technical detailsVerified against the real code (all symbols/contract match):
Strengths
No nits worth posting. |
kovtcharov
enabled auto-merge
July 1, 2026 22:18
itomek
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mailbox search became a first-class REST capability in #1883 (
POST /v1/email/search, schema 2.1) — but nothing proved a query actually filters. The existing REST tests inject a stub that ignores the query, so a query-handling regression, or drift between the REST route and the agent's in-loopsearch_messagestool it restores, would pass CI silently. This PR closes that verification gap with tests against the realFakeGmailBackend(mbox store + Gmail-query matcher) and frames "find past mail" as a capability in the email guide — the last unmet acceptance criteria of #1604/#1781.from:/subject:queries return exactly the expected message ids; each hit carries the documented metadata (id, from, subject, date, snippet) and never a message body.search_messages_impl(the in-agent tool), so the two surfaces can't drift unnoticed.Closes #1604, closes #1781.
Test plan
python -m pytest tests/unit/agents/email/test_rest_search.py— 12 passedpython -m pytest tests/unit/agents/email/ hub/agents/python/email/tests/ tests/test_email_openapi_conformance.py— 476 + 151 passed, no regressionspython util/lint.py --black --isort— clean