From 5f7ee6fcae0a5343e965629fa64fe4280f9c7fda Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sat, 21 Feb 2026 17:34:36 +0300 Subject: [PATCH] fix(form-validate): skip DataPath check for base elements in borrowed forms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In extension forms with BaseForm, elements with id < 1000000 belong to the base configuration and their attributes are not present in the extension. Skip DataPath→Attribute validation for these elements to avoid false errors. Show "N base skipped" in output for transparency. Co-Authored-By: Claude Opus 4.6 --- .../form-validate/scripts/form-validate.ps1 | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.claude/skills/form-validate/scripts/form-validate.ps1 b/.claude/skills/form-validate/scripts/form-validate.ps1 index c51b8dae..fbdbdc32 100644 --- a/.claude/skills/form-validate/scripts/form-validate.ps1 +++ b/.claude/skills/form-validate/scripts/form-validate.ps1 @@ -76,6 +76,9 @@ if ($parentDir) { Write-Host "=== Validation: $formName ===" Write-Host "" +# Early BaseForm detection (used in Check 5 to skip base element DataPath validation) +$hasBaseForm = ($root.SelectSingleNode("f:BaseForm", $nsMgr) -ne $null) + # --- Check 1: Root element and version --- if ($root.LocalName -ne "Form") { @@ -297,6 +300,7 @@ if (-not $stopped) { if (-not $stopped) { $pathErrors = 0 $pathChecked = 0 + $pathBaseSkipped = 0 foreach ($el in $allElements) { if ($stopped) { break } @@ -309,6 +313,11 @@ if (-not $stopped) { continue } + # In borrowed forms, skip DataPath check for base elements (id < 1000000) + if ($hasBaseForm -and $el.Id) { + try { if ([int]$el.Id -lt 1000000) { $pathBaseSkipped++; continue } } catch {} + } + $dpNode = $node.SelectSingleNode("f:DataPath", $nsMgr) if (-not $dpNode) { continue } @@ -328,9 +337,15 @@ if (-not $stopped) { } } - if ($pathErrors -eq 0 -and $pathChecked -gt 0) { - Report-OK "DataPath references: $pathChecked paths checked" - } elseif ($pathChecked -eq 0) { + $pathMsg = "" + if ($pathChecked -gt 0) { $pathMsg = "$pathChecked paths checked" } + if ($pathBaseSkipped -gt 0) { + $skipNote = "$pathBaseSkipped base skipped" + $pathMsg = if ($pathMsg) { "$pathMsg, $skipNote" } else { $skipNote } + } + if ($pathErrors -eq 0 -and $pathMsg) { + Report-OK "DataPath references: $pathMsg" + } elseif ($pathErrors -eq 0) { Report-OK "DataPath references: none" } }