docs: preserve classifier correction and bounded prep recovery

This commit is contained in:
KOKO\Mimi
2026-09-06 12:42:15 +09:00
parent 5dfbea7e54
commit 0a98b2c4fa
7 changed files with 386 additions and 7 deletions
@@ -145,3 +145,115 @@ C++ source 변경 없는 prep의 same-binary 회귀와 새 binary의 fresh eigen
evidence다. Final Step7는 직접 solver invocation·unique generated directory·원본 bytes/hash·
binary/lib hash·result/log mtime/hash·call count를 남겨 freshness를 증명한다. 기존 helper가
파일 존재/mtime로 cache를 사용한 사실만으로 fresh라고 주장하지 않는다.
## E6. Correction 후의 Python/pytest와 process TEMP
[Correction 실제 기록](corrections.md)의 named venv `pytest-venv/Scripts/python.exe`는
Python3.11.15/pytest9.1.1로 native GREEN37개와 전체153개 collection/실행에 성공했다.
아래 모든 경로의 기준은 workspace의
`.harness/build/mitc4-eigen-evidence/prep/classifier-correction/`다.
| 용도 | 확인된 상대 경로 |
| --- | --- |
| 직접 pytest 및 후속 Executor Python | `pytest-venv/Scripts/python.exe` |
| venv의 base runtime | `python-runtime/cpython-3.11.15-windows-x86_64-none/python.exe` |
| uv의 workspace cache | `workspace-python-cache` |
| pytest cache | `pytest-cache` |
Native에서는 direct venv entry를 사용했다. Root의 uv offline 진입도 별도로 관찰됐지만
그 사실을 native uv 실행 성공으로 합치지 않는다. 후속 process의 PATH 앞에 named venv와
base directory를 두고 UV_PYTHON/UV_CACHE_DIR/UV_OFFLINE을 정상 설정하여 child의 기본
python/uv에도 전파한다. Global config·source·Hook command/guard는 바꾸지 않는다.
[설치된 FileTracker IL 관찰](../../.harness/build/mitc4-eigen-evidence/prep/classifier-correction/filetracker-initialization-observation.json)의
SHA-256은 `8d47f96ba913a9adc2d89772cef4b27ea2187f613416912d894608be9730c5cc`다.
Initializer의 Path.GetTempPath→s_tempPath→GetLongFilePath 유일 호출과 실제 접근 거부
stack이 대응하므로 새 workspace TEMP/TMP가 정상 운영 개선 후보라는 근거가 있다.
**이 변경으로 native build가 성공한 evidence는 아직 없다.** FileTracker를 끄거나 DFA가
build 실패까지 해결한다고 추정하지 않는다.
아래 전체 block은 [R6 source checkpoint](implementation-recovery.md#r6-실제-correction-source2의-보존과-남은-실행-조건),
R3 status-only checkpoint와 **해당 exact prep DFA run 직전 명시 사용자 승인** 후에만 실행한다.
이 turn에는 어느 것도 실행하지 않는다. 새 ignored TEMP 경로는 workspace 안에서 생성하고
기존 temp/evidence를 지우지 않는다. 기존 finite wrapper14400 및 모든 Executor guard를 유지한다.
Process 환경은 native 종료/오류 때 finally로 원래 값(미설정 포함)으로 복원한다.
```powershell
$ErrorActionPreference = 'Stop'
$mfeRoot = (Get-Location).Path
$mfeEvidence = Join-Path $mfeRoot '.harness/build/mitc4-eigen-evidence/prep/classifier-correction'
$mfePython = Join-Path $mfeEvidence 'pytest-venv/Scripts/python.exe'
$mfeBasePython = Join-Path $mfeEvidence 'python-runtime/cpython-3.11.15-windows-x86_64-none/python.exe'
$mfeUvCache = Join-Path $mfeEvidence 'workspace-python-cache'
foreach ($mfeFile in @($mfePython, $mfeBasePython)) {
if (-not (Test-Path -LiteralPath $mfeFile -PathType Leaf)) { throw "Missing Python: $mfeFile" }
}
Get-Command uv -ErrorAction Stop | Out-Null
$mfeGitRoot = git rev-parse --show-toplevel
$mfeIdentityExit = $LASTEXITCODE
if ($mfeIdentityExit -ne 0 -or [IO.Path]::GetFullPath($mfeGitRoot) -ne [IO.Path]::GetFullPath($mfeRoot)) {
throw 'Workspace root mismatch'
}
$mfeRunTemp = Join-Path $mfeEvidence ('native-temp-' + [guid]::NewGuid().ToString('N'))
if (-not [IO.Path]::GetFullPath($mfeRunTemp).StartsWith([IO.Path]::GetFullPath($mfeEvidence) + [IO.Path]::DirectorySeparatorChar)) {
throw 'Temp path outside approved workspace evidence'
}
$null = New-Item -ItemType Directory -Path $mfeRunTemp
$mfeEnvNames = @('PATH', 'UV_PYTHON', 'UV_CACHE_DIR', 'UV_OFFLINE', 'TEMP', 'TMP', 'FEM_HARNESS_CODEX_SANDBOX')
$mfeBeforeEnv = @{}
foreach ($mfeName in $mfeEnvNames) {
$mfeBeforeEnv[$mfeName] = [Environment]::GetEnvironmentVariable($mfeName, 'Process')
}
if ($null -ne $mfeBeforeEnv['FEM_HARNESS_CODEX_SANDBOX'] -and $mfeBeforeEnv['FEM_HARNESS_CODEX_SANDBOX'] -ne 'workspace-write') {
throw 'Unexpected pre-existing sandbox environment'
}
$mfeNativeExit = $null
try {
$env:PATH = (Split-Path $mfePython) + ';' + (Split-Path $mfeBasePython) + ';' + $mfeBeforeEnv['PATH']
$env:UV_PYTHON = $mfePython
$env:UV_CACHE_DIR = $mfeUvCache
$env:UV_OFFLINE = 'true'
$env:TEMP = $mfeRunTemp
$env:TMP = $mfeRunTemp
$env:FEM_HARNESS_CODEX_SANDBOX = 'danger-full-access'
& $mfePython -B -X utf8 -c "from scripts import execute; execute.StepExecutor.CODEX_TIMEOUT_SECONDS = 14400; execute.main()" mitc4-shell-feast-eigen-execution-prep --approve-danger-full-access
$mfeNativeExit = $LASTEXITCODE
if ($null -eq $mfeNativeExit) { throw 'Native Executor exit unavailable' }
}
finally {
foreach ($mfeName in $mfeEnvNames) {
[Environment]::SetEnvironmentVariable($mfeName, $mfeBeforeEnv[$mfeName], 'Process')
}
}
exit $mfeNativeExit
```
재개 Implementation은 inherited 환경을 확인한 뒤 pytest entry를 아래 direct venv 방식으로
사용한다. 기존 Step0의 대상/모든 assertions를 유지하며 collection에서3개 classifier test의
6/16/15 parameter inventory를 확인한다. 각 **호출마다 새** basetemp를 만들어 pytest가 기존
evidence directory를 정리하지 않게 한다. 이전 GREEN은 새 RED가 아니다.
```powershell
$ErrorActionPreference = 'Stop'
$mfeEvidence = Join-Path (Get-Location).Path '.harness/build/mitc4-eigen-evidence/prep/classifier-correction'
$mfePython = Join-Path $mfeEvidence 'pytest-venv/Scripts/python.exe'
$mfePytestRuns = @(
@{ label = 'classifier'; targets = @('tests/test_execute.py', '-k', 'environment_classifier or successful_source_echo') },
@{ label = 'focused'; targets = @('tests/test_harness_timeouts.py', 'tests/test_execute.py', 'tests/test_execute_ownership.py', 'tests/test_hook_validation_scope.py', 'tests/test_harness_preset_contract.py') },
@{ label = 'full'; targets = @() }
)
foreach ($mfeRun in $mfePytestRuns) {
$mfeFreshBase = Join-Path $mfeEvidence ('pytest-' + $mfeRun.label + '-' + [guid]::NewGuid().ToString('N'))
$mfeCache = Join-Path $mfeEvidence 'pytest-cache'
$mfeTargets = $mfeRun.targets
& $mfePython -B -X utf8 -m pytest -v -rs -o "cache_dir=$mfeCache" "--basetemp=$mfeFreshBase" @mfeTargets
$mfePytestExit = $LASTEXITCODE
Write-Output ("pytest {0}: exit {1}; basetemp {2}" -f $mfeRun.label, $mfePytestExit, $mfeFreshBase)
if ($null -eq $mfePytestExit -or $mfePytestExit -ne 0) { throw 'pytest verification failed' }
}
```
CMake/MSVC/x64/Debug configure/build와 전체 CTest discovery/run은 기존 Step0의 정확한
명령을 같은 inherited TEMP/TMP에서 별도로 실행한다. 실패 시 actual command/exit와 남은
검증을 기록한다. Registered Stop을 수동 full 검증으로 대체하지 않으며 원 보고서 갱신은
Implementation owner, 종료 뒤 사후 감사는 Coordinator 소유다.