From 912128d24fa92e14512a3ec7be2b0ccc3d4d7aa5 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 19 Jul 2026 13:56:34 +0300 Subject: [PATCH] =?UTF-8?q?feat(cfe-patch-method):=20=D1=80=D0=B0=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=B7=D0=BD=D0=B0=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BE=D0=BA=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20(v2.4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Правка, перенесённая вендором в основную конфигурацию, больше не дублируется и не уходит в ложный конфликт: - вставка, чей код уже в новом оригинале → раньше ДУБЛЬ, теперь снимается; - удаление, чей блок уже вырезан → раньше ложный КОНФЛИКТ, теперь снимается. Обесценивание — свойство операции. Новый статус метода ПЕРЕНЕСЕНО В ОСНОВНУЮ, когда поглощены все правки (перехватчик можно удалить); при частичном — АКТУАЛИЗИРОВАН со счётчиками «правок сохранено: N, перенесено в основную: M». Существующий счётчик «перенесено правок» переименован в «правок сохранено», чтобы «перенесено» осталось за поглощением базой. -Check не роняет exit, если единственное расхождение — перенесённые правки. Детекция на существующих примитивах (Find-UniqueRun + новые Test-RunAt/ Test-DeleteAbsorbed), только по точному совпадению. Зеркально ps1↔py, +3 кейса (transferred-insert/delete/partial), 19/19 на обоих рантаймах. Co-Authored-By: Claude Opus 4.8 --- .claude/skills/cfe-patch-method/SKILL.md | 7 +- .../scripts/cfe-patch-method.ps1 | 77 +++++- .../scripts/cfe-patch-method.py | 91 +++++-- .../cfe-patch-method/resync-reanchor.json | 2 +- .../CommonModules/ПереносМод.xml | 23 ++ .../CommonModules/ПереносМод/Ext/Module.bsl | 8 + .../transferred-delete/Configuration.xml | 252 ++++++++++++++++++ .../Ext/ClientApplicationInterface.xml | 18 ++ .../Ext/CommonModules/ПереносМод.xml | 18 ++ .../CommonModules/ПереносМод/Ext/Module.bsl | 7 + .../transferred-delete/Ext/Configuration.xml | 72 +++++ .../Ext/Languages/Русский.xml | 13 + .../Ext/Roles/Тест_ОсновнаяРоль.xml | 10 + .../transferred-delete/Languages/Русский.xml | 16 ++ .../CommonModules/ПереносМод.xml | 23 ++ .../CommonModules/ПереносМод/Ext/Module.bsl | 9 + .../transferred-insert/Configuration.xml | 252 ++++++++++++++++++ .../Ext/ClientApplicationInterface.xml | 18 ++ .../Ext/CommonModules/ПереносМод.xml | 18 ++ .../CommonModules/ПереносМод/Ext/Module.bsl | 8 + .../transferred-insert/Ext/Configuration.xml | 72 +++++ .../Ext/Languages/Русский.xml | 13 + .../Ext/Roles/Тест_ОсновнаяРоль.xml | 10 + .../transferred-insert/Languages/Русский.xml | 16 ++ .../CommonModules/ПереносМод.xml | 23 ++ .../CommonModules/ПереносМод/Ext/Module.bsl | 10 + .../transferred-partial/Configuration.xml | 252 ++++++++++++++++++ .../Ext/ClientApplicationInterface.xml | 18 ++ .../Ext/CommonModules/ПереносМод.xml | 18 ++ .../CommonModules/ПереносМод/Ext/Module.bsl | 12 + .../transferred-partial/Ext/Configuration.xml | 72 +++++ .../Ext/Languages/Русский.xml | 13 + .../Ext/Roles/Тест_ОсновнаяРоль.xml | 10 + .../transferred-partial/Languages/Русский.xml | 16 ++ .../cfe-patch-method/transferred-delete.json | 37 +++ .../cfe-patch-method/transferred-insert.json | 37 +++ .../cfe-patch-method/transferred-partial.json | 37 +++ 37 files changed, 1574 insertions(+), 34 deletions(-) create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод/Ext/Module.bsl create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Configuration.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/ClientApplicationInterface.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод/Ext/Module.bsl create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Configuration.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Languages/Русский.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Roles/Тест_ОсновнаяРоль.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Languages/Русский.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод/Ext/Module.bsl create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Configuration.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/ClientApplicationInterface.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод/Ext/Module.bsl create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Configuration.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Languages/Русский.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Roles/Тест_ОсновнаяРоль.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Languages/Русский.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод/Ext/Module.bsl create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Configuration.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/ClientApplicationInterface.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод/Ext/Module.bsl create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Configuration.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Languages/Русский.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Roles/Тест_ОсновнаяРоль.xml create mode 100644 tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Languages/Русский.xml create mode 100644 tests/skills/cases/cfe-patch-method/transferred-delete.json create mode 100644 tests/skills/cases/cfe-patch-method/transferred-insert.json create mode 100644 tests/skills/cases/cfe-patch-method/transferred-partial.json diff --git a/.claude/skills/cfe-patch-method/SKILL.md b/.claude/skills/cfe-patch-method/SKILL.md index 28b37988..15c4a633 100644 --- a/.claude/skills/cfe-patch-method/SKILL.md +++ b/.claude/skills/cfe-patch-method/SKILL.md @@ -95,14 +95,15 @@ allowed-tools: После изменения оригинала в конфигурации-источнике перехватчик `&ИзменениеИКонтроль` может рассинхронизироваться — unmarked-контекст разойдётся с новым оригиналом. Платформа при загрузке об этом молчит, поэтому актуализируй сам: -- **Проверить** — `-Check`: отчёт по дрейфу всех контролируемых методов расширения, ничего не пишет (`exit 1`, если дрейф есть). +- **Проверить** — `-Check`: отчёт по всем контролируемым методам расширения, ничего не пишет (`exit 1`, если есть дрейф или конфликт). - **Актуализировать** — `-Actualize`: переносит правки (`#Вставка`/`#Удаление`) на новый оригинал по всему расширению. Сузить область: `-ModulePath` — один модуль, `+ -MethodName` — один метод. Для одного метода то же делает повторный вызов с `-InterceptorType ModificationAndControl`. Статусы в выводе: - `[АКТУАЛЕН]` — оригинал не менялся, правок нет; -- `[АКТУАЛИЗИРОВАН]` — тело обновлено по новому оригиналу, правки перенесены (в выводе — сводка перенесённого); -- `[АКТУАЛИЗИРОВАН-ЧАСТИЧНО]` — часть правок не удалось разместить (якорь изменился в новом оригинале). Они помечены `// [РЕСИНК-КОНФЛИКТ]` в модуле и не потеряны; путь к merge-воркспейсу — в выводе (начни с `index.md`, дальше по каждому конфликту его `conflict.md`, размести блоки вручную в `.bsl` расширения). +- `[АКТУАЛИЗИРОВАН]` — тело обновлено по новому оригиналу, правки сохранены (в выводе — сводка); +- `[АКТУАЛИЗИРОВАН-ЧАСТИЧНО]` — часть правок не удалось разместить (якорь изменился в новом оригинале). Они помечены `// [РЕСИНК-КОНФЛИКТ]` в модуле и не потеряны; путь к merge-воркспейсу — в выводе (начни с `index.md`, дальше по каждому конфликту его `conflict.md`, размести блоки вручную в `.bsl` расширения); +- `[ПЕРЕНЕСЕНО В ОСНОВНУЮ]` — правка уже есть в новом оригинале (вставленный код внесён вендором) или удаляемый блок уже вырезан. Правка неактуальна — убирается из тела, дублировать/конфликтовать не нужно. Если так со всеми правками метода — перехватчик можно удалить. `-Check` этим не роняет `exit`. Повторный вызов `Before`/`After`/`Instead` для уже перехваченного метода дубль не создаёт (`[ПРОПУЩЕН]`). diff --git a/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.ps1 b/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.ps1 index b05bd0a4..cb5ce2c6 100644 --- a/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.ps1 +++ b/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.ps1 @@ -1,4 +1,4 @@ -# cfe-patch-method v2.3 — Source-aware method interceptor for 1C extension (CFE) +# cfe-patch-method v2.4 — Source-aware method interceptor for 1C extension (CFE) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -421,6 +421,31 @@ function Find-UniqueRun { return $found } +# True if the normalized run `keys` sits in `hay` starting exactly at index `at` (contiguous, in-bounds). +# Used to detect an insert whose payload the vendor already placed at the anchor (pereneseno v osnovnuyu). +function Test-RunAt { + param($hay, $keys, [int]$at) + if ($keys.Count -eq 0) { return $false } + if ($at -lt 0 -or ($at + $keys.Count) -gt $hay.Count) { return $false } + for ($m = 0; $m -lt $keys.Count; $m++) { if ($hay[$at + $m] -ne $keys[$m]) { return $false } } + return $true +} + +# True if a deletion is already applied in v2: its before/after context lines are now adjacent +# (nothing left between them), or the missing side sits at a body boundary. $null = boundary side. +function Test-DeleteAbsorbed { + param($v2norm, $beforeCtx, $afterCtx) + if ($null -ne $beforeCtx -and $null -ne $afterCtx) { + for ($i = 0; $i -lt ($v2norm.Count - 1); $i++) { + if ($v2norm[$i] -eq $beforeCtx -and $v2norm[$i + 1] -eq $afterCtx) { return $true } + } + return $false + } + if ($null -eq $beforeCtx -and $null -ne $afterCtx) { return ($v2norm.Count -gt 0 -and $v2norm[0] -eq $afterCtx) } + if ($null -ne $beforeCtx -and $null -eq $afterCtx) { return ($v2norm.Count -gt 0 -and $v2norm[$v2norm.Count - 1] -eq $beforeCtx) } + return $false +} + # Resolve where an insertion lands in v2 using two-sided context. # Returns index to "insert after" (-1 = top of body), or $null if ambiguous/conflict. function Resolve-InsertionPoint { @@ -596,7 +621,7 @@ function Invoke-Resync { return @{ Id = $methodId; Status = 'АКТУАЛЕН'; ExtBsl = $extBsl } } - $insertTop = @(); $insertAfter = @{}; $delStart = @{}; $delEnd = @{}; $disputed = @(); $transferred = @() + $insertTop = @(); $insertAfter = @{}; $delStart = @{}; $delEnd = @{}; $disputed = @(); $transferred = @(); $absorbed = @() foreach ($op in $ops) { if ($op.Kind -eq 'insert') { $beforeLines = @() @@ -605,7 +630,11 @@ function Invoke-Resync { $ae = [Math]::Min($v1norm.Count - 1, $op.After + 3) for ($m = $op.After + 1; $m -le $ae; $m++) { $afterLines += $v1norm[$m] } $k = Resolve-InsertionPoint $v2norm $beforeLines $afterLines - if ($null -eq $k) { + $payloadNorm = @($op.Lines | ForEach-Object { Get-Normalized $_ }) + # Payload already in the new original -> the change was carried into the main config. + $isAbsorbed = if ($null -eq $k) { (Find-UniqueRun $v2norm $payloadNorm) -ge 0 } else { Test-RunAt $v2norm $payloadNorm ($(if ($k -lt 0) { 0 } else { $k + 1 })) } + if ($isAbsorbed) { $absorbed += @{ Kind = 'insert' } } + elseif ($null -eq $k) { $dbefore = @(); if ($op.After -ge 0) { $bz = [Math]::Max(0, $op.After - 2); for ($z = $bz; $z -le $op.After; $z++) { $dbefore += $v1[$z] } } $dafter = @(); $az = [Math]::Min($v1.Count - 1, $op.After + 3); for ($z = $op.After + 1; $z -le $az; $z++) { $dafter += $v1[$z] } $disputed += @{ Kind = 'insert'; Lines = $op.Lines; Before = $dbefore; After = $dafter } @@ -616,13 +645,20 @@ function Invoke-Resync { $keys = @(); for ($m = $op.Start; $m -le $op.End; $m++) { $keys += $v1norm[$m] } $p = Find-UniqueRun $v2norm $keys if ($p -ge 0) { $delStart[$p] = $true; $delEnd[$p + $keys.Count - 1] = $true; $transferred += @{ Kind = 'delete' } } - else { $disputed += @{ Kind = 'delete'; Lines = $op.Lines } } + else { + $delBeforeCtx = if ($op.Start -gt 0) { $v1norm[$op.Start - 1] } else { $null } + $delAfterCtx = if ($op.End -lt ($v1norm.Count - 1)) { $v1norm[$op.End + 1] } else { $null } + # Block already cut from the new original -> deletion already applied in the main config. + if (Test-DeleteAbsorbed $v2norm $delBeforeCtx $delAfterCtx) { $absorbed += @{ Kind = 'delete' } } + else { $disputed += @{ Kind = 'delete'; Lines = $op.Lines } } + } } } if ($ReportOnly) { - $st = if ($disputed.Count -gt 0) { 'КОНФЛИКТ' } else { 'ДРЕЙФ' } - return @{ Id = $methodId; Status = $st; ExtBsl = $extBsl; Transferred = $transferred.Count; Disputed = $disputed.Count; Reason = (Get-ResyncConflictReason $disputed) } + $st = if ($disputed.Count -gt 0) { 'КОНФЛИКТ' } elseif ($transferred.Count -eq 0 -and $absorbed.Count -gt 0) { 'ПЕРЕНЕСЕНО В ОСНОВНУЮ' } else { 'ДРЕЙФ' } + $rsn = if ($disputed.Count -gt 0) { Get-ResyncConflictReason $disputed } elseif ($st -eq 'ПЕРЕНЕСЕНО В ОСНОВНУЮ') { 'все правки уже в основной конфигурации' } else { '' } + return @{ Id = $methodId; Status = $st; ExtBsl = $extBsl; Transferred = $transferred.Count; Absorbed = $absorbed.Count; Disputed = $disputed.Count; Reason = $rsn } } # assemble new marked body @@ -672,8 +708,9 @@ function Invoke-Resync { $conflictDir = $conflictFolder Write-ConflictFolder $conflictFolder $methodId $extBsl $existingName $method $v1 $markedBody $v2 $v1norm $v2norm $disputed $enc } - $status = if ($disputed.Count -gt 0) { 'ЧАСТИЧНО' } else { 'АКТУАЛИЗИРОВАН' } - return @{ Id = $methodId; Status = $status; ExtBsl = $extBsl; Transferred = $transferred.Count; Disputed = $disputed.Count; ConflictDir = $conflictDir; Reason = (Get-ResyncConflictReason $disputed) } + $status = if ($disputed.Count -gt 0) { 'ЧАСТИЧНО' } elseif ($transferred.Count -eq 0 -and $absorbed.Count -gt 0) { 'ПЕРЕНЕСЕНО В ОСНОВНУЮ' } else { 'АКТУАЛИЗИРОВАН' } + $rsn = if ($disputed.Count -gt 0) { Get-ResyncConflictReason $disputed } elseif ($status -eq 'ПЕРЕНЕСЕНО В ОСНОВНУЮ') { 'все правки уже в основной конфигурации — перехватчик можно удалить' } else { '' } + return @{ Id = $methodId; Status = $status; ExtBsl = $extBsl; Transferred = $transferred.Count; Absorbed = $absorbed.Count; Disputed = $disputed.Count; ConflictDir = $conflictDir; Reason = $rsn } } # Write run-root index.md (only if there are conflicts). Returns run-root or $null. @@ -779,20 +816,23 @@ if ($Check -or $Actualize) { Write-Host "[$verb] $extName -> $ConfigPath (на контроле: $total)" $listed = @($results | Where-Object { $_.Status -ne 'АКТУАЛЕН' }) foreach ($p in $listed) { - $line = " {0,-16} {1}" -f $p.Status, $p.Id + $line = " {0,-22} {1}" -f $p.Status, $p.Id if ($p.Reason) { $line += " $($p.Reason)" } Write-Host $line } + $transf = @($results | Where-Object { $_.Status -eq 'ПЕРЕНЕСЕНО В ОСНОВНУЮ' }).Count if ($Check) { $drift = @($results | Where-Object { $_.Status -eq 'ДРЕЙФ' }).Count $confl = @($results | Where-Object { $_.Status -eq 'КОНФЛИКТ' }).Count $gone = @($results | Where-Object { $_.Status -in @('МЕТОД-ИСЧЕЗ', 'ИСТОЧНИК-НЕ-НАЙДЕН') }).Count - Write-Host "Итог: $actual/$total актуальны · дрейф: $drift · конфликтов: $confl · внимания: $gone" - if ($listed.Count -gt 0) { Write-Host "Починить: /cfe-patch-method -Actualize -ExtensionPath $ExtensionPath -ConfigPath $ConfigPath"; exit 1 } else { exit 0 } + Write-Host "Итог: $actual/$total актуальны · дрейф: $drift · конфликтов: $confl · перенесено в основную: $transf · внимания: $gone" + if (($drift + $confl + $gone) -gt 0) { Write-Host "Починить: /cfe-patch-method -Actualize -ExtensionPath $ExtensionPath -ConfigPath $ConfigPath"; exit 1 } + elseif ($transf -gt 0) { Write-Host "Перенесённые в основную конфигурацию правки подчистит: /cfe-patch-method -Actualize -ExtensionPath $ExtensionPath -ConfigPath $ConfigPath"; exit 0 } + else { exit 0 } } else { $upd = @($results | Where-Object { $_.Status -eq 'АКТУАЛИЗИРОВАН' }).Count $part = @($results | Where-Object { $_.Status -eq 'ЧАСТИЧНО' }).Count - Write-Host "Итог: $actual/$total актуальны · актуализировано: $upd · частично: $part" + Write-Host "Итог: $actual/$total актуальны · актуализировано: $upd · частично: $part · перенесено в основную: $transf" $idx = Write-ResyncIndex $runRoot $results $extName $ConfigPath $verb $enc if ($idx) { Write-Host "Merge-воркспейс конфликтов (см. index.md): $idx" } exit 0 @@ -887,10 +927,19 @@ if ($dup) { $res = Invoke-Resync $extBsl $extLines $dup $method $logicalModule $folder $enc switch ($res.Status) { 'АКТУАЛЕН' { Write-Host "[АКТУАЛЕН] &ИзменениеИКонтроль(`"$MethodName`") — оригинал не менялся, изменений нет." } - 'АКТУАЛИЗИРОВАН' { Write-Host "[АКТУАЛИЗИРОВАН] &ИзменениеИКонтроль(`"$MethodName`") — тело обновлено, перенесено правок: $($res.Transferred)" } + 'АКТУАЛИЗИРОВАН' { + $msg = "[АКТУАЛИЗИРОВАН] &ИзменениеИКонтроль(`"$MethodName`") — тело обновлено, правок сохранено: $($res.Transferred)" + if ($res.Absorbed -gt 0) { $msg += ", перенесено в основную конфигурацию: $($res.Absorbed)" } + Write-Host $msg + } + 'ПЕРЕНЕСЕНО В ОСНОВНУЮ' { + Write-Host "[ПЕРЕНЕСЕНО В ОСНОВНУЮ] &ИзменениеИКонтроль(`"$MethodName`") — все правки ($($res.Absorbed)) уже в основной конфигурации, перехватчик можно удалить." + } 'ЧАСТИЧНО' { $idx = Write-ResyncIndex $runRoot @($res) $extName $ConfigPath "АКТУАЛИЗАЦИЯ" $enc - Write-Host "[АКТУАЛИЗИРОВАН-ЧАСТИЧНО] &ИзменениеИКонтроль(`"$MethodName`") — перенесено: $($res.Transferred), конфликтов: $($res.Disputed)" + $msg = "[АКТУАЛИЗИРОВАН-ЧАСТИЧНО] &ИзменениеИКонтроль(`"$MethodName`") — сохранено: $($res.Transferred), конфликтов: $($res.Disputed)" + if ($res.Absorbed -gt 0) { $msg += ", перенесено в основную: $($res.Absorbed)" } + Write-Host $msg Write-Host " Конфликт помечен // [РЕСИНК-КОНФЛИКТ]. Папка метода: $($res.ConflictDir)" if ($idx) { Write-Host " Индекс: $idx" } } diff --git a/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py b/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py index 6a3c09ba..f0f72ee6 100644 --- a/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py +++ b/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# cfe-patch-method v2.3 — Source-aware method interceptor for 1C extension (CFE) +# cfe-patch-method v2.4 — Source-aware method interceptor for 1C extension (CFE) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -411,6 +411,28 @@ def find_unique_run(v2norm, keys): return found +def test_run_at(hay, keys, at): + """True if normalized run `keys` sits in `hay` starting exactly at index `at` (contiguous).""" + if not keys or at < 0 or at + len(keys) > len(hay): + return False + return hay[at:at + len(keys)] == keys + + +def test_delete_absorbed(v2norm, before_ctx, after_ctx): + """True if a deletion is already applied in v2: before/after context are now adjacent + (nothing between them), or the missing side sits at a body boundary (None = boundary).""" + if before_ctx is not None and after_ctx is not None: + for i in range(len(v2norm) - 1): + if v2norm[i] == before_ctx and v2norm[i + 1] == after_ctx: + return True + return False + if before_ctx is None and after_ctx is not None: + return len(v2norm) > 0 and v2norm[0] == after_ctx + if before_ctx is not None and after_ctx is None: + return len(v2norm) > 0 and v2norm[-1] == before_ctx + return False + + def resolve_insertion_point(v2norm, before_lines, after_lines): """Where an insertion lands in v2 using two-sided context. Returns index to insert-after (-1 = top), or None if ambiguous/conflict.""" @@ -589,24 +611,28 @@ def main(): print("[%s] %s -> %s (на контроле: %d)" % (verb, ext_name, cp, total)) listed = [r for r in results if r["status"] != "АКТУАЛЕН"] for pr in listed: - line = " %-16s %s" % (pr["status"], pr["id"]) + line = " %-22s %s" % (pr["status"], pr["id"]) if pr.get("reason"): line += " %s" % pr["reason"] print(line) + transf = sum(1 for r in results if r["status"] == "ПЕРЕНЕСЕНО В ОСНОВНУЮ") if check_mode: drift = sum(1 for r in results if r["status"] == "ДРЕЙФ") confl = sum(1 for r in results if r["status"] == "КОНФЛИКТ") gone = sum(1 for r in results if r["status"] in ("МЕТОД-ИСЧЕЗ", "ИСТОЧНИК-НЕ-НАЙДЕН")) - print("Итог: %d/%d актуальны · дрейф: %d · конфликтов: %d · внимания: %d" - % (actual, total, drift, confl, gone)) - if listed: + print("Итог: %d/%d актуальны · дрейф: %d · конфликтов: %d · перенесено в основную: %d · внимания: %d" + % (actual, total, drift, confl, transf, gone)) + if (drift + confl + gone) > 0: print("Починить: /cfe-patch-method -Actualize -ExtensionPath %s -ConfigPath %s" % (extension_path, cp)) sys.exit(1) + elif transf > 0: + print("Перенесённые в основную конфигурацию правки подчистит: /cfe-patch-method -Actualize -ExtensionPath %s -ConfigPath %s" % (extension_path, cp)) + sys.exit(0) sys.exit(0) else: upd = sum(1 for r in results if r["status"] == "АКТУАЛИЗИРОВАН") part = sum(1 for r in results if r["status"] == "ЧАСТИЧНО") - print("Итог: %d/%d актуальны · актуализировано: %d · частично: %d" % (actual, total, upd, part)) + print("Итог: %d/%d актуальны · актуализировано: %d · частично: %d · перенесено в основную: %d" % (actual, total, upd, part, transf)) idx = write_resync_index(run_root, results, ext_name, cp, verb) if idx: print("Merge-воркспейс конфликтов (см. index.md): %s" % idx) @@ -701,12 +727,19 @@ def main(): if st == "АКТУАЛЕН": print('[АКТУАЛЕН] &ИзменениеИКонтроль("%s") — оригинал не менялся, изменений нет.' % method_name) elif st == "АКТУАЛИЗИРОВАН": - print('[АКТУАЛИЗИРОВАН] &ИзменениеИКонтроль("%s") — тело обновлено, перенесено правок: %d' - % (method_name, res.get("transferred", 0))) + msg = '[АКТУАЛИЗИРОВАН] &ИзменениеИКонтроль("%s") — тело обновлено, правок сохранено: %d' % (method_name, res.get("transferred", 0)) + if res.get("absorbed", 0) > 0: + msg += ", перенесено в основную конфигурацию: %d" % res["absorbed"] + print(msg) + elif st == "ПЕРЕНЕСЕНО В ОСНОВНУЮ": + print('[ПЕРЕНЕСЕНО В ОСНОВНУЮ] &ИзменениеИКонтроль("%s") — все правки (%d) уже в основной конфигурации, перехватчик можно удалить.' + % (method_name, res.get("absorbed", 0))) elif st == "ЧАСТИЧНО": idx = write_resync_index(run_root, [res], ext_name, config_path, "АКТУАЛИЗАЦИЯ") - print('[АКТУАЛИЗИРОВАН-ЧАСТИЧНО] &ИзменениеИКонтроль("%s") — перенесено: %d, конфликтов: %d' - % (method_name, res.get("transferred", 0), res.get("disputed", 0))) + msg = '[АКТУАЛИЗИРОВАН-ЧАСТИЧНО] &ИзменениеИКонтроль("%s") — сохранено: %d, конфликтов: %d' % (method_name, res.get("transferred", 0), res.get("disputed", 0)) + if res.get("absorbed", 0) > 0: + msg += ", перенесено в основную: %d" % res["absorbed"] + print(msg) print(" Конфликт помечен // [РЕСИНК-КОНФЛИКТ]. Папка метода: %s" % res.get("conflict_dir")) if idx: print(" Индекс: %s" % idx) @@ -938,14 +971,22 @@ def resync_one(ext_bsl, ext_lines, dup, method, logical_module, conflict_folder, if "\n".join(v1norm) == "\n".join(v2norm): return {"id": method_id, "status": "АКТУАЛЕН", "ext_bsl": ext_bsl} - insert_top = []; insert_after = {}; del_start = set(); del_end = set(); disputed = []; transferred = 0 + insert_top = []; insert_after = {}; del_start = set(); del_end = set(); disputed = []; transferred = 0; absorbed = 0 for op in ops: if op["kind"] == "insert": after = op["after"] before_lines = v1norm[max(0, after - 2):after + 1] if after >= 0 else [] after_lines = v1norm[after + 1:after + 4] k = resolve_insertion_point(v2norm, before_lines, after_lines) + payload_norm = [normalize(x) for x in op["lines"]] + # Payload already in the new original -> the change was carried into the main config. if k is None: + is_absorbed = find_unique_run(v2norm, payload_norm) >= 0 + else: + is_absorbed = test_run_at(v2norm, payload_norm, 0 if k < 0 else k + 1) + if is_absorbed: + absorbed += 1 + elif k is None: dbefore = v1[max(0, after - 2):after + 1] if after >= 0 else [] dafter = v1[after + 1:after + 4] disputed.append({"kind": "insert", "lines": op["lines"], "before": dbefore, "after": dafter}) @@ -959,12 +1000,24 @@ def resync_one(ext_bsl, ext_lines, dup, method, logical_module, conflict_folder, if p >= 0: del_start.add(p); del_end.add(p + len(keys) - 1); transferred += 1 else: - disputed.append({"kind": "delete", "lines": op["lines"]}) + before_ctx = v1norm[op["start"] - 1] if op["start"] > 0 else None + after_ctx = v1norm[op["end"] + 1] if op["end"] < len(v1norm) - 1 else None + # Block already cut from the new original -> deletion already applied in the main config. + if test_delete_absorbed(v2norm, before_ctx, after_ctx): + absorbed += 1 + else: + disputed.append({"kind": "delete", "lines": op["lines"]}) if report_only: - st = "КОНФЛИКТ" if disputed else "ДРЕЙФ" + if disputed: + st = "КОНФЛИКТ" + elif transferred == 0 and absorbed > 0: + st = "ПЕРЕНЕСЕНО В ОСНОВНУЮ" + else: + st = "ДРЕЙФ" + rsn = conflict_reason(disputed) if disputed else ("все правки уже в основной конфигурации" if st == "ПЕРЕНЕСЕНО В ОСНОВНУЮ" else "") return {"id": method_id, "status": st, "ext_bsl": ext_bsl, "transferred": transferred, - "disputed": len(disputed), "reason": conflict_reason(disputed)} + "absorbed": absorbed, "disputed": len(disputed), "reason": rsn} new_body = [] for blk in insert_top: @@ -1012,9 +1065,15 @@ def resync_one(ext_bsl, ext_lines, dup, method, logical_module, conflict_folder, if disputed: conflict_dir = conflict_folder write_conflict_folder(conflict_folder, method_id, ext_bsl, existing_name, method, v1, marked_body, v2, v1norm, v2norm, disputed) - status = "ЧАСТИЧНО" if disputed else "АКТУАЛИЗИРОВАН" + if disputed: + status = "ЧАСТИЧНО" + elif transferred == 0 and absorbed > 0: + status = "ПЕРЕНЕСЕНО В ОСНОВНУЮ" + else: + status = "АКТУАЛИЗИРОВАН" + rsn = conflict_reason(disputed) if disputed else ("все правки уже в основной конфигурации — перехватчик можно удалить" if status == "ПЕРЕНЕСЕНО В ОСНОВНУЮ" else "") return {"id": method_id, "status": status, "ext_bsl": ext_bsl, "transferred": transferred, - "disputed": len(disputed), "conflict_dir": conflict_dir, "reason": conflict_reason(disputed)} + "absorbed": absorbed, "disputed": len(disputed), "conflict_dir": conflict_dir, "reason": rsn} def write_resync_index(run_root, results, ext_name, config_path, verb): diff --git a/tests/skills/cases/cfe-patch-method/resync-reanchor.json b/tests/skills/cases/cfe-patch-method/resync-reanchor.json index 2b9eb271..6976c86f 100644 --- a/tests/skills/cases/cfe-patch-method/resync-reanchor.json +++ b/tests/skills/cases/cfe-patch-method/resync-reanchor.json @@ -33,5 +33,5 @@ "methodName": "П", "interceptorType": "ModificationAndControl" }, - "expect": { "stdoutContains": "перенесено правок:" } + "expect": { "stdoutContains": "правок сохранено:" } } diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод.xml new file mode 100644 index 00000000..e669bbdd --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод.xml @@ -0,0 +1,23 @@ + + + + + ПереносМод + + + ru + Перенос мод + + + + false + false + false + false + false + false + false + DontUse + + + diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод/Ext/Module.bsl b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод/Ext/Module.bsl new file mode 100644 index 00000000..3431f653 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/CommonModules/ПереносМод/Ext/Module.bsl @@ -0,0 +1,8 @@ +#Область ПрограммныйИнтерфейс + +Процедура П() Экспорт + Шаг1(); + Шаг3(); +КонецПроцедуры + +#КонецОбласти diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Configuration.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Configuration.xml new file mode 100644 index 00000000..aa3b29a1 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/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 + + + + Русский + ПереносМод + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/ClientApplicationInterface.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/ClientApplicationInterface.xml new file mode 100644 index 00000000..3c1161b2 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/ClientApplicationInterface.xml @@ -0,0 +1,18 @@ + + + + + UUID-002 + + + + + UUID-004 + + + + + + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод.xml new file mode 100644 index 00000000..94abf837 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод.xml @@ -0,0 +1,18 @@ + + + + + + Adopted + ПереносМод + + UUID-002 + false + false + false + false + false + false + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод/Ext/Module.bsl b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод/Ext/Module.bsl new file mode 100644 index 00000000..9b0ba71d --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/CommonModules/ПереносМод/Ext/Module.bsl @@ -0,0 +1,7 @@ +#Область ПрограммныйИнтерфейс +&ИзменениеИКонтроль("П") +Процедура Тест_П() + Шаг1(); + Шаг3(); +КонецПроцедуры +#КонецОбласти diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Configuration.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Configuration.xml new file mode 100644 index 00000000..146162b9 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Configuration.xml @@ -0,0 +1,72 @@ + + + + + + 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 + + + + Adopted + Тест + + + ru + Тест + + + + Customization + true + Тест_ + Version8_3_24 + ManagedApplication + + PlatformApplication + + Russian + + Role.Тест_ОсновнаяРоль + + + + Language.Русский + + + + + + TaxiEnableVersion8_2 + + + Русский + Тест_ОсновнаяРоль + ПереносМод + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Languages/Русский.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Languages/Русский.xml new file mode 100644 index 00000000..c21624f5 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Languages/Русский.xml @@ -0,0 +1,13 @@ + + + + + + Adopted + Русский + + UUID-002 + ru + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Roles/Тест_ОсновнаяРоль.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Roles/Тест_ОсновнаяРоль.xml new file mode 100644 index 00000000..ec9dfbaf --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Ext/Roles/Тест_ОсновнаяРоль.xml @@ -0,0 +1,10 @@ + + + + + Тест_ОсновнаяРоль + + + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Languages/Русский.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Languages/Русский.xml new file mode 100644 index 00000000..37c60d78 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-delete/Languages/Русский.xml @@ -0,0 +1,16 @@ + + + + + Русский + + + ru + Русский + + + + ru + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод.xml new file mode 100644 index 00000000..e669bbdd --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод.xml @@ -0,0 +1,23 @@ + + + + + ПереносМод + + + ru + Перенос мод + + + + false + false + false + false + false + false + false + DontUse + + + diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод/Ext/Module.bsl b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод/Ext/Module.bsl new file mode 100644 index 00000000..e67af3b9 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/CommonModules/ПереносМод/Ext/Module.bsl @@ -0,0 +1,9 @@ +#Область ПрограммныйИнтерфейс + +Процедура П(Спр) Экспорт + НачатьТранзакцию(); + Спр.Записать(); + ЗафиксироватьТранзакцию(); +КонецПроцедуры + +#КонецОбласти diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Configuration.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Configuration.xml new file mode 100644 index 00000000..aa3b29a1 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/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 + + + + Русский + ПереносМод + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/ClientApplicationInterface.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/ClientApplicationInterface.xml new file mode 100644 index 00000000..3c1161b2 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/ClientApplicationInterface.xml @@ -0,0 +1,18 @@ + + + + + UUID-002 + + + + + UUID-004 + + + + + + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод.xml new file mode 100644 index 00000000..94abf837 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод.xml @@ -0,0 +1,18 @@ + + + + + + Adopted + ПереносМод + + UUID-002 + false + false + false + false + false + false + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод/Ext/Module.bsl b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод/Ext/Module.bsl new file mode 100644 index 00000000..a6da63f6 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/CommonModules/ПереносМод/Ext/Module.bsl @@ -0,0 +1,8 @@ +#Область ПрограммныйИнтерфейс +&ИзменениеИКонтроль("П") +Процедура Тест_П(Спр) + НачатьТранзакцию(); + Спр.Записать(); + ЗафиксироватьТранзакцию(); +КонецПроцедуры +#КонецОбласти diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Configuration.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Configuration.xml new file mode 100644 index 00000000..146162b9 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Configuration.xml @@ -0,0 +1,72 @@ + + + + + + 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 + + + + Adopted + Тест + + + ru + Тест + + + + Customization + true + Тест_ + Version8_3_24 + ManagedApplication + + PlatformApplication + + Russian + + Role.Тест_ОсновнаяРоль + + + + Language.Русский + + + + + + TaxiEnableVersion8_2 + + + Русский + Тест_ОсновнаяРоль + ПереносМод + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Languages/Русский.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Languages/Русский.xml new file mode 100644 index 00000000..c21624f5 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Languages/Русский.xml @@ -0,0 +1,13 @@ + + + + + + Adopted + Русский + + UUID-002 + ru + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Roles/Тест_ОсновнаяРоль.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Roles/Тест_ОсновнаяРоль.xml new file mode 100644 index 00000000..ec9dfbaf --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Ext/Roles/Тест_ОсновнаяРоль.xml @@ -0,0 +1,10 @@ + + + + + Тест_ОсновнаяРоль + + + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Languages/Русский.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Languages/Русский.xml new file mode 100644 index 00000000..37c60d78 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-insert/Languages/Русский.xml @@ -0,0 +1,16 @@ + + + + + Русский + + + ru + Русский + + + + ru + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод.xml new file mode 100644 index 00000000..e669bbdd --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод.xml @@ -0,0 +1,23 @@ + + + + + ПереносМод + + + ru + Перенос мод + + + + false + false + false + false + false + false + false + DontUse + + + diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод/Ext/Module.bsl b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод/Ext/Module.bsl new file mode 100644 index 00000000..f0186831 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/CommonModules/ПереносМод/Ext/Module.bsl @@ -0,0 +1,10 @@ +#Область ПрограммныйИнтерфейс + +Процедура П(Спр) Экспорт + НачатьТранзакцию(); + Спр.Записать(); + ЗафиксироватьТранзакцию(); + Сообщить("готово"); +КонецПроцедуры + +#КонецОбласти diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Configuration.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Configuration.xml new file mode 100644 index 00000000..aa3b29a1 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/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 + + + + Русский + ПереносМод + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/ClientApplicationInterface.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/ClientApplicationInterface.xml new file mode 100644 index 00000000..3c1161b2 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/ClientApplicationInterface.xml @@ -0,0 +1,18 @@ + + + + + UUID-002 + + + + + UUID-004 + + + + + + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод.xml new file mode 100644 index 00000000..94abf837 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод.xml @@ -0,0 +1,18 @@ + + + + + + Adopted + ПереносМод + + UUID-002 + false + false + false + false + false + false + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод/Ext/Module.bsl b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод/Ext/Module.bsl new file mode 100644 index 00000000..0c3f472b --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/CommonModules/ПереносМод/Ext/Module.bsl @@ -0,0 +1,12 @@ +#Область ПрограммныйИнтерфейс +&ИзменениеИКонтроль("П") +Процедура Тест_П(Спр) + НачатьТранзакцию(); + Спр.Записать(); + ЗафиксироватьТранзакцию(); + Сообщить("готово"); +#Вставка + ЗаписатьВЖурнал(); +#КонецВставки +КонецПроцедуры +#КонецОбласти diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Configuration.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Configuration.xml new file mode 100644 index 00000000..146162b9 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Configuration.xml @@ -0,0 +1,72 @@ + + + + + + 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 + + + + Adopted + Тест + + + ru + Тест + + + + Customization + true + Тест_ + Version8_3_24 + ManagedApplication + + PlatformApplication + + Russian + + Role.Тест_ОсновнаяРоль + + + + Language.Русский + + + + + + TaxiEnableVersion8_2 + + + Русский + Тест_ОсновнаяРоль + ПереносМод + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Languages/Русский.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Languages/Русский.xml new file mode 100644 index 00000000..c21624f5 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Languages/Русский.xml @@ -0,0 +1,13 @@ + + + + + + Adopted + Русский + + UUID-002 + ru + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Roles/Тест_ОсновнаяРоль.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Roles/Тест_ОсновнаяРоль.xml new file mode 100644 index 00000000..ec9dfbaf --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Ext/Roles/Тест_ОсновнаяРоль.xml @@ -0,0 +1,10 @@ + + + + + Тест_ОсновнаяРоль + + + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Languages/Русский.xml b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Languages/Русский.xml new file mode 100644 index 00000000..37c60d78 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/snapshots/transferred-partial/Languages/Русский.xml @@ -0,0 +1,16 @@ + + + + + Русский + + + ru + Русский + + + + ru + + + \ No newline at end of file diff --git a/tests/skills/cases/cfe-patch-method/transferred-delete.json b/tests/skills/cases/cfe-patch-method/transferred-delete.json new file mode 100644 index 00000000..f5f6bca6 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/transferred-delete.json @@ -0,0 +1,37 @@ +{ + "name": "Ресинк: удаление уже применено в оригинале — перенесено в основную (без ложного конфликта)", + "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { "type": "CommonModule", "name": "ПереносМод", "properties": { "Server": true } }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, + { + "writeFile": { + "path": "CommonModules/ПереносМод/Ext/Module.bsl", + "content": "#Область ПрограммныйИнтерфейс\n\nПроцедура П() Экспорт\n\tШаг1();\n\tШаг3();\nКонецПроцедуры\n\n#КонецОбласти\n" + } + }, + { + "script": "cfe-init/scripts/cfe-init", + "args": { "-Name": "Тест", "-OutputDir": "{workDir}/ext", "-ConfigPath": "{workDir}" } + }, + { + "script": "cfe-borrow/scripts/cfe-borrow", + "args": { "-ExtensionPath": "{workDir}/ext", "-ConfigPath": "{workDir}", "-Object": "CommonModule.ПереносМод" } + }, + { + "writeFile": { + "path": "ext/CommonModules/ПереносМод/Ext/Module.bsl", + "content": "#Область ПрограммныйИнтерфейс\n&ИзменениеИКонтроль(\"П\")\nПроцедура Тест_П()\n\tШаг1();\n#Удаление\n\tШаг2();\n#КонецУдаления\n\tШаг3();\nКонецПроцедуры\n#КонецОбласти\n" + } + } + ], + "params": { + "extensionPath": "ext", + "modulePath": "CommonModule.ПереносМод", + "methodName": "П", + "interceptorType": "ModificationAndControl" + }, + "expect": { "stdoutContains": "ПЕРЕНЕСЕНО В ОСНОВНУЮ" } +} diff --git a/tests/skills/cases/cfe-patch-method/transferred-insert.json b/tests/skills/cases/cfe-patch-method/transferred-insert.json new file mode 100644 index 00000000..011c04d1 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/transferred-insert.json @@ -0,0 +1,37 @@ +{ + "name": "Ресинк: вставка уже в новом оригинале — перенесено в основную (без дубля)", + "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { "type": "CommonModule", "name": "ПереносМод", "properties": { "Server": true } }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, + { + "writeFile": { + "path": "CommonModules/ПереносМод/Ext/Module.bsl", + "content": "#Область ПрограммныйИнтерфейс\n\nПроцедура П(Спр) Экспорт\n\tНачатьТранзакцию();\n\tСпр.Записать();\n\tЗафиксироватьТранзакцию();\nКонецПроцедуры\n\n#КонецОбласти\n" + } + }, + { + "script": "cfe-init/scripts/cfe-init", + "args": { "-Name": "Тест", "-OutputDir": "{workDir}/ext", "-ConfigPath": "{workDir}" } + }, + { + "script": "cfe-borrow/scripts/cfe-borrow", + "args": { "-ExtensionPath": "{workDir}/ext", "-ConfigPath": "{workDir}", "-Object": "CommonModule.ПереносМод" } + }, + { + "writeFile": { + "path": "ext/CommonModules/ПереносМод/Ext/Module.bsl", + "content": "#Область ПрограммныйИнтерфейс\n&ИзменениеИКонтроль(\"П\")\nПроцедура Тест_П(Спр)\n\tНачатьТранзакцию();\n#Вставка\n\tСпр.Записать();\n#КонецВставки\n\tЗафиксироватьТранзакцию();\nКонецПроцедуры\n#КонецОбласти\n" + } + } + ], + "params": { + "extensionPath": "ext", + "modulePath": "CommonModule.ПереносМод", + "methodName": "П", + "interceptorType": "ModificationAndControl" + }, + "expect": { "stdoutContains": "ПЕРЕНЕСЕНО В ОСНОВНУЮ" } +} diff --git a/tests/skills/cases/cfe-patch-method/transferred-partial.json b/tests/skills/cases/cfe-patch-method/transferred-partial.json new file mode 100644 index 00000000..8f2b5403 --- /dev/null +++ b/tests/skills/cases/cfe-patch-method/transferred-partial.json @@ -0,0 +1,37 @@ +{ + "name": "Ресинк: одна правка перенесена в оригинал, одна живая — актуализирован со счётчиками", + "preRun": [ + { + "script": "meta-compile/scripts/meta-compile", + "input": { "type": "CommonModule", "name": "ПереносМод", "properties": { "Server": true } }, + "args": { "-JsonPath": "{inputFile}", "-OutputDir": "{workDir}" } + }, + { + "writeFile": { + "path": "CommonModules/ПереносМод/Ext/Module.bsl", + "content": "#Область ПрограммныйИнтерфейс\n\nПроцедура П(Спр) Экспорт\n\tНачатьТранзакцию();\n\tСпр.Записать();\n\tЗафиксироватьТранзакцию();\n\tСообщить(\"готово\");\nКонецПроцедуры\n\n#КонецОбласти\n" + } + }, + { + "script": "cfe-init/scripts/cfe-init", + "args": { "-Name": "Тест", "-OutputDir": "{workDir}/ext", "-ConfigPath": "{workDir}" } + }, + { + "script": "cfe-borrow/scripts/cfe-borrow", + "args": { "-ExtensionPath": "{workDir}/ext", "-ConfigPath": "{workDir}", "-Object": "CommonModule.ПереносМод" } + }, + { + "writeFile": { + "path": "ext/CommonModules/ПереносМод/Ext/Module.bsl", + "content": "#Область ПрограммныйИнтерфейс\n&ИзменениеИКонтроль(\"П\")\nПроцедура Тест_П(Спр)\n\tНачатьТранзакцию();\n#Вставка\n\tСпр.Записать();\n#КонецВставки\n\tЗафиксироватьТранзакцию();\n\tСообщить(\"готово\");\n#Вставка\n\tЗаписатьВЖурнал();\n#КонецВставки\nКонецПроцедуры\n#КонецОбласти\n" + } + } + ], + "params": { + "extensionPath": "ext", + "modulePath": "CommonModule.ПереносМод", + "methodName": "П", + "interceptorType": "ModificationAndControl" + }, + "expect": { "stdoutContains": "перенесено в основную конфигурацию: 1" } +}