mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 16:49:41 +03:00
feat(meta-edit): create-if-missing свойств + типо-гард (Фаза 2 Шаг 1, v1.12)
modify-property и default-ветка modify-attribute/-dimension/-resource раньше при отсутствии элемента свойства делали тихий Warn+no-op — правка молча терялась (модель думала, что применилось). Теперь: известное отсутствующее свойство СОЗДАЁТСЯ (в канонической позиции по attrPropOrder для реквизитов, append для объектных — порядок 1С терпит, cert Шаг 0); неизвестное имя (опечатка) → внятная ошибка exit≠0. Наборы известных свойств — union по корпусу acc+erp 8.3.24 (knownObjectProps 133, knownChildProps 40); attrPropOrder — из Build-AttributeFragment. Новый хелпер Insert-PropertyInOrder. ps1+py зеркально. Cert: Шаг 0 (навыками db-*) — 1С грузит и применяет объект со свойством вне канонической позиции → append безопасен. Load-cert create-if-missing выхода — LoadConfigFromFiles+UpdateDBCfg успешны. verify-snapshots --skill meta-edit 9/9. Тесты: error-modify-property-typo + error-modify-attribute-typo (expectError) + integration meta-edit-create-if-missing (compile→editFile удалить→правка→assert). meta-edit 13/13 ps1+py. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "modify-attribute с опечаткой в имени свойства реквизита → ошибка (не тихий no-op)",
|
||||
"setup": "empty-config",
|
||||
"preRun": [
|
||||
{
|
||||
"script": "meta-compile/scripts/meta-compile",
|
||||
"input": { "type": "Catalog", "name": "Спр", "attributes": ["Комм: String(50)"] },
|
||||
"args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" }
|
||||
}
|
||||
],
|
||||
"params": { "objectPath": "Catalogs/Спр" },
|
||||
"input": { "modify": { "attributes": { "Комм": { "ЧёТоНеТо": "1" } } } },
|
||||
"expectError": true
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "modify-property с опечаткой в имени свойства → ошибка (не тихий no-op)",
|
||||
"setup": "empty-config",
|
||||
"preRun": [
|
||||
{
|
||||
"script": "meta-compile/scripts/meta-compile",
|
||||
"input": { "type": "Catalog", "name": "Спр" },
|
||||
"args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" }
|
||||
}
|
||||
],
|
||||
"params": { "objectPath": "Catalogs/Спр" },
|
||||
"input": { "modify": { "properties": { "CodeLenght": "11" } } },
|
||||
"expectError": true
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// meta-edit-create-if-missing.test.mjs — Integration: create-if-missing свойства объекта
|
||||
// Steps: cf-init → meta-compile Catalog → editFile (удалить DataHistory) → meta-edit modify-property
|
||||
// DataHistory=Use (свойство отсутствует → должно СОЗДАТЬСЯ, а не тихий no-op) → assertContains
|
||||
|
||||
export const name = 'meta-edit create-if-missing: пересоздание отсутствующего свойства объекта';
|
||||
export const setup = 'none';
|
||||
|
||||
export const steps = [
|
||||
{
|
||||
name: 'cf-init: пустая конфигурация',
|
||||
script: 'cf-init/scripts/cf-init',
|
||||
args: { '-Name': 'ТестПравки', '-OutputDir': '{workDir}/config' },
|
||||
},
|
||||
{
|
||||
name: 'meta-compile: Catalog Спр',
|
||||
script: 'meta-compile/scripts/meta-compile',
|
||||
input: { type: 'Catalog', name: 'Спр' },
|
||||
args: { '-JsonPath': '{inputFile}', '-OutputDir': '{workDir}/config' },
|
||||
},
|
||||
{
|
||||
name: 'editFile: удалить свойство DataHistory (симуляция отсутствия)',
|
||||
editFile: '{workDir}/config/Catalogs/Спр.xml',
|
||||
replace: '<DataHistory>DontUse</DataHistory>',
|
||||
with: '',
|
||||
},
|
||||
{
|
||||
name: 'meta-edit: modify-property DataHistory=Use (create-if-missing)',
|
||||
script: 'meta-edit/scripts/meta-edit',
|
||||
input: { modify: { properties: { DataHistory: 'Use' } } },
|
||||
args: { '-DefinitionFile': '{inputFile}', '-ObjectPath': '{workDir}/config/Catalogs/Спр.xml' },
|
||||
validate: { script: 'meta-validate/scripts/meta-validate', flag: '-ObjectPath', path: 'config/Catalogs/Спр.xml' },
|
||||
},
|
||||
{
|
||||
name: 'assertContains: DataHistory создан',
|
||||
assertContains: '{workDir}/config/Catalogs/Спр.xml',
|
||||
expect: '<DataHistory>Use</DataHistory>',
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user