Skip to content

API robustness roundup: task write races, orphaned task assignments, duplicate RiskAssessments, pagination parsing, replay-after-headers #55

Description

@manjula25

Summary

Low-priority correctness items found in the API review, batched together.

Items

  1. Task write races (fhir/client.ts:925-942 assignTask, 965-996 transitionTask): both do GET → mutate in memory → PUT with no If-Match/ETag and no status precondition — two concurrent writes on the same task silently lose one, and transitionTask will "complete" an already-cancelled task.
  2. assignTask accepts nonexistent coordinator ids (routes/tasks.ts:46-51 validates only non-empty string): a typo'd id is stored in FHIR and permanently orphans the task from team-performance reporting (team/service.ts:74 matches ownerCoordinatorId against users.id).
  3. Duplicate RiskAssessments double-count population (fhir/client.ts:683-693): one profile per resource, not per patient — a patient with two RiskAssessments appears as two scatter points and inflates totalPatients/projectedCostAvoidance.
  4. Governance pagination parsing (routes/governance.ts:84-87): Number('') is 0, so ?limit= (present but empty) yields LIMIT 0 (empty page) instead of the default; there is also no upper bound (?limit=99999999 dumps the whole table).
  5. Mock-fixture replay after headers sent (routes/analysis.ts:241-248): calls replayCachedAnalysis after writeHead with no try/catch (the cached-replay path at 208-218 has one) — a throw there propagates after headers are sent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions