fix(rectification): skip covered-domain existence probes, then pick max gain
Dated evidence in a domain no longer yields another existence question in that domain. Remaining varga discriminators all stay in the pool so the next card is whichever unused split scores highest. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -251,6 +251,24 @@ export function askedEventProbeKeysFromLedgerEvidence(
|
||||
return [...keys];
|
||||
}
|
||||
|
||||
export function datedDomainsFromEvidence(
|
||||
evidence: readonly Readonly<{
|
||||
status?: string | null;
|
||||
domain?: string | null;
|
||||
occurredFrom?: string | null;
|
||||
occurredTo?: string | null;
|
||||
}>[],
|
||||
): string[] {
|
||||
const domains = new Set<string>();
|
||||
for (const item of evidence) {
|
||||
if (item.status && !LIVE_EVIDENCE.has(item.status)) continue;
|
||||
if (!item.domain) continue;
|
||||
const dated = [item.occurredFrom, item.occurredTo].some((value) => /^\d{4}/.test(value ?? ""));
|
||||
if (dated) domains.add(item.domain);
|
||||
}
|
||||
return [...domains];
|
||||
}
|
||||
|
||||
export function volunteeredDomainsFromEvidence(
|
||||
evidence: readonly Readonly<{
|
||||
status?: string | null;
|
||||
@@ -286,18 +304,21 @@ export function buildCandidateContrastPacket(input: {
|
||||
transitions?: readonly WindowScanTransition[];
|
||||
askedKeys?: readonly string[];
|
||||
volunteeredDomains?: readonly string[];
|
||||
providedDomains?: readonly string[];
|
||||
}): CandidateContrastPacket {
|
||||
const asked = new Set(input.askedKeys ?? []);
|
||||
const provided = new Set(input.providedDomains ?? []);
|
||||
const fromEngine = (input.engineProbes ?? []).flatMap((probe) => {
|
||||
const built = probeFromEngine(probe, input.candidateSetVersion, input.calculationResultId ?? null);
|
||||
if (!built) return [];
|
||||
const eventKey = built.domain && built.year ? `${built.domain}.${built.year}` : null;
|
||||
const isStructured = built.choiceKind === "varga_style" || built.semanticKey.startsWith("varga.");
|
||||
const isStructured = isStructuredDiscriminator(built);
|
||||
if (
|
||||
asked.has(built.semanticKey)
|
||||
|| asked.has(built.candidateSplitHash)
|
||||
|| asked.has(built.probeId)
|
||||
|| (!isStructured && eventKey && asked.has(eventKey))
|
||||
|| (!isStructured && built.domain && provided.has(built.domain))
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
@@ -316,13 +337,13 @@ export function buildCandidateContrastPacket(input: {
|
||||
transitions: input.transitions ?? [],
|
||||
});
|
||||
const presentKeys = new Set(fromEngine.map((item) => item.semanticKey));
|
||||
const fromVarga = vargaProbe(
|
||||
const fromVarga = vargaProbes(
|
||||
remainingSplits,
|
||||
input.candidateSetVersion,
|
||||
input.calculationResultId ?? null,
|
||||
new Set([...asked, ...presentKeys]),
|
||||
);
|
||||
const probes = [...fromEngine, ...(fromVarga ? [fromVarga] : [])]
|
||||
const probes = [...fromEngine, ...fromVarga]
|
||||
.sort((left, right) => right.informationGain - left.informationGain);
|
||||
return {
|
||||
candidateSetVersion: input.candidateSetVersion,
|
||||
@@ -596,15 +617,23 @@ function styleOptionsFromEngine(
|
||||
return parsed.length > 0 ? parsed : undefined;
|
||||
}
|
||||
|
||||
function vargaProbe(
|
||||
export function isStructuredDiscriminator(probe: Pick<CandidateDiscriminatorProbe, "choiceKind" | "semanticKey">): boolean {
|
||||
return probe.choiceKind === "varga_style"
|
||||
|| probe.choiceKind === "event_quality"
|
||||
|| probe.semanticKey.startsWith("varga.");
|
||||
}
|
||||
|
||||
function vargaProbes(
|
||||
remainingSplits: readonly RemainingVargaSplit[],
|
||||
candidateSetVersion: string,
|
||||
calculationResultId: string | null,
|
||||
asked: ReadonlySet<string>,
|
||||
): CandidateDiscriminatorProbe | null {
|
||||
const remaining = remainingSplits.find((item) => !vargaLayerAsked(asked, item.layer));
|
||||
if (!remaining) return null;
|
||||
return vargaProbeFromRemaining(remaining, candidateSetVersion, calculationResultId);
|
||||
): CandidateDiscriminatorProbe[] {
|
||||
return remainingSplits.flatMap((item) => {
|
||||
if (vargaLayerAsked(asked, item.layer)) return [];
|
||||
const probe = vargaProbeFromRemaining(item, candidateSetVersion, calculationResultId);
|
||||
return probe ? [probe] : [];
|
||||
});
|
||||
}
|
||||
|
||||
function vargaLayerAsked(asked: ReadonlySet<string>, layer: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user