refactor(agent-email): address review nits from #1829 (connector routes)#1830
Conversation
- Wire the module logger into the configure/complete/grant except handlers so the live OAuth path is debuggable (was defined-but-unused). - Centralize the DEFAULT_ACCOUNT sentinel normalization server-side (new _account_email helper, applied on /connectors and /complete) and drop the redundant client-side 'default' magic string.
Verdict: ApproveThis is a tight, scope-clean follow-up to #1829 that addresses the two actionable review nits on the new email connector routes: it wires the previously-unused module logger into the OAuth error handlers so live failures are debuggable, and it centralizes the The bottom line: the sentinel is now translated in exactly one place and applied on both the list and complete endpoints, so the client no longer needs to know the store's internal 🔍 Technical detailsIssuesNone blocking. 🟢 Per-call deferred import in the new helper ( Verified
Strengths
|
Small follow-up to the merged #1829 — addresses the two actionable (non-blocking) nits from the code review on the new connector routes:
configure/complete/granterror handlers, so the live OAuth path is debuggable (it was defined-but-unused).DEFAULT_ACCOUNT("default") sentinel handling server-side — a new_account_emailhelper applied on bothGET /v1/email/connectorsand/complete— and drop the redundant client-side!== "default"magic string, so the store's sentinel value stays server-side only.The third review nit (empty-scope grant) was explicitly flagged as needing no action; left as-is.
Evidence
This change is backend-only (logger + server-side sentinel normalization), so the playground UI is unchanged — verified below straight from this PR's build.
Behavioral proof of the new normalization —
GET /v1/email/connectorsnow maps the store's"default"no-email sentinel tonull:UI still works — screenshots captured from this PR's sidecar (md5-identical to the #1829 baseline, confirming the UI did not change):
Not connected — per-provider client_id/secret connect forms; Send disabled:
Connected — a Disconnect button on each account; Send picks the mailbox from a dropdown and is ready:
Test plan
PYTHONPATH=hub/agents/python/email python -m pytest tests/unit/agents/email/test_connector_routes.py tests/unit/agents/email/test_playground.py -q— includes a new test asserting/completenormalizes the"default"sentinel tonull.