Spaces:
Sleeping
Sleeping
Commit History
-
Housekeeping: lint in CI, client lifecycle, and a truer breaker signal
Claude +1: Claude Opus 5Unverified signatureIndependent cleanups from the review, grouped because each is small. A3 - utils.log_gathered_exceptions imported SerpQuery from serp.py purely to read one attribute, so the lowest layer in the codebase depended on the domain layer. It now takes any iterable of query strings, which also makes it usable from the patent and OPS paths. A4 - the shared httpx client was created at import and never closed; the lifespan tore down the browser but left its connection pool open. It is now closed on shutdown, including when Playwright failed to start. Two lifespan tests cover this, and the existing one no longer closes the real client out from under the rest of the session. A5 - the circuit breaker could not tell "this query had no hits" from "this backend is refusing us". query_ddg_search raises on an empty result because a soft block can parse to zero results, but _search_one counted every exception against the backend - and the breaker is a process-wide singleton, so three unusual-but-legiti…9841346 -
Fix bare except and misattributed logger (item 3 from review)
ClaudeUnverified signature- serp.py: query_google_patents's per-item extraction caught bare `except:`, which also swallows asyncio.CancelledError (BaseException in 3.8+), silently absorbing task cancellation instead of letting it propagate. Narrowed to `except Exception:`. - utils.py: `from asyncio.log import logger` reused asyncio's internal logger, so every warning here was misattributed to the 'asyncio' logging namespace instead of the app's own. Now uses logging.getLogger(__name__). - Updated the characterization test that had pinned the old logger name to assert the fixed one instead.21042c7
-
Add pytest harness with characterization tests for scrap/ops/serp/utils
ClaudeUnverified signatureAdds a test safety net ahead of any refactoring, per the TDD/architecture review of this codebase (no test infrastructure existed before this): - pytest + pytest-asyncio + respx as dev-only deps (requirements-dev.txt) - Pure-function tests for SerpQuery's n_results clamping, utils.py's exception logging, and every OPS JSON-walking helper (ops.py handles OPS's XML-to-JSON quirk where a repeated element is a list but a single one stays a bare dict - tests cover both shapes for each helper) - HTTP-mocked (respx) tests for scrap_patent_async's HTML parsing (abstract/description/claims/classification-code extraction, plus the documented ValueError path for an unexpected page layout), the OPS token manager's caching/refresh/retry-on-stale-token behavior, and query_arxiv's Atom feed parsing - A DDGS-mocked test pinning the DuckDuckGo empty-results-means-blocked fix from d341a7a, so a regression there fails a test instead of shipping silently - Real-headless-Chromium tests f…5796881