Project

General

Profile

Actions

Bug #16

open

COVID Tracker Reliability & Data-Safety Hardening — Result/Error contract, data adapter, UI states, live daily source & dependency modernization

Added by Redmine Admin about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
09/02/2026
Due date:
% Done:

0%

Estimated time:

Description

Ticket Metadata

Field Value
Project ai-workbench
Tracker Feature
Priority Normal
Module project_corona_tracker — React SPA frontend / API access layer
Entity CovidTotals (global & per-country statistics)
Feature Type enhancement, validation, error-handling
Source Repository arpitsaxena-gl/project_corona_tracker (branch master)
Source References run 20260902T155901_njmakz: 01-code-analysis.md, analysis_output.json, 02-design-document.md, 03-task-list.md, tasks.json
Prior Ticket Key COVID-19 (tentative — resembles project name; validate before linking)

1. User Story

As an end user monitoring COVID-19 statistics, I want the tracker to clearly show when data fails to load and let me retry, and never crash on unexpected API responses, so that I can trust the numbers and recover from transient failures instead of a permanent "Loading…".

As the maintaining developer, I want a normalized error/result contract, an anti-corruption data adapter, a live daily-data source, and a baseline test suite, so that failures are visible, upstream shape changes no longer crash the UI, and the vulnerable dependency surface is patched.

2. Background

project_corona_tracker is a client-only React 16 (Create React App) SPA showing global/per-country COVID-19 totals (cards + bar chart) and a US daily time-series (line chart). No backend, no database, no persistence — all data comes from two public keyless HTTPS APIs (covid19.mathdro.id, and the retired api.covidtracking.com).

Code analysis surfaced the driving defects:

Sev Finding Location
High (P1/S3) Every API catch does return error; → the Error becomes state.data; failures show as a permanent "Loading…" src/api/index.js:16,45,58
High (S1) Vulnerable/EOL deps: axios@0.19.2, react-scripts@3.4.1, MUI v4 package.json
Med (P3) fetchDailyData targets retired api.covidtracking.com; line chart never renders src/api/index.js:36
Med (P2) Unguarded confirmed.value/recovered.value/deaths.value → runtime TypeError Cards.jsx, Chart.jsx
Low (S2/P5) Unencoded country in URL; no effect abort/cleanup; conflicting ESLint configs; zero tests various

3. Scope

In Scope:

  • Normalized Result / AppError contract (api/errors.js); remove every return error.
  • Anti-corruption adapter (api/adapter.js) with null-safe reads + numeric defaults.
  • Distinct loading / error / empty / ready UI states with Retry.
  • useAsync hook (AbortController + mounted guard) + services/covidService.js.
  • Env config (src/config.js, REACT_APP_*) + encodeURIComponent(country).
  • Live daily source via REACT_APP_DAILY_URL, graceful empty when unset.
  • PropTypes on Card/Cards/Chart/CountryPicker.
  • Baseline Jest/RTL suite.
  • Dependency modernization (isolated, last): axios@^1, MUI v5, ESLint reconcile, CI lint/test/build/npm audit gate.

Out of Scope:

  • Backend/database/persistence; global state library beyond fix needs; visual redesign; any language/platform rewrite (CRA→Vite is an optional note only).

4. Acceptance Criteria

Labels: ai-created, enhancement, frontend, react, error-handling, validation

No data to display

Actions

Also available in: Atom PDF