All problems

Concurrent Job Dispatches Overwrite Shared Station Context

Level 2 · node · Concurrency · Shared request context overwritten during asynchronous authorization

Scenario

A fictional manufacturing dispatch service accepts jobs and stores them by station after asynchronous authorization. When jobs for different stations are submitted concurrently, a second request overwrites the shared active station while the first request awaits authorization. The first job can then be stored under the wrong station. Inspect the repository, service, and controller flow.

Requirements

Keep each request's station identifier consistent before and after asynchronous authorization. Concurrent jobs for different stations must not interfere. Preserve single and sequential requests, per-station lists, rejection of invalid input, and avoid external dependencies or network calls.

Acceptance criteria

  • Two concurrent jobs are assigned to their respective stations.
  • A single job is assigned to its requested station.
  • Stored jobs are separated by their requested station.
  • An unknown station returns an empty job list.
  • Sequential jobs remain assigned to their own stations.
  • An invalid job request leaves stored jobs unchanged.