fix(meta-edit, epf-validate): у внешней обработки/отчёта нет команд объекта и модуля менеджера (#108)

Платформа выбрасывает Command из внешней обработки/отчёта при сборке
(«не является подчиненным»), а Ext/ManagerModule.bsl — вовсе без
сообщения; epf-build при этом сообщает об успехе. Цепочка молча теряла
написанное: meta-edit добавлял команду, epf-validate её пропускал.

meta-edit: внешние типы внесены в таблицу допустимых детей — команду
не добавляет, предупреждает. epf-validate: Command и ManagerModule.bsl —
ошибки с пояснением.

Refs #108

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-09-26 15:20:06 +03:00
co-authored by Claude Opus 5.5
parent 372510bbc4
commit 5d1b5cdf74
12 changed files with 195 additions and 12 deletions
@@ -1,4 +1,4 @@
# epf-validate v1.6 — Validate 1C external data processor / report structure
# epf-validate v1.7 — Validate 1C external data processor / report structure
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# Works for both EPF (ExternalDataProcessor) and ERF (ExternalReport) — auto-detects
[CmdletBinding(PositionalBinding=$false)]
@@ -135,7 +135,8 @@ $classIds = @{
"ExternalReport" = "e41aff26-25cf-4bb6-b6c1-3f478a75f374"
}
$allowedChildTypes = @("Attribute","TabularSection","Form","Template","Command")
# Команд объекта у внешней обработки/отчёта нет: платформа выбрасывает их при сборке (#108).
$allowedChildTypes = @("Attribute","TabularSection","Form","Template")
# Expected order of child types in ChildObjects
$childTypeOrder = @{
@@ -143,7 +144,6 @@ $childTypeOrder = @{
"TabularSection" = 1
"Form" = 2
"Template" = 3
"Command" = 4
}
$validPropertyValues = @{
@@ -410,6 +410,11 @@ if ($childObjNode) {
if ($child.NodeType -ne 'Element') { continue }
$childTag = $child.LocalName
if ($childTag -eq "Command") {
Report-Error "4. ChildObjects: Command — у внешней обработки/отчёта команд объекта нет, платформа выбросит его при сборке"
$check4Ok = $false
continue
}
if ($allowedChildTypes -notcontains $childTag) {
Report-Error "4. ChildObjects: disallowed element '$childTag'"
$check4Ok = $false
@@ -424,7 +429,7 @@ if ($childObjNode) {
# Check ordering
$thisOrder = $childTypeOrder[$childTag]
if ($thisOrder -lt $lastOrder -and $orderOk) {
Report-Warn "4. ChildObjects: '$childTag' appears after higher-order elements (expected: Attribute, TabularSection, Form, Template, Command)"
Report-Warn "4. ChildObjects: '$childTag' appears after higher-order elements (expected: Attribute, TabularSection, Form, Template)"
$orderOk = $false
}
$lastOrder = $thisOrder
@@ -665,14 +670,13 @@ if ($script:stopped) { & $finalize; exit 1 }
$check8Ok = $true
# Collect all names: attributes + tabular sections + forms + templates + commands
# Collect all names: attributes + tabular sections + forms + templates
$allNames = @{}
if ($childObjNode) {
$nameKinds = @(
@{ XPath = "md:Attribute"; Kind = "Attribute" },
@{ XPath = "md:TabularSection"; Kind = "TabularSection" },
@{ XPath = "md:Command"; Kind = "Command" }
@{ XPath = "md:TabularSection"; Kind = "TabularSection" }
)
foreach ($nk in $nameKinds) {
@@ -777,6 +781,13 @@ if (Test-Path $objModule) {
$filesChecked++
}
# Модуля менеджера у внешней обработки/отчёта нет: платформа выбрасывает файл без сообщения.
$mgrModule = Join-Path (Join-Path $objDir "Ext") "ManagerModule.bsl"
if (Test-Path $mgrModule) {
Report-Error "9. Ext/ManagerModule.bsl — у внешней обработки/отчёта нет модуля менеджера, платформа выбросит его молча"
$check9Ok = $false
}
if ($check9Ok) {
if ($filesChecked -gt 0) {
Report-OK "9. File existence: $filesChecked files verified"
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# epf-validate v1.6 — Validate 1C external data processor / report structure
# epf-validate v1.7 — Validate 1C external data processor / report structure
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# Works for both EPF (ExternalDataProcessor) and ERF (ExternalReport) — auto-detects
@@ -49,14 +49,14 @@ CLASS_IDS = {
"ExternalReport": "e41aff26-25cf-4bb6-b6c1-3f478a75f374",
}
ALLOWED_CHILD_TYPES = {"Attribute", "TabularSection", "Form", "Template", "Command"}
# Команд объекта у внешней обработки/отчёта нет: платформа выбрасывает их при сборке (#108).
ALLOWED_CHILD_TYPES = {"Attribute", "TabularSection", "Form", "Template"}
CHILD_TYPE_ORDER = {
"Attribute": 0,
"TabularSection": 1,
"Form": 2,
"Template": 3,
"Command": 4,
}
@@ -381,6 +381,10 @@ def main():
continue
child_tag = localname(child)
if child_tag == "Command":
report_error("4. ChildObjects: Command — у внешней обработки/отчёта команд объекта нет, платформа выбросит его при сборке")
check4_ok = False
continue
if child_tag not in ALLOWED_CHILD_TYPES:
report_error(f"4. ChildObjects: disallowed element '{child_tag}'")
check4_ok = False
@@ -390,7 +394,7 @@ def main():
this_order = CHILD_TYPE_ORDER.get(child_tag, -1)
if this_order < last_order and order_ok:
report_warn(f"4. ChildObjects: '{child_tag}' appears after higher-order elements (expected: Attribute, TabularSection, Form, Template, Command)")
report_warn(f"4. ChildObjects: '{child_tag}' appears after higher-order elements (expected: Attribute, TabularSection, Form, Template)")
order_ok = False
last_order = this_order
@@ -597,7 +601,6 @@ def main():
name_kinds = [
("Attribute", f"{{{MD_NS}}}Attribute"),
("TabularSection", f"{{{MD_NS}}}TabularSection"),
("Command", f"{{{MD_NS}}}Command"),
]
for kind, xpath in name_kinds:
@@ -678,6 +681,12 @@ def main():
if os.path.isfile(obj_module):
files_checked += 1
# Модуля менеджера у внешней обработки/отчёта нет: платформа выбрасывает файл без сообщения.
mgr_module = os.path.join(obj_dir, "Ext", "ManagerModule.bsl")
if os.path.isfile(mgr_module):
report_error("9. Ext/ManagerModule.bsl — у внешней обработки/отчёта нет модуля менеджера, платформа выбросит его молча")
check9_ok = False
if check9_ok:
if files_checked > 0:
report_ok(f"9. File existence: {files_checked} files verified")
@@ -1705,6 +1705,9 @@ $script:validChildTypes = @{
"Task" = @("attributes","tabularSections","forms","templates","commands")
"Report" = @("attributes","tabularSections","forms","templates","commands")
"DataProcessor" = @("attributes","tabularSections","forms","templates","commands")
# Внешняя обработка/отчёт: команд объекта нет — платформа выбрасывает их при сборке.
"ExternalDataProcessor" = @("attributes","tabularSections","forms","templates")
"ExternalReport" = @("attributes","tabularSections","forms","templates")
"Enum" = @("enumValues","forms","templates","commands")
"InformationRegister" = @("dimensions","resources","attributes","forms","templates","commands")
"AccumulationRegister" = @("dimensions","resources","attributes","forms","templates","commands")
@@ -1693,6 +1693,9 @@ valid_child_types = {
"Task": ["attributes", "tabularSections", "forms", "templates", "commands"],
"Report": ["attributes", "tabularSections", "forms", "templates", "commands"],
"DataProcessor": ["attributes", "tabularSections", "forms", "templates", "commands"],
# Внешняя обработка/отчёт: команд объекта нет — платформа выбрасывает их при сборке.
"ExternalDataProcessor": ["attributes", "tabularSections", "forms", "templates"],
"ExternalReport": ["attributes", "tabularSections", "forms", "templates"],
"Enum": ["enumValues", "forms", "templates", "commands"],
"InformationRegister": ["dimensions", "resources", "attributes", "forms", "templates", "commands"],
"AccumulationRegister": ["dimensions", "resources", "attributes", "forms", "templates", "commands"],
@@ -0,0 +1,9 @@
{
"name": "Валидатор находит ошибку: команда объекта у внешней обработки (#108)",
"setup": "fixture:epf-command",
"params": { "objectPath": "Тест.xml" },
"expectError": true,
"expect": {
"stdoutContains": ["у внешней обработки/отчёта команд объекта нет"]
}
}
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.17">
<ExternalDataProcessor uuid="7fa58af8-8b12-4dcf-878f-46df8eca5948">
<InternalInfo>
<xr:ContainedObject>
<xr:ClassId>c3831ec8-d8d5-4f93-8a22-f9bfae07327f</xr:ClassId>
<xr:ObjectId>f11ff676-8870-4887-ab9c-f10bc177997c</xr:ObjectId>
</xr:ContainedObject>
<xr:GeneratedType name="ExternalDataProcessorObject.Тест" category="Object">
<xr:TypeId>2a7c8bf5-ca61-4bf0-a3b7-3051c28e9fb5</xr:TypeId>
<xr:ValueId>6f3614a7-6fd0-4463-bdec-56f81f410c90</xr:ValueId>
</xr:GeneratedType>
</InternalInfo>
<Properties>
<Name>Тест</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Тест</v8:content>
</v8:item>
</Synonym>
<Comment/>
<DefaultForm/>
<AuxiliaryForm/>
</Properties>
<ChildObjects>
<Command uuid="65ef0588-c393-4406-8dc9-43ac4ee97777">
<Properties>
<Name>ПробнаяКоманда</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Пробная команда</v8:content>
</v8:item>
</Synonym>
<Comment/>
<Group>FormNavigationPanelGoTo</Group>
<CommandParameterType/>
<ParameterUseMode>Single</ParameterUseMode>
<ModifiesData>false</ModifiesData>
<Representation>Auto</Representation>
<ToolTip/>
<Picture/>
<Shortcut/>
<OnMainServerUnavalableBehavior>Auto</OnMainServerUnavalableBehavior>
</Properties>
</Command>
</ChildObjects>
</ExternalDataProcessor>
</MetaDataObject>
@@ -0,0 +1,6 @@
&НаКлиенте
Процедура ОбработкаКоманды(ПараметрКоманды, ПараметрыВыполненияКоманды)
// Вставьте обработчик команды.
КонецПроцедуры
@@ -0,0 +1,11 @@
#Область ОписаниеПеременных
#КонецОбласти
#Область ПрограммныйИнтерфейс
#КонецОбласти
#Область СлужебныеПроцедурыИФункции
#КонецОбласти
@@ -0,0 +1,20 @@
{
"name": "Валидатор находит ошибку: модуль менеджера у внешнего отчёта (#108)",
"preRun": [
{
"script": "erf-init/scripts/init",
"args": { "-Name": "ТестовыйОтчёт", "-SrcDir": "{workDir}" }
},
{
"writeFile": {
"path": "ТестовыйОтчёт/Ext/ManagerModule.bsl",
"content": "Процедура Тест() Экспорт\nКонецПроцедуры\n"
}
}
],
"params": { "objectPath": "ТестовыйОтчёт.xml" },
"expectError": true,
"expect": {
"stdoutContains": ["нет модуля менеджера"]
}
}
@@ -0,0 +1,22 @@
{
"name": "Внешняя обработка: команду объекта не добавлять — платформа её выбросит (#108)",
"setup": "none",
"skipValidation": true,
"preRun": [
{
"script": "epf-init/scripts/init",
"args": { "-Name": "Проба", "-SrcDir": "{workDir}" }
}
],
"params": { "objectPath": "Проба.xml", "objectName": "Проба" },
"input": {
"add": {
"commands": ["ПробнаяКоманда"]
}
},
"expect": {
"stdoutContains": ["commands not allowed for ExternalDataProcessor", "Validation OK"],
"fileNotContains": [{ "file": "Проба.xml", "text": ["<Command"] }],
"filesAbsent": ["Проба/Commands"]
}
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.17">
<ExternalDataProcessor uuid="UUID-001">
<InternalInfo>
<xr:ContainedObject>
<xr:ClassId>UUID-002</xr:ClassId>
<xr:ObjectId>UUID-003</xr:ObjectId>
</xr:ContainedObject>
<xr:GeneratedType name="ExternalDataProcessorObject.Проба" category="Object">
<xr:TypeId>UUID-004</xr:TypeId>
<xr:ValueId>UUID-005</xr:ValueId>
</xr:GeneratedType>
</InternalInfo>
<Properties>
<Name>Проба</Name>
<Synonym>
<v8:item>
<v8:lang>ru</v8:lang>
<v8:content>Проба</v8:content>
</v8:item>
</Synonym>
<Comment/>
<DefaultForm/>
<AuxiliaryForm/>
</Properties>
<ChildObjects/>
</ExternalDataProcessor>
</MetaDataObject>
@@ -0,0 +1,11 @@
#Область ОписаниеПеременных
#КонецОбласти
#Область ПрограммныйИнтерфейс
#КонецОбласти
#Область СлужебныеПроцедурыИФункции
#КонецОбласти