Skip to content

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
developfrom
ERA-13536-analyzers-list-empty-on-single-failure
Open

fix: isolate per-analyzer failures so one bad analyzer can't empty the Analyzers list (ERA-13536)#1624
jeslefcourt wants to merge 1 commit into
developfrom
ERA-13536-analyzers-list-empty-on-single-failure

Conversation

@jeslefcourt

@jeslefcourt jeslefcourt commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What

Fault-isolates per-analyzer processing in fetchAnalyzers so a single failing analyzer can no longer wipe out the entire Analyzers list.

Jira: ERA-13536

Why

fetchAnalyzers builds the analyzer list inside one Promise.all(data.map(async (analyzer) => {...})). If processing any one analyzer throws, the whole Promise.all rejects, FETCH_ANALYZERS_SUCCESS is 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.0 over a line geometry. The proximity branch buffers the feature by threshold / 1000 km; negative-buffering a line returns undefined from turf, so proximityPoly.geometry throws a TypeError — and that single bad analyzer made every analyzer (KPR Geofence Analyzer included) disappear from the list.

Change

  • Wrap each analyzer's async processing in try/catch. On error, console.warn (name + id + error) and return null instead of rejecting the shared Promise.all.
  • Filter out the null (failed) analyzers before the existing empty-features check.
  • Proximity buffer logic is intentionally unchanged — guarding invalid threshold_dist_meters is 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:

  • the two valid analyzers are still dispatched and the failing one is excluded;
  • exactly one console.warn fires naming the failed analyzer.
Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total

🤖 Generated with Claude Code

…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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 returning null on failure instead of rejecting the shared Promise.all.
  • Filter out failed (null) analyzers before dispatching FETCH_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 jeslefcourt self-assigned this Jun 30, 2026
@jeslefcourt
jeslefcourt requested review from JoshuaVulcan and chrisj-er and removed request for chrisj-er June 30, 2026 11:24
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.

2 participants