forked from 1b-agent/opencadstudio-upstream
- `--export ... --target-version`, and explicit target_format / target_version on automation and protocol saves; a conversion that would drop unsupported records is refused unless allow_lossy is set. - `audit` read op: dangling layers/blocks, duplicate handles, non-finite bounds, serialization, lossy records and the source DXF handle graph. - `save_verified`: writes the requested version from the same snapshot a normal save writes, reopens it, checks the version and the entity manifest, audits the ASCII DXF handle graph and returns a SHA-256. - ZOOM EXTENTS includes SDF text glyphs. - Live MCP acceptance script and an optional reference-console audit runner under docs/automation. Squashed from the PR with review fixes: merged with the DWT save path, the save snapshot, the tool lists added since, and vendor-neutral harness names; the dated verification record is left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.4 KiB
PowerShell
68 lines
2.4 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Directory,
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$ConsolePath,
|
|
[int]$TimeoutSeconds = 25
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$drawingDirectory = (Resolve-Path -LiteralPath $Directory).Path
|
|
$scriptPath = Join-Path $PSScriptRoot 'reference_audit.scr'
|
|
$targets = @(
|
|
@{ Version = '2000'; File = 'mcp-acceptance-2000.dwg' },
|
|
@{ Version = '2013'; File = 'mcp-acceptance-2013.dwg' },
|
|
@{ Version = '2018'; File = 'mcp-acceptance-2018.dwg' }
|
|
)
|
|
$results = foreach ($target in $targets) {
|
|
$drawing = Join-Path $drawingDirectory $target.File
|
|
if (-not (Test-Path -LiteralPath $drawing -PathType Leaf)) {
|
|
throw "Missing acceptance drawing: $drawing"
|
|
}
|
|
$isolation = Join-Path $env:TEMP "ocs-reference-acceptance-$($target.Version)"
|
|
New-Item -ItemType Directory -Force -Path $isolation | Out-Null
|
|
|
|
$start = [Diagnostics.ProcessStartInfo]::new()
|
|
$start.FileName = $ConsolePath
|
|
$start.UseShellExecute = $false
|
|
$start.CreateNoWindow = $true
|
|
$start.RedirectStandardOutput = $true
|
|
$start.RedirectStandardError = $true
|
|
$start.StandardOutputEncoding = [Text.Encoding]::Unicode
|
|
$start.StandardErrorEncoding = [Text.Encoding]::Unicode
|
|
@(
|
|
'/i', $drawing,
|
|
'/s', $scriptPath,
|
|
'/l', 'en-US',
|
|
'/isolate', "ocsaccept$($target.Version)", $isolation,
|
|
'/readonly'
|
|
) | ForEach-Object { [void]$start.ArgumentList.Add($_) }
|
|
|
|
$process = [Diagnostics.Process]::new()
|
|
$process.StartInfo = $start
|
|
[void]$process.Start()
|
|
$stdout = $process.StandardOutput.ReadToEndAsync()
|
|
$stderr = $process.StandardError.ReadToEndAsync()
|
|
$forcedTermination = -not $process.WaitForExit($TimeoutSeconds * 1000)
|
|
if ($forcedTermination) {
|
|
$process.Kill($true)
|
|
$process.WaitForExit()
|
|
}
|
|
$text = $stdout.Result + $stderr.Result
|
|
$log = Join-Path $drawingDirectory "reference-audit-$($target.Version).log"
|
|
[IO.File]::WriteAllText($log, $text, [Text.UTF8Encoding]::new($false))
|
|
$passed = [regex]::IsMatch($text, 'Total errors found\s+0\s+fixed\s+0')
|
|
[pscustomobject]@{
|
|
Version = $target.Version
|
|
Passed = $passed
|
|
ForcedTermination = $forcedTermination
|
|
ExitCode = $process.ExitCode
|
|
Log = $log
|
|
}
|
|
}
|
|
|
|
$results | Format-Table -AutoSize
|
|
if ($results.Passed -contains $false) {
|
|
exit 1
|
|
}
|