Skip to content

Robust pipeline stage to status mapping (no silent empty columns) #105

Description

@RikepilB

Problem

src/app/api/admin/jobs/[id]/pipeline/route.ts groups applicants by stage.name.toUpperCase() matched against the ApplicationStatus enum (NEW, REVIEWING, SHORTLISTED, INTERVIEW, OFFERED, REJECTED, WITHDRAWN). User-defined stage names that don't match an enum value silently produce empty columns. The seed stages (New / Screening / Interview / Offer / Hired) only match NEW and INTERVIEW — the rest render empty.

Fix

Decouple display stages from the status enum. Options (pick in implementation):

  • Store an explicit status mapping on each PipelineStage, OR
  • Persist applicant→stage by stage id rather than deriving from name→enum.
  • Backfill existing data; ensure no applicants are dropped from view.

Acceptance

  • Custom stage names show their applicants (no silent empty columns)
  • Seed pipeline renders all stages populated correctly
  • Existing applicants preserved after migration
  • Test covering non-enum stage names

Notes

Documented in .claude/rules/scoutlane-architecture.md and CLAUDE.md as a known coupling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions