fix(rectification): keep invite collect CHECK-legal after kind mapping (BUG-656)
Independent Staging Quality Gate / validate (push) Successful in 9m14s
Independent Staging Quality Gate / publish (push) Successful in 2m12s

Full TAP failed because invite_more is not a target_kind enum value, and
exhaustion re-decide after skipped targeted persist must reuse decideAfterInferenceChange.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-12 06:34:35 +08:00
co-authored by Cursor
parent eae049d0ea
commit 529fcc097f
6 changed files with 52 additions and 6 deletions
@@ -1625,7 +1625,11 @@ async function persistExhaustionCollect(input: {
followup,
});
dossier = dossierWithSkippedTargetedCollect(dossier, followup);
decision = decideFromDossier(dossier);
decision = decideAfterInferenceChange({
dossier,
state: previousInferenceFromReceipt(receipt),
userStopped: false,
});
catalog = rectificationFollowupCatalog(
dossier.latestResult ?? null,
dossier.evidence,
@@ -407,7 +407,14 @@ test("persistNextInterviewAfterChoice after family denial asks the invite, not o
const setFocus = accounting.calls.find((item) => item.fn === "set_agentic_rectification_conversation_focus");
assert.equal(setFocus?.args.p_target_domain, "other");
assert.equal(setFocus?.args.p_question_id, "collect:invite:more");
assert.equal(setFocus?.args.p_target_kind, "invite_more");
// 原值: invite_more
// 新值: nullcollect_kind=invite_more
// 原因: target_kind CHECK 不允许 invite_more,原 hint 只进 schemaBUG-656
assert.equal(setFocus?.args.p_target_kind, null);
assert.equal(
(setFocus?.args.p_expected_answer_schema as { collect_kind?: string } | undefined)?.collect_kind,
"invite_more",
);
assert.match(
String((setFocus?.args.p_expected_answer_schema as { prompt?: string } | undefined)?.prompt ?? ""),
/^还有吗?/,
@@ -573,7 +573,14 @@ test("persistServerOwnedFocus writes family as target_domain so a no answer beco
assert.equal(invitePersisted.status, "created");
const call = inviteAccounting.calls.find((item) => item.fn === "set_agentic_rectification_conversation_focus");
assert.equal(call?.args.p_target_domain, "other");
assert.equal(call?.args.p_target_kind, "invite_more");
// 原值: invite_more
// 新值: nullcollect_kind=invite_more
// 原因: target_kind CHECK 不允许 invite_more,原 hint 只进 schemaBUG-656
assert.equal(call?.args.p_target_kind, null);
assert.equal(
(call?.args.p_expected_answer_schema as { collect_kind?: string } | undefined)?.collect_kind,
"invite_more",
);
assert.equal(call?.args.p_intent, "collect_method_evidence");
});
@@ -977,4 +977,25 @@ test("T1: collect focus kinds map to the table CHECK enum", async () => {
assert.equal(persisted.focus?.expectedAnswerSchema.collect_kind, item.collectKind);
assert.equal(accounting.calls[0]?.args.p_target_kind, persisted.focus?.targetKind);
}
const inviteMapped = collectFocusTargetKind({ kind_hint: "invite_more", domain: "other" });
assert.equal(inviteMapped, null);
const inviteAccounting = fakeAccounting({
set_agentic_rectification_conversation_focus: (_fn, args) => focusRowFromArgs(args),
});
const invitePersisted = await persistServerOwnedFocus({
accounting: inviteAccounting.client,
userId: USER_ID,
caseId: CASE_ID,
activeFocus: null,
decisionReceipt: null,
followup: collectFollowup({
domain: "other",
kind_hint: "invite_more",
collection_key: "collect:invite:more",
spoken_prompt: "还有吗?把能想起来的都说一声。",
}),
});
assert.equal(invitePersisted.status, "created");
assert.equal(invitePersisted.focus?.targetKind, null);
assert.equal(invitePersisted.focus?.expectedAnswerSchema.collect_kind, "invite_more");
});