#Requires -Version 7.0 $ErrorActionPreference='Stop' if(Test-Path -LiteralPath (Join-Path $PSScriptRoot 'enumeration.json')){throw 'Preserve existing enumeration; use a new gate for retries.'} Set-StrictMode -Version Latest $workspace='C:\Users\User\Documents\Git\ARCADIA-Studio\.local\scenario-spacing-ytr83r-20260913' $pin='c4a2cf63f11818cf7fc766acf3a2779768a2a658' Push-Location -LiteralPath $workspace try { $head=git rev-parse HEAD if($LASTEXITCODE -ne 0 -or $head -cne $pin){throw 'Wrong frozen pin'} $status=@(git status --porcelain) if($LASTEXITCODE -ne 0 -or $status.Count){throw 'Frozen worktree is not clean'} $scopes=@('crates','docs','examples','build','harness/fixtures','harness/experiments/textual-authoring-20260911') $roots=@('Cargo.toml','Cargo.lock','rust-toolchain.toml') $tracked=@(git ls-files -- @roots @scopes) if($LASTEXITCODE -ne 0){throw 'Git enumeration failed'} $tracked=@($tracked | ForEach-Object { $_.Replace('\','/') } | Sort-Object -Unique) $present=@(rg --files @scopes) if($LASTEXITCODE -ne 0){throw 'Independent rg enumeration failed'} $present=@(($present+$roots) | ForEach-Object { $_.Replace('\','/') } | Sort-Object -Unique) if(@(Compare-Object $tracked $present).Count){throw 'Git and actual file memberships differ'} $gitTree=git rev-parse 'HEAD^{tree}' if($LASTEXITCODE -ne 0){throw 'Tree identity unavailable'} $record=[ordered]@{base=$head;tree=$gitTree;workspace=$workspace;capturedUtc=[DateTime]::UtcNow.ToString('o');scopes=$scopes;rootInputs=$roots;gitCount=$tracked.Count;rgCount=$present.Count;gitPaths=$tracked;rgPaths=$present} $record|ConvertTo-Json -Depth 6|Set-Content -LiteralPath (Join-Path $PSScriptRoot 'enumeration.json') -Encoding utf8 Write-Output ('Verified Git/rg membership '+$tracked.Count+' at '+$head) } finally {Pop-Location}