fix(web): unblock staging web image typecheck for inference probes
Docker next build rejected 909de8b8 because engine probe outcomes, reverse-verify source checks, and a nullable window scan failed TypeScript.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
import type { DiscriminatingEventProbe } from "../v9/refinement-packet.ts";
|
||||
import type { ConflictProbe, ProbeOutcome } from "./types.ts";
|
||||
import type { AnswerClass, ConflictProbe, ProbeOutcome } from "./types.ts";
|
||||
|
||||
export type EngineProbeFields = DiscriminatingEventProbe & {
|
||||
information_gain?: number;
|
||||
semantic_key?: string;
|
||||
candidate_split_hash?: string;
|
||||
expected_outcomes?: readonly ProbeOutcome[];
|
||||
left_time?: string;
|
||||
right_time?: string;
|
||||
};
|
||||
const ANSWER_CLASSES: ReadonlySet<string> = new Set(["yes", "weak_yes", "no", "unsure"]);
|
||||
|
||||
export type EngineProbeFields = DiscriminatingEventProbe;
|
||||
|
||||
export function probeFromEngine(probe: EngineProbeFields): ConflictProbe {
|
||||
const semanticKey = probe.semantic_key ?? `${probe.domain}.${probe.year}`;
|
||||
@@ -22,12 +17,34 @@ export function probeFromEngine(probe: EngineProbeFields): ConflictProbe {
|
||||
year: probe.year,
|
||||
question: probe.user_meaning,
|
||||
candidate_ids: [probe.left_time, probe.right_time].filter((item): item is string => Boolean(item)),
|
||||
expected_outcomes: probe.expected_outcomes ?? defaultOutcomes(probe.left_time, probe.right_time),
|
||||
expected_outcomes: outcomesFromEngine(
|
||||
probe.expected_outcomes,
|
||||
probe.left_time,
|
||||
probe.right_time,
|
||||
),
|
||||
information_gain: probe.information_gain ?? 0,
|
||||
source: probe.source,
|
||||
};
|
||||
}
|
||||
|
||||
function outcomesFromEngine(
|
||||
rows: DiscriminatingEventProbe["expected_outcomes"],
|
||||
left?: string,
|
||||
right?: string,
|
||||
): readonly ProbeOutcome[] {
|
||||
if (!rows) return defaultOutcomes(left, right);
|
||||
const parsed: ProbeOutcome[] = [];
|
||||
for (const row of rows) {
|
||||
if (!ANSWER_CLASSES.has(row.answer_class)) continue;
|
||||
parsed.push({
|
||||
answer_class: row.answer_class as AnswerClass,
|
||||
supports: row.supports,
|
||||
conflicts: row.conflicts,
|
||||
});
|
||||
}
|
||||
return parsed.length > 0 ? parsed : defaultOutcomes(left, right);
|
||||
}
|
||||
|
||||
function defaultOutcomes(left?: string, right?: string): ProbeOutcome[] {
|
||||
if (!left || !right || left === right) return [];
|
||||
return [
|
||||
|
||||
@@ -228,6 +228,11 @@ const PROBE_METHOD_ID = {
|
||||
health_pressure: "d30_health",
|
||||
} as const;
|
||||
|
||||
const CONFLICT_PROBE_SOURCES = new Set<string>([
|
||||
"dasha_boundary",
|
||||
"dasha_activation",
|
||||
]);
|
||||
|
||||
function remainingReverseVerifyProbes(
|
||||
probes: readonly DiscriminatingEventProbe[] | undefined,
|
||||
evidence: readonly MethodFollowupEvidence[],
|
||||
@@ -239,7 +244,7 @@ function remainingReverseVerifyProbes(
|
||||
if (probe.source === "known_event_quality" || probe.role === "distinguish") continue;
|
||||
if (declined.has(probe.domain)) continue;
|
||||
if (hasDatedEvidenceInYear(evidence, probe.domain, probe.year)) continue;
|
||||
if (probe.source === "dasha_boundary" || probe.source === "dasha_activation" || probe.source === "dasha_boundary" || probe.source === "dasha_activation") {
|
||||
if (CONFLICT_PROBE_SOURCES.has(probe.source)) {
|
||||
dasha.push(probe);
|
||||
} else {
|
||||
fallback.push(probe);
|
||||
@@ -248,13 +253,6 @@ function remainingReverseVerifyProbes(
|
||||
return [...dasha, ...fallback].slice(0, MAX_REVERSE_VERIFY);
|
||||
}
|
||||
|
||||
const CONFLICT_PROBE_SOURCES = new Set<string>([
|
||||
"dasha_boundary",
|
||||
"dasha_activation",
|
||||
"dasha_boundary",
|
||||
"dasha_activation",
|
||||
]);
|
||||
|
||||
function remainingConflictProbes(
|
||||
probes: readonly DiscriminatingEventProbe[] | undefined,
|
||||
evidence: readonly MethodFollowupEvidence[],
|
||||
|
||||
@@ -638,7 +638,7 @@ export function createRectificationV9Tools(ctx: RectificationV9Context) {
|
||||
evidence: parsed.scorable,
|
||||
probes: refinement.discriminating_event_probes,
|
||||
previous: previousInferenceFromReceipt(dossier.latestResult?.decisionReceipt ?? null),
|
||||
transitionTimes: windowScan.transitions.map((item) => item.at),
|
||||
transitionTimes: windowScan?.transitions.map((item) => item.at) ?? [],
|
||||
});
|
||||
const persisted = await persistV9Candidate(accounting, userId, targetCaseId, {
|
||||
engineResultId: score.engineResultId,
|
||||
|
||||
Reference in New Issue
Block a user