fix(loop-engine): carded 只跳过这一笔,不收拍 —— 配方尾部的笔从前永远不跑

同一份配方 `[project, card, project]` 在两种局面下行为相反:人还在填(quiet)时
card 被 quiet 过滤 `continue` 掉,**第三笔照跑**;人交回之后(非 quiet、carded)
走到 carded 分支 `stop: true` break 掉整条 do,**第三笔不跑**。
也就是说**唯一一个「人的答案已经在草稿里」的时刻,配方的后半截偏偏不执行**;
而人还没答完时它倒是跑了。写配方的人会很自然地写「铺格 → 发卡 → 收口整理」,
然后发现第三笔从来没生效过 —— 静默,没有痕。

「收拍」留给**真发出去了卡**那一次(两条带 stop 的 return 不动)。

配套一条装包 warn:card 后面还有 N 笔时说清它们什么时候跑 —— 顺序读起来像
「一拍连做」,实际要等人交回之后的那一拍。

auto-runner 3 测(carded 跑完 / 真发卡仍收拍 / quiet 与 carded 现在一致)+
static-audit 2 测。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKMZDwMbyKzjw6Hembwvet
This commit is contained in:
xcs
2026-08-29 08:29:21 +08:00
co-authored by Claude Opus 5
parent 198d12af1b
commit a09acc7504
4 changed files with 90 additions and 1 deletions
@@ -581,3 +581,45 @@ describe('createOnly + 配方:已在库的当「不用建」跳过,不抛(I2)',
expect([...drafts.values()].find((d) => d.key['internal_pn'] === 'IN_LIB')?.landed).toBe(true);
});
});
/**
* **`carded` 只跳过这一笔,不收拍**(2026-08-29 终审 I3)。
*
* 从前 carded 分支 `stop: true` → break 掉整条 `do`。同一份配方 `[project, card, project]`
* 在两种局面下行为相反:人还在填(quiet)时 card 被 quiet 过滤 `continue` 掉,**第三笔照跑**;
* 人交回之后(非 quiet、carded)走到 carded 分支 break,**第三笔不跑** ——
* 唯一一个「人的答案已经在草稿里」的时刻,配方的后半截偏偏不执行,而且静默、没有痕。
*/
describe('carded:跳这一笔,不收拍(I3)', () => {
const THREE: AutoRecipe = {
do: [
{ kind: 'project', into: 'sub_eval.part', from: { once: true }, fields: { eval_ref: 'W05-1', internal_pn: 'A' } },
{ kind: 'card', as: 'execution', title: '请补齐', basis: [{ k: 'a', v: 'b' }] },
{ kind: 'project', into: 'parts.parameter', from: { once: true }, fields: { internal_pn: 'A', param_name: '收口', param_value: '1' } },
],
};
it('人交回之后那一拍:卡不再发,**卡后面那一笔照跑**', async () => {
const { runner, drafts, cards, ctx } = harness({});
const out = await runner.run(THREE, { ...ctx, carded: true });
expect(cards.issued).toHaveLength(0);
expect(out.issuedCardId).toBeUndefined();
expect([...drafts.values()].map((d) => d.object).sort()).toEqual(['parameter', 'part']);
});
it('卡真发出去那一拍仍然收拍 —— 「收拍」留给发得出去的那一次', async () => {
const { runner, drafts, cards, ctx } = harness({});
const out = await runner.run(THREE, ctx);
expect(cards.issued).toHaveLength(1);
expect(out.issuedCardId).toBe('card-1');
// 第一笔写了,第三笔没跑
expect([...drafts.values()].map((d) => d.object)).toEqual(['part']);
});
it('人还在填(quiet)那一拍:card 被跳过,前后两笔都跑 —— 两种局面现在一致了', async () => {
const { runner, drafts, cards, ctx } = harness({});
await runner.run(THREE, { ...ctx, quiet: true, carded: true });
expect(cards.issued).toHaveLength(0);
expect([...drafts.values()].map((d) => d.object).sort()).toEqual(['parameter', 'part']);
});
});
@@ -211,13 +211,22 @@ export function createAutoRunner(deps: AutoRunnerDeps): {
* 不必再有一个「先 start」的礼仪:学不稳的礼仪就是死法(2026-08-02 已拆过一次)。
*/
if (context.carded) {
/*
* **只跳过这一笔,不收拍**(2026-08-29 终审 I3)。从前这里 `stop: true`,
* 于是同一份配方 `[project, card, project]` 在两种局面下行为相反:
* 人还在填(quiet)时 card 被上面那道 quiet 过滤 `continue` 掉 → **第三笔照跑**;
* 人交回之后(非 quiet、carded)→ 走到这儿 break,**第三笔不跑**。
* 也就是说唯一一个「人的答案已经在草稿里」的时刻,配方的后半截偏偏不执行 ——
* 写配方的人会很自然地写「铺格 → 发卡 → 收口整理」,然后发现第三笔从来没生效过,
* 而且静默、没有痕。**「收拍」该留给真发出去了卡那一次**(下面两条 return 带 stop)。
*/
await deps.memory.append({
taskId: context.taskId,
kind: 'observation',
title: `这一步已经发过卡,不再发第二张`,
detail: { auto: `${context.stepId}#${index + 1}`, internal: true },
});
return { wrote: 0, dropped: 0, stop: true };
return { wrote: 0, dropped: 0 };
}
const basis = (action.basis ?? []).map((b) => ({ k: b.k, v: evalText(b.v, base) }));
if (action.as === 'decide') {