From 085fcb7e81836ef270e8e7212c7a075cc3161742 Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Wed, 14 Oct 2026 15:38:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A9=E6=89=8B=E6=B5=81=E3=80=8C=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=8D=E9=82=A3=E4=B8=80=E8=A1=8C=E5=B1=95=E5=BC=80=E7=9A=84?= =?UTF-8?q?=E6=98=8E=E7=BB=86=EF=BC=8C=E6=94=B9=E5=89=8D=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E5=92=8C=E5=8D=A1=E7=89=87=E5=90=8C=E4=B8=80=E4=B8=AA=E5=86=99?= =?UTF-8?q?=E6=B3=95=EF=BC=88patchBeforeText=EF=BC=89=EF=BC=9A=E6=8F=90?= =?UTF-8?q?=E6=A1=88=E8=90=BD=E5=9C=A8=E5=B7=B2=E9=A9=B3=E5=9B=9E=E7=9A=84?= =?UTF-8?q?=E9=A1=B9=E4=B8=8A=E6=97=B6=E5=86=99=E3=80=8C=E5=B7=B2=E9=A9=B3?= =?UTF-8?q?=E5=9B=9E=EF=BC=9A=E5=8F=AF=E7=B4=AF=E5=8A=A0=20=E2=86=92=20?= =?UTF-8?q?=E5=AD=98=E9=87=8F=E3=80=8D=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=86=99?= =?UTF-8?q?=E6=88=90=E5=83=8F=E6=98=AF=E5=BD=93=E5=89=8D=E5=80=BC=E7=9A=84?= =?UTF-8?q?=E3=80=8C=E5=8F=AF=E7=B4=AF=E5=8A=A0=20=E2=86=92=20=E5=AD=98?= =?UTF-8?q?=E9=87=8F=E3=80=8D=E3=80=81=E5=92=8C=E5=90=8C=E4=B8=80=E8=BD=AE?= =?UTF-8?q?=E4=B8=8B=E9=9D=A2=E5=8D=A1=E7=89=87=E7=9A=84=E3=80=8C=E5=B7=B2?= =?UTF-8?q?=E9=A9=B3=E5=9B=9E=EF=BC=9A=E5=8F=AF=E7=B4=AF=E5=8A=A0=E3=80=8D?= =?UTF-8?q?=E5=AF=B9=E4=B8=8D=E4=B8=8A=EF=BC=9Bcheck-decode=20=E8=A1=A5?= =?UTF-8?q?=E4=B8=80=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/run/decode.ts | 7 ++++--- scripts/check-decode.mjs | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/run/decode.ts b/frontend/src/run/decode.ts index 07ac6e5c..69f88119 100644 --- a/frontend/src/run/decode.ts +++ b/frontend/src/run/decode.ts @@ -8,7 +8,7 @@ import { claimTally, evidenceTally, issuanceLabel, nodeTypeLabel, } from '../lib/terms' -import { catalogPatchOf, patchValueText, patchWhere } from './catalogPatch' +import { catalogPatchOf, patchBeforeText, patchValueText, patchWhere } from './catalogPatch' import { claimCountsOf, isJudged, statsTally } from '../lib/evidence' import { isSqlCheckCode, sortSqlChecks, sqlCheckOf, sqlChecksOf, sqlCheckWhere, sqlRuleLabel } from '../lib/sqlcheck' @@ -3268,13 +3268,14 @@ export function decodeCopilot(ops: CopilotOp[], opts?: { break } case 'catalog_patch': { - // 目录修改提案:过程里记一行(哪张表、几项,展开看改前改后),保存、忽略在轮次里的卡片上做(catalogPatchesOf) + // 目录修改提案:过程里记一行(哪张表、几项,展开看改前改后),保存、忽略在轮次里的卡片上做(catalogPatchesOf)。 + // 改前和卡片同一个写法(patchBeforeText):落在已驳回的项上写「已驳回:<原值>」,不写成像是当前值的原值 const patch = catalogPatchOf(op, String(i - 1)) if (!patch) break add({ id: `cpt-${i}`, seq: i, kind: 'schema', status: 'done', code: 'catalog_patch', title: CATALOG_PATCH_TEXT.step(patch.tableLabel ?? patch.table, patch.changes.length), sub: CATALOG_PATCH_TEXT.stepSub, - detail: patch.changes.map((c) => `${patchWhere(c)}:${patchValueText(c.path, c.before)} → ${patchValueText(c.path, c.after)}`) + detail: patch.changes.map((c) => `${patchWhere(c)}:${patchBeforeText(c)} → ${patchValueText(c.path, c.after)}`) .join('\n') }) break } diff --git a/scripts/check-decode.mjs b/scripts/check-decode.mjs index a4f94ff8..9cf14664 100644 --- a/scripts/check-decode.mjs +++ b/scripts/check-decode.mjs @@ -759,6 +759,17 @@ await section('Copilot:建议更新数据目录(catalog_patch 操作)', as && row.detail.includes('列 visitor_count 的度量类型:可累加 → 可累加'), row?.detail) check('是看表结构那一类、标着规划阶段', row?.kind === 'schema' && row?.stage === 'plan' && row?.status === 'done') check('结局仍是「只回答」', mod.copilotOutcome(synthetic.COPILOT_CATALOG_PATCH).kind === 'reply') + // 提案落在已驳回的项上(服务端照样交回驳回的原值,before_status 为 rejected):展开的明细和同一轮下面的卡片同一个说法 + // 「已驳回:可累加」,不写成像是当前值的「可累加 → 存量」 + const onRejected = mod.decodeCopilot([{ op: 'catalog_patch', source: 'scenic', source_id: 'src-scenic', table: 'visits', table_label: '入园记录', + version: 3, changes: [ + { path: 'columns.visitor_count.measure', before: 'flow', before_status: 'rejected', after: 'stock', value: 'stock', reason: '', state: 'change' }, + { path: 'kind', before: null, before_status: null, after: 'fact', value: 'fact', reason: '', state: 'change' }, + ] }], { context: 'canvas' }).find((s) => s.code === 'catalog_patch') + check('改前是已驳回的值:展开写「已驳回:可累加 → 存量」,和卡片一致', + !!onRejected?.detail?.split('\n').includes('列 visitor_count 的度量类型:已驳回:可累加 → 存量') + && cp.patchBeforeText({ path: 'columns.visitor_count.measure', before: 'flow', before_status: 'rejected' }) === '已驳回:可累加', onRejected?.detail) + check('……原来没有的照旧写「未填写」', !!onRejected?.detail?.split('\n').includes('表的表类型:未填写 → 明细表'), onRejected?.detail) const [patch] = cp.catalogPatchesOf(synthetic.COPILOT_CATALOG_PATCH) check('卡片拿到版本、数据源 id、表和中文名', patch?.version === 3 && patch.sourceId === 'src-scenic' && patch.table === 'visits'