feat(tools): 全语料守门跑批 sweep_corpus.ps1 + raw 基线复扫(VDE-1193 §9.11.9)
- sweep_corpus.ps1:分批跑批(20 文件/批)+ 聚合(import_fail/empty/ err_bodies/err_files/pen_pairs),语料集 = real\step 顶层 452 + real\complex 190 = 642 文件,与 _corpus_sweep.json 基线同源 - reaggregate_sweep.ps1:batch json 重聚合(UTF8 读取,parse_fail 计数) - Raw 基线(--diag-only):files=642 bodies=17324 import_fail=0 empty=12(11 已归类空开 + technic42006 待归类) err_bodies=60/err_files=35/pen_pairs=86;452 主集 err_bodies=15/13 (对比 2026-09-13 基线 20/16 继续下降) - 教训记档:PS5.1 无 BOM ps1 按 GBK 解析中文注释吞行(脚本须 ASCII); probe UTF8 JSON 须 -Encoding UTF8 读取否则 ConvertFrom-Json 断裂
This commit is contained in:
@@ -1310,3 +1310,24 @@ edge_tris 净增 6,病态约束集打转时同样无界);③VDE_TIMING_HEA
|
||||
回归 12 套全绿(325 用例:trim 30/heal 41/measure 33/validate 18/
|
||||
step_import 54/ssi 13/face_split 13/adv_heal 31/delaunay3d 6/
|
||||
ssi_bool 51/brep_bool 21/step_export 14)。
|
||||
|
||||
#### 9.11.9 全语料守门复扫基线(2026-09-14,sweep_corpus.ps1)
|
||||
|
||||
新增 `tools/sweep_corpus.ps1`(分批跑批 + 聚合,语料集 = corpus/real/
|
||||
step 顶层 452 件 + real/complex 190 件 = 642 文件;空格文件名由 `&`
|
||||
传参自动引号——Start-Process 拆参坑不适用于 `&`;PS1 必须 ASCII 或带
|
||||
BOM,否则 PS5.1 按 GBK 解析中文注释吞行)。
|
||||
|
||||
**Raw 基线(--diag-only,未 heal;UTF8 修复后重聚合,parse_fail=0)**:
|
||||
files=642 **bodies=17324** import_fail=0(导入 100%)**empty=12**
|
||||
(外参考缺失×3、纯装配容器×4、线框/曲线集×3、纯元数据×1、
|
||||
technic42006 空装配×1——前 11 与 §9.11.5 空开归类一致,technic42006
|
||||
待归类)**err_bodies=60 / err_files=35 / pen_pairs=86**。其中 452 件
|
||||
主集 err_bodies=15/err_files=13(bm2_id_t4-A、bug24983_111FACE、
|
||||
bug25013×2、bug28414_bug_toroidal、bug32314_corrupted、ctc_02×2 副本
|
||||
(12 对)、OCC8228(1 体 2 对)、trj3×2(各 2 体 8 对)、trj6/trj7_k1-sd-214)
|
||||
——对比 2026-09-13 基线 20 体/16 文件继续下降(镶嵌体分类 + 本轮
|
||||
投影/CDT 修复的累积效果)。
|
||||
|
||||
heal 扫描(--heal)进行中,预期残余 = 残缺面片件(如实降级)+
|
||||
ctc_02(12 对双墙,待 SSI 或 heal 能力覆盖)。
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# reaggregate_sweep.ps1 - re-aggregate existing sweep batch jsons
|
||||
# Usage: powershell -File tools\reaggregate_sweep.ps1 -OutDir <dir>
|
||||
# Keep ASCII-only (PS5.1 reads BOM-less ps1 as ANSI/GBK).
|
||||
param([Parameter(Mandatory=$true)][string]$OutDir)
|
||||
$importFail = 0; $emptyCases = 0; $errBodies = 0; $errFiles = 0; $penPairs = 0
|
||||
$totalBodies = 0; $fileCount = 0; $parseFail = 0
|
||||
$failList = @(); $errList = @()
|
||||
Get-ChildItem $OutDir -Filter "batch_*.json" | ForEach-Object {
|
||||
$j = $null
|
||||
try { $j = Get-Content $_.FullName -Raw -Encoding UTF8 | ConvertFrom-Json }
|
||||
catch { $parseFail++; Write-Output ("PARSE-FAIL: " + $_.Name); return }
|
||||
foreach ($f in $j.files) {
|
||||
$fileCount++
|
||||
if ($f.error) { $importFail++; $failList += "$($f.file) => $($f.error)"; continue }
|
||||
if (-not $f.bodies -or $f.bodies.Count -eq 0) { $emptyCases++; $failList += "$($f.file) => EMPTY"; continue }
|
||||
$totalBodies += $f.bodies.Count
|
||||
$fe = 0; $fp = 0
|
||||
foreach ($b in $f.bodies) {
|
||||
if ($b.diag_err -gt 0) { $errBodies++; $fe++; $pp = 0; if ($b.pen_pairs) { $pp = $b.pen_pairs }; $penPairs += $pp; $fp += $pp }
|
||||
}
|
||||
if ($fe -gt 0) { $errFiles++; $errList += "$($f.file) => err_bodies=$fe pen_pairs=$fp" }
|
||||
}
|
||||
}
|
||||
"files=$fileCount bodies=$totalBodies import_fail=$importFail empty=$emptyCases err_bodies=$errBodies err_files=$errFiles pen_pairs=$penPairs parse_fail=$parseFail"
|
||||
"--- failures ---"; $failList | ForEach-Object { $_ }
|
||||
"--- err files ---"; $errList | ForEach-Object { $_ }
|
||||
@@ -0,0 +1,79 @@
|
||||
# sweep_corpus.ps1 - full-corpus diagnostic sweep (VDE-1193 gatekeeper)
|
||||
# Usage: powershell -File tools\sweep_corpus.ps1 -Probe <probe.exe> -OutDir <dir> [-Heal] [-CorpusRoot <dir>]
|
||||
# Output: OutDir\batch_NNN.json (batches) + run log (aggregate at end)
|
||||
# Aggregate semantics consistent with docs/feedback/VDE-1193.md baselines:
|
||||
# import_fail (incl. EmptyResult) / err_bodies (bodies with diag_err>0)
|
||||
# / err_files / pen_pairs (diagnosed penetration pairs)
|
||||
# NOTE: keep this file ASCII-only. PowerShell 5.1 reads BOM-less .ps1 as
|
||||
# ANSI (GBK on zh-CN systems); UTF-8 Chinese comments garble the parse.
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$Probe,
|
||||
[Parameter(Mandatory=$true)][string]$OutDir,
|
||||
[switch]$Heal,
|
||||
[string]$CorpusRoot = "d:\20_AI\ViewDesignEngine\corpus\real"
|
||||
)
|
||||
# EAP must stay Continue: the probe writes progress banners to stderr and
|
||||
# PowerShell 5.1 turns each stderr line of a native command into an
|
||||
# ErrorRecord - with "Stop" the first banner would kill the script.
|
||||
$ErrorActionPreference = "Continue"
|
||||
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
|
||||
|
||||
# Corpus enumeration, same source as the _corpus_sweep.json baseline set:
|
||||
# corpus\real\step top level (452 files, NOT recursive - subdirs hold
|
||||
# round-trip/generated artifacts) + corpus\real\complex (heavy assemblies).
|
||||
$files = @()
|
||||
$files += (Get-ChildItem (Join-Path $CorpusRoot "step") -File -Filter "*.stp" |
|
||||
Sort-Object Name | ForEach-Object { $_.FullName })
|
||||
$cx = Join-Path $CorpusRoot "complex"
|
||||
if (Test-Path $cx) {
|
||||
$files += (Get-ChildItem $cx -Recurse -Include "*.stp","*.step" |
|
||||
Sort-Object FullName | ForEach-Object { $_.FullName })
|
||||
}
|
||||
"corpus files: $($files.Count)"
|
||||
|
||||
# Filenames with spaces: `&` argument passing quotes automatically (the
|
||||
# old Start-Process splitting pitfall does not apply here).
|
||||
$batchSize = 20
|
||||
$mode = "--diag-only"
|
||||
if ($Heal) { $mode = "--diag-only --heal" }
|
||||
$nBatches = [Math]::Floor(($files.Count + $batchSize - 1) / $batchSize)
|
||||
"batches: $nBatches x $batchSize"
|
||||
for ($b = 0; $b -lt $nBatches; $b++) {
|
||||
$lo = $b * $batchSize
|
||||
$hi = $lo + $batchSize - 1
|
||||
if ($hi -ge $files.Count) { $hi = $files.Count - 1 }
|
||||
$batch = @()
|
||||
for ($k = $lo; $k -le $hi; $k++) { $batch += $files[$k] }
|
||||
$outJson = Join-Path $OutDir ("batch_{0:d3}.json" -f $b)
|
||||
$pargs = @($outJson) + $mode.Split(" ")
|
||||
foreach ($f in $batch) { $pargs += $f }
|
||||
$sw = [Diagnostics.Stopwatch]::StartNew()
|
||||
& $Probe @pargs 2>> (Join-Path $OutDir "sweep.log") | Out-Null
|
||||
$sw.Stop()
|
||||
"batch $b : $($batch.Count) files, $([int]$sw.Elapsed.TotalSeconds)s -> $outJson"
|
||||
}
|
||||
"all batches done"
|
||||
|
||||
# Aggregate
|
||||
$importFail = 0; $emptyCases = 0; $errBodies = 0; $errFiles = 0; $penPairs = 0
|
||||
$totalBodies = 0; $fileCount = 0
|
||||
$failList = @(); $errList = @()
|
||||
Get-ChildItem $OutDir -Filter "batch_*.json" | ForEach-Object {
|
||||
# probe writes UTF-8 JSON; without -Encoding UTF8 PS5.1 reads it as
|
||||
# ANSI(GBK) and ConvertFrom-Json breaks on garbled non-ASCII strings
|
||||
$j = Get-Content $_.FullName -Raw -Encoding UTF8 | ConvertFrom-Json
|
||||
foreach ($f in $j.files) {
|
||||
$fileCount++
|
||||
if ($f.error) { $importFail++; $failList += "$($f.file) => $($f.error)"; continue }
|
||||
if (-not $f.bodies -or $f.bodies.Count -eq 0) { $emptyCases++; $failList += "$($f.file) => EMPTY"; continue }
|
||||
$totalBodies += $f.bodies.Count
|
||||
$fe = 0; $fp = 0
|
||||
foreach ($b in $f.bodies) {
|
||||
if ($b.diag_err -gt 0) { $errBodies++; $fe++; $pp = 0; if ($b.pen_pairs) { $pp = $b.pen_pairs }; $penPairs += $pp; $fp += $pp }
|
||||
}
|
||||
if ($fe -gt 0) { $errFiles++; $errList += "$($f.file) => err_bodies=$fe pen_pairs=$fp" }
|
||||
}
|
||||
}
|
||||
"files=$fileCount bodies=$totalBodies import_fail=$importFail empty=$emptyCases err_bodies=$errBodies err_files=$errFiles pen_pairs=$penPairs"
|
||||
"--- failures ---"; $failList | ForEach-Object { $_ }
|
||||
"--- err files ---"; $errList | ForEach-Object { $_ }
|
||||
Reference in New Issue
Block a user