a368c74a9a
Pure-function module that derives per-stage StageState (one of pending / in_progress / done / skipped) from the existing ScanStatus payload. No new query, no new endpoint — reuses what createScanStatusQuery already polls. Truth table covered by tests: scan undefined → skipped; in-flight with no tallies → all pending; in-flight with library tally only → library in_progress, rest pending; in-flight with library + mbid_backfill → library done, mbid in_progress; finished with all tallies → all done; finished with missing library tally → library skipped, others done; in-flight with last stage tally → only last stage in_progress (all earlier done).