Skip to content

feat(interview-kit): RH probes know which role the candidate applied for - #35

Merged
wboudiche merged 6 commits into
mainfrom
feat/rh-probes-know-the-role
Sep 24, 2026
Merged

wboudiche merged 6 commits into
mainfrom
feat/rh-probes-know-the-role

Conversation

@wboudiche

Copy link
Copy Markdown
Owner

The last item from the #33 review. An RH round's generated questions now see the job's title and description — but still not its criteria or the score breakdown, which is what keeps the register HR rather than technical.

Without the role, the prompt could only ask about the past in the abstract. With it, a question can ask why this move, why here, why a team of this size.

  • generate_profile_probes and draft_profile_question take job_title and job_description and share one _role_block helper, so both paths describe the role the same way.
  • The description is whitespace-normalised and capped at 700 characters: a long pasted JD must not crowd out the career history the questions are built from.
  • Nothing else changes: score-gap generation, curated tracks and the technical drafting path are untouched.

Test plan

  • Backend uv run pytest -q: 852 passed (4 new)
  • uv run ruff check src/ tests/: 474, unchanged
  • Written test-first; each new test failed on the missing role first

New tests: the profile prompt names the role; a 5000-character description is trimmed while the history survives; an RH round's generation carries the role and still no scoring; drafting on an RH track carries it too.

🤖 Generated with Claude Code

wboudiche and others added 6 commits September 24, 2026 18:19
Blind to the scoring, not to the job. Without the role an RH question
can only ask about the past in the abstract — never why this move, why
here, why a team this size. The profile prompts now carry the job's
title and description; its criteria and score breakdown stay out, which
is what keeps the register HR rather than technical.

The description is normalised and capped at 700 characters: a pasted JD
must not crowd out the career history the questions are built from.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review found the hole in the first cut: the weighted criteria are
generated FROM the job description, so handing the RH prompt the raw
description reintroduces in prose the technical material the mode exists
to exclude. A job ad opening on the Kubernetes fleet and the years of
production SRE required is exactly what an RH round must not ask about.

The description now arrives delimited, the way a recruiter's pasted hint
already does, and both profile system prompts say the role is context for
asking why this move and why here — never something whose requirements
become a question about skills. The criteria and the score breakdown
still never reach the prompt.

Also from the review: the role arguments are required rather than
defaulting to None, so a future caller cannot drop the role silently;
_role_block is keyword-only, since both its parameters are strings; the
description is sliced before being normalised rather than normalising an
unbounded job ad; draft_kit_question fetches the job once for both
branches; the cap test pins the budget instead of merely "shorter"; one
API test asserts its scheduling response; and the repeated
function-local imports moved to the module's import block.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Second review of the fencing found it did not hold. A description
containing the delimiter closed the fence early and had its remainder
read as instructions; a description pasted from a web page, mostly
indentation, was thrown away whole because the raw text was trimmed
before its whitespace was collapsed; and the title sat beside the fence
rather than inside it, unbounded.

Title and description are now normalised together, stripped of the
delimiters, cut at a word boundary with a marker saying so, and fenced as
one block. The rule about how to read the role travels inside that block
rather than in the system prompt, so a prompt without a role no longer
tells the model to use one.

The test guarding that rule asserted a substring of a module constant and
so could never fail; it now reads the prompt the model receives. The
draft path, which built its prompt inline and was pinned by nothing, is
covered too, and the drafting handler guards a job row deleted mid-edit
instead of raising an AttributeError dressed up as a 502. Two comments
claiming the description is "deliberately not passed" now say what the
code does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Third review caught a regression from the second: guarding the job row
replaced the criteria fallback with a job check, so a job whose criteria
column holds JSON null would have failed every technical draft with a
502. The fallback is back, and the guard is gone — applications.job_id is
NOT NULL and cascades, so an application whose job is missing has already
404'd above.

The role block had three holes of its own. Its parameters are typed as
strings but three tests passed None, so a job with nothing filled in
described a role called "None None"; absence is now the empty string and
an empty role leaves the block out entirely. Title and description were
normalised together, so "Head of Platform" followed by a description
opening on "Engineering, Paris" read as one job called "Head of Platform
Engineering"; they are normalised separately and joined with a dash. And
the delimiters were stripped from the description but not from the
recruiter's hint, which is interpolated into the same fence one function
away — both now go through one helper that strips the delimiters,
collapses whitespace, caps at a word boundary and fences, in that order,
so stripped delimiters no longer eat into the budget.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fourth review verified the hole left by fencing only the role: the
candidate profile carries web-scraped enrichment summaries, and a summary
containing the delimiter unbalanced the fences outright. It is the least
trusted text in the prompt and was the only unfenced one. Every prompt in
the module now fences the profile, the role and the hint through one
helper.

That helper keeps line structure, which the previous cut did not. A job ad
collapsed to a single line turns its headings and bullets into a run of
dashes, and a recruiter's multi-line hint lost its list — so runs of
spaces are collapsed and blank lines dropped, but the text's own line
breaks are kept.

The guard for the mode's purpose — an RH prompt never carrying the
scoring — had been "fixed" in the previous round by passing an empty role,
which made it assert the absence of the feature it guards. It runs with a
role present again.

Also from the review: the hint block, duplicated in both drafting prompts,
is one helper; the text helpers sit above their first use rather than
under the RH section, since the technical prompts use them too; and the
cap's word-boundary guard keeps the ratio check, which the review read as
unreachable — it is, when the text holds no space at all, but not when a
title is followed by one enormous word, which is the case it was for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fifth review, the findings that belong to this branch. Both blocks tested
their input for emptiness BEFORE the fence markers were stripped, so a
hint of ">>>" announced a topic and handed over an empty block, and a job
of "<<<" described a role called "—". Cleaning now returns the body and
the callers decide on that, which also removes a second pass over the
same text.

The word-boundary cut looked for a space only, so a responsibilities list
pasted one item per line — newlines and nothing else — was cut mid-word
despite the marker promising otherwise. It cuts on any whitespace.

Title and description shared one budget, so a long title ate the part
with something to say; the description is capped on its own budget and the
title is bounded by its column. The drafting prompt is built by a helper
beside its three siblings rather than inline, which is why it kept missing
each round of hardening. Two test claims that were written in terms of the
constant they pinned, or contradicted the schema, now say what is true.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wboudiche
wboudiche merged commit 0c293d8 into main Sep 24, 2026
2 checks passed
@wboudiche
wboudiche deleted the feat/rh-probes-know-the-role branch September 24, 2026 22:32
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