Skip to content

fix: extra reviews broken — nil map panic + missing JobData field#259

Merged
gosom merged 2 commits into
gosom:mainfrom
vigkrish99:main
Apr 19, 2026
Merged

fix: extra reviews broken — nil map panic + missing JobData field#259
gosom merged 2 commits into
gosom:mainfrom
vigkrish99:main

Conversation

@vigkrish99
Copy link
Copy Markdown
Contributor

Summary

Fixes #242 — Extra reviews not working.

Two bugs prevented -extra-reviews from working via the web API:

Bug 1: Nil map panic in extractPlaceID (reviews.go)

The patterns map was declared but never initialized with make(). This caused a panic on first use, crashing the RPC-based review extraction path entirely.

Fix: Added patterns = make(map[string]*regexp.Regexp) in the patternsOnce.Do block.

Bug 2: Missing ExtraReviews field in web JobData struct (web/job.go)

The JobData struct didn't have an ExtraReviews field. When extra_reviews: true was sent via the /api/v1/jobs POST endpoint, Go's JSON unmarshaler silently dropped it. Jobs were stored without the flag, so PlaceJob.ExtractExtraReviews was always false.

Fix: Added ExtraReviews bool \json:"extra_reviews"`toJobData, and updated the webrunner to use job.Data.ExtraReviews || w.cfg.ExtraReviews` so both per-job API param and global CLI flag work.

Verified

  • Before fix: 8 reviews returned for a business with 167 Google reviews
  • After fix: all 167 reviews returned in user_reviews_extended
  • Tested on self-hosted Railway deployment with residential proxy

The patterns map was declared but never initialized with make().
This caused a panic on first assignment in extractPlaceID(), which
broke the RPC-based review extraction path entirely.

Fixes gosom#242 — Extra reviews not working.
The web API handler (/api/v1/jobs) was silently ignoring extra_reviews
from the request body because JobData struct didn't have that field.
JSON unmarshal discarded it.

Also: webrunner now uses job.Data.ExtraReviews OR the global CLI flag,
so extra_reviews works both as a per-job API parameter and as a global
-extra-reviews CLI flag.
@macsux
Copy link
Copy Markdown
Contributor

macsux commented Apr 14, 2026

Confirmed working

@gosom gosom merged commit 1af177d into gosom:main Apr 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extra Review does not work any more

3 participants