fix(rectification): keep candidate state coherent
Independent Staging Quality Gate / validate (push) Failing after 15m32s
Independent Staging Quality Gate / publish (push) Has been skipped

This commit is contained in:
Jesse_Chen
2026-08-27 13:59:38 +08:00
parent 518119acbd
commit 5f855c610c
30 changed files with 2109 additions and 167 deletions
@@ -218,9 +218,15 @@ test("candidate results restore through the durable Candidate Snapshot API, neve
assert.doesNotMatch(chat, /<!--AYANAM_SUGGESTIONS/);
});
test("candidate acceptance is non-billable and happens through the durable case endpoint", () => {
test("candidate acceptance is non-billable, mutually exclusive, and continues through the durable case endpoint", () => {
assert.match(chat, /\/candidates\/accept/);
assert.match(chat, /resultId: candidateResult\.resultId/);
assert.match(chat, /if \(!candidateResult \|\| acceptingCandidateId \|\| busy \|\| readonly\) return;/);
assert.match(chat, /setAcceptingCandidateId\(candidateId\);[\s\S]*setPending\(true\);/);
assert.match(chat, /await loadCaseSnapshot\(\);[\s\S]*choiceContinuationPending\.current = true;/);
assert.match(chat, /finally \{[\s\S]*setAcceptingCandidateId\(null\);[\s\S]*setPending\(false\);/);
assert.match(chat, /if \(!choiceContinuationPending\.current \|\| busy \|\| readonly\) return;[\s\S]*void send\("read_only", ""\);/);
assert.doesNotMatch(chat, /await loadCaseSnapshot\(\);[\s\S]*await send\("read_only", ""\);/);
assert.doesNotMatch(chat, /action: "accept_candidate"/);
const acceptRoute = readFileSync(
new URL("../src/app/api/rectification/cases/[caseId]/candidates/accept/route.ts", import.meta.url),
@@ -610,8 +616,8 @@ test("rectification Agent output stays natural and keeps tool execution silent",
assert.match(agent, /本轮做了什么/);
assert.match(agent, /完成凭证完全由服务端公开 Activity\/receipt 展示/);
assert.match(agent, /禁止只说记下了、会话会保留、以后再继续/);
assert.match(agent, /暂时想不到了 \/ 没有更多 \/ 没有了 \/ 没了 \/ 没有其它 \/ 想不起来了 \/ 先这样/);
assert.match(agent, /on_user_stop/);
assert.match(agent, /没有 \/ 没有了 \/ 没有其它 \/ 想不起来了.*只关闭当前 focus 或当前领域/);
assert.match(agent, /结束校正 \/ 不想继续 \/ 直接给结果 \/ 就到这里.*on_user_stop/);
assert.match(agent, /skill_verification_report/);
assert.match(agent, /D9\/D10 类型对照/);
assert.doesNotMatch(agent, /分盘句和宫位表由界面展示/);