Skip to content

feat(interview-kit): interview templates (phase 2) - #31

Merged
wboudiche merged 11 commits into
mainfrom
feat/interview-templates
Sep 21, 2026
Merged

wboudiche merged 11 commits into
mainfrom
feat/interview-templates

Conversation

@wboudiche

Copy link
Copy Markdown
Owner

Phase 2 of multiple kinds of interview kit. Org-wide interview templates (e.g. "Technical", "RH screen") decide what a round's kit contains and whether it gets LLM-generated probes. A template is picked when a round starts, so round one can be technical and round two an RH screen.

Spec: docs/superpowers/specs/2026-09-21-interview-templates-design.md · Plan: docs/superpowers/plans/2026-09-21-interview-templates.md

What changes

  • Settings → Interview templates (admins and recruiters; viewers are refused by the /api viewer guard). Create, edit, archive and unarchive. Each template has questions, a probe mode (score_gaps or none), and an "include the job's own questions" switch. Templates are archived, never deleted, and a name is unique only among active templates.
  • Job default: the job details sheet gains a "Default interview template" select.
  • Round start: "Mark as scheduled" and "Another round" open a picker with the job's default preselected, plus "No template". With no templates defined, the picker never appears and both buttons send exactly what they sent before.
  • Snapshot: a kit keeps a copy of its template (template_id, template_name, template_snapshot). Regeneration reads that copy, never the live template, so editing a template can't rewrite a round under way.
    • Template question ids are namespaced t<template_id>-<id> so they can't clash with the job's own.
  • RH-style templates (probe_mode: none) make no LLM call, including on installs with no provider configured.
  • Reopening with the same template copies the kit forward, as today. A different template starts the new round's kit fresh from that template.
  • Kit header reads e.g. "Round 2 · RH screen".
  • API:
    • GET/POST /api/interview-templates, PATCH /api/interview-templates/{id}
    • default_interview_template_id on jobs
    • optional interview_template_id on PATCH /api/applications/{id} with stage: "scheduled": absent means the job's default, null means no template
    • template_name on the kit read
  • Migration e6f2a9c4b1d3 is purely additive. Existing kits come through with no template and behave exactly as before, and the downgrade drops only what it added. The forward, back and forward-again round trip is tested on real Postgres.

Decisions made during implementation

  1. The ruff check stayed flat except for 3 B008 findings from FastAPI Depends(...) defaults. The repo already had 121 of those.
  2. interview_templates.questions defaults to '[]' in the database, as the spec asks.
  3. The spec's "answers stay with the right question" test is covered by asserting the namespaced ids are distinct, because sheets store answers by question id.
  4. If a job's default template is archived, the job sheet shows "None" and the stale id stays in the column. The server already treats an archived default as none. Un-archiving the template restores it as the preselected default.
  5. Re-scheduling the same round keeps the kit's snapshot when the template is unchanged. It re-snapshots only when a different template is chosen, so live template edits never leak into a round under way.

Known limitations (deferred)

  • Once round 1's template is archived, round 2 can't copy round 1's kit forward and starts fresh. With no LLM configured, that fresh kit becomes an error kit. Answers already given are per round, so nothing is lost. A candidate for phase 3, e.g. a "same as last round" option.
  • Clicking Generate by hand still needs an LLM provider, even for a none-mode kit.
  • Minor test gaps and cosmetic points are recorded in the review notes. None of them block the merge.

Test plan

  • Backend uv run pytest -q: 790 passed
  • Frontend npx vitest --run: 297 passed
  • npm run lint (tsc) and npm run build are clean
  • uv run ruff check src/ tests/: 466 (463 baseline + 3 B008)
  • Migration forward, back and forward again; alembic upgrade head matches create_all with zero autogenerate drift
  • After merge: back up the local DB, alembic upgrade head, then create an "RH screen" template (probes off, job questions off) and schedule a round with it

🤖 Generated with Claude Code

wboudiche and others added 11 commits September 21, 2026 13:42
Org-wide, reusable question sets that decide what a round's kit contains
and whether it gets generated probes. A recruiter picks the template when
a round starts, so round one can be technical and round two an RH screen.

Two things make this more than a lookup table. Probe generation is
always driven by the technical score breakdown, so a template must be
able to switch probes off or an RH kit would carry questions derived
from technical criteria. And a kit snapshots its template at creation, so
editing a template can never rewrite a round already under way.

With no templates defined, nothing changes: every existing kit and every
job behaves exactly as before.

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

Tables and schemas only; nothing reads them yet. A kit snapshots its
template at creation so editing a template can never rewrite a round
already under way, and a template name is unique only among active
templates so archiving frees it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two pure functions decide a kit's fixed questions and whether it gets
generated probes, from a snapshot rather than the live template. With no
template they return exactly what kits have always been built from.
Template question ids are namespaced so they can never share an id with
the job's own questions, since sheets key answers by id.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CRUD for org-wide templates, archived rather than deleted. The router
sits on _api_router so viewers are refused by the same guard as every
other /api route. A job gains an optional default template, which an
archived template cannot become.

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

Scheduling and reopening take an optional interview_template_id: absent
uses the job's default, null uses none. The kit snapshots the template,
and generation reads the snapshot, so an RH template yields curated
questions with no model call while editing a template never rewrites a
round under way. Reopening with the same template copies forward as
before; a different one seeds fresh.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
second's job had no default, so absent and explicit null both resolved
to no template regardless of _resolve_round_template's null handling.
Give second's job the same default first, so the assertion can only
hold if explicit null overrides it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The baseline sheet's question editor is extracted so templates reuse it,
with the baseline tests unchanged as the proof the extraction moved
nothing. Admins and recruiters get an Interview templates tab; a job can
choose which template a round starts from by default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Mark as scheduled and Another round open a picker with every active
template, the job's default preselected, plus No template. With no
templates defined the picker never appears and both buttons stay a
single click. The kit header names the template the round was built from.

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

Final-review fixes for the interview templates branch:

- Strengthen the same-template reopen test so it can actually fail: edit
  the template and hand-add a question to round 1's kit between rounds,
  then assert round 2 copied round 1's snapshot/name/questions forward
  instead of re-reading the live (edited) template.
- Assert the template PATCH succeeds in the "editing a template" test,
  so a failing edit can't make it pass vacuously.
- Stop patch_application's same-round restamp from rewriting an unfrozen
  kit's template snapshot when the SAME template is chosen again; only
  restamp when a genuinely different template is picked. Add tests for
  both the same-template (snapshot unchanged) and different-template
  (restamped) cases.
- Move snapshot_from_row inside run_generate_kit's try block so a
  malformed stored snapshot becomes an error kit instead of an
  exception escaping this "never raises" background task.
- Restore two comments dropped from _open_next_round explaining why the
  round's interviewed_at is cleared and why the previous kit's
  status/error carry forward on a same-template reopen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Trim the template name before it's sent in the create/edit PATCH, so
  "RH screen" and "RH screen " can't both exist as active templates.
  Add a test asserting a trailing-space name is POSTed trimmed.
- Remove the unused InterviewTemplateInput export from
  use-interview-templates.ts (nothing imports it).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wboudiche
wboudiche merged commit cefd020 into main Sep 21, 2026
2 checks passed
@wboudiche
wboudiche deleted the feat/interview-templates branch September 21, 2026 22:26
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