Skip to content

feat(ats): stage-move toast — and why Undo cannot mean "move it back" #643

Closed

Description

@thinkclay

The prototype's mobile pipeline moves a candidate with a stage-tag sheet and confirms it with a toast carrying Undo. We cannot implement the Undo half as "move it back", and it is worth writing down why before somebody adds the button.

The transition graph is strictly one-way

packages/scf-core/features/office/applications/hooks/useApplicationStatusChange.ts:60

export const ALLOWED_TRANSITIONS: Record<ApplicationStatus, ApplicationStatus[]> = {
  new:       ['screen', 'rejected'],
  screen:    ['inquired', 'interview', 'rejected'],
  inquired:  ['interview', 'offer', 'rejected'],
  interview: ['offer', 'rejected'],
  offer:     ['hired', 'rejected'],
  hired:     [], // Terminal
  rejected:  [], // Terminal
  withdrawn: [],
}

Every edge points forward. There is no pair (a, b) where both a → b and b → a are legal, so isValidStatusTransition(to, from) is false for every move an employer can make. The comment at :49 says this mirrors the API's application-transitions.ts, so the server refuses the same moves — an Undo button wired to a reverse changeStatus would render, be clickable, and produce a 400 every time.

That is the failure mode this project keeps hitting: a control that looks real and does nothing.

Two honest options

A. Delayed write (recommended). The toast holds the mutation for a few seconds and Undo cancels it before it is ever sent — Gmail's "Undo Send". Nothing is reversed because nothing was written. Needs: optimistic cache update, a timer, a flush on unmount/navigation so a move is never silently lost, and care that the ['applications'] invalidation does not clobber the optimistic state mid-window.

B. Allow backward transitions. A product and data-model decision, not a UI one. It has real consequences: the ATS brief is built on candidates seeing "each move as honest progress, not silence", and a candidate who sees "moved to Interview" and is then quietly moved back is precisely the dishonesty that argument is against. If we do this it needs to be deliberate, and probably visible to the candidate.

Until one of those lands, the toast should confirm the move without an Undo action. That is still worth shipping on its own: a stage move currently produces no feedback at all on a phone.

Acceptance

  • Moving a candidate shows a toast naming the candidate and the destination stage.
  • Either (A) Undo cancels the pending write inside the window and the row returns to its original stage with no request sent, or (B) a decision is recorded here that backward transitions are allowed, and ALLOWED_TRANSITIONS plus the server table are updated together.
  • No Undo affordance is rendered for a move that cannot actually be undone.
  • If (A): navigating away or unmounting inside the window flushes the write rather than dropping it.

Out of scope

The stacked-card layout for the mobile pipeline — that shipped separately.

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

    ATSFrontendenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions