Skip to content

AIV-P1-047: compare the candidates ticked on the ranking side by side, with cited trade-offs - #643

Open
ALFRED-LUCIFER wants to merge 2 commits into
mainfrom
feat/AIV-P1-047-compare-candidates
Open

ALFRED-LUCIFER wants to merge 2 commits into
mainfrom
feat/AIV-P1-047-compare-candidates

Conversation

@ALFRED-LUCIFER

Copy link
Copy Markdown
Owner

Ticket

Closes #111 · AIV-P1-047

Stack: none

What changed

The comparison page at /app/jobs/[jobId]/compare?ids=…, built from the Compare artboard, and the ranking's "Compare" action that opens it.

Owner decision, 26 Nov 2026: not three candidates, any number the recruiter ticks. A comparison holds 2 to 10 candidates (MAX_COMPARED in @credalent/assessment, held equal to the browser's MAX_COMPARE by a test). Ten bounds the page's reads and the trade-offs prompt; it is one constant. The ranking's button text and journeys.md are updated to match.

  • Ranking (features/ranking): "Compare" is no longer behind the compare flag. It is enabled with 2 to 10 rows ticked and opens the comparison with the ticked people in rank order; outside that the disabled button says why ("Choose 2 or more to compare", "Compare up to 10 at a time").
  • Compare page (features/compare, route jobs/(compare)/[jobId]/compare): breadcrumb, "Compare candidates", "Senior AI Engineer · rubric v2. The same 6 competencies…", "Change selection" (back to the ranking with the same people ticked) and "Open decision pack". One row per competency of the approved rubric, heaviest first ("Weight 25% · job needs 4 of 5"); one column per candidate headed by name, backed score and "up to N if claims hold" (ScoreWithUncertainty). Each cell shows strength (StrengthMeter), the verdict ("Above the need · 5 against 2"), provenance (ProvenanceTag) and the first cited item's own words. The competency column stays in view while a wide comparison scrolls sideways.
  • States: one candidate (or more than ten) → "Choose 2 to 10 candidates to compare" with "Change selection"; an id that is not an applicant of this job → "These candidates are not all on this job", and nothing about anyone is read; a candidate not yet scored keeps their column ("Not yet scored", basis "Not yet available"); loading, error with retry, 403 for an ungranted job-scoped member, 404 for a malformed id.
  • The trade-offs (new AI task assessment.compareTradeoffs@1, use case compareTradeoffs in @credalent/assessment), shown when a person clicks "Show the trade-offs": one model call for the compared candidates.
    • The model writes no sentence that is shown. The assessment module writes each candidate's facts from the compared snapshots ("is the only one compared with independently checked work on Arabic and bilingual NLP."). The model picks one to three statements per candidate by citing them: facts lines, and excerpts of the work behind the proven levels. keptTradeoffs shows each pick as it stands in its source: the one facts line that holds the quote, or the excerpt whole.
    • Why so strict: on the live dev model, copied facts lines came back reworded ("has is below…") and lost "the only one compared with"; and the code review of the first commit showed that prose about a piece of work could carry a comparison or advice ("…the strongest of anyone compared and should be advanced") that no rule held back.
    • Rejected whole, reading "Trade-off summary unavailable. The grid above is complete.": an answer citing another candidate's evidence, leaving a candidate out or reordering them, a facts quote that no line or more than one line holds, or nothing picked for one candidate; also when the model cannot be asked.
    • Every compared person's name, emails and phones are redacted from every source. A claim's words are never sent, nor an excerpt in which detectUnusualContent finds text aimed at an AI.
    • Every statement names its candidate ("Layla Haddad is the only one…", "Cited work of Layla Haddad: …"); a cited excerpt is highlighted and links to that item on the candidate's profile.
    • The closing line counts from the snapshots with its basis ("Observed · 7 points separate the 3 candidates."); "Claims still to check could change this order." shows only when a lower candidate's "up to" reaches the highest backed score.
  • Decision pack page: "Open comparison" for a pack of 2 to 10 candidates (its deviation comment named this ticket).
  • Root-cause fix in shared code: listText (assessment domain/explain.ts) wrote ", and Cost and reliability" for a single competency whose name holds "and"; one name is now written as it is. It also affected a ranking explanation with one such claim.
  • e2e seed: Arjun Menon and Layla Haddad each get one competency proven by a checked repository, so the trio compares on real cells. ranking-selection.spec.ts is no longer fixme (it waited for this ticket); its box ticks use the repo's retry-until-hydrated pattern.

Deviations from the Compare artboard and the ticket's wording (also at the top of Compare.tsx and Tradeoffs.tsx)

  • 2 to 10 candidates, not 3 (owner decision above).
  • The trade-offs are not AI-written paragraphs: the model picks, and every word shown is a snapshot fact or cited evidence (reasons above). So the ticket's "is the only one with inspected Arabic work" reads "is the only one compared with independently checked work on Arabic and bilingual NLP."
  • They are shown on demand, not with the page: each ask is a model call on the workspace's AI allowance and none is stored yet (shortcut: in compareTradeoffs).
  • The closing line reads "7 points separate the 3 candidates. Claims still to check could change this order.", not "Seven points separate the three. A difference this small is within what Round 2 could change.": figures as everywhere in the product, and no gap is called small (AGENTS.md 1.7).
  • No "Round 1 outcome" row: nothing reads interview-based score changes yet (AIV-P1-046, [AIV-P1-046] Show what needs live verification, score history and the candidate across roles #110); no outcome is invented.
  • A cell's summary is the first cited item's own words (cut to three lines), not a written summary.
  • A competency resting only on claims reads "Claim only", "0 against N": a claim counts zero (AGENTS.md 1.6). The artboard draws "Supporting · 1 against 2".
  • The demo's "Huda Al Mansoori" is "Layla Haddad" in the seed (personas.md).
  • "Open decision pack" opens the job's Decision page (a job may have several packs). No assistant panel (AIV-P2-028, [AIV-P2-028] Create the assistant module: page context, read tools and cited answers #142).

How verified

Locally, on the final commit unless noted: pnpm lint, pnpm typecheck, pnpm format:check; web 1095 tests, @credalent/assessment 153, @credalent/ai 432, @credalent/i18n 47; pnpm ai:eval (recorded) all tasks pass. On the first commit: tests/architecture 75, tests/integration 975 on PostgreSQL, pnpm --filter web build.

  • Scenario: Three candidates → tests/e2e/src/compare.spec.ts "Scenario: Three candidates" (68 "up to 84 if claims hold", 64/76, 61/82; the Arabic row's "Strong · Above the need · 5 against 2 · Independently corroborated"), Compare.test.tsx, loadCompare.test.ts.
  • Scenario: Trade-offs cite evidence → compare.spec.ts "Trade-offs cite evidence, asked for by keyboard"; modules/assessment/src/application/tradeoffs.test.ts; eval golden set packages/ai/evals/assessment.compareTradeoffs/ (4 cases: the demo trio, a pair where one candidate rests on claims only, an injection case, five candidates), recorded from the dev deployment's live answers: citation validity 100%, contract 100%, field match 100%, safety 100%, judge 100%.
  • Scenario: Candidates from another job and One candidate → compare.spec.ts "One candidate, and candidates from another job", loadCompare.test.ts, Compare.test.tsx.
  • Scenario: Trade-offs unavailable → compare.spec.ts "Trade-offs unavailable" (the fake model answers 503), tradeoffs.test.ts.
  • Unit "cell verdict formatting" → compare.test.ts, Compare.test.tsx.
  • Playwright locally against a throwaway PostgreSQL: compare, ranking-selection, pack-from-ranking, candidate-profile, add-applicants, duplicates, interviews, suggested-questions: 72 passed. axe in light and dark with the trade-offs shown; keyboard path on the ranking and on "Show the trade-offs". A light and a dark screenshot of the page were compared with the artboard by eye.
  • code-reviewer agent on the first commit: 2 blockers, 5 should-fix, 6 nits. All fixed in the second commit except one answered: "use another job's real applicant in the other-job test". The only check is membership of this job's applicant list, so another job's applicant and an unknown id take the same path; the tests now say so.

Not done / follow-up ticket

  • Storing a comparison's trade-offs (so a reload keeps them and an ask is not a new model call): recorded shortcut:; needs a table whose rows a candidate's deletion reaches.
  • "Round 1 outcome" row: AIV-P1-046 ([AIV-P1-046] Show what needs live verification, score history and the candidate across roles #110).
  • The profile's "Compare" button: a comparison starts from the ranking's ticked rows.
  • Not checked on Azure dev (Entra sign-in, the real model behind the page); the live eval ran against the dev deployment from a workstation.

Definition of Done (AGENTS.md §5)

  • Every Gherkin scenario of the ticket passes (with the wording deviations listed above)
  • Written under the Ponytail discipline; code-reviewer agent findings resolved (AGENTS.md 7.0); Copilot's as they arrive
  • Synthetic data only: no real person's data in code, tests, fixtures or logs
  • pnpm lint, pnpm typecheck, affected tests and pnpm build pass locally; CI green
  • Safety tests mutation-checked, each with its // SAFETY: mutation check: comment (name the tests): eval.test.ts "Trade-offs between compared candidates" (crossed citations, a candidate left out, a quote across or between facts lines, the quote shown in place of the line or the excerpt); tradeoffs.test.ts (a candidate named twice, the model's own words, an excerpt aimed at an AI, missing identifiers, authorisation); compare.test.ts and Compare.test.tsx (the order line, claim-only strength, the name on a statement about work); loadCompare.test.ts (not on this job, the job check); navigation.test.ts (the page's 403)
  • Database change: none
  • X1 Security: writeTradeoffs and loadCompare run in inActiveWorkspace; candidate.view is checked per candidate on the job; ids validated with zod
  • X2 Privacy: opaque ids in the URL, the page title names no one, logs carry a task and an error name only; nothing is stored
  • X3 Fairness and human decision: nothing ranks, rejects or contacts anyone; claims count zero; every cell cites; figures carry "Observed"; nobody ticked is dropped; no model-written words
  • X4 States: empty, loading, error, 403 handled
  • X5 Accessibility and language: axe clean in light and dark, keyboard path, strings in packages/i18n, logical utilities
  • X6 Performance: two reads per candidate, at most ten candidates; one model call only on a click
  • X7 No migration; asking again is safe (nothing is written)
  • X8 Quality: unit, e2e on PostgreSQL, eval set
  • Docs: README structure table, journeys.md, the assessment README

🤖 Generated with Claude Code

ALFRED-LUCIFER and others added 2 commits November 26, 2026 20:48
…, with cited trade-offs

The comparison page at /app/jobs/[jobId]/compare?ids=..., from the Compare artboard: the approved rubric's
competencies by candidate (strength, verdict against the job's need, provenance, the cited words), headed by each
candidate's backed score and "up to N if claims hold". Owner decision 26 Nov 2026: any number the recruiter ticks,
not three, so a comparison holds 2 to 10 candidates and the ranking's Compare is no longer behind a flag.

"The trade-offs" is a new AI task, assessment.compareTradeoffs@1, asked for on demand. What compares candidates
is written from the snapshots and only picked by the model through a quote (keptTradeoffs shows the line as
written): the live model reworded copied lines. A statement about cited work links to that item on the profile.
An answer crossing candidates' evidence, leaving one out or leaving nothing for one reads "unavailable".

Also: "Open comparison" on the decision pack page; listText no longer writes ", and X" for one name holding
"and"; the e2e seed gives Arjun Menon and Layla Haddad a checked competency; ranking-selection.spec runs again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s its candidate

Code review of the first commit found that a model-written sentence about a piece of work could still carry a
comparison or advice, and that a candidate whose statements were all about work showed without their name.

- The model now writes no sentence. It picks one to three statements per candidate by citing them, and
  keptTradeoffs shows each pick as it stands in its source: the one facts line that holds the quote, or the cited
  excerpt whole (a part of an excerpt could change what it says). The checks on model prose are gone with the prose.
- A facts quote must pick exactly one line. An excerpt in which detectUnusualContent finds text aimed at an AI is
  never offered as a pick.
- Every statement names its candidate ("<name> is the only one compared with ...", "Cited work of <name>: ...").
- The closing line no longer calls a gap small ("Claims still to check could change this order.") and carries its
  basis, Observed.
- Tests for "Open comparison" on the decision pack page and for listText with one name holding "and"; the README
  row has its status cell. Golden cases re-recorded from the dev deployment's live answers.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

[AIV-P1-047] Compare three candidates side by side with the trade-offs

1 participant