fix: isolate per-analyzer failures so one bad analyzer can't empty the Analyzers list (ERA-13536)#1624
Open
jeslefcourt wants to merge 1 commit into
Open
Conversation
…e list (ERA-13536) fetchAnalyzers built the analyzer list inside a single Promise.all, so a throw while processing any one analyzer rejected the whole batch and the Analyzers sidebar list rendered completely empty. Wrap each analyzer's processing in try/catch: on error, log a console.warn naming the analyzer and skip it (resolve null) instead of failing the entire fetch, and filter the nulls before the existing empty-features check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fault-isolates per-analyzer processing inside fetchAnalyzers so that a single analyzer with invalid spatial-group geometry/threshold configuration cannot cause the entire analyzers fetch to fail and leave the Analyzers sidebar empty.
Changes:
- Wrap per-analyzer async processing in
try/catch, logging a warning and returningnullon failure instead of rejecting the sharedPromise.all. - Filter out failed (
null) analyzers before dispatchingFETCH_ANALYZERS_SUCCESS. - Add an MSW-backed Jest test that reproduces the real-world negative-buffer proximity failure and asserts other analyzers still dispatch plus a single
console.warn.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/ducks/analyzers.js |
Prevents one analyzer-processing exception from rejecting the whole analyzers fetch; filters out failed analyzers before dispatch. |
src/ducks/analyzers.test.js |
Adds regression coverage ensuring valid analyzers still dispatch when one analyzer throws, and that a warning is logged for the failed analyzer. |
jeslefcourt
requested review from
JoshuaVulcan and
chrisj-er
and removed request for
chrisj-er
June 30, 2026 11:24
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.
What
Fault-isolates per-analyzer processing in
fetchAnalyzersso a single failing analyzer can no longer wipe out the entire Analyzers list.Jira: ERA-13536
Why
fetchAnalyzersbuilds the analyzer list inside onePromise.all(data.map(async (analyzer) => {...})). If processing any one analyzer throws, the wholePromise.allrejects,FETCH_ANALYZERS_SUCCESSis never dispatched, and the Analyzers sidebar list stays at its empty initial state — with no user-facing error.This is happening on wildlifeactdev.pamdas.org: a proximity analyzer ("Tourist Road Proximity - Line") is configured with
threshold_dist_meters: -1.0over a line geometry. The proximity branch buffers the feature bythreshold / 1000km; negative-buffering a line returnsundefinedfrom turf, soproximityPoly.geometrythrows aTypeError— and that single bad analyzer made every analyzer (KPR Geofence Analyzer included) disappear from the list.Change
try/catch. On error,console.warn(name + id + error) and returnnullinstead of rejecting the sharedPromise.all.null(failed) analyzers before the existing empty-features check.threshold_dist_metersis a tracked follow-up, as is backend/admin validation.Tests
Added
src/ducks/analyzers.test.js(MSW +setupServer, matching the repo's duck-test pattern). It reproduces the real-world failure (a valid geofence, a valid proximity, and a negative-buffer line proximity) and asserts:console.warnfires naming the failed analyzer.🤖 Generated with Claude Code