Archived
活动声明了 gateWhen,发卡装配的手写清单没点它的名:落库载荷 undefined, 按钮禁用与服务端拒收一起无声失效(手写字段清单第四次丢值,与 variant 上次被丢的同一段)。抽 cardConditionGate 校验着转交(5 测);e2e w05 数据卡阶段补末端断言 expectCardGateWhen。活体验证:载荷带条件 → 闸关 → API 强行确认 400;e2e 案例 0 全绿。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LKMZDwMbyKzjw6Hembwvet
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* **确认闸的条件档要在真发卡那条路上转交**(2026-09-01 用户实测:「两个芯片类型不一样,
|
||||
* 页面上方有红色提示,右边派发的卡片还可以点击下一步」)。
|
||||
*
|
||||
* 病:发卡装配那段手写清单逐项点名转交 `gateLedgers`/`variant`,而 `gateWhen`/`gateWhenSay`
|
||||
* 没被点名 —— 配方白纸黑字声明了「类型不一致不许确认」,落库的工单载荷里那两个字段是
|
||||
* undefined(任务 43 法证)。红带是视图画的所以照亮;按钮禁用与服务端拒收读的都是
|
||||
* 存下的 `order.gateWhen`,一起无声失效。**手写字段清单第四次丢值**(fields / blocks /
|
||||
* redoable 之后),而且丢在 `variant` 上次被丢的同一段。
|
||||
*
|
||||
* 这个缝取的是模型也会路过的不可信卡骨架,逐项校验转交是设计 —— 所以治法不是整包 spread,
|
||||
* 是把这两项的取用抽成纯函数、在 variant 的测试位旁边钉死。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { cardConditionGate } from '../wiring/engines.ts';
|
||||
|
||||
describe('cardConditionGate —— 条件档从卡骨架到工单载荷', () => {
|
||||
it('声明了就转交,一个字不改', () => {
|
||||
expect(cardConditionGate({ gateWhen: 'parts_profile_distinct_chip_type_id <= 1', gateWhenSay: '两颗料不是同一个芯片类型' })).toEqual({
|
||||
gateWhen: 'parts_profile_distinct_chip_type_id <= 1',
|
||||
gateWhenSay: '两颗料不是同一个芯片类型',
|
||||
});
|
||||
});
|
||||
|
||||
it('没声明就什么都不带 —— 不发明键', () => {
|
||||
expect(cardConditionGate({})).toEqual({});
|
||||
expect(cardConditionGate({ gateLedgers: ['parts.profile'] })).toEqual({});
|
||||
});
|
||||
|
||||
it('脏值不端下去:非字符串 / 空白串一律丢', () => {
|
||||
expect(cardConditionGate({ gateWhen: 42, gateWhenSay: '话' })).toEqual({});
|
||||
expect(cardConditionGate({ gateWhen: ' ', gateWhenSay: '话' })).toEqual({});
|
||||
expect(cardConditionGate({ gateWhen: null })).toEqual({});
|
||||
});
|
||||
|
||||
it('只有那句话没有条件 = 什么都不带(say 单独存在没有意义,评估端只认 when)', () => {
|
||||
expect(cardConditionGate({ gateWhenSay: '两颗料不是同一个芯片类型' })).toEqual({});
|
||||
});
|
||||
|
||||
it('条件在、话没写:条件照转交,拒回用兜底话术', () => {
|
||||
expect(cardConditionGate({ gateWhen: 'a > 1' })).toEqual({ gateWhen: 'a > 1' });
|
||||
expect(cardConditionGate({ gateWhen: 'a > 1', gateWhenSay: '' })).toEqual({ gateWhen: 'a > 1' });
|
||||
});
|
||||
});
|
||||
@@ -279,6 +279,24 @@ export function executionCardVariant(fromCard: unknown, fromStep: unknown): 'dat
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* **确认闸的条件档从卡骨架到工单载荷**(2026-09-01 用户实测:「两个芯片类型不一样…
|
||||
* 右边派发的卡片还可以点击下一步」)。配方声明了 `gateWhen`/`gateWhenSay`,发卡装配的
|
||||
* 手写清单没点它们的名 —— 落库的工单载荷里两个字段是 undefined,按钮禁用与服务端拒收
|
||||
* 读的都是它,一起无声失效(**手写字段清单第四次丢值**,且丢在 `variant` 上次被丢的同一段)。
|
||||
* 这个缝取的是模型也会路过的不可信卡骨架,不能整包 spread —— 校验着转交:
|
||||
* 条件必须是非空字符串;那句话只在有条件时才有意义(评估端只认 `when`)。
|
||||
*/
|
||||
export function cardConditionGate(card: Readonly<Record<string, unknown>>): { gateWhen?: string; gateWhenSay?: string } {
|
||||
const when = card['gateWhen'];
|
||||
if (typeof when !== 'string' || when.trim() === '') return {};
|
||||
const say = card['gateWhenSay'];
|
||||
return {
|
||||
gateWhen: when,
|
||||
...(typeof say === 'string' && say.trim() !== '' ? { gateWhenSay: say } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
export function decisionCardFace(
|
||||
input: { readonly variant?: 'review' | undefined; readonly checklist?: ReadonlyArray<string> | undefined },
|
||||
step: { readonly cardVariant?: string | undefined; readonly acceptanceChecklist?: ReadonlyArray<string> | undefined } | undefined,
|
||||
@@ -1974,6 +1992,8 @@ export function wireEngines(deps: EngineWiringDeps): EngineWiring {
|
||||
...(blocks === undefined ? {} : { blocks: blocks as ExecutionWorkOrderDraft['blocks'] }),
|
||||
...(gateLedgers.length === 0 ? {} : { gateLedgers }),
|
||||
...(variant === undefined ? {} : { variant }),
|
||||
/* 条件档(gateWhen/gateWhenSay)—— 校验着转交,见 cardConditionGate 的账 */
|
||||
...cardConditionGate(input.card),
|
||||
});
|
||||
// 打扰率的计量对象:每发一张卡就是调了一次人 —— 不计就等于没有上限
|
||||
await taskStore.addConsumption(input.taskId, { humanCalls: 1 });
|
||||
|
||||
Reference in New Issue
Block a user