From 0dac85946f8bb7c3842bba56e378a50ff53a6f11 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 6 Sep 2026 17:59:11 +0300 Subject: [PATCH] =?UTF-8?q?fix(meta-edit):=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BA=D0=B0=20=C2=AB=D1=80=D0=B5=D0=B1=D1=91=D0=BD?= =?UTF-8?q?=D0=BE=D0=BA=20=D1=83=D0=B6=D0=B5=20=D0=B5=D1=81=D1=82=D1=8C?= =?UTF-8?q?=C2=BB=20=D0=BD=D0=B5=20=D0=B2=D0=B8=D0=B4=D0=B5=D0=BB=D0=B0=20?= =?UTF-8?q?=D1=83=D0=B7=D0=BB=D0=BE=D0=B2=20=D0=B1=D0=B5=D0=B7=20Propertie?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get-AllChildNames собирал имена только из Properties/Name и пропускал детей, которые регистрируются голым текстом: Имя
,
Имя
, . Из-за этого проверка на дубликат была мёртвой: после удаления файла таблицы повторное добавление отвечало «Added: 1» и клало в ChildObjects второй такой же . Теперь имя берётся из текста узла, если у ребёнка нет Properties. Кейс воспроизводит исходный сценарий: добавить таблицу, удалить её файл, добавить снова — второй записи быть не должно. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01AtG4qGvZocJSWLAsbHpBCQ --- .../skills/meta-edit/scripts/meta-edit.ps1 | 11 +- .claude/skills/meta-edit/scripts/meta-edit.py | 8 +- .../cases/meta-edit/eds-add-table-twice.json | 27 ++ .../eds-add-table-twice/Configuration.xml | 252 ++++++++++++++++++ .../Ext/ClientApplicationInterface.xml | 18 ++ .../ExternalDataSources/PG.xml | 34 +++ .../PG/Tables/products.xml | 130 +++++++++ .../eds-add-table-twice/Languages/Русский.xml | 16 ++ 8 files changed, 493 insertions(+), 3 deletions(-) create mode 100644 tests/skills/cases/meta-edit/eds-add-table-twice.json create mode 100644 tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Configuration.xml create mode 100644 tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Ext/ClientApplicationInterface.xml create mode 100644 tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG.xml create mode 100644 tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG/Tables/products.xml create mode 100644 tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Languages/Русский.xml diff --git a/.claude/skills/meta-edit/scripts/meta-edit.ps1 b/.claude/skills/meta-edit/scripts/meta-edit.ps1 index 7f089f95e..b67175e21 100644 --- a/.claude/skills/meta-edit/scripts/meta-edit.ps1 +++ b/.claude/skills/meta-edit/scripts/meta-edit.ps1 @@ -1,4 +1,4 @@ -# meta-edit v1.46 — Edit existing 1C metadata object XML +# meta-edit v1.47 — Edit existing 1C metadata object XML # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills [CmdletBinding(PositionalBinding=$false)] param( @@ -1505,7 +1505,14 @@ function Get-AllChildNames { $propsEl = $gc; break } } - if (-not $propsEl) { continue } + # Часть детей регистрируется голым текстом, без :
Имя
, + #
Имя
, . Пропуская их, проверка «уже существует» + # становилась мёртвой — повторное добавление давало второй такой же узел. + if (-not $propsEl) { + $n = $child.InnerText.Trim() + if ($n) { $names[$n] = $child.LocalName } + continue + } foreach ($gc in $propsEl.ChildNodes) { if ($gc.NodeType -eq 'Element' -and $gc.LocalName -eq "Name") { $n = $gc.InnerText.Trim() diff --git a/.claude/skills/meta-edit/scripts/meta-edit.py b/.claude/skills/meta-edit/scripts/meta-edit.py index bcb0d145b..7fcfb38f2 100644 --- a/.claude/skills/meta-edit/scripts/meta-edit.py +++ b/.claude/skills/meta-edit/scripts/meta-edit.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# meta-edit v1.46 — Edit existing 1C metadata object XML +# meta-edit v1.47 — Edit existing 1C metadata object XML # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -1522,7 +1522,13 @@ def get_all_child_names(): if localname(gc) == "Properties": props_el = gc break + # Часть детей регистрируется голым текстом, без : Имя
, + #
Имя
, . Пропуская их, проверка «уже существует» + # становилась мёртвой — повторное добавление давало второй такой же узел. if props_el is None: + n = (child.text or "").strip() + if n: + names[n] = localname(child) continue for gc in props_el: if localname(gc) == "Name": diff --git a/tests/skills/cases/meta-edit/eds-add-table-twice.json b/tests/skills/cases/meta-edit/eds-add-table-twice.json new file mode 100644 index 000000000..721a3f30a --- /dev/null +++ b/tests/skills/cases/meta-edit/eds-add-table-twice.json @@ -0,0 +1,27 @@ +{ + "name": "Повторное добавление таблицы не даёт второй записи в ChildObjects", + "setup": "empty-config", + "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { + "type": "ExternalDataSource", + "name": "PG", + "tables": { "products": { "keyFields": ["id"], "fields": ["id: Number(10,0)"] } } + }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, + { + "script": "meta-edit/scripts/meta-edit", + "input": { "add": { "tables": { "sales": ["id: Number(10,0)"] } } }, + "args": { "-DefinitionFile": "{inputFile}", "-ObjectPath": "{workDir}/ExternalDataSources/PG.xml" } + }, + { "deletePath": "ExternalDataSources/PG/Tables/sales.xml" } + ], + "params": { "objectPath": "ExternalDataSources/PG.xml" }, + "input": { "add": { "tables": { "sales": ["id: Number(10,0)"] } } }, + "expect": { + "stdoutContains": ["already exists"], + "filesAbsent": ["ExternalDataSources/PG/Tables/sales.xml"] + } +} diff --git a/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Configuration.xml b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Configuration.xml new file mode 100644 index 000000000..da0e784ee --- /dev/null +++ b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Configuration.xml @@ -0,0 +1,252 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + UUID-008 + UUID-009 + + + UUID-010 + UUID-011 + + + UUID-012 + UUID-013 + + + UUID-014 + UUID-015 + + + + TestConfig + + + ru + TestConfig + + + + + Version8_3_24 + ManagedApplication + + PlatformApplication + + Russian + + + + + false + false + false + + + + + + + + + + + + + + + + + + + + + + Biometrics + true + + + Location + false + + + BackgroundLocation + false + + + BluetoothPrinters + false + + + WiFiPrinters + false + + + Contacts + false + + + Calendars + false + + + PushNotifications + false + + + LocalNotifications + false + + + InAppPurchases + false + + + PersonalComputerFileExchange + false + + + Ads + false + + + NumberDialing + false + + + CallProcessing + false + + + CallLog + false + + + AutoSendSMS + false + + + ReceiveSMS + false + + + SMSLog + false + + + Camera + false + + + Microphone + false + + + MusicLibrary + false + + + PictureAndVideoLibraries + false + + + AudioPlaybackAndVibration + false + + + BackgroundAudioPlaybackAndVibration + false + + + InstallPackages + false + + + OSBackup + true + + + ApplicationUsageStatistics + false + + + BarcodeScanning + false + + + BackgroundAudioRecording + false + + + AllFilesAccess + false + + + Videoconferences + false + + + NFC + false + + + DocumentScanning + false + + + SpeechToText + false + + + Geofences + false + + + IncomingShareRequests + false + + + AllIncomingShareRequestsTypesProcessing + false + + + + + + Normal + + + Language.Русский + + + + + + Managed + NotAutoFree + DontUse + DontUse + TaxiEnableVersion8_2 + DontUse + Version8_3_24 + + + + Русский + PG + + + \ No newline at end of file diff --git a/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Ext/ClientApplicationInterface.xml b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Ext/ClientApplicationInterface.xml new file mode 100644 index 000000000..3c1161b2d --- /dev/null +++ b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Ext/ClientApplicationInterface.xml @@ -0,0 +1,18 @@ + + + + + UUID-002 + + + + + UUID-004 + + + + + + + + \ No newline at end of file diff --git a/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG.xml b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG.xml new file mode 100644 index 000000000..e07a72d65 --- /dev/null +++ b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG.xml @@ -0,0 +1,34 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + + PG + + + ru + PG + + + + Automatic + + + products
+ sales
+
+
+
\ No newline at end of file diff --git a/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG/Tables/products.xml b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG/Tables/products.xml new file mode 100644 index 000000000..205ef9363 --- /dev/null +++ b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/ExternalDataSources/PG/Tables/products.xml @@ -0,0 +1,130 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + UUID-008 + UUID-009 + + + UUID-010 + UUID-011 + + + UUID-012 + UUID-013 + + + UUID-014 + UUID-015 + + + UUID-016 + UUID-017 + + + + products + + + ru + products + + + + Table + products + + NonobjectData + + ExternalDataSource.PG.Table.products.Field.id + + + + + + true + false + + Auto + Begin + Directly + Auto + + + + + + + + + + + + false + false + Auto + + InDialog + + + Automatic + + + + + id + + + ru + id + + + + + xs:decimal + + 10 + 0 + Any + + + false + + + + false + + false + false + + + false + 0 + DontCheck + + + Auto + Auto + Auto + + id + false + false + + + +
+
\ No newline at end of file diff --git a/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Languages/Русский.xml b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Languages/Русский.xml new file mode 100644 index 000000000..37c60d786 --- /dev/null +++ b/tests/skills/cases/meta-edit/snapshots/eds-add-table-twice/Languages/Русский.xml @@ -0,0 +1,16 @@ + + + + + Русский + + + ru + Русский + + + + ru + + + \ No newline at end of file