fix(rectification): bind quality cards to the followup probe
Graduation no longer gets the college-experience question, and identical D24 splits only ask once. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -100,6 +100,7 @@ export type ChoiceCardFollowup = Readonly<{
|
||||
choice_kind?: EventProbeChoiceKind;
|
||||
style_options?: readonly EventProbeStyleOption[];
|
||||
semantic_key?: string;
|
||||
probe_id?: string;
|
||||
}>;
|
||||
|
||||
export type ChoiceCardEvidence = Readonly<{
|
||||
@@ -230,12 +231,28 @@ function followupDomain(followup: ChoiceCardFollowup): string | null {
|
||||
return THEME_DOMAIN[followup.ask_theme] ?? null;
|
||||
}
|
||||
|
||||
function probeMatchesId(item: DiscriminatingEventProbe, probeId: string): boolean {
|
||||
return item.semantic_key === probeId;
|
||||
}
|
||||
|
||||
function pickProbe(
|
||||
probes: readonly DiscriminatingEventProbe[] | undefined,
|
||||
domain: string | null,
|
||||
followup?: ChoiceCardFollowup,
|
||||
): DiscriminatingEventProbe | null {
|
||||
if (!probes?.length) return null;
|
||||
const probeId = followup?.probe_id?.trim() ?? "";
|
||||
const semanticKey = followup?.semantic_key?.trim() ?? "";
|
||||
const hasKey = Boolean(probeId || semanticKey);
|
||||
if (probeId) {
|
||||
const byId = probes.find((item) => probeMatchesId(item, probeId));
|
||||
if (byId) return byId;
|
||||
}
|
||||
if (semanticKey) {
|
||||
const keyed = probes.find((item) => item.semantic_key === semanticKey);
|
||||
if (keyed) return keyed;
|
||||
}
|
||||
if (hasKey) return null;
|
||||
const inDomain = domain ? probes.filter((item) => item.domain === domain) : [...probes];
|
||||
const pool = inDomain.length > 0 ? inDomain : probes;
|
||||
if (followup?.choice_kind === "event_quality") {
|
||||
@@ -244,10 +261,6 @@ function pickProbe(
|
||||
);
|
||||
if (quality) return quality;
|
||||
}
|
||||
if (followup?.semantic_key) {
|
||||
const keyed = pool.find((item) => item.semantic_key === followup.semantic_key);
|
||||
if (keyed) return keyed;
|
||||
}
|
||||
return pool[0] ?? probes[0] ?? null;
|
||||
}
|
||||
|
||||
@@ -386,8 +399,10 @@ export function buildChoiceFrame(
|
||||
const skipQuestion = skipThisProbe
|
||||
|| followup.intent === "out_of_sample_check"
|
||||
|| followup.source === "oos_blind";
|
||||
const probeKey = followup.semantic_key?.trim() || followup.probe_id?.trim() || "";
|
||||
const questionBase = `${followup.method_id}:${followup.ask_theme}:${scoring ? "score" : "holdout"}`;
|
||||
return {
|
||||
question_id: `${followup.method_id}:${followup.ask_theme}:${scoring ? "score" : "holdout"}`,
|
||||
question_id: probeKey ? `${questionBase}:${probeKey}` : questionBase,
|
||||
method_id: followup.method_id,
|
||||
period: periodFor(input.evidence, domain, input.probes, input.birthDate, followup),
|
||||
prompt: hypothesis.prompt,
|
||||
|
||||
Reference in New Issue
Block a user