Skip to content

Light mode, and a round of interview-kit fixes and features - #29

Merged
wboudiche merged 19 commits into
mainfrom
feat/light-mode-and-interview-kit-fixes
Sep 21, 2026
Merged

wboudiche merged 19 commits into
mainfrom
feat/light-mode-and-interview-kit-fixes

Conversation

@wboudiche

@wboudiche wboudiche commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Six commits, each self-contained. Reviewable in order; separable if you'd rather split them.

1. feat(theme): light mode with a toggle

A warm-parchment light theme and a header toggle, without touching a single component's markup. The palette moves out of .geist-theme onto html.dark / html.light in a new theme-palettes.css, so every shadcn token and Tailwind colour utility flips by swapping one class. geist-theme.css keeps only structure and now carries no colour literal at all — a test pins that.

Resolution is localStorage > prefers-color-scheme > dark, shared through a useSyncExternalStore over storage rather than per-component state: the header toggle, the login page and the toast portal all read it at once and would otherwise drift. An inline script paints the class before first paint.

Three things needed real fixes: login.tsx redeclared --ed-* as hex on :root (freezing it dark and leaking those names app-wide); the backdrop grain is white noise under overlay, inert on a near-white ground; and the modal overlays were a hardcoded bg-black/80.

2. fix(interview-kit): regeneration no longer orphans draft answers

The freeze only begins at the first submit, so before that a regeneration minted fresh probe ids and the next sheet save pruned the orphaned answers — silently. merge_regenerated was meant to prevent this but tested the legacy q.answer/q.rating fields, always None since answers moved onto sheets, so it had degenerated into a full rebuild preserving nothing.

run_generate_kit is restructured so the model call is the only thing inside the try and the kit is assembled after the row lock — both things that can change across an LLM round trip now come from one panel read.

Also: an errored kit rendered only a banner, and Retry is recruiter-only, so an interviewer saw an error and no way out while their own sheet sat intact underneath.

3. feat(interview-kit): reopen for another round

A second interview used to require rejecting the candidate — the only legal path was interviewed → rejected → scored → validated → re-invite → scheduled, stamping a rejected_at on someone you wanted to keep and forcing a second invitation email.

Assignments become one row per interviewer per round. Reopening carries the panel forward with empty sheets while the closed round stays submitted and immutable.

The freeze had to split in two — the crux. The kit is one shared blob and the closed round's answers are keyed to its ids, so the question freeze stays global (or reopening regenerates and orphans round one) while round completion becomes current-round only (or round one's rows, submitted forever, close round two the instant it opens). Visibility splits the same way: recruiters see every round, an interviewer only the live one.

4. fix(theme): status colours get tokens

The light-mode sweep missed Tailwind colour classes — it searched hex, rgba and --ed-*, not text-red-600. Eighteen usages across nine files were fixed colours, worst of all banners pairing bg-yellow-50 with dark type: fine on parchment, a muddy smear on near-black.

Status colour is now a trio — type, wash, hairline — for warning, danger and success. All clear AA on both their wash and the page ground, in both themes (5.74 lowest). A test walks every .tsx and fails on a raw palette class with no dark: sibling.

5. feat(interview-kit): richer generation, verdict tally, idempotent generate

Probe generation read candidate.summary or full_name while scoring got the whole structured candidate — for a candidate whose summary never extracted, the entire prompt was "Candidate profile:\nMarie". Enrichment never reached the generator at all. Both now go through a shared candidate_profile module.

generate is idempotent. Not simply "refuse while generating" — a run killed mid-flight would then strand the kit forever — so the guard carries a start timestamp and expires.

The feedback table leads with 2 hire · 1 unsure · 1 outstanding, counting submitted sheets only: a draft verdict is not a decision.

6. feat(interview-kit): lock the wording of an answered question

A submitted answer is a record of what was asked and what was said; rewording the question afterwards changes what that record means.

This narrows a decision from the multi-interviewer build rather than reversing it. That decision kept renaming allowed after a freeze, because ids are what stay stable and a recruiter will want to fix a typo after the first interview. Both concerns survive: the lock applies only to questions answered or rated in a submitted sheet, so an untouched question is still the recruiter's to fix, and a draft answer locks nothing — there is no record yet, and the recruiter may be fixing the very question the interviewer is struggling with.

Enforced in patch_kit (409 naming the ids) and mirrored in the component, which renders a locked question as text. Both spec documents are annotated where they state the old rule — they are a record, and a silent rewrite would mislead the next reader.

Testing

746 backend tests (+23) and 280 frontend tests (+28). tsc --noEmit and the build clean. CI gates on pytest and tsc, both green.

Every test that passed on first write was verified by breaking the implementation to confirm it fails — the palette invariants, the storage fallback, draft-answer orphaning, the cross-round freeze, the idempotency guard, and the richer prompt.

The migration was verified by upgrade → downgrade → upgrade against a scratch Postgres, including the round > 1 delete the downgrade needs before the old unique constraint can be restored.

Both themes were driven in a real browser against the running stack: login, jobs list, kanban with live stage pills, dialogs, toggle persistence, and the new status trios.

Notes for review

  • Stage colours differ between themes — darkened for AA on parchment. Say if you'd rather they matched.
  • Status washes sit close to the ground (~5% lightness). Deliberate: the design is hairlines and flat fills, and a louder wash reads as a stain. Easy to strengthen.
  • prune_answers is deliberately unchanged — it filters the incoming payload, so it was never the loss mechanism, and dropping answers for a question a recruiter explicitly removed is intended.
  • Ruff goes from 459 to 461. Correcting an earlier claim in this description: I previously attributed those 2 findings to the new alembic migration. That was wrong — ruff check src/ tests/ does not scan alembic/versions/ at all, so a migration contributes nothing to that count. The 2 come from the new test file (tests/api/test_interview_rounds.py carries an I001). Ruff is not in CI and reports 459 on main.

🤖 Generated with Claude Code

wboudiche and others added 3 commits September 20, 2026 17:36
The app shipped a single dark editorial palette with no way to switch.
This adds a warm-parchment light theme and a header toggle, without
touching a single component's markup.

The palette moves out of `.geist-theme` onto `html.dark` / `html.light`
in a new theme-palettes.css, so every shadcn token and Tailwind colour
utility flips by swapping one class. geist-theme.css keeps only
structure, typography and chrome, and now carries no colour literal at
all — a test pins that. The `--ed-*` names are roles, not literals:
`--ed-cream` is "high-contrast type" (cream on dark, oxblood ink on
parchment), which the file documents so they aren't misread.

Theme resolution is localStorage > prefers-color-scheme > dark, shared
through a useSyncExternalStore over storage rather than per-component
state — the header toggle, the login page and the toast portal all read
it at once and would otherwise drift. An inline script in index.html
paints the class before first paint, so a light-mode user gets no flash
of the dark ground. Reading localStorage throws rather than returning
null when a browser blocks site data, and that read sits on the render
path, so it is guarded and falls back to an in-memory session value.

Three things needed real fixes rather than a token swap:

- login.tsx redeclared `--ed-*` as hex on `:root`, which both froze it
  to dark and leaked those names app-wide. It now consumes the shared
  tokens via local aliases.
- The backdrop grain is WHITE noise under `overlay`, which is inert on
  a near-white ground. Light mode gets its own black-noise data URI
  under `multiply`.
- Dialog and sheet overlays were a hardcoded `bg-black/80` — right over
  near-black, a grey sheet over parchment. Now a themed `--ed-scrim`,
  byte-identical in dark.

Every light text token passes WCAG AA on the parchment ground (4.77
lowest); the amber accent and stage-extracting were darkened from 4.38
and 3.99 to clear it. Stage colours therefore differ between themes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…or kits stay readable

Two defects found reviewing the kit flow.

Regeneration silently discarded unsubmitted draft answers. The freeze
only begins at the first SUBMIT, so before that a recruiter could
regenerate while interviewers had answers saved. Fresh probe ids were
minted, and since a sheet keys its answers by question id, the next
sheet save pruned the now-orphaned ones — no error, no notice.

merge_regenerated was supposed to prevent exactly this, but it tested
`q.answer`/`q.rating`, the LEGACY per-question fields that stopped being
written when answers moved onto per-interviewer sheets. On any kit
recorded since, both are always None, so the function had quietly
degenerated into a full rebuild that preserved nothing. It now also
takes `answered_ids` — read off the assignment rows by a new
`answered_question_ids` helper — which revives the guarantee its
docstring already promised.

run_generate_kit is restructured so the model call is the only thing
inside the try, and the kit is assembled after the row lock. Both things
that can change across an LLM round trip are now decided from one panel
read: `is_frozen` covers a sheet submitted meanwhile, and the answered
set covers answers typed meanwhile. Reading the answered set before
generation would have left the same race one layer down.

Separately, an errored kit hid everything. A failed regeneration keeps
its questions, and sheets may already hold answers against them, but the
component returned only a banner — and Retry is recruiter-only, so an
interviewer saw an error message and no way out while their own sheet
sat intact underneath. The takeover screen is now reserved for kits with
no questions; otherwise the error renders as a banner above them.

Note prune_answers is deliberately unchanged: it filters the incoming
payload, so it was never the loss mechanism here, and dropping answers
for a question a recruiter explicitly removed is intended behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A second interview used to require rejecting the candidate. `scheduled`
was reachable only from `invited`, and `invited` only by sending an
invitation from `validated`, so the one legal path back was
interviewed -> rejected -> scored -> validated -> re-invite -> scheduled.
That stamped a rejected_at on someone the recruiter wanted to keep, made
them re-send an invitation email, and left round-one interviewers unable
to contribute again: their sheets are permanently submitted and cannot be
removed from the panel.

Assignments become one row per interviewer PER ROUND, and the
application carries the round in progress. `interview_round` is a column
rather than max(assignment.round) because a fresh round exists before any
of its rows do. Reopening copies the panel forward with empty sheets, so
the common "same people, follow-up conversation" case needs no setup,
while the closed round's sheets stay submitted and immutable beside it.

The freeze had to split in two, which is the crux of the change. The kit
is ONE shared blob and the closed round's answers are keyed to its
question ids, so:

- the question freeze stays GLOBAL across every round — otherwise
  reopening would see "round two has no submitted sheets", regenerate,
  mint fresh probe ids and orphan round one's answers;
- round completion becomes CURRENT-ROUND only — otherwise round one's
  rows, submitted forever, would close round two the instant it opened.

Visibility splits along the same seam: recruiters and admins see every
round, since earlier rounds are the record of how the candidate got here,
while an interviewer sees only the live round. Their round-one sheet is
submitted, so the blind rule would happily hand it back — but replaying
an earlier round while they judge this one is the anchoring that rule
exists to prevent.

The UI gets an "Another round" button on interviewed, and the kit labels
the round past the first, where resetting every sheet is otherwise
indistinguishable from a round that never happened.

Migration verified by upgrade/downgrade/upgrade against a scratch
Postgres, including the round>1 delete the downgrade needs before the old
(application, user) unique constraint can be restored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wboudiche wboudiche changed the title Light mode with a toggle, and two interview-kit fixes Light mode with a toggle, and three interview-kit changes Sep 20, 2026
wboudiche and others added 2 commits September 20, 2026 20:28
The light-mode work themed the palette but missed Tailwind colour classes
— it swept hex, rgba and --ed-* references, not `text-red-600`. Eighteen
usages across nine files were left as fixed colours: tuned for one ground,
wrong on the other. The worst were banners pairing near-white washes
(bg-yellow-50) with dark type, which is legible on parchment and a muddy
smear on near-black.

Status colour now comes in trios — the type colour, the wash it sits on,
and its hairline — for warning, danger and success, declared in both
palettes and exposed as `text-warning` / `bg-warning-soft` /
`border-warning-line`. Pairing text with its own wash is what makes a
banner survive a theme flip; inheriting --foreground does not, since that
is cream in dark and ink in light.

Every status type colour clears WCAG AA on both its own wash and the page
ground, in both themes (5.74 lowest). The washes sit deliberately close to
the ground — the design is hairlines and flat fills, and a loud wash would
read as a stain rather than a panel.

A test now walks every .tsx and fails on a raw palette class that has no
`dark:` variant on the same line, which is exactly the bug this fixes. The
score badge and distribution strip keep their raw classes: they already
pair each with a `dark:` sibling, so they were never broken.

Also drops a comment in search-tab that said the app "renders permanently
dark" — true when it was written, false since light mode landed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… idempotent generate

Three improvements from the same review.

Probe generation was reading `candidate.summary or full_name` while
scoring got the whole structured candidate — so for a candidate whose
summary never extracted, the entire prompt was "Candidate profile:\nMarie",
and the questions drifted towards whatever the CV already answers.
Enrichment — repos, talks, posts, the richest source of "ask for a concrete
story" material — never reached the generator at all. Both now go through
a shared `candidate_profile` module, which also absorbs the ORM-to-schema
converter that notifications.py had kept privately.

The profile is prose rather than a JSON dump: these prompts ask for
interview questions, and a model writing questions reads a profile better
than a serialised object. Empty sections are dropped so a sparsely
extracted candidate does not arrive as a wall of "None".

`generate` is now idempotent — a double-click or a second tab bought a
second LLM call whose result merely overwrote the first. The guard is not
simply "refuse while generating": a run killed mid-flight leaves the kit
marked generating for good, and refusing on that alone would strand it
with no way back. So a start timestamp is recorded and the guard expires,
and a generating kit with no timestamp — one written before this field —
stays retryable for the same reason.

Each sheet already carried a hire/no-hire/unsure verdict with nothing
tallying them. The feedback table now leads with "2 hire · 1 unsure ·
1 outstanding", counting SUBMITTED sheets only: a draft verdict is not a
decision, and folding it in would report a split panel as settled.
Anything undecided is named as outstanding rather than dropped, so the
counts always add up to the panel.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wboudiche wboudiche changed the title Light mode with a toggle, and three interview-kit changes Light mode, and five interview-kit fixes and features Sep 20, 2026
@wboudiche wboudiche changed the title Light mode, and five interview-kit fixes and features Light mode, and a round of interview-kit fixes and features Sep 20, 2026
wboudiche and others added 9 commits September 20, 2026 21:51
…answered

A submitted answer is a record of what was asked and what was said.
Rewording the question afterwards changes what that record means, which
matters the moment a hiring decision is questioned — and the old
`merge_regenerated` docstring valued "original wording" for exactly this
reason before answers moved onto sheets.

This narrows a decision recorded during the multi-interviewer build
rather than reversing it. That decision kept renaming allowed after a
freeze, on the grounds that ids are what stay stable and a recruiter
will want to fix a typo after the first interview. Both concerns survive:
the lock applies only to questions answered or rated in a SUBMITTED
sheet, so an untouched question is still the recruiter's to fix, and a
draft answer locks nothing — there is no record yet, and the recruiter
may well be fixing the very question the interviewer is struggling with.

Enforced in `patch_kit` with a 409 naming the offending ids, and mirrored
in the component, which renders a locked question as text rather than a
textarea: offering an editable box that fails on save would be a worse
way to find out.

Both spec documents are annotated where they state the old rule, since
they are a record and a silent rewrite would mislead whoever reads them
next.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A job is interviewed in more than one way — a technical conversation and
an RH screen ask different questions, are run by different people, and
sometimes happen at different times. Neither is expressible while an
application has exactly one question list in a JSON blob.

This is phase 1 of four: move kits into their own table keyed by
(application, round, track), with no user-visible behaviour change. It
exists to make templates, parallel tracks and generator modes cheap, and
it removes a special case on the way — the question freeze only spans
rounds because rounds share one blob, which currently makes it
impossible to regenerate round two's questions at all once round one has
a submitted sheet.

Records eight decisions so the plan does not reopen them, including why
`track` lands a phase early (it is part of the unique constraint) and
why the ORM model takes a Row suffix (InterviewKit is already the
Pydantic schema in the module that would import both).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four tasks, each with its own test cycle and commit. Two migrations
bracket the refactor so the tree is green at every step: migration A
creates the table and backfills while the blob stays untouched, the call
sites then switch behind one store module, and migration B drops the
blob last once nothing reads it.

The self-review pass added four tests the spec asked for that the first
draft missed — legacy answer/rating surviving the copy, every blob key
landing in its column, the kit row's three creation points, and naming
the two existing idempotency tests as the signal that
generation_in_flight now reads the row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
One row per (application, round, track), backfilled with a copy per round
because a reopened application shares one blob today and round one's
submitted sheets resolve against its question ids.

The blob is deliberately left in place so this revision is lossless in
both directions and nothing has to change at once.

Also fixes two things the new in-process migration test exposed:
- alembic/env.py disabled every already-created app logger
  (disable_existing_loggers defaults to True in fileConfig) the first time
  alembic ran inside the pytest process, breaking unrelated logging tests
  later in the same run.
- psycopg2-binary was never an actual dependency; testcontainers' sync
  connection URL needs it and nothing in the suite exercised that path
  before this test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rview_kits

Review found that InterviewKit.submitted_at (the pre-multi-interviewer
single-submit timestamp, still read by merge_regenerated) was missing from
InterviewKitRow, migration A's table, and its backfill — silently
unrecoverable once Task 4 drops the blob. Add the column, backfill it from
interview_kit ->> 'submitted_at', and extend the migration test to assert
it round-trips.

Migration c1a7e05b3f92 is edited in place: it is brand new and unpushed,
so a one-column follow-up would be noise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every call site moves from applications.interview_kit to the row for
(application, current round, 'default'), behind one small store module
(kit_store.py) that both routers can import without a cycle.

content_of/apply_content also carry submitted_at, per Task 1's ruling
that the legacy single-submit timestamp must survive the move
(InterviewKitRow already had the column; the store's brief omitted it).

No behaviour change: the existing kit, freeze, sheet, panel and rounds
tests pass, which is this commit's correctness signal. Several
pre-existing tests seeded and asserted on storage internals directly
(update(Application).values(interview_kit=...), row.interview_kit) —
their fixtures move to interview_kits rows too, since the storage they
poke at moved; every assertion is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The freeze spanned every round only because rounds shared one question
list: regenerating round two would mint fresh ids and orphan round one's
submitted answers. Each round owns its kit now, so the special case goes
— and with it the limitation that a reopened round could never regenerate
its questions at all.

Two tests asserted the old rule and are replaced, not adjusted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nothing reads the blob now. Split from the migration that created
interview_kits so that one stays lossless in both directions; this one's
downgrade rebuilds the blob from the highest round, which phase 3 must
revisit once rounds can genuinely diverge.

Also updates the stale InterviewAssignment docstring, which still pointed
at applications.interview_kit, to describe the interview_kits table and
its (application_id, round, track) match key instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- run_generate_kit re-resolves kit_row after taking the row lock and
  abandons the write if the round moved since dispatch, so a
  SCHEDULED -> INTERVIEWED -> SCHEDULED round trip during generation
  can no longer reopen and overwrite a closed round's row.
- Scope both answered_question_ids(...) call sites in interview.py to
  the current round, matching the is_frozen sites, so regeneration and
  the reword guard actually see only their own round's answers instead
  of every prior round's.
- _open_next_round carries the previous kit's status and error forward
  instead of forcing "ready", so a round stuck in "error" stays
  visibly broken on reopen.
- Seed an application before upgrading to LATEST in the migration
  downgrade test so json_build_object's data path actually runs, and
  assert all seven blob fields (plus a nested legacy answer/rating)
  survive the round trip.
- Delete the dead _seed_kit helper in test_interview_stage_wiring.py.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
wboudiche and others added 5 commits September 21, 2026 02:19
Two of them made the interview-round feature unusable for the single
recruiter it was written for.

**A recruiter could not fill in their round-2 sheet.** A recruiter is
shown every round's sheets, oldest first, and `SheetRead` carried no
round — so the component matched on user_id alone and found the round-1
row. After reopening, the page showed that sheet as already submitted,
seeded the editor with round-1 answers, and offered no way to record
round-2 feedback. The round could then never close, leaving the
candidate stuck in SCHEDULED. `SheetRead` now carries `round` and both
the sheet lookup and the feedback table match on it.

**The feedback table double-counted a reopened panel.** Columns were
keyed by user_id, which collides the moment someone holds a sheet in two
rounds, and the verdict tally counted the whole history: a reopened
two-person panel read "2 unsure · 2 outstanding" across four unlabelled
columns. It now renders the live round only.

**The board badge counted every round.** `_sheet_counts` grouped by
application alone, so a reopened two-person panel read 2/4 — as if half
the new round were already in. It now joins `interview_round`.

**Reopening was the one round mutation without a row lock.** It
read-modify-writes `interview_round` then inserts a row per panellist, so
two concurrent reopens both read the old round and collided on the
assignment unique constraint as an unhandled 500 — reproduced in a test
before the fix. `submit_sheet`, `patch_sheet` and `put_interviewers`
already locked; the PATCH handler now does too.

**An OS appearance change never repainted the page.** `applyTheme` was
reached only through `setTheme`, i.e. an explicit toggle. When macOS
flipped at sunset with nothing stored, the hook reported light while
<html> kept its dark class: the icon and toasts flipped, the page did
not, and the next click looked like a no-op because `resolveTheme`
already returned the target theme. The media listener now repaints before
notifying.

The test that let the last one through asserted only the hook's reported
value, never the DOM — it now asserts both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The previous commit taught the sheet lookup about rounds; review found
three more reads in the same component still treating every round's
sheets as one list. A recruiter is shown every round, oldest first, and
round one's sheets stay submitted forever, so each of these went wrong
the moment an application was reopened:

- The question freeze read "any sheet submitted" across rounds, so after
  a reopen every Remove button was disabled for good — contradicting the
  server, which allows that removal in round two.
- `canWriteSheet`'s no-panel-yet fallback checked every round, while the
  server's `_own_assignment` checks the live one. With round two's panel
  emptied, the server would create the recruiter's row but the page
  showed no editor.
- The sheet editor's seed key was (user, submitted). Closing a round by
  hand with a draft and reopening kept that key, so the editor held on to
  round one's draft and Save would have written it into round two. Round
  is now part of the key.

All three now go through one `liveRoundSheets` list, so there is a single
place that decides what "the sheets" means.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Interview kits become rows (phase 1 of multiple kit kinds)
@wboudiche
wboudiche merged commit d25c344 into main Sep 21, 2026
2 checks passed
@wboudiche
wboudiche deleted the feat/light-mode-and-interview-kit-fixes branch September 21, 2026 16:35
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.

1 participant