fix: extra reviews broken — nil map panic + missing JobData field#259
Merged
Conversation
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.
Contributor
|
Confirmed working |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #242 — Extra reviews not working.
Two bugs prevented
-extra-reviewsfrom working via the web API:Bug 1: Nil map panic in
extractPlaceID(reviews.go)The
patternsmap was declared but never initialized withmake(). This caused a panic on first use, crashing the RPC-based review extraction path entirely.Fix: Added
patterns = make(map[string]*regexp.Regexp)in thepatternsOnce.Doblock.Bug 2: Missing
ExtraReviewsfield in webJobDatastruct (web/job.go)The
JobDatastruct didn't have anExtraReviewsfield. Whenextra_reviews: truewas sent via the/api/v1/jobsPOST endpoint, Go's JSON unmarshaler silently dropped it. Jobs were stored without the flag, soPlaceJob.ExtractExtraReviewswas always false.Fix: Added
ExtraReviews bool \json:"extra_reviews"`toJobData, and updated the webrunner to usejob.Data.ExtraReviews || w.cfg.ExtraReviews` so both per-job API param and global CLI flag work.Verified
user_reviews_extended