Conversation
The jq -s arguments were swapped ($nepal_tmp $world_tmp instead of $world_tmp $nepal_tmp), causing Nepal stations to be filtered out as if they were world stations. This resulted in only 3 of 31 Nepali radio stations appearing in the globe view.
AksharP5
left a comment
There was a problem hiding this comment.
The merge can still drop Nepal stations, and the extra request bypasses existing response limits and delays the initial globe load. Please address the three findings below before merging.
The title and description also need updating. The base branch has no Nepal merge or swapped arguments; this diff introduces Nepal-specific prioritization. I would prefer a general fix for missing country coverage using the existing fetch paths.
Verified with isolated fixtures against this commit. The existing curl fixture rejects the new request for omitting the size limit, but the error is suppressed, so it does not exercise a successful Nepal merge. Add focused coverage for that path and its failure cases.
| | ($world | map(.stationuuid // "")) as $world_uuids | ||
| | ($nepal | map(select(.stationuuid as $u | ($world_uuids | index($u)) == null))) as $new | ||
| | ($new + $world)[:500] | ||
| ' "$world_tmp" "$nepal_tmp" > "$merged_tmp" |
There was a problem hiding this comment.
[P2] Preserve all priority stations before truncating
Nepal stations already in $world are removed from $new, so they retain their original positions and can be cut off by [:500]. I reproduced a 500-station world list with three Nepal stations at the tail and a 31-station Nepal response: the result contains only 28 Nepal stations. If country prioritization is retained, put the complete priority list first, deduplicate by UUID while preserving order, then apply the cap. Add a regression case with overlapping stations near the cutoff.
| curl -s --max-time 12 \ | ||
| "https://all.api.radio-browser.info/json/stations/bycountrycodeexact/NP?hidebroken=true&order=clickcount&reverse=true&limit=100" \ | ||
| > "$nepal_tmp" 2>/dev/null || true |
There was a problem hiding this comment.
[P2] Reuse the bounded request helper
This direct curl call skips the existing 4 MiB response limit, record-count validation, retries, and server fallback. limit=100 is a server query parameter, not a client-side bound; I confirmed an oversized Nepal response is accepted. Route the request through request 100 with the existing query-argument convention, and preserve the world-only fallback when the optional request fails.
| | ($nepal | map(select(.stationuuid as $u | ($world_uuids | index($u)) == null))) as $new | ||
| | ($new + $world)[:500] | ||
| ' "$world_tmp" "$nepal_tmp" > "$merged_tmp" | ||
| store_results "$world_cache_file" < "$merged_tmp" >/dev/null |
There was a problem hiding this comment.
[P2] Publish the initial world data before fetching enrichment
With no valid cache, fetch_world waits for this function before returning any stations. The Nepal request runs after the world request and can add its full 12-second timeout even when the world response succeeded. A fixture with a one-second Nepal timeout added that second to first load. Return the available world data first and load any extra country coverage through the existing background expansion flow.
The jq -s arguments were swapped in refresh_world_cache, causing Nepal stations to be filtered out. Only 3 of 31 Nepali radio stations appeared in the globe view. Fixed by swapping the file arguments to match the variable names in the jq filter.