Add bounded definition and reference navigation for current source drafts
Preserve loaded draft bytes and model history, reject stale workspace and input events, and keep captured Escape under modal priority. Verified 181 focused Windows tests and strict desktop Clippy on exact inputs4; earlier full737 scope and component/native preparation evidence are archived separately. Native navigation acceptance remains pending.
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. ./.local/toolchain/env.ps1
|
||||
$env:CARGO_BUILD_JOBS = '1'
|
||||
$evidenceRoot = Join-Path (Get-Location) '.local/text-navigation-integration-20260911'
|
||||
foreach ($gateName in @('outline1','core1','clippy1')) {
|
||||
$prior = Get-Content -Raw -LiteralPath (Join-Path $evidenceRoot "$gateName-status.json") | ConvertFrom-Json
|
||||
if ($prior.exitCode -ne 0) { throw "Required prior gate failed: $gateName" }
|
||||
}
|
||||
function Invoke-RecordedNative {
|
||||
param([string]$Name,[string]$Executable,[string[]]$Arguments)
|
||||
$stdout = Join-Path $evidenceRoot "$Name-stdout.log"
|
||||
$stderr = Join-Path $evidenceRoot "$Name-stderr.log"
|
||||
$status = Join-Path $evidenceRoot "$Name-status.json"
|
||||
if ((Test-Path $stdout) -or (Test-Path $stderr) -or (Test-Path $status)) { throw "Refusing overwrite $Name" }
|
||||
$started = [DateTime]::UtcNow.ToString('o')
|
||||
& $Executable @Arguments 1> $stdout 2> $stderr
|
||||
$code = $LASTEXITCODE
|
||||
[ordered]@{started=$started;finished=[DateTime]::UtcNow.ToString('o');exitCode=$code;executable=$Executable;args=$Arguments;buildJobs=1} | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $status
|
||||
Get-Content -LiteralPath $stderr
|
||||
if ($Name -ne 'artifacts1') { Get-Content -LiteralPath $stdout }
|
||||
if ($code -ne 0) { exit $code }
|
||||
}
|
||||
$artifactStatus = Get-Content -Raw -LiteralPath (Join-Path $evidenceRoot 'artifacts1-status.json') | ConvertFrom-Json
|
||||
if ($artifactStatus.exitCode -ne 0) { throw 'Original artifact build did not pass' }
|
||||
$dependencyDirectories = @()
|
||||
$messages = Get-Content -LiteralPath (Join-Path $evidenceRoot 'artifacts1-stdout.log') | ForEach-Object { $_ | ConvertFrom-Json }
|
||||
$bindings = @{}
|
||||
$bindingRecords = @()
|
||||
foreach ($crate in @('oa_core','serde_json')) {
|
||||
$artifacts = @($messages | Where-Object { $_.reason -eq 'compiler-artifact' -and $_.target.name -eq $crate -and $_.target.kind -contains 'lib' })
|
||||
if ($artifacts.Count -ne 1) { throw "Expected exactly one Cargo lib artifact for $crate; got $($artifacts.Count)" }
|
||||
$rlibs = @($artifacts[0].filenames | Where-Object { $_.EndsWith('.rlib') })
|
||||
if ($rlibs.Count -ne 1) { throw "Expected one rlib for $crate" }
|
||||
$rlib = $rlibs[0]
|
||||
$artifactHash = (Get-FileHash -LiteralPath $rlib).Hash
|
||||
$artifactBase = [IO.Path]::GetFileNameWithoutExtension($rlib)
|
||||
if ($artifactBase.StartsWith('lib' + $crate + '-')) {
|
||||
$dependencyRlib = $rlib
|
||||
$matchEvidence = @([ordered]@{path=$rlib;sha256=$artifactHash})
|
||||
} else {
|
||||
$dependencyRoot = Join-Path (Split-Path $rlib) 'deps'
|
||||
$matchEvidence = @(Get-ChildItem -LiteralPath $dependencyRoot -Filter "lib$crate-*.rlib" | ForEach-Object {
|
||||
[pscustomobject]@{path=$_.FullName;sha256=(Get-FileHash -LiteralPath $_.FullName).Hash}
|
||||
})
|
||||
$matchesByHash = @($matchEvidence | Where-Object { $_.sha256 -eq $artifactHash })
|
||||
if ($matchesByHash.Count -ne 1) { throw "Expected exactly one byte-hash-matching dependency rlib for $crate; got $($matchesByHash.Count)" }
|
||||
$dependencyRlib = $matchesByHash[0].path
|
||||
if (-not [Linq.Enumerable]::SequenceEqual([byte[]][IO.File]::ReadAllBytes($rlib),[byte[]][IO.File]::ReadAllBytes($dependencyRlib))) { throw 'Hash-matched rlib byte readback differs' }
|
||||
}
|
||||
$dependencyDirectories += Split-Path $dependencyRlib
|
||||
$suffix = [IO.Path]::GetFileNameWithoutExtension($dependencyRlib).Substring(('lib' + $crate + '-').Length)
|
||||
$packageName = if ($crate -eq 'oa_core') { 'oa-core' } else { $crate }
|
||||
$fingerprintRoot = Join-Path $env:CARGO_TARGET_DIR "debug/.fingerprint/$packageName-$suffix"
|
||||
$fingerprints = @()
|
||||
foreach ($name in @("lib-$crate", "lib-$crate.json")) {
|
||||
$fp = Join-Path $fingerprintRoot $name
|
||||
if (-not (Test-Path -LiteralPath $fp -PathType Leaf)) { throw "Missing exact fingerprint $fp" }
|
||||
$destination = Join-Path $evidenceRoot "fingerprints/$packageName-$suffix/$name"
|
||||
New-Item -ItemType Directory -Path (Split-Path $destination) -Force | Out-Null
|
||||
Copy-Item -LiteralPath $fp -Destination $destination
|
||||
$fingerprints += [ordered]@{original=$fp;copy=$destination;sha256=(Get-FileHash -LiteralPath $fp).Hash}
|
||||
}
|
||||
$bindings[$crate] = $rlib
|
||||
$bindingRecords += [ordered]@{crate=$crate;rlib=$rlib;bytes=(Get-Item -LiteralPath $rlib).Length;sha256=(Get-FileHash -LiteralPath $rlib).Hash;cargoArtifact=$artifacts[0];matchedDependencyRlib=$dependencyRlib;candidateHashes=$matchEvidence;fingerprints=$fingerprints}
|
||||
}
|
||||
$bindingRecords | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath (Join-Path $evidenceRoot 'query-bindings.json')
|
||||
$source = Join-Path $evidenceRoot 'source_symbols-v2.rs'
|
||||
$binary = Join-Path $evidenceRoot 'source-symbols-v2-tests.exe'
|
||||
$uniqueDependencyDirectories = @($dependencyDirectories | Sort-Object -Unique)
|
||||
if ($uniqueDependencyDirectories.Count -ne 1) { throw 'Artifact dependency directories differ' }
|
||||
$dependencies = $uniqueDependencyDirectories[0]
|
||||
Invoke-RecordedNative 'query-compile1' 'rustc' @('--edition=2024','--crate-name','source_symbols_v2','--test','-Dwarnings','-C','linker=clang.exe',$source,'--extern',"oa_core=$($bindings['oa_core'])",'--extern',"serde_json=$($bindings['serde_json'])",'-L',"dependency=$dependencies",'-o',$binary)
|
||||
Invoke-RecordedNative 'query-tests1' $binary @('--test-threads=1')
|
||||
[ordered]@{sourceSha256=(Get-FileHash -LiteralPath $source).Hash;binarySha256=(Get-FileHash -LiteralPath $binary).Hash;binaryBytes=(Get-Item -LiteralPath $binary).Length} | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $evidenceRoot 'query-artifacts.json')
|
||||
Reference in New Issue
Block a user