brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
serpapi-upgrade-migrationMigrate legacy SerpAPI Python or JavaScript packages and response assumptions to current official clients with contract tests and rollback. Use when performing dependency or API upgrades. Trigger with "migrate a SerpAPI client".
Independent GitHub snapshot · Automated classification · Original documentation governs
Inventory actual legacy behavior, introduce the current official client behind a seam, and prove response and failure compatibility before removing the old path.
Use Read, Glob, and Grep to inventory dependencies and behavior, WebFetch to verify current official packages, Write or Edit for the adapter and tests, and Bash(python3:*) or Bash(npm:*) only for approved installs and test execution.
The recommended Python distribution is serpapi, distinct from the legacy google-search-results distribution. Its Client.search returns a SerpResults mapping with helpers such as as_dict() and pagination methods. The current JavaScript serpapi package supports promises and callbacks; migration from google-search-results-nodejs must preserve engine parameters and error behavior explicitly.
Keep the existing server-side SERPAPI_KEY boundary unchanged during migration. Never copy credentials into migration scripts, lockfiles, fixtures, dual-run telemetry, or exception snapshots.
Return the baseline and target versions, behavior matrix, changed call sites, lockfile diff, fixture/live comparison, canary evidence, legacy removal decision, and rollback plan.
| Condition | Response |
|---|---|
Result treated as an exact plain dict | Update types to the documented mapping or call as_dict() where an exact dictionary is required. |
| Error behavior changes | Normalize exceptions in the gateway before rollout. |
| Engine parameters drift | Restore parity and test each engine independently. |
| Dual-run doubles usage | Stop duplicate live calls and compare from one sanitized capture. |
# Current official Python client
import os
import serpapi
client = serpapi.Client(api_key=os.environ["SERPAPI_KEY"], timeout=10)
result = client.search({"engine": "google", "q": "coffee"})
plain_result = result.as_dict()
Remove the feature flag only after a full observation window and archive the rollback receipt.