Skip to content

refactor(ats): extract ATSApplication from the mock-data file - #570

Merged
thinkclay merged 1 commit into
mainfrom
claude/ats-application-type
Aug 11, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/ats-application-type

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #536. Net −471 lines.

MockApplication was the production domain type for fourteen components, exported from a file whose own header says it exists so the UI can be built "WITHOUT needing a backend". It is now ATSApplication in features/office/applications/types.ts.

Reconciled, not copied

Three fields are gone, because nothing could ever populate them:

field why
autoRejected there is no auto_rejected column anywhere
notes NotesTab fetches its own via TeamCommentThread
messages MessagesTab fetches its own via useApplicationMessages

notes and messages were not merely unused — they had three consumers, all reading [] forever:

  • the detail tab read "Notes (0)" no matter how many notes existed;
  • ActivityFeedTab looped over both, contributing nothing while making the feed look more complete than it was;
  • the kanban card computed a commentCount that was passed down and never rendered.

Removed rather than defaulted — ?? 0 tells the same lie more quietly.

Optional now, because the employer payload does not carry them: candidate email/phone (gated behind the success fee, fetched by useContactInfo), skills, certifications, experience, and the job's company. CandidateProfileTab now says "Not included in this view" rather than rendering an empty card that reads as "this candidate has no certifications". Absent is not none.

The mock file is deleted, not demoted

The issue's step 3 was to demote ats-mock-data.ts to a fixture importing the domain type. Once every import was repointed, nothing referenced it at all — no fixture, no helper, no Storybook story; all twenty imports were type-only. It was 700 lines whose sole remaining role was housing the type, so I deleted it. Flagging the deviation because it differs from what the issue asked for.

Migration 344 — the vestigial ENUM

core.application_status reads draft, submitted, under_review, interviewing, offer_extended, hired, rejected, withdrawn. The real vocabulary is the CHECK on core.applications.status: new, screen, inquired, interview, offer, hired, rejected, withdrawn. Three labels overlap.

An ENUM looks authoritative, so anyone reading the schema for the canonical status list found a vocabulary no code has ever written or read. Verified against the local database before writing the migration: no column and no function uses the type. DROP TYPE without CASCADE on purpose — if something does depend on it, this should fail loudly rather than quietly removing that object too.

Applied and verified locally: type gone, 27 applications intact, all 4 CHECK constraints intact, status values unchanged.

Verification

  • Office suite 71 passed / 0 failed (6 pre-existing skips); scf-core and app typechecks clean; biome lint clean.
  • Acceptance 1 — no production file imports from a mock-data path. The only remaining mention of MockApplication anywhere is the sentence in types.ts explaining the rename.
  • Acceptance 2 — core.application_status no longer exists.

Note for review

My first pass ran biome check --write, which reformatted files I had not otherwise touched — ProjectHiringScreen.tsx picked up 203 insertions with no type change in it. I reverted everything and redid the rename without the formatter, so the diff is a 1:1 rename plus the specific consumer fixes. The repo's own pre-commit hook then formatted the staged files, which is the established convention here.

Not applied yet

Migration 344 is applied locally only. Per #559, a merged migration has no mechanism that applies it — say the word and I'll run it through dev → preview → prod with the same verification I used for 343.

Closes #536. `MockApplication` was the production domain type for fourteen
components, exported from a file whose own header says it exists so the UI
can be built "WITHOUT needing a backend". The type is now
`ATSApplication` in features/office/applications/types.ts.

Reconciled against what the employer endpoint actually returns, rather
than carried over. Three fields are gone because nothing could ever
populate them:

  autoRejected  there is no `auto_rejected` column anywhere.
  notes         NotesTab fetches its own via TeamCommentThread.
  messages      MessagesTab fetches its own via useApplicationMessages.

`notes` and `messages` were not merely unused — they had three consumers,
all reading `[]` forever. The detail tab read "Notes (0)" no matter how
many notes existed; ActivityFeedTab looped over both and contributed
nothing while making the feed look more complete than it was; the kanban
card computed a `commentCount` that was passed down and never rendered.
Those are removed rather than defaulted, because `?? 0` tells the same lie
more quietly.

Optional now, because the payload does not carry them: candidate email and
phone (gated behind the success fee, fetched by useContactInfo), skills,
certifications, experience, and the job's company name. CandidateProfileTab
says "Not included in this view" instead of rendering an empty card that
reads as "this candidate has no certifications" — absent is not none.

ats-mock-data.ts is deleted rather than demoted to a fixture, which is what
the issue proposed. Once every import was repointed, nothing referenced it
at all: no fixture, no helper, no Storybook story. All twenty imports were
type-only. It was 700 lines whose sole remaining role was housing the type.

Also drops the vestigial core.application_status ENUM (migration 344). It
reads draft/submitted/under_review/interviewing/offer_extended/…, while
the real vocabulary is the CHECK on core.applications.status:
new/screen/inquired/interview/offer/hired/rejected/withdrawn. Three labels
overlap. An ENUM looks authoritative, so anyone reading the schema for the
canonical status list found a vocabulary no code has ever written. Verified
against the local database first: no column and no function uses the type.
DROP without CASCADE on purpose — if something does depend on it, the
migration should fail loudly.

Office suite 71 passed / 0 failed. scf-core and app typechecks clean.
@thinkclay
thinkclay merged commit 8250cce into main Aug 11, 2026
6 of 7 checks passed
@thinkclay
thinkclay deleted the claude/ats-application-type branch August 11, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(ats): MockApplication is the production domain type for 14 components

1 participant