# A6.P5 fixture builder — pull the 3 representative records from the live # capture into the test fixture. One-shot; gitignored fixture path. param( [string]$Source = 'door-stuck-capture.jsonl', [string]$Out = 'tests/AcDream.Core.Tests/Fixtures/door-bug/over-penetration-capture.jsonl' ) $ErrorActionPreference = 'Stop' $outDir = Split-Path -Parent $Out if (-not (Test-Path $outDir)) { New-Item -ItemType Directory -Force -Path $outDir | Out-Null } # We need exactly three records: # A) The over-penetration tick: cellId 2847146303, currentPos.Y ~16.35, # targetPos.Y ~16.76 — the resolve that committed the over-penetration. # B) A stuck-position hit=yes tick: cellId 2847146320, currentPos at # (132.401, 16.762, 94), resultCollisionNormalValid=true. # C) A stuck-position hit=no tick: cellId 2847146320, same currentPos, # resultCollisionNormalValid=false. $records = Get-Content -LiteralPath $Source -Encoding UTF8 | ForEach-Object { if ([string]::IsNullOrWhiteSpace($_)) { return } $obj = $_ | ConvertFrom-Json $obj | Add-Member -NotePropertyName _raw -NotePropertyValue $_ $obj } # A — over-penetration tick: input cell 2847146303, output cell 2847146320, # target Y >~16.7, result position approx == target (not blocked). $overpen = $records | Where-Object { $_.input.cellId -eq 2847146303 -and $_.result.cellId -eq 2847146320 -and $_.input.targetPos.y -gt 16.7 -and [Math]::Abs($_.result.position.y - $_.input.targetPos.y) -lt 0.01 } | Select-Object -First 1 # B — stuck-position hit=yes $stuckHit = $records | Where-Object { $_.input.cellId -eq 2847146320 -and [Math]::Abs($_.input.currentPos.x - 132.401) -lt 0.001 -and [Math]::Abs($_.input.currentPos.y - 16.762) -lt 0.001 -and $_.result.collisionNormalValid } | Select-Object -First 1 # C — stuck-position hit=no $stuckMiss = $records | Where-Object { $_.input.cellId -eq 2847146320 -and [Math]::Abs($_.input.currentPos.x - 132.401) -lt 0.001 -and [Math]::Abs($_.input.currentPos.y - 16.762) -lt 0.001 -and -not $_.result.collisionNormalValid } | Select-Object -First 1 if ($null -eq $overpen) { throw 'over-penetration tick not found' } if ($null -eq $stuckHit) { throw 'stuck hit=yes tick not found' } if ($null -eq $stuckMiss) { throw 'stuck hit=no tick not found' } @($overpen._raw, $stuckHit._raw, $stuckMiss._raw) | Set-Content -Encoding utf8 -Path $Out "Wrote $Out with 3 records (over-penetration + stuck hit + stuck miss)."