Repository navigation
feat(market-research-agent): restore recipe as a deployable contrib recipe - #2831
nikhithajoy wants to merge 5 commits into
Conversation
| project_id = None | ||
|
|
||
| allow_origins = ( | ||
| os.getenv("ALLOW_ORIGINS", "").split(",") |
There was a problem hiding this comment.
[MINOR] env read carries a hardcoded default (second argument is a hardcoded default); 8 occurrence(s) across 4 file(s). Defaults belong in .env.example, not in the code (contrib/python/market-research-agent/app/fast_api_app.py:44; and 5 more)
| - "Vertex AI" | ||
|
|
||
| ownership: | ||
| team: "nikhithajoy" |
There was a problem hiding this comment.
[MINOR] ownership.team and poc are both "nikhithajoy". One of the two is wrong: team is the owning team and poc is a person, so a single value cannot be both, and whichever one is the personal handle leaves the recipe unowned the moment that person moves (.github/schemas/manifest-schema.json (ownership.team))
|
|
||
| EXPOSE 8080 | ||
|
|
||
| CMD ["uv", "run", "uvicorn", "app.fast_api_app:app", "--host", "0.0.0.0", "--port", "8080"] |
There was a problem hiding this comment.
[MAJOR] Can you please add a non-root USER before the container entrypoint? The container currently runs as root.
| Returns: | ||
| JSON string with lat, lng, and formatted_address fields. | ||
| """ | ||
| async with httpx.AsyncClient() as client: |
There was a problem hiding this comment.
[MAJOR] Can you please specify an explicit timeout on httpx.AsyncClient()? There are 4 outbound client calls across this file without one.
| ) | ||
| async with httpx.AsyncClient() as client: | ||
| resp = await client.get( | ||
| f"{_PLACES_BASE_URL}/{resource}", |
There was a problem hiding this comment.
[MAJOR] Can you please validate or URL-encode place_id before constructing the URL? An unsanitised value could traverse the API path or inject query parameters.
| ``APP_URL``). Call once per app — typically in a FastAPI ``lifespan``, since | ||
| the card is built asynchronously; repeated calls register duplicate routes. | ||
| """ | ||
| resolved_app_url = app_url or os.getenv("APP_URL", "http://0.0.0.0:8000") |
There was a problem hiding this comment.
[MINOR] Is there a reason for hardcoding defaults on environment reads here? Defaults belong in .env.example, and there are 4 instances across the recipe.
| @pytest.mark.asyncio | ||
| async def test_geocode_address_handles_failure(self): | ||
| mock_response = {"status": "ZERO_RESULTS", "results": []} | ||
| with patch("httpx.AsyncClient") as mock_client_cls: |
There was a problem hiding this comment.
[MINOR] Can we extract this httpx mock setup into a shared pytest fixture? It is duplicated across four tests in this class.
| }, | ||
| headers={ | ||
| "X-Goog-Api-Key": _api_key(), | ||
| "X-Goog-FieldMask": ( |
There was a problem hiding this comment.
[MINOR] duplicate field mask string
| attach_reasoning_engine_routes, | ||
| ) | ||
|
|
||
| load_dotenv() |
There was a problem hiding this comment.
[MINOR] is this still needed?
|
There is a problem with the Antigravity CLI Correctness PR review. Please check the action logs for details. |
|
Ready for review. All checks pass. Re-requested review from |
|
@tommywagz The remaining failing check (test_routing_rules_sync_with_codeowners_and_workflow) also fails on main. #2826 added /core/python/genmedia-for-commerce/** to .github/CODEOWNERS but not to ROUTING_RULES in .github/scripts/process_issue_response.py or the routing list in .github/workflows/_ai-issue-response-core.yml. All of this recipe's own checks pass. Happy to open a separate fix PR if that helps. |
|
|
||
| import os | ||
|
|
||
| os.environ.setdefault("MODEL_NAME", "gemini-3.5-flash") |
There was a problem hiding this comment.
[MINOR] env read carries a hardcoded default (second argument is a hardcoded default); 8 occurrence(s) across 4 file(s). Defaults belong in .env.example, not in the code (contrib/python/market-research-agent/tests/conftest.py:26; and 5 more)
…tainer, httpx timeouts, place_id validation, env defaults)
Summary
Restores `contrib/python/market-research-agent`, originally merged in #1391 and removed in #2756 because it lacked a root `Dockerfile` and `deployable: true`.
Changes
Test plan