[codex] Harden place extractor fixtures and preview enrichment#48
[codex] Harden place extractor fixtures and preview enrichment#48michaelmwu wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29b58efe7d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if 1900 <= value <= 2100: | ||
| return None |
There was a problem hiding this comment.
Do not drop valid 1900–2100 review counts
When the DOM lacks a review count and the preview payload is used as the fallback, a valid compact rating summary such as [4.7, 2000] is discarded solely because the count falls in the year-looking range. Places with 1,900–2,100 reviews are valid and fairly common, and the later _rating_count_pair_is_ambiguous check already handles actual year/price evidence from the same node, so this leaves rating/review_count missing for those places instead of enriching them from preview data.
Useful? React with 👍 / 👎.
Summary
_PLACE_JS_EXTRACTORJavaScript intosrc/gmaps_scraper/data/place_extractor.jsand load it viaimportlib.resourceswhile preserving the Python symbol.ratingandreview_count, with fixtures for positive and ambiguous payloads.Why
The JS extractor was mostly protected by source-string assertions, which can pass even when selector behavior drifts. The new fixture harness evaluates the extractor in a real local browser page and asserts the structured snapshot. Preview payloads can also contain rating and review-count signals on limited/thin pages, so the scraper now backfills those fields when DOM data is missing.
Notes
.context/, but.context/is gitignored workspace memory and is not part of this PR.Validation
./scripts/lint.sh./scripts/typecheck.sh./scripts/test.sh(266 tests)gmaps_scraper/data/place_extractor.jsis included.Note
Medium Risk
Touches core place extraction and merge logic for rating/review_count, but changes are covered by new browser fixtures and conservative preview heuristics with DOM precedence.
Overview
Moves the large inline
_PLACE_JS_EXTRACTORscript out ofplace_scraper.pyinto packagedplace_extractor.js, loaded at runtime viaimportlib.resourcesso behavior stays the same while the Python module shrinks.Replaces many source-string tests with browser-backed checks: local HTML fixtures (overview, reviews, about, limited view, search results) are opened in Playwright and the extractor (plus related tab/about/review scripts) is evaluated against real DOM snapshots.
Adds conservative preview-payload enrichment for
ratingandreview_countwhen the DOM is thin or missing those fields. Parsing only accepts unambiguous compact numeric pairs and rejects price-shaped, year-like, non-adjacent, or conflicting evidence; DOM values still win when present.Reviewed by Cursor Bugbot for commit 29b58ef. Bugbot is set up for automated code reviews on this repo. Configure here.