From faec6e6f193caedd148ed008ab2829aea56629dc Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 5 Jul 2026 21:06:55 +0300 Subject: [PATCH] =?UTF-8?q?test(verify-snapshots):=20=D1=83=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D0=BC=D0=B0=D1=81=D0=BA=D0=B8=D1=80=D1=83?= =?UTF-8?q?=D1=8E=D1=89=D0=B8=D0=B9=20hostEdit=20=E2=80=94=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=82=D0=BE=D1=80=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D1=8F=D0=B5=D0=BC=D1=8B=D0=B9=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=8A=D0=B5=D0=BA=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Верификатор для плана счетов с субконто без extDimensionTypes сам выдумывал стаб-ПВХ И патчил план через meta-edit (modify-property ExtDimensionTypes=…). Это маскировка: в 1С грузилась изменённая версия, а не та, что выдал meta-compile — байт-снэпшот (пустой ) расходился с загружаемым артефактом. К тому же для главного объекта правка не работала вовсе (hostEdit в Step 3.5 бил по объекту до его компиляции в Step 4 → «object not found»). Убран весь механизм hostEdits (единственный источник — ветка ChartOfAccounts в getStructuralDeps). Теперь верификатор создаёт только стабы ЗАВИСИМОСТЕЙ (объектов, на которые вход РЕАЛЬНО ссылается, через extractTypeRefs); postEdit правит стабы-зависимости (легитимно), но не проверяемый объект. Следствие: план с ext-dim обязан сам нести extDimensionTypes. Кейсы form-compile-from-object (chartofaccounts-item/list) переведены на самодостаточный паттерн — реальный ПВХ ВидыСубконто в preRun (типизированные предопределённые) + явный extDimensionTypes. Фикстура ПС теперь несёт ChartOfCharacteristicTypes.ВидыСубконто (консистентно с загрузкой); Form.xml не изменился. Байт 12/12, 1С-cert обоих ✓. Прочие ссылки на ПС (accounting-register) не затронуты — makeStubDSL даёт maxExtDimensionCount:0. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../chartofaccounts-item-simple.json | 11 +++ .../chartofaccounts-list-simple.json | 11 +++ .../ChartsOfAccounts/Хозрасчетный.xml | 2 +- .../ВидыСубконто.xml | 97 +++++++++++++++++++ .../ВидыСубконто/Ext/ObjectModule.bsl | 0 .../ВидыСубконто/Ext/Predefined.xml | 16 +++ .../Configuration.xml | 1 + .../ChartsOfAccounts/Хозрасчетный.xml | 2 +- .../ВидыСубконто.xml | 97 +++++++++++++++++++ .../ВидыСубконто/Ext/ObjectModule.bsl | 0 .../ВидыСубконто/Ext/Predefined.xml | 16 +++ .../Configuration.xml | 1 + tests/skills/verify-snapshots.mjs | 52 ++-------- 13 files changed, 258 insertions(+), 48 deletions(-) create mode 100644 tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml create mode 100644 tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/ObjectModule.bsl create mode 100644 tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml create mode 100644 tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml create mode 100644 tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/ObjectModule.bsl create mode 100644 tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml diff --git a/tests/skills/cases/form-compile-from-object/chartofaccounts-item-simple.json b/tests/skills/cases/form-compile-from-object/chartofaccounts-item-simple.json index dbe8b7b8..16e86a4b 100644 --- a/tests/skills/cases/form-compile-from-object/chartofaccounts-item-simple.json +++ b/tests/skills/cases/form-compile-from-object/chartofaccounts-item-simple.json @@ -1,6 +1,16 @@ { "name": "ChartOfAccounts Item — план счетов с флагами и субконто", "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { + "type": "ChartOfCharacteristicTypes", + "name": "ВидыСубконто", + "valueType": "String(100)", + "predefined": ["Номенклатура: String(100)"] + }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, { "script": "meta-compile/scripts/meta-compile", "input": { @@ -8,6 +18,7 @@ "name": "Хозрасчетный", "codeLength": 9, "descriptionLength": 100, + "extDimensionTypes": "ChartOfCharacteristicTypes.ВидыСубконто", "maxExtDimensionCount": 3, "accountingFlags": [ { "name": "Валютный" }, diff --git a/tests/skills/cases/form-compile-from-object/chartofaccounts-list-simple.json b/tests/skills/cases/form-compile-from-object/chartofaccounts-list-simple.json index 3aec24bb..97e2d26e 100644 --- a/tests/skills/cases/form-compile-from-object/chartofaccounts-list-simple.json +++ b/tests/skills/cases/form-compile-from-object/chartofaccounts-list-simple.json @@ -1,6 +1,16 @@ { "name": "ChartOfAccounts List — план счетов, форма списка", "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { + "type": "ChartOfCharacteristicTypes", + "name": "ВидыСубконто", + "valueType": "String(100)", + "predefined": ["Номенклатура: String(100)"] + }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, { "script": "meta-compile/scripts/meta-compile", "input": { @@ -8,6 +18,7 @@ "name": "Хозрасчетный", "codeLength": 9, "descriptionLength": 100, + "extDimensionTypes": "ChartOfCharacteristicTypes.ВидыСубконто", "maxExtDimensionCount": 3, "accountingFlags": [ { "name": "Валютный" }, diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfAccounts/Хозрасчетный.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfAccounts/Хозрасчетный.xml index 6c745c4d..fd1b08a6 100644 --- a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfAccounts/Хозрасчетный.xml +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfAccounts/Хозрасчетный.xml @@ -43,7 +43,7 @@ true false - + ChartOfCharacteristicTypes.ВидыСубконто 3 9 diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml new file mode 100644 index 00000000..af6b9707 --- /dev/null +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml @@ -0,0 +1,97 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + UUID-008 + UUID-009 + + + UUID-010 + UUID-011 + + + UUID-012 + UUID-013 + + + + ВидыСубконто + + + ru + Виды субконто + + + + true + false + + + xs:string + + 100 + Variable + + + false + true + 9 + Variable + 100 + WholeCharacteristicKind + true + true + AsDescription + + Auto + InDialog + false + BothWays + + ChartOfCharacteristicTypes.ВидыСубконто.StandardAttribute.Description + ChartOfCharacteristicTypes.ВидыСубконто.StandardAttribute.Code + + DontUse + Begin + Directly + DontUse + Auto + + + + + + + + + + + + + Managed + Use + + + + + + DontUse + false + false + + + + diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/ObjectModule.bsl b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/ObjectModule.bsl new file mode 100644 index 00000000..e69de29b diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml new file mode 100644 index 00000000..29b24b84 --- /dev/null +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml @@ -0,0 +1,16 @@ + + + + Номенклатура + + Номенклатура + + xs:string + + 100 + Variable + + + false + + diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/Configuration.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/Configuration.xml index 2dfd33d3..51e7edc8 100644 --- a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/Configuration.xml +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-item-simple/Configuration.xml @@ -246,6 +246,7 @@ Русский + ВидыСубконто Хозрасчетный diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfAccounts/Хозрасчетный.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfAccounts/Хозрасчетный.xml index 07b569ef..c19cfe0d 100644 --- a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfAccounts/Хозрасчетный.xml +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfAccounts/Хозрасчетный.xml @@ -43,7 +43,7 @@ true false - + ChartOfCharacteristicTypes.ВидыСубконто 3 9 diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml new file mode 100644 index 00000000..af6b9707 --- /dev/null +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто.xml @@ -0,0 +1,97 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + UUID-008 + UUID-009 + + + UUID-010 + UUID-011 + + + UUID-012 + UUID-013 + + + + ВидыСубконто + + + ru + Виды субконто + + + + true + false + + + xs:string + + 100 + Variable + + + false + true + 9 + Variable + 100 + WholeCharacteristicKind + true + true + AsDescription + + Auto + InDialog + false + BothWays + + ChartOfCharacteristicTypes.ВидыСубконто.StandardAttribute.Description + ChartOfCharacteristicTypes.ВидыСубконто.StandardAttribute.Code + + DontUse + Begin + Directly + DontUse + Auto + + + + + + + + + + + + + Managed + Use + + + + + + DontUse + false + false + + + + diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/ObjectModule.bsl b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/ObjectModule.bsl new file mode 100644 index 00000000..e69de29b diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml new file mode 100644 index 00000000..29b24b84 --- /dev/null +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/ChartsOfCharacteristicTypes/ВидыСубконто/Ext/Predefined.xml @@ -0,0 +1,16 @@ + + + + Номенклатура + + Номенклатура + + xs:string + + 100 + Variable + + + false + + diff --git a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/Configuration.xml b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/Configuration.xml index 2dfd33d3..51e7edc8 100644 --- a/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/Configuration.xml +++ b/tests/skills/cases/form-compile-from-object/snapshots/chartofaccounts-list-simple/Configuration.xml @@ -246,6 +246,7 @@ Русский + ВидыСубконто Хозрасчетный diff --git a/tests/skills/verify-snapshots.mjs b/tests/skills/verify-snapshots.mjs index 887f1f33..dd13b7e5 100644 --- a/tests/skills/verify-snapshots.mjs +++ b/tests/skills/verify-snapshots.mjs @@ -135,9 +135,8 @@ function extractTypeRefs(input) { function getStructuralDeps(input) { const deps = []; - const hostEdits = []; // edits applied to the host (the input that triggered the dep) const inputs = Array.isArray(input) ? input : [input]; - if (!inputs[0] || !inputs[0].type) return { deps, hostEdits }; + if (!inputs[0] || !inputs[0].type) return deps; for (const inp of inputs) { const regTypePrefix = { @@ -178,28 +177,9 @@ function getStructuralDeps(input) { } } break; - case 'ChartOfAccounts': { - // ExtDimensionTypes (виды субконто) link is required when the chart uses - // any ExtDimension at all — otherwise platform rejects forms that bind to - // Объект.ExtDimensionTypes.*. - const usesExtDim = (inp.maxExtDimensionCount && inp.maxExtDimensionCount > 0) - || (Array.isArray(inp.extDimensionAccountingFlags) && inp.extDimensionAccountingFlags.length > 0); - if (usesExtDim && !inp.extDimensionTypes) { - const stubName = `ВидыСубконтоСтаб${inp.name}`; - deps.push({ - type: 'ChartOfCharacteristicTypes', name: stubName, - dsl: { type: 'ChartOfCharacteristicTypes', name: stubName, codeLength: 9, descriptionLength: 100 }, - }); - hostEdits.push({ - hostType: 'ChartOfAccounts', hostName: inp.name, - op: 'modify-property', val: `ExtDimensionTypes=ChartOfCharacteristicTypes.${stubName}`, - }); - } - break; - } } } - return { deps, hostEdits }; + return deps; } // ─── Stub creation ────────────────────────────────────────────────────────── @@ -483,10 +463,10 @@ async function verifyCase(skillName, caseName, skillConfig, caseData, opts) { if (configDir && allInputs.length > 0) { const mainNames = new Set(allInputs.map(i => `${i.type}.${i.name}`)); - // Structural deps (scanned across both main input and preRun inputs) - const { deps: structDeps, hostEdits: structHostEdits } = getStructuralDeps(allInputs); - // Stash host edits on the result so we can apply them after preRun. - result._structHostEdits = structHostEdits; + // Structural deps (scanned across both main input and preRun inputs). + // NB: только зависимости (стабы объектов, на которые ССЫЛАЕТСЯ вход). Верификатор НЕ правит сам + // проверяемый объект — иначе в 1С грузится не то, что выдал компилятор (маскировка дефекта DSL). + const structDeps = getStructuralDeps(allInputs); const structDSLs = new Map(); const structPostEdits = new Map(); for (const dep of structDeps) { @@ -550,26 +530,6 @@ async function verifyCase(skillName, caseName, skillConfig, caseData, opts) { return result; } - // ── Step 3.5: host-level structural edits (apply to objects created in preRun) ── - if (configDir && result._structHostEdits?.length) { - for (const he of result._structHostEdits) { - const dir = TYPE_TO_DIR[he.hostType]; - const objPath = dir ? join(configDir, dir, he.hostName) : null; - if (!objPath || !existsSync(objPath)) { - result.warnings.push(`HostEdit skipped (object not found): ${he.hostType}.${he.hostName}`); - continue; - } - try { - execSkill(opts.runtime, 'meta-edit/scripts/meta-edit', - ['-ObjectPath', objPath, '-Operation', he.op, '-Value', he.val]); - log(`hostEdit: ${he.hostType}.${he.hostName}`, true, `${he.op} ${he.val}`); - } catch (e) { - log(`hostEdit: ${he.hostType}.${he.hostName}`, false, e.stderr || e.message); - result.warnings.push(`HostEdit failed: ${he.hostType}.${he.hostName}`); - } - } - } - // ── Step 4: Main skill script ── let inputFile = null; if (caseData.input !== undefined) {