Archived
契约:launchOption 加 group/groupLabel(x-options.group 从字典表现读人读名)、 launchParam 加 linkGroup(x-link 结组);api-report 已随 --update 入库。 前端 launch-link.ts 纯函数管三条口径:锚摆全量、其余按锚的分组键收窄 (未标类型殿后一组,新增照走);锚粘着 —— 清空只解除收窄不换锚,人改得了主意。 服务端不据此立墙:combo 本就收候选之外的值,类型一致归 S1 收步判据 sub_eval_part_distinct_chip_type_id = 1(数得出来的门)。 W05 清单两格挂上 x-link: chip-type;文档同步。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LKMZDwMbyKzjw6Hembwvet
This commit is contained in:
@@ -287,6 +287,28 @@ describe('契约', () => {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* 按芯片类型联动(2026-08-31 用户定):候选带上分组键与人读名,两格结成一组。
|
||||
* 分组键指的那一列必须是候选表**真有**的列(`parts.profile.chip_type_id`),
|
||||
* 字典指的那一张表也得是本活动声明过的 —— 写错地址不会炸,只会静默不联动(服务端 warn 一句),
|
||||
* 而「静默不联动」正是没人会发现的那种坏。
|
||||
*/
|
||||
it('两格按芯片类型联动:候选带分组键 + 字典换人读名,x-link 同名结成一组', () => {
|
||||
const props = manifest.contract.input.data['properties'] as Record<string, Record<string, unknown>>;
|
||||
const ledgerOf = (address: string) => manifest.declarations.ledger.find((l) => `${l.domain}.${l.object}` === address);
|
||||
for (const key of ['originalInternalPn', 'candidateInternalPn']) {
|
||||
expect(props[key]?.['x-link']).toBe('chip-type');
|
||||
const options = props[key]?.['x-options'] as { group?: { column?: string; ledger?: string; value?: string; label?: string } };
|
||||
expect(options.group).toEqual({ column: 'chip_type_id', ledger: 'parts.chip_type', value: 'type_id', label: 'type_name' });
|
||||
// 分组键那一列在候选表上真的存在
|
||||
expect(ledgerOf('parts.profile')?.fields.some((f) => f.name === options.group?.column)).toBe(true);
|
||||
// 换名字典的两列也真的存在
|
||||
const dict = ledgerOf('parts.chip_type');
|
||||
expect(dict?.fields.some((f) => f.name === options.group?.value)).toBe(true);
|
||||
expect(dict?.fields.some((f) => f.name === options.group?.label)).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('零工具 —— 这是这次重写的立场,不是疏漏', () => {
|
||||
expect(manifest.contract.resources.tools).toEqual([]);
|
||||
expect(manifest.declarations.tools).toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user