Compare commits
8
Commits
31ae6a6ab2
...
d18f551a26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d18f551a26 | ||
|
|
ef021e79f0 | ||
|
|
589481218d | ||
|
|
c60248dbfe | ||
|
|
0172916ffd | ||
|
|
e17cfbebe3 | ||
|
|
16f5e126be | ||
|
|
9c59f60b50 |
No files matched your search
@@ -30,6 +30,6 @@
|
||||
"uncommitted_files": [
|
||||
"?? tools.yaml"
|
||||
],
|
||||
"next_action": "Plan 01-05 complete and reviewed. Continue plan 01-06 task 1, then plan 01-07; do not resume completed 01-05 task 2.",
|
||||
"next_action": "Consumed historical handoff. Plans01-05 and01-06 complete and reviewed. Continue01-07 task1; actual session acceptance remains0/120 OPEN.",
|
||||
"context_notes": "Quota interruption after server-restart recovery. Plans01-01..04 complete, primary-reviewed and pushed through de68796. Currentplan01-05 task1 RED446930d/GREEN6112339; task2 RED818191c. No01-05SUMMARY. Preserve partial uncommitted edits to scripts/collect-fidelity-windows.ps1 and tools/recon/fidelity_checkpoint.py; preserve unrelated tools.yaml. Do not restart task1 or treatREDcommit as completion. Inspect actual gitdiff before continuation.\nExisting generated packages artifacts/fidelity/01-05-packages/{linux-x64,win-x64} and tracerbundle artifacts/fidelity/01-05-tracer-checkpoint exist; inspect manifests/logs rather than rebuilding blindly. Task2 REDreproduced23tests with missing-session-materials assertion/statusAPI error. Cached local PowerShell executable .tools/powershell-check/root/opt/microsoft/powershell/7/pwsh and cacheddeb found; no successful execution/provenance was reported before quota. No third-party installers redistributed. Need finish task2Windowsagenda/selftests/complete truthfulresults, verify, writeSUMMARY andhandlerstate; then primaryreview/push. All120actualoriginal-DxWnd/nativeLinux/nativeWindowsacceptanceOPEN. Plans01-06Linuxcapture/01-07combinedhands-onreadiness+acceptance remain.\nSequential nativeexecutors because worktreebasecheckcannotresolveorigin/HEAD (repoGitea/main). Maincommits authorized;git.allow_default_branch_commits=true. Local sockettests/Node runner needescalation to actuallyexecute namedtests. Fullwave2scripts/test.sh authorizedpasses462Python+2HUD/allmanaged/36GPUzeroerrorsGTX1070/539hashes; observer23managed+7process/privateXvfb4onoffidentical. No newWindowsororiginalcomparison.\nUser asked howtoresumeandautomatelow5husagepause. Researched officialCodexaccount/rateLimits/read plusaccount/rateLimits/updated andPreToolUse/PostToolUsehooks; no guardconfigured. OnlySessionStarthook currentlyconfigured;statuslinealreadyfive-hour-limit. Do not claimautopauseinstalled. Need customwatcher/hook before it canbeautomatic. No activeworkersknown;recover_01_05 returnedquotaerror, do notimmediatelyredispatchwhilequotaexhausted. Resumewhenuserrequestsafterlimitreset; inspectactualremainingquota ratherthanstale10:28PMreset. No sourcefeatureworkwasdonebyprimaryforthisquestion.\n\n2026-11-13 quota-guard setup: tools/workflow/codex_quota_guard.py and .codex/hooks.json implement local Linux 60-second actual 300-minute quota polling; <=20% denies new worker dispatch, <=15% independent recovery snapshot plus cooperative GSD pause request. The watcher is running and live quota read works. Five project hooks are discovered but require user /hooks trust before registration/tool blocking activate. See docs/codex-quota-guard.md. No feature tasks resumed or partial collector edits committed during this setup. After reset/user resume, continue plan 01-05 task 2 from this original handoff.\n\nConsumed after successful continuation: SUMMARY2d48ee5/tracking1af5217. Primary repeats24 checkpoint and17 PowerShell checks successfully. Both full bundle preflights passed. Retained for preservation after auto-review rejected deletion. New current position is01-06 task1; old quota blocker is resolved.\n"
|
||||
}
|
||||
@@ -39,7 +39,7 @@ Integer phases are planned work; decimal phases may be inserted for urgent recov
|
||||
2. A tester can reproduce identified whole-original reference scenarios from an isolated generated installation and inspect corresponding input/events, images and audio where applicable; unavailable execution keeps this criterion open.
|
||||
3. A reviewer can trace every full-game capability from original evidence through current implementation, platform receipts, discrepancies and its remaining acceptance condition.
|
||||
4. Testers can repeat the same baseline movement/route scenarios on native Linux and native Windows with exact revision identities; Wine/cross-publish receipts remain separately labeled and cannot close missing native execution.
|
||||
**Plans:** 5/7 plans executed
|
||||
**Plans:** 6/7 plans executed
|
||||
**Wave 1**
|
||||
- [x] 01-01-PLAN.md
|
||||
|
||||
@@ -52,7 +52,7 @@ Integer phases are planned work; decimal phases may be inserted for urgent recov
|
||||
- [x] 01-05-PLAN.md
|
||||
|
||||
**Wave 4** *(blocked on Wave 3 completion)*
|
||||
- [ ] 01-06-PLAN.md
|
||||
- [x] 01-06-PLAN.md
|
||||
|
||||
**Wave 5** *(blocked on Wave 4 completion)*
|
||||
- [ ] 01-07-PLAN.md
|
||||
@@ -151,7 +151,7 @@ Execution follows 1 → 2 → 3 → 4 → 5 → 6 → 7 → 8, subject to the ex
|
||||
|
||||
| Phase | Plans Complete | Status | Completed |
|
||||
|-------|----------------|--------|-----------|
|
||||
| 1. Reproducible Fidelity Baseline | 5/7 | In Progress | - |
|
||||
| 1. Reproducible Fidelity Baseline | 6/7 | In Progress | - |
|
||||
| 2. Faithful Movement and Scene Handoffs | 0/TBD | Not started | - |
|
||||
| 3. Original Actors, Hazards and Combat | 0/TBD | Not started | - |
|
||||
| 4. Complete Gadget and Vehicle Use | 0/TBD | Not started | - |
|
||||
|
||||
+10
-7
@@ -3,16 +3,16 @@ gsd_state_version: "1.0"
|
||||
current_phase: 01
|
||||
current_phase_name: Reproducible Fidelity Baseline
|
||||
status: executing
|
||||
stopped_at: Completed 01-05-PLAN.md
|
||||
last_updated: "2026-11-13T16:45:57.021Z"
|
||||
stopped_at: Completed 01-06-PLAN.md
|
||||
last_updated: "2026-11-13T17:04:40.651Z"
|
||||
last_activity: 2026-11-12
|
||||
last_activity_desc: Phase 01 execution started
|
||||
state_head: 2d48ee5316a727e510db54910c59bc0a79e18e6f
|
||||
state_head: c60248dbfe5c8d151677babca0543af1f1d1b5e0
|
||||
progress:
|
||||
total_phases: 8
|
||||
completed_phases: 0
|
||||
total_plans: 7
|
||||
completed_plans: 5
|
||||
completed_plans: 6
|
||||
percent: 0
|
||||
---
|
||||
|
||||
@@ -28,7 +28,7 @@ See: .planning/PROJECT.md (updated 2026-11-12)
|
||||
## Current Position
|
||||
|
||||
Phase: 01 (Reproducible Fidelity Baseline) — EXECUTING
|
||||
Plan: 6 of 7
|
||||
Plan: 7 of 7
|
||||
Status: Ready to execute
|
||||
Last activity: 2026-11-12 — Phase 01 execution started
|
||||
|
||||
@@ -54,6 +54,7 @@ Recent trend: No execution plans completed in this roadmap. Existing project wor
|
||||
| Phase 01 P03 | 22 min | 2 tasks | 4 files |
|
||||
| Phase 01 P04 | 16 min | 2 tasks | 5 files |
|
||||
| Phase 01 P05 | 12h 4min | 2 tasks | 7 files |
|
||||
| Phase 01 P06 | 14 min | 2 tasks | 4 files |
|
||||
|
||||
## Accumulated Context
|
||||
|
||||
@@ -75,6 +76,8 @@ Recent trend: No execution plans completed in this roadmap. Existing project wor
|
||||
- [Phase 01]: Observer records are diagnostic source material for later collectors, not receipts or automatic original/native acceptance; fixture classification survives continuations.
|
||||
- [Phase 01]: READY validates identified offline materials only; original-DxWnd/native Linux/native Windows acceptance remains open 0/120.
|
||||
- [Phase 01]: Runtime package provenance retains actual completed publish source/dirty/diff identity; selected external tools are identified without redistributing executables.
|
||||
- [Phase 01]: No display and only auto_null audio yields failed native preflight; all forty Linux obligations retain explicit physical/audible capture dependencies.
|
||||
- [Phase 01]: Linux matrix history revalidates saved receipt hashes and requires new launch/session IDs; focused captures cannot replace continuous route lifetimes.
|
||||
|
||||
### Pending Todos
|
||||
|
||||
@@ -101,6 +104,6 @@ No original-required category deferred outside full reconstruction. Later phases
|
||||
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-11-13T16:45:56.992Z
|
||||
Stopped at: Completed 01-05-PLAN.md
|
||||
Last session: 2026-11-13T17:04:40.619Z
|
||||
Stopped at: Completed 01-06-PLAN.md
|
||||
Resume file: None
|
||||
+17
-3
@@ -1,10 +1,10 @@
|
||||
---
|
||||
schema_version: 1
|
||||
open_count: 0
|
||||
open_count: 1
|
||||
waived_count: 0
|
||||
fixed_count: 1
|
||||
total_count: 1
|
||||
last_updated: 2026-11-13T00:13:04.410Z
|
||||
total_count: 2
|
||||
last_updated: 2026-11-13T17:02:56.623Z
|
||||
---
|
||||
|
||||
# Broken Windows Ledger
|
||||
@@ -16,6 +16,7 @@ last_updated: 2026-11-13T00:13:04.410Z
|
||||
| id | phase | kind | file | line | description | status | reason | recorded_at | resolved_at |
|
||||
|----|-------|------|------|------|-------------|--------|--------|-------------|-------------|
|
||||
| 1 | 01 | deviation | tests/test_fidelity_sessions.py | | Task 2 also strengthens shared receipt security regressions in the task-1 test file; fixed and verified. | fixed | | 2026-11-13T00:12:34.143Z | 2026-11-13T00:13:04.410Z |
|
||||
| 2 | 01 | unrun-verify | docs/evidence/linux-session.md | | Actual Linux display, physical-input and audible capture remains open: no display session and only auto_null audio; all 40 Linux obligations await the final combined session. | open | | 2026-11-13T17:02:56.623Z | |
|
||||
|
||||
````json
|
||||
[
|
||||
@@ -31,6 +32,19 @@ last_updated: 2026-11-13T00:13:04.410Z
|
||||
"recorded_at": "2026-11-13T00:12:34.143Z",
|
||||
"resolved_at": "2026-11-13T00:13:04.410Z",
|
||||
"milestone": null
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"kind": "unrun-verify",
|
||||
"phase": "01",
|
||||
"file": "docs/evidence/linux-session.md",
|
||||
"line": null,
|
||||
"description": "Actual Linux display, physical-input and audible capture remains open: no display session and only auto_null audio; all 40 Linux obligations await the final combined session.",
|
||||
"status": "open",
|
||||
"reason": "",
|
||||
"recorded_at": "2026-11-13T17:02:56.623Z",
|
||||
"resolved_at": null,
|
||||
"milestone": null
|
||||
}
|
||||
]
|
||||
````
|
||||
@@ -0,0 +1,200 @@
|
||||
---
|
||||
phase: 01-reproducible-fidelity-baseline
|
||||
plan: "06"
|
||||
subsystem: testing
|
||||
tags: [linux, fidelity, capture, ffmpeg, provenance]
|
||||
requires:
|
||||
- phase: 01-01
|
||||
provides: Typed receipts and eight-cell scenario contract
|
||||
- phase: 01-02
|
||||
provides: Local paired review export
|
||||
- phase: 01-04
|
||||
provides: Passive runtime observer
|
||||
- phase: 01-05
|
||||
provides: Identified sealed Linux checkpoint package
|
||||
provides:
|
||||
- Bounded local Linux preflight/run/collect and immutable receipt import
|
||||
- Forty Linux obligations with exact open dependencies and verified attempt history
|
||||
- Actual host failed-preflight receipt and local review export
|
||||
affects: [01-07]
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns: [fresh output allocation, owned child deadlines, sealed package checks, explicit open acceptance]
|
||||
key-files:
|
||||
created:
|
||||
- tools/recon/fidelity_capture.py
|
||||
- scripts/collect-fidelity-linux.sh
|
||||
- tests/test_fidelity_capture.py
|
||||
- docs/evidence/linux-session.md
|
||||
modified: []
|
||||
key-decisions:
|
||||
- "A real host with no display and only auto_null audio yields failed native preflight, never synthetic replacement gameplay."
|
||||
- "One common failed environment dependency can explain all forty open Linux obligations without inventing forty game launches."
|
||||
- "Retry history revalidates actual saved receipts and requires new launch/session IDs; focused captures never substitute for the continuous journey."
|
||||
requirements-completed: [EVID-01, EVID-04]
|
||||
requirements-acceptance: "OPEN: conditional tooling/preparation contributions complete; actual native physical/audible acceptance remains 0/40 Linux and 0/120 overall. Shared IDs remain Pending while plan 01-07 is unfinished."
|
||||
coverage:
|
||||
- id: linux-collector
|
||||
description: Bounded process/media doubles, actual receipt import and classification
|
||||
requirement: EVID-04
|
||||
verification:
|
||||
- kind: integration
|
||||
ref: tests/test_fidelity_capture.py
|
||||
status: pass
|
||||
human_judgment: false
|
||||
- id: linux-matrix
|
||||
description: Eight cells and forty continuous/focused obligations with retained/fresh history
|
||||
requirement: EVID-01
|
||||
verification:
|
||||
- kind: integration
|
||||
ref: artifacts/fidelity/linux/01-06-matrix.json
|
||||
status: pass
|
||||
human_judgment: false
|
||||
- id: actual-native-capture
|
||||
description: Actual moving gameplay, physical input, real audible output and original/native comparison
|
||||
verification: []
|
||||
human_judgment: true
|
||||
rationale: "Actual host preflight found no display session and only auto_null audio. All physical/audible and full-route obligations remain assigned to the final combined session."
|
||||
actuals:
|
||||
tokens: 14371
|
||||
tasks: 2
|
||||
commits: 4
|
||||
basis: "ceil(chars/4) over the realized four-file production/test/procedure diff: 57484 characters; persisted ledger measures four task commits before summary metadata."
|
||||
plan_head_before: 31ae6a6ab2ab1c342361de376a8756dafafb8227
|
||||
plan_head_after: 0172916ffd9e3120e57c87c3bd853965f3e4d196
|
||||
duration: 14 min
|
||||
started: 2026-11-13T16:49:00Z
|
||||
completed: 2026-11-13
|
||||
status: complete
|
||||
---
|
||||
|
||||
# Phase 01 Plan 06: Linux Capture and Open Native Matrix Summary
|
||||
|
||||
**A bounded FFmpeg collector preserves package identity, failed native preflight and all forty Linux obligations without substituting synthetic gameplay.**
|
||||
|
||||
## Accomplishments
|
||||
|
||||
Both conditional plan tasks are complete. The collector provides `preflight`,
|
||||
`run`, `collect` and `matrix`; the shell launcher does no build, download or
|
||||
dummy-device fallback. It validates the sealed existing package/resources,
|
||||
records OS/tools/hash/device/GPU information, and supports installed X11/Pulse
|
||||
recording with normal `NewGame.tsk --walk` entry and passive observer. Actual
|
||||
runtime SDL/active GPU/Vulkan versions remain unavailable without a game launch.
|
||||
|
||||
Fresh contained output, inert argument arrays, selected local sources, bounded
|
||||
metadata/log/media sizes, one deadline and owned-child cleanup implement the
|
||||
plan's process/filesystem trust boundaries. Raw lossless FFV1/PCM MKV, media
|
||||
probes, logs, clocks and prelaunch identities survive collection/import. Media
|
||||
emptiness, missing streams, frozen indicators, interrupted/failed children and
|
||||
post-launch package changes keep observations incomplete. No automatic acceptance,
|
||||
retiming, volume adjustment or gameplay/movement change was introduced.
|
||||
|
||||
The matrix enumerates each lifetime/dialogue/input cell and all five obligations,
|
||||
including exact events/procedures and continuous lab → VR04 → lab → outside.
|
||||
Saved retry history is hash-checked; a new attempt needs a new launch/session ID.
|
||||
Annotations bind contained prerequisite recordings and actual copy-state identity
|
||||
records without promoting them to physical/audible review. The Linux procedure
|
||||
joins the single later Windows/original combined agenda.
|
||||
|
||||
## Task Commits
|
||||
|
||||
1. Task 1 RED: `9c59f60` — require bounded Linux capture round trip.
|
||||
2. Task 1 GREEN: `16f5e12` — collect bounded Linux capture and honest failed preflight.
|
||||
3. Task 2 RED: `e17cfbe` — require full Linux matrix continuity and resume history.
|
||||
4. Task 2 GREEN: `0172916` — preserve full Linux obligation matrix and capture history.
|
||||
|
||||
Normal hooks and the supplied-root/protected-branch checks ran. The primary
|
||||
explicitly authorized recovery after my first guard extraction omitted its bound
|
||||
assignment; the complete literal guard then passed before any write. No root drift,
|
||||
tracked deletion, runtime edit or unrelated `tools.yaml` change occurred. Primary
|
||||
owns integration reports and push.
|
||||
|
||||
## Actual Execution and Package Identity
|
||||
|
||||
The outside-sandbox host probe found a TTY session, no `DISPLAY`/`WAYLAND_DISPLAY`
|
||||
or X11 socket, no resolved Xvfb/OBS command and only suspended PipeWire Pulse
|
||||
`auto_null`/`auto_null.monitor`. FFmpeg/ffprobe are installed distribution version
|
||||
`6.1.1-3ubuntu5+esm15`; local help confirms the selected frozen-frame filter.
|
||||
`lspci` succeeded; `vulkaninfo` is absent. The exact observations/tool hashes and
|
||||
selected settings are retained. No game/recorder was launched, and no raw
|
||||
video/audio or observed gameplay/input event was fabricated.
|
||||
|
||||
The existing package `artifacts/fidelity/01-05-packages/linux-x64` was reused,
|
||||
without publish or bulk copying. Its file-list hash remains
|
||||
`124cf271e4952f3822eec5c24358447fcffc9e9e1803aded8d96d4d4472dc5a3`.
|
||||
Its actual source is `446930d2a30d6d616c60ac5e59e4169a840bea09`, dirty yes,
|
||||
diff `90cef95669caece53fe2d2c4736cf2ac05ed27f5d25ca03ab572589686bcb73d`;
|
||||
the collector revision never replaces that runtime provenance.
|
||||
|
||||
| Evidence | Exact local result |
|
||||
|---|---|
|
||||
| Task-1 diagnostic | `artifacts/fidelity/linux/01-06-focused-preflight/receipt.json`, ID `linux-01-06-focused-preflight-linux`, failed/open |
|
||||
| Current typed dependency | `artifacts/fidelity/linux/01-06-matrix-preflight/receipt.json`, ID `linux-01-06-matrix-preflight-linux`, failed/open |
|
||||
| Current applicable import | `artifacts/fidelity/linux-current-receipts/linux-01-06-matrix-preflight-linux/receipt.json` |
|
||||
| Full Linux checklist | `artifacts/fidelity/linux/01-06-matrix.json`, 8 cells / 40 obligations, all open |
|
||||
| Current shared audit | `artifacts/fidelity/linux/01-06-audit.json`, accepted 0 / required 120, invalid `[]` |
|
||||
| Local review | `artifacts/fidelity/linux/01-06-review/index.html`, failed receipt with no fabricated media |
|
||||
|
||||
The older task-1 import remains diagnostic history; select the current typed
|
||||
receipt for scenario audit. The focused failure is an actual preflight result,
|
||||
not an executed gameplay moment. Every continuous/focused slot retains the exact
|
||||
current dependency receipt plus its own actual capture/lifetime/human-review
|
||||
requirement. No native matrix cell was runnable after the shared preflight failed.
|
||||
|
||||
## Verification
|
||||
|
||||
- Final counted capture verification: **23 tests pass**, exceeding both 10/14
|
||||
thresholds. Doubles stay synthetic, native automation stays `port_fixture`,
|
||||
positive retained file/clock binding and invalid retained-session cases pass.
|
||||
- Broader `test_fidelity*.py` regression: **156 tests pass** in 36.316 seconds,
|
||||
including local viewer sockets and existing real .NET/observer fixtures outside
|
||||
sandbox restrictions. This ran before the final capture-size bound regression;
|
||||
the final focused suite passed all 23 after that bounded collector change.
|
||||
Complete report: `artifacts/fidelity/linux/01-06-fidelity-tests.log`.
|
||||
- Shell syntax and `git diff --check` pass. Both actual failed receipts validate
|
||||
through the shared validator/importer. The current scenario audit has no invalid
|
||||
receipts and grants no acceptance.
|
||||
- Original inventory verified **539 unchanged files** before capture preparation
|
||||
and repeatedly after collection/final changes. No generated package, original,
|
||||
trace or raw media is staged.
|
||||
- Task-1 tracer verification reran and passed before matrix expansion. No blanket
|
||||
fidelity tolerance or native Windows/original execution claim is made.
|
||||
|
||||
## TDD Gate Compliance
|
||||
|
||||
Actual records `artifacts/fidelity/tdd/01-06-01-red.json` and
|
||||
`01-06-02-red.json` both return `RED_EVIDENCE_OK`. Task 1's named target executes
|
||||
the planned missing capture-API assertion, without import/setup failure. Task 2's
|
||||
named target executes the missing forty-obligation matrix assertion while the
|
||||
first twelve tests remain green. Both RED commits precede their GREEN commits.
|
||||
No separate refactor was needed.
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
None in scope. The plan's explicit unavailable-native conditional was exercised:
|
||||
precise failed preflight, usable collector/procedure and complete open matrix
|
||||
replace unavailable execution, without waiving acceptance. Additional correctness
|
||||
checks preserve prelaunch identity after package tampering, bind annotation files
|
||||
and exclude oversized raw media from unbounded import. These implement the
|
||||
planned T-01-16/17/18/SC mitigations; no new trust surface was introduced.
|
||||
|
||||
## Remaining Acceptance and Next Phase
|
||||
|
||||
All **40 Linux** and **120 total** actual original/native acceptance obligations
|
||||
remain OPEN. A usable display, real output/monitor device, physical play, continuous
|
||||
and focused recordings, audible/visible/browser review and original-DxWnd/native
|
||||
Windows comparisons are still required in the final combined session. Independent
|
||||
fresh execution-copy staging and actual same-process retained state remain visible
|
||||
procedure obligations; no source package is silently relabeled as a fresh copy.
|
||||
The unavailable physical/native check is recorded as open WINDOWS ledger entry 2
|
||||
(`unrun-verify`), not as a passed test or waived truth. No implementation stub or
|
||||
skipped mandatory automated verification remains. Shared EVID-01/EVID-04 IDs stay
|
||||
Pending because unfinished plan 01-07 owns their remaining gates.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
All four implementation/procedure files exist; all four recorded task commits
|
||||
are ancestors of HEAD. Actual failed/current receipt files, matrix, audit and local
|
||||
review export exist. The persisted ledger measures four commits over the recorded
|
||||
before/after range. Original verification, final counted tests and current receipt
|
||||
audit pass within their stated scope.
|
||||
@@ -49,5 +49,5 @@
|
||||
"label": "Advance to the next step",
|
||||
"reason": "Phase 1 of 8 · 0% · executing"
|
||||
},
|
||||
"updated_at": "2026-11-13T16:45:56.190Z"
|
||||
"updated_at": "2026-11-13T17:04:38.735Z"
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
# Compatibility and validation
|
||||
|
||||
## Phase 1 plan 01-06 — reviewed tooling evidence
|
||||
|
||||
Primary repeats23 capture tests; executor records156 broader fidelity tests
|
||||
and539 unchanged originals. Actual host TTY/no-display/auto_null preflight failed
|
||||
with a structurally valid imported receipt. No Linux gameplay capture was made;
|
||||
all40 Linux and120 total acceptance obligations remainOPEN.
|
||||
|
||||
## Phase 1 plan 01-05 — reviewed tooling evidence
|
||||
|
||||
24 checkpoint tests and17 actual PowerShell selftests pass in primary review;
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# Decisions
|
||||
|
||||
## Linux capture access — phase 1 plan 01-06
|
||||
|
||||
A common failed native display/audio preflight may explain all40 Linux open
|
||||
obligations. Do not fabricate40 launches or substitute fixture playback. Preserve
|
||||
actual package seals, unique session history and retained prerequisite evidence.
|
||||
Physical input, moving content and audible playback remain human gates.
|
||||
|
||||
## Offline checkpoint review — phase 1 plan 01-05
|
||||
|
||||
Keep prepared-material readiness separate from runtime acceptance. Identify
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
# Local Linux fidelity capture
|
||||
|
||||
This joins the single final combined session described in
|
||||
[windows-session.md](windows-session.md). Prepare locally; no early hands-on
|
||||
session is requested. Every original/native acceptance obligation remains open
|
||||
until actual evidence and human review. No gameplay/movement reset is added.
|
||||
|
||||
Use the existing sealed Linux package, not a rebuilt or relabeled package.
|
||||
The 01-05 package is `artifacts/fidelity/01-05-packages/linux-x64`:
|
||||
source `446930d2a30d6d616c60ac5e59e4169a840bea09`, dirty yes, publish diff
|
||||
`90cef95669caece53fe2d2c4736cf2ac05ed27f5d25ca03ab572589686bcb73d`.
|
||||
Its file-list hash is `124cf271e4952f3822eec5c24358447fcffc9e9e1803aded8d96d4d4472dc5a3`.
|
||||
The collector checks all sealed bytes before launch and collection. Keep output
|
||||
outside the package and originals, in a fresh session directory.
|
||||
|
||||
Select the actual local X11 display and capture rectangle, real Pulse monitor
|
||||
source and physical input method. Save a local JSON settings object with these
|
||||
exact fields (values below are examples, not observed devices):
|
||||
|
||||
```json
|
||||
{"display_method":"x11","display":":0","audio_method":"pulse",
|
||||
"audio_source":"actual-device.monitor","input_method":"physical",
|
||||
"size":"1280x720","offset":"0,0"}
|
||||
```
|
||||
|
||||
Inspect `pactl list short sources` and `pactl list short sinks` locally. Null/dummy
|
||||
devices do not qualify. This collector implements X11/Pulse capture with installed
|
||||
FFmpeg/ffprobe; it records unsupported Wayland/TTY/dependency conditions as failed
|
||||
preflight. Do not install or select a guessed alternative automatically. Use a
|
||||
separately identified existing recorder for unsupported display sources and retain
|
||||
its actual settings, tool identity, raw recording and timing provenance.
|
||||
|
||||
```sh
|
||||
bash scripts/collect-fidelity-linux.sh preflight --package artifacts/fidelity/01-05-packages/linux-x64 --settings /local/linux-settings.json
|
||||
bash scripts/collect-fidelity-linux.sh run --package artifacts/fidelity/01-05-packages/linux-x64 --settings /local/linux-settings.json --output artifacts/fidelity/linux/unique-launch --session-id unique-launch --case-id fresh-natural-ordinary --scope dialogue-return --seconds 120
|
||||
bash scripts/collect-fidelity-linux.sh collect --run artifacts/fidelity/linux/unique-launch --import-to artifacts/fidelity/linux-receipts
|
||||
```
|
||||
|
||||
Nonzero run/collect exits preserve failure/abort output; inspect it, and collect
|
||||
the failed run too. Recorder starts before the normal `--load-save NewGame.tsk
|
||||
--walk` process and passive observer. This is the existing story entry, not an
|
||||
implemented main menu. Close the game normally before the selected duration.
|
||||
Both children have one bounded deadline; interruption ends only owned children.
|
||||
Logs and metadata have explicit bounds; raw recording is capped at 8 GiB. Retain
|
||||
the entire lossless FFV1/PCM MKV and tail; a detected frozen interval is an open
|
||||
inspection flag, not a claim of failure or parity derived from a numeric tolerance.
|
||||
|
||||
Collection probes actual streams/duration and hashes logs/media/observer and
|
||||
package/source/resource identities. The duplicate MKV audio alias preserves exact
|
||||
bytes for the shared receipt's distinct audio role. No audio normalization,
|
||||
retiming, crop repair or preview is implicit. If a browser needs a remux/preview,
|
||||
retain raw media and explicit derivation command/version/hash/time mapping under
|
||||
the existing shared derivative contract. The local viewer exporter consumes the
|
||||
imported receipts; actual playback/seeking/audio/crop remain human review gates.
|
||||
|
||||
Record manual event annotations as `{"events":[...]}` using the exact fields in
|
||||
`scenarios.json`: hashed raw artifact name, media and monotonic elapsed seconds,
|
||||
method and uncertainty. Supply `collect --annotations /local/annotations.json`.
|
||||
Port simulation ticks remain separate from raw clocks. Observer gate results
|
||||
do not prove a physical key was pressed. Automated injection is `port_fixture`;
|
||||
test doubles are permanently synthetic. No collector output grants acceptance.
|
||||
|
||||
## Actual 2026-11-13 preflight
|
||||
|
||||
The scoped host probe, outside sandbox device restrictions, found a TTY session,
|
||||
no `DISPLAY` or `WAYLAND_DISPLAY` and no X11 socket. Existing FFmpeg/ffprobe are
|
||||
available. Pulse exposes only `auto_null` and `auto_null.monitor` (suspended).
|
||||
No Xvfb or OBS command resolved. A synthetic display or null audio would not
|
||||
establish the requested normal visible/audible gameplay, so no game/recorder
|
||||
was launched and no substitute route/media was fabricated.
|
||||
|
||||
The exact failed focused receipt is `linux-01-06-focused-preflight-linux`, at
|
||||
`artifacts/fidelity/linux/01-06-focused-preflight/receipt.json`, imported into
|
||||
`artifacts/fidelity/linux-receipts/linux-01-06-focused-preflight-linux/`.
|
||||
`preflight.json` preserves observed OS, tool versions/hashes, Pulse devices and
|
||||
available GPU/Vulkan diagnostics; missing SDL/active-instance runtime versions
|
||||
remain explicit. The selected package/resource seal matches the hash above.
|
||||
Both the failed result and its import validate structurally, with acceptance open.
|
||||
Before collection, all 539 original files verified unchanged.
|
||||
|
||||
Required next physical session: provide an actual display/game capture source
|
||||
and real audible device/monitor source, verify moving unobstructed content and
|
||||
audio, then record physical normal controls and full tails. Inspect capture cost,
|
||||
crop/aspect and actual browser playback/seeking separately. Preserve this failed
|
||||
preflight as history; new attempts use new session IDs and fresh output roots.
|
||||
|
||||
## Full matrix and the final combined agenda
|
||||
|
||||
The current typed dependency receipt is
|
||||
`linux-01-06-matrix-preflight-linux`, at
|
||||
`artifacts/fidelity/linux/01-06-matrix-preflight/receipt.json`, imported under
|
||||
`artifacts/fidelity/linux-current-receipts/`. The earlier task-1 receipt is
|
||||
retained diagnostic history; select the current typed receipt for scenario audit.
|
||||
`artifacts/fidelity/linux/01-06-matrix.json` enumerates every obligation, exact
|
||||
procedures/events, failed attempt ID and shared display/audio dependency.
|
||||
There were no runnable native cells after that common dependency failed. The
|
||||
collector does not manufacture 40 failed game launches or unrelated scene clips.
|
||||
|
||||
In this table **OPEN** means the exact current dependency receipt above plus
|
||||
the named cell/obligation's actual recording, lifetime evidence and human review.
|
||||
|
||||
| Cell | continuous | dialogue-return | bank-left | bank-right | landing-idle |
|
||||
|---|---|---|---|---|---|
|
||||
| fresh-natural-edge | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| fresh-natural-ordinary | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| fresh-skipped-edge | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| fresh-skipped-ordinary | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| retained-natural-edge | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| retained-natural-ordinary | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| retained-skipped-edge | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
| retained-skipped-ordinary | OPEN | OPEN | OPEN | OPEN | OPEN |
|
||||
|
||||
Follow `scenarios.json` literally. Continuous recording begins before startup or
|
||||
retained setup and keeps lab → VR04 → lab → outside in one process/clock and raw
|
||||
video. Use normal supported controls/gadget/RETURN, without warps/grants. Focused
|
||||
clips have their own declared setup and never substitute for the continuous run.
|
||||
Natural dialogue reaches its real end; skipped dialogue records the actual skip
|
||||
key and observed skip/end boundaries. Ordinary play releases movement at return;
|
||||
edge play records held input through dialogue and RETURN, release/first-neutral,
|
||||
independent left/right banked jumps, landing and idle. Preserve legitimate bank,
|
||||
TSK-retained story input order and distinct fresh direct-scene observations.
|
||||
No blanket angle/pixel/timing/audio tolerance or leveling repair is implied.
|
||||
|
||||
For each fresh observation, use a new launch/session ID and separately identified
|
||||
generated execution copy; verify its existing seal rather than rebuilding it.
|
||||
Keep the source package immutable. The collector records the selected package
|
||||
root and sealed pre/post identities; copying/staging is an explicit local step,
|
||||
not an invented copy claim. The prepared checkpoint's immutable Linux package is
|
||||
also available for a verified local copy. Never select the original installation.
|
||||
For retained observations, keep one actual process, copy and clock across visible
|
||||
prerequisite lab departure to VR04 and return, then the tested interval. Capture
|
||||
the real generated-copy state while that process remains alive; a later launch
|
||||
or synthetic snapshot cannot replace the prerequisite. Use a separate terminal
|
||||
to save the observed state records inside the run directory before finalization.
|
||||
|
||||
Annotations may declare `artifact_roles` mapping contained recording paths to
|
||||
`prerequisite`, `identity_files` mapping `copy_pre`, `retained_copy`, `copy_post`
|
||||
to actual contained state-record paths, and `continuity` with `lifetime_id`,
|
||||
`prerequisite_artifact`, `copy_pre_sha256`, and for retained runs
|
||||
`departure_session_id`, `return_session_id`, `retained_copy_sha256`.
|
||||
All hashes refer to actual identity records. The selected prerequisite recording
|
||||
must have a probed duration, and prerequisite events precede the tested interval.
|
||||
A byte-identical alias of raw media can identify its prerequisite role without
|
||||
retiming; preserve its exact bytes. The collector never invents these observations.
|
||||
`clocks.clock_id` identifies the outer capture clock; preserve the passive observer
|
||||
clock's separate origin and annotate any alignment/uncertainty explicitly.
|
||||
|
||||
Export/update the checklist with an unused output filename:
|
||||
|
||||
```sh
|
||||
bash scripts/collect-fidelity-linux.sh matrix --receipt artifacts/fidelity/linux-current-receipts/linux-01-06-matrix-preflight-linux/receipt.json --dependency-run artifacts/fidelity/linux/01-06-matrix-preflight --output artifacts/fidelity/linux/new-matrix.json
|
||||
```
|
||||
|
||||
For interrupted work, pass `--previous /local/prior-matrix.json` and repeat
|
||||
`--receipt` for new attempts. Old receipts are re-read and hash-checked; reused
|
||||
or conflicting session/receipt IDs are rejected. Preserve failed/incomplete
|
||||
history, retry only missing/incomplete obligations, and use fresh IDs/directories.
|
||||
Do not hand-edit history to imply completed cells. Shared scenario validation
|
||||
checks chronological required markers, one recording and retained identity;
|
||||
the final acceptance audit still owns review and applicability selection.
|
||||
|
||||
The single final session adds these Linux actions to the Windows/original agenda:
|
||||
|
||||
1. Verify all 539 authoritative originals before staging and after collection with
|
||||
`python3 tools/recon/inventory.py ../Original --verify docs/original-manifest.json`.
|
||||
2. Select real display/audio and identified installed recorder/probe; perform a
|
||||
short moving-content, audible-output, crop/aspect and physical-control check.
|
||||
3. Record all 40 obligations with their real setup/lifetime; retain raw video/audio,
|
||||
accepted gate/observer logs, manual input descriptions, clocks and uncertainty.
|
||||
4. Import current applicable receipts and export local paired review. Verify actual
|
||||
browser playback/seeking/tails at normal speed and exclusive original/port audio;
|
||||
retain any preview's exact derivation and raw source. Review capture overhead.
|
||||
5. Recheck source/package/original identities and matrix history, retain remaining
|
||||
discrepancies/open dependencies, and transfer results locally together once.
|
||||
|
||||
The Linux subset is **0/40 accepted**. The full three-side protocol remains
|
||||
**0/120 accepted**: original-DxWnd/native Windows/physical audible review are open.
|
||||
@@ -1,5 +1,14 @@
|
||||
# Progress — 2026-11-07
|
||||
|
||||
## Phase 1 plan 01-06 — reviewed completion
|
||||
|
||||
Linux capture tooling and full40-obligation matrix are complete. Primary repeats
|
||||
23 capture tests; executor records156 broader fidelity checks and539 unchanged
|
||||
originals. Actual host preflight has no display and only auto_null audio, saved as
|
||||
`linux-01-06-matrix-preflight-linux`. No game was launched. Matrix/review artifacts
|
||||
are under `artifacts/fidelity/linux/`. Phase1 is6/7 plans; all120 runtime acceptance
|
||||
obligations stayOPEN. Final readiness and combined-session audit are next.
|
||||
|
||||
## Phase 1 plan 01-05 — reviewed completion
|
||||
|
||||
Offline Windows checkpoint preparation is complete:10,983 identified immutable
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Tasks
|
||||
|
||||
## Phase 1 plan 01-06 — reviewed completion
|
||||
|
||||
- [x] Linux collector and23 targeted checks, full40-obligation open matrix.
|
||||
- [x] Record actual no-display/null-audio host dependency; retain failed receipt.
|
||||
- [ ]01-07 final readiness/audit/integration and combined human session.
|
||||
|
||||
## Phase 1 plan 01-05 — reviewed completion
|
||||
|
||||
- [x] Complete offline Windows/DxWnd collection materials and synthetic selftests.
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# No build, download, device fallback or acceptance promotion.
|
||||
set -euo pipefail
|
||||
task_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
exec python3 "$task_root/tools/recon/fidelity_capture.py" "$@"
|
||||
@@ -0,0 +1,282 @@
|
||||
"""Capture doubles exercise collection only; no test establishes gameplay acceptance."""
|
||||
import importlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / 'tools/recon'))
|
||||
import fidelity_checkpoint as checkpoint
|
||||
import fidelity_receipts as receipts
|
||||
try:
|
||||
capture = importlib.import_module('fidelity_capture')
|
||||
except ModuleNotFoundError:
|
||||
capture = None
|
||||
|
||||
|
||||
class CaptureTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.tmp = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(self.tmp.cleanup)
|
||||
self.root = Path(self.tmp.name)
|
||||
self.package = self.root / 'package'
|
||||
self.package.mkdir()
|
||||
for name in ('GamePort', 'GamePort.dll', 'GamePort.runtimeconfig.json',
|
||||
'GamePort.deps.json', 'libSDL3.so.0', 'BUILD-INFO.txt',
|
||||
'assets/NewGame.tsk', 'scenes/level1b/scene.json',
|
||||
'scenes/VR04/scene.json', 'scenes/level1/scene.json',
|
||||
'scenes/animations/jimstop/animation.json', 'audio/a.wav', 'Shaders/a.spv'):
|
||||
path = self.package / name
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(b'test fixture ' + name.encode())
|
||||
(self.package / 'GamePort').chmod(0o755)
|
||||
checkpoint.seal_package(self.package, 'linux-x64', {'commit': 'fixture'}, tooling=True)
|
||||
self.settings = {'display_method': 'x11', 'display': ':11',
|
||||
'audio_method': 'pulse', 'audio_source': 'hardware.monitor',
|
||||
'input_method': 'physical', 'size': '1280x720', 'offset': '0,0'}
|
||||
self.run = self.root / 'test-run'
|
||||
self.media = {'streams': [{'codec_type': 'video', 'duration': '2'},
|
||||
{'codec_type': 'audio', 'duration': '2'}],
|
||||
'format': {'duration': '2'}}
|
||||
|
||||
def api(self):
|
||||
self.assertIsNotNone(capture, 'bounded Linux capture API must exist')
|
||||
return capture
|
||||
|
||||
def probe(self, argv, timeout=10):
|
||||
output = json.dumps(self.media) if 'ffprobe' in Path(argv[0]).name else 'local test tool\n'
|
||||
if 'sources' in argv:
|
||||
output = '1 hardware.monitor module-pipewire float32le 2ch 48000Hz RUNNING\n'
|
||||
return {'argv': argv, 'exit_code': 0, 'stdout': output, 'error': None}
|
||||
|
||||
def spawn(self, argv, **kwargs):
|
||||
proc = mock.Mock()
|
||||
proc.pid = 99999999
|
||||
proc.wait.return_value = 0
|
||||
proc.poll.return_value = 0
|
||||
if '-f' in argv and argv[-1].endswith('.mkv'):
|
||||
Path(argv[-1]).write_bytes(b'fixture recording')
|
||||
else:
|
||||
observer = Path(argv[argv.index('--fidelity-output') + 1])
|
||||
observer.mkdir()
|
||||
(observer / 'events.jsonl').write_text('{"fixture":true}\n')
|
||||
return proc
|
||||
|
||||
def execute(self, **changes):
|
||||
options = dict(package=self.package, output=self.run, session_id='test-launch',
|
||||
case_id='fresh-natural-ordinary', scope='dialogue-return', settings=self.settings,
|
||||
seconds=2, tooling=True, probe=self.probe, popen=self.spawn)
|
||||
options.update(changes)
|
||||
return self.api().run_capture(**options)
|
||||
|
||||
def test_capture_probe_hash_import_roundtrip_stays_synthetic(self):
|
||||
self.execute()
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(receipt['status'], 'captured')
|
||||
self.assertEqual(receipt['evidence_kind'], 'synthetic')
|
||||
imported = receipts.import_receipt(self.run / 'receipt.json', self.run, self.root / 'test-imports')
|
||||
self.assertTrue(Path(imported['path']).exists())
|
||||
self.assertFalse(receipts.validate_receipt(receipt, self.run)['accepted'])
|
||||
self.assertTrue(any(a['role'] == 'video' for a in receipt['artifacts']))
|
||||
|
||||
def test_missing_display_publishes_failed_preflight_receipt(self):
|
||||
self.settings['display'] = ''
|
||||
self.execute()
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(receipt['status'], 'failed')
|
||||
self.assertTrue(any('display' in s.lower() for s in receipt['missing_evidence']))
|
||||
|
||||
def test_null_audio_cannot_be_native_acceptance(self):
|
||||
self.settings['audio_source'] = 'auto_null.monitor'
|
||||
report = self.api().preflight(self.package, self.settings, tooling=True, probe=self.probe)
|
||||
self.assertFalse(report['ready'])
|
||||
self.assertTrue(any('null' in s for s in report['blockers']))
|
||||
|
||||
def test_stale_package_rejected(self):
|
||||
(self.package / 'GamePort.dll').write_bytes(b'changed')
|
||||
self.assertFalse(self.api().preflight(self.package, self.settings, tooling=True, probe=self.probe)['ready'])
|
||||
|
||||
def test_fixture_package_rejected_in_real_mode(self):
|
||||
self.assertFalse(self.api().preflight(self.package, self.settings, probe=self.probe)['ready'])
|
||||
|
||||
def test_recorder_exit_failure_remains_failed(self):
|
||||
def bad(argv, **kwargs):
|
||||
proc = self.spawn(argv, **kwargs)
|
||||
if '-f' in argv: proc.wait.return_value = 7
|
||||
return proc
|
||||
self.execute(popen=bad)
|
||||
self.assertEqual(self.api().collect(self.run, probe=self.probe)['status'], 'failed')
|
||||
|
||||
def test_timeout_aborts_owned_processes(self):
|
||||
processes = []
|
||||
def hanging(argv, **kwargs):
|
||||
proc = self.spawn(argv, **kwargs)
|
||||
proc.wait.side_effect = [subprocess.TimeoutExpired(argv, 2), 0]
|
||||
processes.append(proc)
|
||||
return proc
|
||||
self.execute(popen=hanging)
|
||||
self.assertEqual(self.api().collect(self.run, probe=self.probe)['status'], 'aborted')
|
||||
self.assertTrue(any(p.send_signal.called for p in processes))
|
||||
|
||||
def test_empty_media_fails(self):
|
||||
self.execute()
|
||||
(self.run / 'raw.mkv').write_bytes(b'')
|
||||
self.assertEqual(self.api().collect(self.run, probe=self.probe)['status'], 'failed')
|
||||
|
||||
def test_missing_audio_stream_fails(self):
|
||||
self.execute()
|
||||
self.media['streams'] = self.media['streams'][:1]
|
||||
self.assertEqual(self.api().collect(self.run, probe=self.probe)['status'], 'failed')
|
||||
|
||||
def test_frozen_indicator_keeps_result_incomplete(self):
|
||||
self.execute()
|
||||
(self.run / 'recorder.log').write_text('lavfi.freezedetect.freeze_start: 0\n')
|
||||
result = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(result['status'], 'failed')
|
||||
self.assertTrue(any('frozen' in x for x in result['missing_evidence']))
|
||||
|
||||
def test_automated_or_headless_never_physical_category(self):
|
||||
self.settings['input_method'] = 'automated'
|
||||
self.execute()
|
||||
result = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(result['evidence_kind'], 'synthetic')
|
||||
self.assertFalse(result['review']['ordinary_input'])
|
||||
|
||||
def test_output_reuse_and_package_overlap_rejected_before_launch(self):
|
||||
self.execute()
|
||||
with self.assertRaises(ValueError): self.execute()
|
||||
with self.assertRaises(ValueError): self.execute(output=self.package / 'capture')
|
||||
|
||||
def matrix(self, records=(), **kwargs):
|
||||
api = self.api()
|
||||
self.assertTrue(hasattr(api, 'matrix'), 'Linux matrix must enumerate and preserve all forty obligations')
|
||||
return api.matrix(receipts.read_json(ROOT / 'docs/evidence/scenarios.json'), records, **kwargs)
|
||||
|
||||
def test_matrix_enumerates_eight_cells_forty_open_obligations(self):
|
||||
result = self.matrix(dependency={'receipt_id': 'failed-preflight', 'reasons': ['No real display']})
|
||||
self.assertEqual(len(result['cells']), 8)
|
||||
self.assertEqual(sum(len(c['obligations']) for c in result['cells']), 40)
|
||||
self.assertTrue(all(o['state'] == 'open' and o['dependencies'] for c in result['cells'] for o in c['obligations']))
|
||||
|
||||
def test_matrix_preserves_dialogue_lifetime_and_input_procedures(self):
|
||||
result = self.matrix()
|
||||
for cell in result['cells']:
|
||||
self.assertIn(cell['lifetime'], ('fresh', 'retained'))
|
||||
self.assertIn(cell['dialogue'], ('natural', 'skipped'))
|
||||
self.assertIn(cell['input'], ('ordinary', 'edge'))
|
||||
for obligation in cell['obligations']:
|
||||
if cell['dialogue'] == 'skipped' and obligation['id'] == 'dialogue-return':
|
||||
self.assertIn('dialogue_skip', obligation['required_events'])
|
||||
if cell['input'] == 'edge' and obligation['id'] == 'continuous':
|
||||
self.assertIn('held_return', obligation['required_events'])
|
||||
|
||||
def test_continuous_route_cannot_be_replaced_by_focused_capture(self):
|
||||
self.execute()
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
result = self.matrix([(receipt, self.run)])
|
||||
cell = next(c for c in result['cells'] if c['id'] == receipt['case_id'])
|
||||
continuous = next(o for o in cell['obligations'] if o['id'] == 'continuous')
|
||||
focused = next(o for o in cell['obligations'] if o['id'] == 'dialogue-return')
|
||||
self.assertFalse(continuous['attempts'])
|
||||
self.assertEqual(focused['attempts'][0]['receipt_id'], receipt['receipt_id'])
|
||||
self.assertEqual(continuous['route'], ['lab', 'VR04', 'lab', 'outside'])
|
||||
|
||||
def test_resume_preserves_failed_history_and_requires_new_launch(self):
|
||||
self.settings['display'] = ''
|
||||
self.execute()
|
||||
first = self.api().collect(self.run, probe=self.probe)
|
||||
previous = self.matrix([(first, self.run)])
|
||||
new_run = self.root / 'test-second'
|
||||
self.execute(output=new_run, session_id='test-second')
|
||||
second = self.api().collect(new_run, probe=self.probe)
|
||||
resumed = self.matrix([(second, new_run)], previous=previous)
|
||||
attempts = next(o['attempts'] for c in resumed['cells'] for o in c['obligations'] if o['attempts'])
|
||||
self.assertEqual([a['session_id'] for a in attempts], ['test-launch', 'test-second'])
|
||||
second['session_id'] = first['session_id']
|
||||
with self.assertRaises(ValueError): self.matrix([(second, new_run)], previous=previous)
|
||||
|
||||
def test_collection_exposes_shared_scenario_identity_without_claiming_continuity(self):
|
||||
self.execute()
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(receipt.get('obligation_id'), 'dialogue-return')
|
||||
self.assertEqual(receipt['clocks'].get('clock_id'), 'test-launch-monotonic')
|
||||
matrix = self.matrix([(receipt, self.run)])
|
||||
self.assertEqual(matrix['accepted'], 0)
|
||||
self.assertFalse(matrix['complete'])
|
||||
|
||||
def test_disconnected_or_missing_retained_setup_remains_open(self):
|
||||
self.execute(case_id='retained-skipped-edge', scope='continuous')
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
result = self.matrix([(receipt, self.run)])
|
||||
attempted = next(o for c in result['cells'] for o in c['obligations'] if o['attempts'])
|
||||
self.assertEqual(attempted['state'], 'open')
|
||||
self.assertTrue(any('scenario' in x.lower() for x in attempted['dependencies']))
|
||||
|
||||
def test_changed_package_after_launch_keeps_prelaunch_identity_and_failure(self):
|
||||
self.execute()
|
||||
before = receipts.identify_file(self.run / 'identity/GamePort')['sha256']
|
||||
(self.package / 'GamePort').write_bytes(b'changed after launch')
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(receipt['identity']['executable']['sha256'], before)
|
||||
self.assertEqual(receipt['status'], 'failed')
|
||||
self.assertTrue(any('Post-capture' in reason for reason in receipt['missing_evidence']))
|
||||
|
||||
def test_retained_annotations_bind_real_files_and_clock_without_acceptance(self):
|
||||
self.execute(case_id='retained-natural-ordinary', scope='landing-idle')
|
||||
(self.run / 'prerequisite.mkv').write_bytes((self.run / 'raw.mkv').read_bytes())
|
||||
for name in ('copy-pre.json', 'retained-copy.json'):
|
||||
(self.run / name).write_text(json.dumps({'fixture': name}))
|
||||
note = self.root / 'annotations.json'
|
||||
note.write_text(json.dumps({'events': [
|
||||
dict(name=name, artifact=artifact, media_seconds=i * .0001,
|
||||
elapsed_seconds=i * .0001, method='manual', uncertainty_seconds=.01)
|
||||
for i, (name, artifact) in enumerate([
|
||||
('prerequisite_departure', 'prerequisite.mkv'),
|
||||
('prerequisite_return', 'prerequisite.mkv'),
|
||||
('landing', 'raw.mkv'), ('idle', 'raw.mkv')])],
|
||||
'artifact_roles': {'prerequisite.mkv': 'prerequisite'},
|
||||
'identity_files': {'copy_pre': 'copy-pre.json', 'retained_copy': 'retained-copy.json'},
|
||||
'continuity': {'lifetime_id': 'test-launch', 'departure_session_id': 'test-launch',
|
||||
'return_session_id': 'test-launch', 'prerequisite_artifact': 'prerequisite.mkv',
|
||||
'copy_pre_sha256': receipts.identify_file(self.run / 'copy-pre.json')['sha256'],
|
||||
'retained_copy_sha256': receipts.identify_file(self.run / 'retained-copy.json')['sha256']}}))
|
||||
receipt = self.api().collect(self.run, probe=self.probe, annotations=note)
|
||||
protocol = receipts.read_json(ROOT / 'docs/evidence/scenarios.json')
|
||||
cell = next(c for c in protocol['cells'] if c['id'] == receipt['case_id'])
|
||||
receipts._scenario_observation(protocol, cell, receipt)
|
||||
receipt['continuity']['return_session_id'] = 'other-process'
|
||||
with self.assertRaises(ValueError): receipts._scenario_observation(protocol, cell, receipt)
|
||||
self.assertEqual(receipt['acceptance']['state'], 'open')
|
||||
|
||||
def test_annotated_prerequisite_cannot_escape_capture_root(self):
|
||||
self.execute()
|
||||
note = self.root / 'annotations.json'
|
||||
note.write_text(json.dumps({'artifact_roles': {'../secret.mkv': 'prerequisite'}}))
|
||||
with self.assertRaises(ValueError): self.api().collect(self.run, probe=self.probe, annotations=note)
|
||||
|
||||
def test_native_automation_remains_fixture_even_after_collection(self):
|
||||
self.settings['input_method'] = 'automated'
|
||||
self.execute()
|
||||
state = receipts.read_json(self.run / 'session.json')
|
||||
state['tooling_only'] = False
|
||||
(self.run / 'session.json').write_bytes(receipts.canonical_bytes(state))
|
||||
receipt = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(receipt['evidence_kind'], 'port_fixture')
|
||||
self.assertFalse(receipts.validate_receipt(receipt, self.run)['accepted'])
|
||||
|
||||
def test_oversized_raw_media_is_preserved_without_unbounded_import(self):
|
||||
self.execute()
|
||||
with (self.run / 'raw.mkv').open('r+b') as stream:
|
||||
stream.truncate(self.api().MAX_MEDIA + 1)
|
||||
result = self.api().collect(self.run, probe=self.probe)
|
||||
self.assertEqual(result['status'], 'failed')
|
||||
self.assertFalse(any(a['path'] == 'raw.mkv' for a in result['artifacts']))
|
||||
self.assertTrue(any('8 GiB' in reason for reason in result['missing_evidence']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,485 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Local Linux capture. Collection never grants physical/audible acceptance.
|
||||
|
||||
Only tool-owned argument arrays execute. Immutable package bytes are checked at
|
||||
both boundaries; output is fresh and disjoint. No original is executed or copied.
|
||||
X11/Pulse are the implemented external recorder sources; unsupported sources
|
||||
produce precise failed receipts rather than dummy fallback recordings.
|
||||
"""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from fidelity_checkpoint import _package
|
||||
from fidelity_receipts import (MAX_JSON_BYTES, _id, _write_json, canonical_bytes,
|
||||
contained_path, identify_file, import_receipt, read_json, separated_roots,
|
||||
utc_now, validate_receipt, validate_scenario_contract, required_events,
|
||||
_scenario_observation, read_receipt)
|
||||
|
||||
PROJECT = Path(__file__).resolve().parents[2]
|
||||
MAX_SECONDS = 3600
|
||||
MAX_LOG = 32 * 1024**2
|
||||
MAX_MEDIA = 8 * 1024**3
|
||||
|
||||
|
||||
def command_probe(argv, timeout=10):
|
||||
"""Bound subprocess lifetime and returned metadata; no unbounded PIPE buffer."""
|
||||
try:
|
||||
with tempfile.TemporaryFile() as log:
|
||||
process = subprocess.Popen(argv, stdout=log, stderr=log, start_new_session=True)
|
||||
try:
|
||||
code = process.wait(timeout=timeout)
|
||||
except subprocess.TimeoutExpired:
|
||||
os.killpg(process.pid, signal.SIGKILL)
|
||||
process.wait(timeout=5)
|
||||
code = None
|
||||
log.seek(0)
|
||||
data = log.read(MAX_JSON_BYTES + 1)
|
||||
error = 'metadata timeout' if code is None else None
|
||||
if len(data) > MAX_JSON_BYTES:
|
||||
error = 'metadata exceeds 4 MiB'; data = data[:MAX_JSON_BYTES]
|
||||
return {'argv': argv, 'exit_code': code, 'stdout': data.decode('utf8', errors='replace'), 'error': error}
|
||||
except OSError as error:
|
||||
return {'argv': argv, 'exit_code': None, 'stdout': '', 'error': str(error)}
|
||||
|
||||
|
||||
def _settings(settings):
|
||||
expected = {'display_method', 'display', 'audio_method', 'audio_source',
|
||||
'input_method', 'size', 'offset'}
|
||||
if set(settings) != expected or any(not isinstance(v, str) or len(v) > 256 for v in settings.values()):
|
||||
raise ValueError('Settings require exactly the documented bounded string fields')
|
||||
if settings['input_method'] not in ('physical', 'automated', 'headless'):
|
||||
raise ValueError('Unknown input method')
|
||||
if not re.fullmatch(r'[1-9][0-9]{1,3}x[1-9][0-9]{1,3}', settings['size']):
|
||||
raise ValueError('Explicit bounded capture size required')
|
||||
if not re.fullmatch(r'[0-9]{1,5},[0-9]{1,5}', settings['offset']):
|
||||
raise ValueError('Explicit nonnegative X11 offset required')
|
||||
if settings['display'] and not re.fullmatch(r':[0-9]{1,5}(?:\.[0-9]{1,2})?', settings['display']):
|
||||
raise ValueError('Only local X11 displays are supported')
|
||||
if settings['audio_source'] and not re.fullmatch(r'[A-Za-z0-9_.-]{1,200}', settings['audio_source']):
|
||||
raise ValueError('Explicit local Pulse source name required')
|
||||
return dict(settings)
|
||||
|
||||
|
||||
def preflight(package, settings, tooling=False, probe=command_probe):
|
||||
settings = _settings(settings)
|
||||
blockers, observations = [], {}
|
||||
package = Path(package).resolve(strict=True)
|
||||
identity = None
|
||||
try:
|
||||
identity = _package(package, 'linux-x64', tooling)
|
||||
if not os.access(package / 'GamePort', os.X_OK):
|
||||
blockers.append('Identified Linux apphost is not executable')
|
||||
except (ValueError, OSError) as error:
|
||||
blockers.append('Package identity: ' + str(error))
|
||||
if platform.system() != 'Linux': blockers.append('Native Linux host required')
|
||||
for name, argv in {'recorder': ['ffmpeg', '-version'], 'media_probe': ['ffprobe', '-version'],
|
||||
'pulse_sources': ['pactl', 'list', 'short', 'sources'],
|
||||
'pulse_sinks': ['pactl', 'list', 'short', 'sinks'],
|
||||
'gpu': ['lspci', '-nn'], 'vulkan': ['vulkaninfo', '--summary']}.items():
|
||||
observations[name] = probe(argv, timeout=10)
|
||||
executable = shutil.which(argv[0])
|
||||
if executable:
|
||||
observations[name]['executable'] = {'path': str(Path(executable).resolve()),
|
||||
**identify_file(Path(executable).resolve())}
|
||||
for name in ('recorder', 'media_probe'):
|
||||
if observations[name]['exit_code'] != 0 or observations[name]['error']:
|
||||
blockers.append('Unavailable local ' + name)
|
||||
if settings['display_method'] != 'x11' or not settings['display']:
|
||||
blockers.append('No selected usable X11 display; Wayland/TTY capture requires a separately verified recorder')
|
||||
else:
|
||||
result = probe(['ffmpeg', '-nostdin', '-hide_banner', '-f', 'x11grab',
|
||||
'-video_size', settings['size'], '-i', settings['display'] + '+' + settings['offset'],
|
||||
'-frames:v', '1', '-f', 'null', '-'], timeout=10)
|
||||
observations['display_probe'] = result
|
||||
if result['exit_code'] != 0 or result['error']: blockers.append('Selected display capture probe failed')
|
||||
source = settings['audio_source']
|
||||
if settings['audio_method'] != 'pulse' or not source or any(x in source.lower() for x in ('null', 'dummy')):
|
||||
blockers.append('No selected real Pulse audio source; null/dummy output cannot prove audible gameplay')
|
||||
elif observations['pulse_sources']['exit_code'] != 0 or source not in [
|
||||
line.split()[1] for line in observations['pulse_sources']['stdout'].splitlines() if len(line.split()) >= 2]:
|
||||
blockers.append('Selected Pulse source is unavailable')
|
||||
else:
|
||||
result = probe(['ffmpeg', '-nostdin', '-hide_banner', '-f', 'pulse', '-i', source,
|
||||
'-t', '0.25', '-f', 'null', '-'], timeout=10)
|
||||
observations['audio_probe'] = result
|
||||
if result['exit_code'] != 0 or result['error']: blockers.append('Selected audio capture probe failed')
|
||||
return {'schema_version': 1, 'ready': not blockers, 'blockers': blockers,
|
||||
'settings': settings, 'package': identity, 'package_root': str(package),
|
||||
'host': {'system': platform.system(), 'release': platform.release(),
|
||||
'machine': platform.machine(), 'session_type': os.environ.get('XDG_SESSION_TYPE'),
|
||||
'display_env_present': bool(os.environ.get('DISPLAY')),
|
||||
'wayland_env_present': bool(os.environ.get('WAYLAND_DISPLAY'))},
|
||||
'observations': observations, 'checked_utc': utc_now(),
|
||||
'runtime_version_gaps': ['SDL runtime version and active GPU/driver/Vulkan instance require actual game logs'],
|
||||
'acceptance': {'state': 'open', 'remaining': ['Preflight is not gameplay or audiovisual review']}}
|
||||
|
||||
|
||||
def _stop(process):
|
||||
"""Signal only a child we own; escalate its own process group after grace."""
|
||||
try:
|
||||
process.send_signal(signal.SIGINT)
|
||||
process.wait(timeout=5)
|
||||
except subprocess.TimeoutExpired:
|
||||
try: os.killpg(process.pid, signal.SIGKILL)
|
||||
except ProcessLookupError: pass
|
||||
process.wait(timeout=5)
|
||||
except ProcessLookupError:
|
||||
pass
|
||||
|
||||
|
||||
def run_capture(package, output, session_id, case_id, scope, settings, seconds=120,
|
||||
tooling=False, probe=command_probe, popen=subprocess.Popen):
|
||||
_id(session_id); _id(case_id)
|
||||
if len(session_id) > 88: raise ValueError('Session ID must leave room for receipt suffix')
|
||||
protocol = read_json(PROJECT / 'docs/evidence/scenarios.json')
|
||||
if case_id not in {c['id'] for c in protocol['cells']} or scope not in protocol['obligations']:
|
||||
raise ValueError('Unknown matrix case or obligation')
|
||||
if not isinstance(seconds, (int, float)) or not math.isfinite(seconds) or not 1 <= seconds <= MAX_SECONDS:
|
||||
raise ValueError('Capture duration must be 1..3600 seconds')
|
||||
package = Path(package).resolve(strict=True)
|
||||
output = Path(output).absolute()
|
||||
if any(p.is_symlink() for p in (output, *output.parents)):
|
||||
raise ValueError('Capture output cannot use symlink aliases')
|
||||
separated_roots(package, output); separated_roots(PROJECT.parent / 'Original', output)
|
||||
if output.exists(): raise ValueError('Capture output must be fresh; use a new session ID')
|
||||
report = preflight(package, settings, tooling, probe)
|
||||
output.mkdir(parents=True)
|
||||
_write_json(output / 'preflight.json', report)
|
||||
identity_dir = output / 'identity'; identity_dir.mkdir()
|
||||
if report['package']:
|
||||
for name in ('GamePort', 'fidelity-build.json', 'BUILD-INFO.txt'):
|
||||
shutil.copyfile(package / name, identity_dir / name)
|
||||
_write_json(identity_dir / 'resources.json', report['package']['resources'])
|
||||
shutil.copyfile(Path(__file__), identity_dir / 'collector.py')
|
||||
start, wall_start = time.monotonic(), utc_now()
|
||||
game = [str(package / 'GamePort'), '--assets', str(package / 'assets'),
|
||||
'--load-save', str(package / 'assets/NewGame.tsk'), '--walk',
|
||||
'--fidelity-output', str(output / 'observer'), '--fidelity-session', session_id,
|
||||
'--fidelity-case', case_id]
|
||||
recorder = ['ffmpeg', '-nostdin', '-hide_banner', '-n', '-f', 'x11grab',
|
||||
'-framerate', '30', '-video_size', settings['size'], '-i',
|
||||
settings['display'] + '+' + settings['offset'], '-f', 'pulse', '-i',
|
||||
settings['audio_source'], '-t', str(seconds), '-vf', 'freezedetect=n=-60dB:d=2',
|
||||
'-c:v', 'ffv1', '-c:a', 'pcm_s16le', '-fs', str(MAX_MEDIA), str(output / 'raw.mkv')]
|
||||
state = {'schema_version': 1, 'session_id': session_id, 'launch_id': session_id,
|
||||
'clock_id': session_id + '-monotonic', 'case_id': case_id, 'scope': scope,
|
||||
'package_root': str(package), 'tooling_only': tooling,
|
||||
'input_method': settings['input_method'], 'settings': settings,
|
||||
'invocation': {'argv': game, 'cwd': str(package)}, 'recorder_argv': recorder,
|
||||
'clocks': {'monotonic_start': start, 'monotonic_end': start,
|
||||
'wall_start': wall_start, 'wall_end': wall_start,
|
||||
'clock_id': session_id + '-monotonic'},
|
||||
'status': 'failed' if not report['ready'] else 'incomplete',
|
||||
'missing': list(report['blockers']), 'processes': {}}
|
||||
_write_json(output / 'started.json', state)
|
||||
processes = []
|
||||
try:
|
||||
if report['ready']:
|
||||
env = dict(os.environ, DISPLAY=settings['display'], SDL_VIDEODRIVER='x11')
|
||||
if not tooling and (env.get('SDL_AUDIODRIVER') in ('dummy', 'disk') or env.get('SDL_VIDEODRIVER') == 'dummy'):
|
||||
raise ValueError('Dummy SDL devices cannot be used for native capture')
|
||||
# Explicit source matches the selected real Pulse system, not a dummy inherited backend.
|
||||
env['SDL_AUDIODRIVER'] = 'pulseaudio'
|
||||
with (output / 'recorder.log').open('xb') as recording_log, (output / 'game.log').open('xb') as game_log:
|
||||
recording = popen(recorder, cwd=output, env=env, stdout=recording_log,
|
||||
stderr=subprocess.STDOUT, start_new_session=True)
|
||||
processes.append(recording)
|
||||
child = popen(game, cwd=package, env=env, stdout=game_log,
|
||||
stderr=subprocess.STDOUT, start_new_session=True)
|
||||
processes.append(child)
|
||||
# One deadline covers both children. Logs/media are checked every wait slice.
|
||||
deadline = time.monotonic() + seconds + 3
|
||||
for name, child_process in (('game', child), ('recorder', recording)):
|
||||
while True:
|
||||
if any(p.stat().st_size > MAX_LOG for p in (output / 'game.log', output / 'recorder.log')):
|
||||
raise ValueError('Capture log exceeds 32 MiB bound')
|
||||
remaining = deadline - time.monotonic()
|
||||
if remaining <= 0: raise subprocess.TimeoutExpired(game, seconds)
|
||||
try:
|
||||
code = child_process.wait(timeout=min(1, remaining))
|
||||
state['processes'][name] = code
|
||||
break
|
||||
except subprocess.TimeoutExpired:
|
||||
# Doubles and real processes both expose poll; timeout at the
|
||||
# total deadline remains an abort, never a captured outcome.
|
||||
if child_process.poll() is not None:
|
||||
raise
|
||||
state['status'] = 'captured' if all(c == 0 for c in state['processes'].values()) else 'failed'
|
||||
if state['status'] == 'failed': state['missing'].append('Game or recorder exited unsuccessfully')
|
||||
except (KeyboardInterrupt, subprocess.TimeoutExpired):
|
||||
state['status'] = 'aborted'; state['missing'].append('Capture interrupted or duration deadline exceeded')
|
||||
except (OSError, ValueError) as error:
|
||||
state['status'] = 'failed'; state['missing'].append(str(error))
|
||||
finally:
|
||||
for process in processes:
|
||||
if process.poll() is None or state['status'] == 'aborted': _stop(process)
|
||||
state['clocks'].update(monotonic_end=time.monotonic(), wall_end=utc_now())
|
||||
_write_json(output / 'session.json', state)
|
||||
return state
|
||||
|
||||
|
||||
def collect(run, probe=command_probe, annotations=None):
|
||||
run = Path(run).resolve(strict=True)
|
||||
state, pre = read_json(run / 'session.json'), read_json(run / 'preflight.json')
|
||||
if (run / 'receipt.json').exists(): raise ValueError('Receipt already finalized; preserve history')
|
||||
missing = list(state['missing'])
|
||||
if pre['package']:
|
||||
try:
|
||||
current = _package(Path(state['package_root']), 'linux-x64', state['tooling_only'])
|
||||
if current != pre['package']: raise ValueError('Package changed since launch')
|
||||
except (ValueError, OSError) as error:
|
||||
missing.append('Post-capture package identity failed: ' + str(error))
|
||||
media = run / 'raw.mkv'
|
||||
duration = None
|
||||
if media.exists() and media.stat().st_size > MAX_MEDIA:
|
||||
missing.append('Raw media exceeds 8 GiB capture bound; preserved locally but excluded from import')
|
||||
elif media.exists() and media.stat().st_size:
|
||||
media_probe = probe(['ffprobe', '-v', 'error', '-show_streams', '-show_format',
|
||||
'-of', 'json', str(media)], timeout=20)
|
||||
_write_json(run / 'media-probe.json', media_probe)
|
||||
try:
|
||||
payload = json.loads(media_probe['stdout'])
|
||||
duration = float(payload['format']['duration'])
|
||||
roles = {s.get('codec_type') for s in payload['streams']}
|
||||
if media_probe['exit_code'] != 0 or media_probe['error'] or not math.isfinite(duration) or duration <= 0:
|
||||
raise ValueError('Invalid media duration/probe')
|
||||
if not {'video', 'audio'}.issubset(roles): raise ValueError('Missing video/audio streams')
|
||||
except (ValueError, KeyError, TypeError) as error:
|
||||
missing.append('Media inspection failed: ' + str(error)); duration = None
|
||||
else:
|
||||
missing.append('Raw video/audio recording missing or empty')
|
||||
log = run / 'recorder.log'
|
||||
if log.exists():
|
||||
if log.stat().st_size > MAX_LOG: missing.append('Recorder log exceeds bounded inspection')
|
||||
elif 'freeze_start' in log.read_text(errors='replace'):
|
||||
missing.append('Possible frozen media indicator requires actual visual inspection')
|
||||
if not (run / 'observer').exists(): missing.append('Passive observer/input events unavailable')
|
||||
identity = {}
|
||||
identity_dir = run / 'identity'
|
||||
if pre['package']:
|
||||
for key, name in (('executable', 'GamePort'), ('package', 'fidelity-build.json'),
|
||||
('source', 'BUILD-INFO.txt')):
|
||||
identity[key] = {'path': 'identity/' + name, **identify_file(identity_dir / name)}
|
||||
identity['resources'] = {'path': 'identity/resources.json', **identify_file(identity_dir / 'resources.json')}
|
||||
identity['launcher'] = {'path': 'identity/collector.py', **identify_file(identity_dir / 'collector.py')}
|
||||
note = read_json(annotations) if annotations else {}
|
||||
# Explicit local annotations bind actual files; no imported commands execute.
|
||||
extra_roles = note.get('artifact_roles', {})
|
||||
if not isinstance(extra_roles, dict) or any(role != 'prerequisite' for role in extra_roles.values()):
|
||||
raise ValueError('Only explicit prerequisite artifact roles can supplement capture roles')
|
||||
for name in extra_roles: identify_file(contained_path(run, name))
|
||||
for key, name in note.get('identity_files', {}).items():
|
||||
if key not in ('copy_pre', 'retained_copy', 'copy_post'):
|
||||
raise ValueError('Unsupported annotated copy identity')
|
||||
identity[key] = {'path': name, **identify_file(contained_path(run, name))}
|
||||
artifacts = []
|
||||
count = 0
|
||||
for path in run.rglob('*'):
|
||||
count += 1
|
||||
if count > 10000: raise ValueError('Capture exceeds 10000-entry bound')
|
||||
if path.is_symlink(): raise ValueError('Symlink in capture output')
|
||||
if not path.is_file() or path.is_relative_to(identity_dir): continue
|
||||
bound = MAX_MEDIA if path.suffix == '.mkv' else MAX_LOG
|
||||
if path.stat().st_size > bound:
|
||||
missing.append('Artifact exceeds import bound: ' + path.relative_to(run).as_posix())
|
||||
continue
|
||||
name = path.relative_to(run).as_posix()
|
||||
role = 'video' if name == 'raw.mkv' else 'input_events' if name.startswith('observer/') else 'diagnostic'
|
||||
role = extra_roles.get(name, role)
|
||||
item = {'path': name, 'role': role, **identify_file(path)}
|
||||
if state['tooling_only']: item['synthetic'] = True
|
||||
if name == 'raw.mkv' and duration is not None: item['duration_seconds'] = duration
|
||||
if role == 'prerequisite' and duration is not None:
|
||||
if item['sha256'] == identify_file(media)['sha256']:
|
||||
item['duration_seconds'] = duration
|
||||
else:
|
||||
inspection = probe(['ffprobe', '-v', 'error', '-show_format', '-of', 'json', str(path)], timeout=20)
|
||||
try:
|
||||
seconds = float(json.loads(inspection['stdout'])['format']['duration'])
|
||||
if inspection['exit_code'] != 0 or inspection['error'] or not math.isfinite(seconds) or seconds <= 0:
|
||||
raise ValueError('Invalid prerequisite media duration')
|
||||
item['duration_seconds'] = seconds
|
||||
except (ValueError, KeyError, TypeError) as error:
|
||||
raise ValueError('Cannot identify prerequisite recording duration') from error
|
||||
artifacts.append(item)
|
||||
artifacts.sort(key=lambda item: item['path'])
|
||||
# The same hashed MKV contains both streams; audio role uses a distinct
|
||||
# byte-identical local alias to satisfy the shared validator's unique paths.
|
||||
if duration is not None:
|
||||
shutil.copyfile(media, run / 'raw-audio.mkv')
|
||||
artifacts.append({'path': 'raw-audio.mkv', 'role': 'audio',
|
||||
'duration_seconds': duration, **identify_file(run / 'raw-audio.mkv'),
|
||||
**({'synthetic': True} if state['tooling_only'] else {})})
|
||||
events = note.get('events', [])
|
||||
kind = 'synthetic' if state['tooling_only'] else 'native_port' if state['input_method'] == 'physical' else 'port_fixture'
|
||||
status = state['status']
|
||||
if status == 'captured' and missing: status = 'failed'
|
||||
receipt = {'schema_version': 1, 'receipt_id': state['session_id'] + '-linux',
|
||||
'session_id': state['session_id'], 'case_id': state['case_id'], 'scope': state['scope'],
|
||||
'obligation_id': state['scope'],
|
||||
'evidence_kind': kind, 'historical': False, 'status': status,
|
||||
'platform': {'os': 'linux', 'execution': 'native' if kind == 'native_port' else kind},
|
||||
'invocation': state['invocation'], 'clocks': state['clocks'], 'identity': identity,
|
||||
'artifacts': artifacts, 'derivatives': [], 'events': events,
|
||||
'limitations': ['Collection does not prove visible moving gameplay, physical input or audible output',
|
||||
'Existing NewGame.tsk entry is not a reconstructed main menu',
|
||||
'Observer and recording overhead remains part of this identified run'],
|
||||
'missing_evidence': missing, 'review': {'visible': False, 'audible': False,
|
||||
'ordinary_input': False, 'human_reviewed': False},
|
||||
'capture_methods': state['settings'], 'clock_id': state['clock_id'],
|
||||
'launch_id': state['launch_id'],
|
||||
'continuity': note.get('continuity', {}),
|
||||
'acceptance': {'state': 'open', 'remaining': [
|
||||
'Actual moving-content/crop/clock/physical-input/audibility review',
|
||||
'Observed scenario markers and lifetime/route continuity validation',
|
||||
'Original-DxWnd and native Windows comparison']}}
|
||||
validate_receipt(receipt, run)
|
||||
_write_json(run / 'receipt.json', receipt)
|
||||
return receipt
|
||||
|
||||
|
||||
def matrix(protocol, records=(), previous=None, dependency=None):
|
||||
"""Forty Linux obligations with validated append-only attempt history.
|
||||
|
||||
Previous attempts are re-read and hash-checked, never trusted as acceptance.
|
||||
Distinct failed/incomplete retries require distinct process/session IDs.
|
||||
A shared environment failure is a dependency, not forty fabricated runs.
|
||||
"""
|
||||
validate_scenario_contract(protocol)
|
||||
cells = {c['id']: c for c in protocol['cells']}
|
||||
slots = {(c['id'], o): [] for c in protocol['cells'] for o in c['obligations']}
|
||||
history = []
|
||||
if previous:
|
||||
if previous.get('schema_version') != 1 or previous.get('side') != 'port-linux-native':
|
||||
raise ValueError('Unrecognized previous Linux matrix')
|
||||
for cell in previous['cells']:
|
||||
for obligation in cell['obligations']:
|
||||
for attempt in obligation['attempts']:
|
||||
path = Path(attempt['receipt_path'])
|
||||
if identify_file(path)['sha256'] != attempt['receipt_sha256']:
|
||||
raise ValueError('Historical receipt bytes changed')
|
||||
history.append((read_receipt(path), path.parent))
|
||||
seen, sessions = {}, {}
|
||||
for receipt, root in [*history, *records]:
|
||||
root = Path(root).resolve(strict=True)
|
||||
validated = validate_receipt(receipt, root)
|
||||
key = (receipt['case_id'], receipt.get('obligation_id', receipt['scope']))
|
||||
if key not in slots: raise ValueError('Unknown Linux matrix slot')
|
||||
if receipt['platform']['os'] != 'linux': raise ValueError('Linux matrix requires Linux observations')
|
||||
digest = hashlib.sha256(canonical_bytes(receipt)).hexdigest()
|
||||
record_id, session_id = receipt['receipt_id'], receipt['session_id']
|
||||
if record_id in seen:
|
||||
if seen[record_id] != digest: raise ValueError('Conflicting immutable receipt ID')
|
||||
continue
|
||||
if session_id in sessions:
|
||||
raise ValueError('A new matrix attempt must use a new launch/session ID')
|
||||
sessions[session_id] = record_id; seen[record_id] = digest
|
||||
reasons = list(validated['missing_evidence'])
|
||||
try:
|
||||
_scenario_observation(protocol, cells[key[0]], receipt)
|
||||
except (ValueError, KeyError, StopIteration) as error:
|
||||
reasons.append('Scenario continuity: ' + str(error))
|
||||
if receipt['evidence_kind'] != 'native_port':
|
||||
reasons.append('Linux native gameplay requires actual native evidence')
|
||||
path = root / 'receipt.json'
|
||||
if read_receipt(path) != receipt: raise ValueError('Matrix input differs from saved receipt')
|
||||
slots[key].append({'receipt_id': record_id, 'session_id': session_id,
|
||||
'receipt_path': str(path), 'receipt_sha256': identify_file(path)['sha256'],
|
||||
'status': receipt['status'], 'evidence_kind': receipt['evidence_kind'],
|
||||
'accepted': validated['accepted'] and not reasons, 'remaining': list(dict.fromkeys(reasons))})
|
||||
result_cells, accepted = [], 0
|
||||
for cell in protocol['cells']:
|
||||
result = {k: cell[k] for k in ('id', 'lifetime', 'dialogue', 'input')}
|
||||
result['procedures'] = {
|
||||
'lifetime': protocol['lifetime_procedures'][cell['lifetime']],
|
||||
'dialogue': protocol['dialogue_procedures'][cell['dialogue']],
|
||||
'input': protocol['input_procedures'][cell['input']]}
|
||||
result['obligations'] = []
|
||||
for obligation_id in cell['obligations']:
|
||||
attempts = slots[(cell['id'], obligation_id)]
|
||||
done = any(a['accepted'] for a in attempts)
|
||||
accepted += int(done)
|
||||
dependencies = [] if done else list((dependency or {}).get('reasons', []))
|
||||
if not done:
|
||||
dependencies += ['Actual Linux ' + cell['id'] + '/' + obligation_id + ' recording and physical/audible review']
|
||||
dependencies += [reason for a in attempts for reason in a['remaining']]
|
||||
result['obligations'].append({'id': obligation_id, 'state': 'accepted' if done else 'open',
|
||||
'attempts': attempts, 'dependencies': list(dict.fromkeys(dependencies)),
|
||||
'dependency_receipt_id': (dependency or {}).get('receipt_id'),
|
||||
'required_events': required_events(protocol, cell, obligation_id),
|
||||
'route': protocol['obligations'][obligation_id].get('route'),
|
||||
'procedure': protocol['obligations'][obligation_id]})
|
||||
result_cells.append(result)
|
||||
return {'schema_version': 1, 'side': 'port-linux-native', 'required': 40,
|
||||
'accepted': accepted, 'complete': accepted == 40, 'cells': result_cells,
|
||||
'environment_dependency': dependency,
|
||||
'acceptance': {'state': 'open', 'remaining': ['Final combined original/native acceptance audit']}}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
sub = parser.add_subparsers(dest='action', required=True)
|
||||
for action in ('preflight', 'run'):
|
||||
command = sub.add_parser(action)
|
||||
command.add_argument('--package', type=Path, required=True)
|
||||
command.add_argument('--settings', type=Path, required=True)
|
||||
if action == 'run':
|
||||
command.add_argument('--output', type=Path, required=True)
|
||||
command.add_argument('--session-id', required=True)
|
||||
command.add_argument('--case-id', required=True)
|
||||
command.add_argument('--scope', required=True)
|
||||
command.add_argument('--seconds', type=float, default=120)
|
||||
command = sub.add_parser('collect')
|
||||
command.add_argument('--run', type=Path, required=True)
|
||||
command.add_argument('--annotations', type=Path)
|
||||
command.add_argument('--import-to', type=Path)
|
||||
command = sub.add_parser('matrix')
|
||||
command.add_argument('--receipt', type=Path, action='append', default=[])
|
||||
command.add_argument('--previous', type=Path)
|
||||
command.add_argument('--dependency-run', type=Path)
|
||||
command.add_argument('--output', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
if args.action == 'preflight':
|
||||
result = preflight(args.package, read_json(args.settings))
|
||||
elif args.action == 'run':
|
||||
result = run_capture(args.package, args.output, args.session_id, args.case_id,
|
||||
args.scope, read_json(args.settings), args.seconds)
|
||||
elif args.action == 'collect':
|
||||
result = collect(args.run, annotations=args.annotations)
|
||||
if args.import_to: import_receipt(args.run / 'receipt.json', args.run, args.import_to)
|
||||
else:
|
||||
dependency = None
|
||||
if args.dependency_run:
|
||||
path = args.dependency_run / 'receipt.json'
|
||||
receipt = read_receipt(path)
|
||||
validate_receipt(receipt, path.parent)
|
||||
pre = read_json(args.dependency_run / 'preflight.json')
|
||||
if pre['ready'] or not pre['blockers'] or receipt['status'] != 'failed':
|
||||
raise ValueError('Environment dependency requires an actual failed-preflight receipt')
|
||||
dependency = {'receipt_id': receipt['receipt_id'], 'receipt_path': str(path.resolve()),
|
||||
'receipt_sha256': identify_file(path)['sha256'], 'reasons': pre['blockers']}
|
||||
result = matrix(read_json(PROJECT / 'docs/evidence/scenarios.json'),
|
||||
[(read_receipt(p), p.parent) for p in args.receipt],
|
||||
read_json(args.previous) if args.previous else None, dependency)
|
||||
separated_roots(PROJECT.parent / 'Original', args.output)
|
||||
if any(p.is_symlink() for p in (args.output.absolute(), *args.output.absolute().parents)):
|
||||
raise ValueError('Matrix output cannot use symlink aliases')
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
_write_json(args.output, result)
|
||||
print(canonical_bytes(result).decode(), end='')
|
||||
return 0 if args.action == 'matrix' or result.get('ready', result.get('status') == 'captured') else 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user