refactor(shipping-notice): 进度信号统一为 15 阶 stage 契约码并透传阻断原因

- 后端进度写入 step_key 全量切换为 15 阶契约 stage 码
- 投影层清除 CheckPoint stepN_* 遗留别名与子串/前缀启发式,阶段信号按契约码精确匹配
- 建单前 Case 摘要透传草稿首要阻断原因
- 前端标签/归一化/处理卡片同步契约码,阻断原因按 i18n 优先展示
- 修复正式下游回看时 activeCase 刻意为空导致队列定位与接收解析上下文静默跳过
- 同步更新投影/门禁/工作台/RPA 流程测试
This commit is contained in:
hugo committed 2026-09-17 15:54:53 +08:00
1 parent d1adbe5ec5
commit 18af972d20
34 files changed
+903 -111

No files matched your search

@@ -87,6 +87,44 @@ export function resolveShippingProcessingReasonLabel(
return te(unknownKey) ? t(unknownKey) : '当前步骤需要人工处理';
}
/** Gate 原因码的多命名空间查找键(与 resolveGateReasonLabel 保持同源顺序)。 */
function gateReasonNamespaceKeys(code: string): string[] {
return [
`chat.shippingProcessing.gateReasons.${code}`,
`workspace.shippingNotice.workflowReasons.${code}`,
`workspace.shippingNotice.processGate.reasons.${code}`,
];
}
/**
* 解析批次中心行内「阻塞原因」文案;通用兜底返回空串(调用方隐藏原因行)。
* 核心逻辑:i18n_key → reasonCode 专用键 → Gate 三命名空间 → 契约透传 message;
* 与 isGenericBlockingReason 同一判据,保证「隐藏的」与「展示的」口径一致。
*/
export function resolveBlockingReasonText(
reason: {
code?: string | null;
i18nKey?: string | null;
i18n_key?: string | null;
message?: string | null;
} | null | undefined,
te: (key: string) => boolean,
t: (key: string) => string,
): string {
if (isGenericBlockingReason(reason, te)) return '';
const i18nKey = String(reason?.i18nKey || reason?.i18n_key || '').trim();
if (i18nKey && te(i18nKey)) return t(i18nKey);
const code = String(reason?.code || '').trim();
if (code) {
const reasonCodeKey = `chat.shippingProcessing.reasonCode.${code}`;
if (te(reasonCodeKey)) return t(reasonCodeKey);
for (const key of gateReasonNamespaceKeys(code)) {
if (te(key)) return t(key);
}
}
return String(reason?.message || '').trim();
}
/**
* 解析统一处理文案。
*
@@ -197,22 +235,33 @@ export function resolveShippingLifecycleStageLabel(
/**
* 判定阻塞原因是否为「通用兜底」(应在行内隐藏,避免与状态芯片重复)。
*
* 三方约定:仅当下发到具体、非兜底的阻塞原因(有真实 i18n 文案)才展示原因行;
* 进到 reasonCode.unknown / 无 i18n_key 的通用码一律视为重复信息。
* 三方约定:仅当下发到具体、非兜底的阻塞原因才展示原因行。具体判据:
* i18n_key 命中、reasonCode 专用键命中、Gate 三命名空间任一命中
* (四语言齐备),或契约透传了具体 message(无命名空间时的最后兜底)。
* 进到 unknown / 全部未命中的一律视为重复信息。
*
* @param reason - 后端 blocking_reason(code / i18n_key)
* @param reason - 后端 blocking_reason(code / i18n_key / message)
* @param te - i18n te
* @returns true=通用兜底(应隐藏)
*/
export function isGenericBlockingReason(
reason: { code?: string | null; i18nKey?: string | null; i18n_key?: string | null } | null | undefined,
reason: {
code?: string | null;
i18nKey?: string | null;
i18n_key?: string | null;
message?: string | null;
} | null | undefined,
te: (key: string) => boolean,
): boolean {
if (!reason) return true;
const i18nKey = String(reason.i18nKey || reason.i18n_key || '').trim();
if (i18nKey && te(i18nKey)) return false;
const code = String(reason.code || '').trim();
if (code && code !== 'unknown' && te(`chat.shippingProcessing.reasonCode.${code}`)) return false;
if (code && code !== 'unknown') {
if (te(`chat.shippingProcessing.reasonCode.${code}`)) return false;
if (gateReasonNamespaceKeys(code).some((key) => te(key))) return false;
}
if (String(reason.message || '').trim()) return false;
return true;
}