Compare commits
7
Commits
e815534895
...
de68796df1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de68796df1 | ||
|
|
4bf072d03c | ||
|
|
85e533b629 | ||
|
|
ea4dc9b5df | ||
|
|
6bccd47b9b | ||
|
|
72523eebb7 | ||
|
|
773c228a30 |
No files matched your search
@@ -39,14 +39,14 @@ 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.
|
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.
|
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.
|
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:** 3/7 plans executed
|
**Plans:** 4/7 plans executed
|
||||||
**Wave 1**
|
**Wave 1**
|
||||||
- [x] 01-01-PLAN.md
|
- [x] 01-01-PLAN.md
|
||||||
|
|
||||||
**Wave 2** *(blocked on Wave 1 completion)*
|
**Wave 2** *(blocked on Wave 1 completion)*
|
||||||
- [x] 01-02-PLAN.md
|
- [x] 01-02-PLAN.md
|
||||||
- [x] 01-03-PLAN.md
|
- [x] 01-03-PLAN.md
|
||||||
- [ ] 01-04-PLAN.md
|
- [x] 01-04-PLAN.md
|
||||||
|
|
||||||
**Wave 3** *(blocked on Wave 2 completion)*
|
**Wave 3** *(blocked on Wave 2 completion)*
|
||||||
- [ ] 01-05-PLAN.md
|
- [ ] 01-05-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 |
|
| Phase | Plans Complete | Status | Completed |
|
||||||
|-------|----------------|--------|-----------|
|
|-------|----------------|--------|-----------|
|
||||||
| 1. Reproducible Fidelity Baseline | 3/7 | In Progress | - |
|
| 1. Reproducible Fidelity Baseline | 4/7 | In Progress | - |
|
||||||
| 2. Faithful Movement and Scene Handoffs | 0/TBD | Not started | - |
|
| 2. Faithful Movement and Scene Handoffs | 0/TBD | Not started | - |
|
||||||
| 3. Original Actors, Hazards and Combat | 0/TBD | Not started | - |
|
| 3. Original Actors, Hazards and Combat | 0/TBD | Not started | - |
|
||||||
| 4. Complete Gadget and Vehicle Use | 0/TBD | Not started | - |
|
| 4. Complete Gadget and Vehicle Use | 0/TBD | Not started | - |
|
||||||
|
|||||||
+11
-7
@@ -3,16 +3,16 @@ gsd_state_version: "1.0"
|
|||||||
current_phase: 01
|
current_phase: 01
|
||||||
current_phase_name: Reproducible Fidelity Baseline
|
current_phase_name: Reproducible Fidelity Baseline
|
||||||
status: executing
|
status: executing
|
||||||
stopped_at: Completed 01-03-PLAN.md; primary continues phase1
|
stopped_at: Completed 01-04-PLAN.md; primary continues phase1
|
||||||
last_updated: "2026-11-13T03:59:45.965Z"
|
last_updated: "2026-11-13T04:23:09.969Z"
|
||||||
last_activity: 2026-11-12
|
last_activity: 2026-11-12
|
||||||
last_activity_desc: Phase 01 execution started
|
last_activity_desc: Phase 01 execution started
|
||||||
state_head: 564b19ad03e39b34fa31b35db07a121ac023070d
|
state_head: 85e533b6293e8573abe41738e467c79c721b012a
|
||||||
progress:
|
progress:
|
||||||
total_phases: 8
|
total_phases: 8
|
||||||
completed_phases: 0
|
completed_phases: 0
|
||||||
total_plans: 7
|
total_plans: 7
|
||||||
completed_plans: 3
|
completed_plans: 4
|
||||||
percent: 0
|
percent: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ See: .planning/PROJECT.md (updated 2026-11-12)
|
|||||||
## Current Position
|
## Current Position
|
||||||
|
|
||||||
Phase: 01 (Reproducible Fidelity Baseline) — EXECUTING
|
Phase: 01 (Reproducible Fidelity Baseline) — EXECUTING
|
||||||
Plan: 4 of 7
|
Plan: 5 of 7
|
||||||
Status: Ready to execute
|
Status: Ready to execute
|
||||||
Last activity: 2026-11-12 — Phase 01 execution started
|
Last activity: 2026-11-12 — Phase 01 execution started
|
||||||
|
|
||||||
@@ -52,6 +52,7 @@ Recent trend: No execution plans completed in this roadmap. Existing project wor
|
|||||||
| Phase 01 P01 | 16 min | 2 tasks | 5 files |
|
| Phase 01 P01 | 16 min | 2 tasks | 5 files |
|
||||||
| Phase 01 P02 | 16 min | 2 tasks | 6 files |
|
| Phase 01 P02 | 16 min | 2 tasks | 6 files |
|
||||||
| Phase 01 P03 | 22 min | 2 tasks | 4 files |
|
| Phase 01 P03 | 22 min | 2 tasks | 4 files |
|
||||||
|
| Phase 01 P04 | 16 min | 2 tasks | 5 files |
|
||||||
|
|
||||||
## Accumulated Context
|
## Accumulated Context
|
||||||
|
|
||||||
@@ -68,6 +69,9 @@ Recent trend: No execution plans completed in this roadmap. Existing project wor
|
|||||||
- [Phase 01]: Paired review preserves actual speed, separate raw clocks, explicit event and playback drift, exclusive audio and complete recording tails; export never promotes runtime acceptance.
|
- [Phase 01]: Paired review preserves actual speed, separate raw clocks, explicit event and playback drift, exclusive audio and complete recording tails; export never promotes runtime acceptance.
|
||||||
- [Phase 01]: Capability source links are normalized to contained tracked bounded UTF-8 text copies and activated only through exporter-validated local hrefs.
|
- [Phase 01]: Capability source links are normalized to contained tracked bounded UTF-8 text copies and activated only through exporter-validated local hrefs.
|
||||||
- [Phase 01]: Capability ledger maps all33 requirements and reconciles33 hashed checkpoint rows; documentary coverage, unimplemented work and exact historical content never promote actual original/native acceptance.
|
- [Phase 01]: Capability ledger maps all33 requirements and reconciles33 hashed checkpoint rows; documentary coverage, unimplemented work and exact historical content never promote actual original/native acceptance.
|
||||||
|
- [Phase 01]: One outer observer owns a unique launch/clock identity through Run continuations; simulation ticks remain scene-local and case/session IDs remain declared provenance.
|
||||||
|
- [Phase 01]: Accepted input means the existing binding's returned gate result, with separately identified post-step ownership; individual command dispatch and independent body/fire work are not inferred.
|
||||||
|
- [Phase 01]: Observer records are diagnostic source material for later collectors, not receipts or automatic original/native acceptance; fixture classification survives continuations.
|
||||||
|
|
||||||
### Pending Todos
|
### Pending Todos
|
||||||
|
|
||||||
@@ -94,6 +98,6 @@ No original-required category deferred outside full reconstruction. Later phases
|
|||||||
|
|
||||||
## Session Continuity
|
## Session Continuity
|
||||||
|
|
||||||
Last session: 2026-11-13T03:59:45.938Z
|
Last session: 2026-11-13T04:23:09.938Z
|
||||||
Stopped at: Completed 01-03-PLAN.md; primary continues phase1
|
Stopped at: Completed 01-04-PLAN.md; primary continues phase1
|
||||||
Resume file: None
|
Resume file: None
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
---
|
||||||
|
phase: 01-reproducible-fidelity-baseline
|
||||||
|
plan: "04"
|
||||||
|
subsystem: testing
|
||||||
|
tags: [dotnet, passive-observation, jsonl, sdl, vulkan, provenance]
|
||||||
|
requires:
|
||||||
|
- phase: 01-01
|
||||||
|
provides: Version 1 receipts and separately classified scenario observations
|
||||||
|
provides:
|
||||||
|
- Optional bounded application observer with requested/accepted input and immutable state snapshots
|
||||||
|
- One launch clock and ordered departure/arrival records across retained scene composition
|
||||||
|
- Explicit script/skip/control methods, incomplete failure summaries and observer-on/off regressions
|
||||||
|
affects: [01-05, 01-06, 01-07, native-capture]
|
||||||
|
tech-stack:
|
||||||
|
added: []
|
||||||
|
patterns: [standalone net10 console tests, streamed bounded UTF-8 JSONL, snapshot-only application diagnostics]
|
||||||
|
key-files:
|
||||||
|
created:
|
||||||
|
- src/GamePort/Application/FidelityObservation.cs
|
||||||
|
- tests/GamePort.FidelityObservationTests/GamePort.FidelityObservationTests.csproj
|
||||||
|
- tests/GamePort.FidelityObservationTests/Program.cs
|
||||||
|
- tests/test_fidelity_observation.py
|
||||||
|
modified:
|
||||||
|
- src/GamePort/Program.cs
|
||||||
|
key-decisions:
|
||||||
|
- "One outer observer owns a unique launch/clock identity through Run continuations; simulation ticks remain scene-local and case/session IDs remain declared provenance."
|
||||||
|
- "Accepted input means the existing binding's returned gate result, with separately identified post-step ownership; individual command dispatch and independent body/fire work are not inferred."
|
||||||
|
- "Observer records are diagnostic source material for later collectors, not receipts or automatic original/native acceptance; fixture classification survives continuations."
|
||||||
|
patterns-established:
|
||||||
|
- "Copied values only: no simulation references, gameplay callbacks, setters, extra steps or recovery resets enter the observer."
|
||||||
|
- "Caller-selected new local output supports standalone checkpoint/transfer folders while rejecting protected asset/Git overlap, aliases, symlink ancestry and reused sessions."
|
||||||
|
requirements-completed: [EVID-02, EVID-04]
|
||||||
|
requirements-acceptance: "OPEN: assigned observation contribution only. Shared requirements remain Pending; actual original-DxWnd/native Linux/native Windows comparison acceptance remains 0/120."
|
||||||
|
coverage:
|
||||||
|
- id: observer-semantics
|
||||||
|
description: Bounded requested/accepted input, identity, clocks, disposal and output failure preserve simulation behavior
|
||||||
|
requirement: EVID-02
|
||||||
|
verification:
|
||||||
|
- kind: unit
|
||||||
|
ref: tests/GamePort.FidelityObservationTests/Program.cs
|
||||||
|
status: pass
|
||||||
|
- kind: integration
|
||||||
|
ref: tests/test_fidelity_observation.py
|
||||||
|
status: pass
|
||||||
|
human_judgment: false
|
||||||
|
- id: retained-observation
|
||||||
|
description: Real port fixture publishes LV1B to VR04 to LV1B with one ordered launch clock and paired departure sequences
|
||||||
|
requirement: EVID-04
|
||||||
|
verification:
|
||||||
|
- kind: integration
|
||||||
|
ref: tests/test_fidelity_observation.py#test_retained_continuation_keeps_one_ordered_session_clock
|
||||||
|
status: pass
|
||||||
|
human_judgment: false
|
||||||
|
- id: passive-runtime-comparison
|
||||||
|
description: Existing bounded headless and native SDL Carl fixtures preserve exact state and four GPU readbacks with observation on/off
|
||||||
|
verification:
|
||||||
|
- kind: integration
|
||||||
|
ref: tests/test_fidelity_observation.py#test_observed_off_fixture_state_and_readbacks_match
|
||||||
|
status: pass
|
||||||
|
- kind: other
|
||||||
|
ref: artifacts/fidelity/verification/01-04-native-1794543576213164551/comparison.json
|
||||||
|
status: pass
|
||||||
|
human_judgment: false
|
||||||
|
- id: actual-scenario-acceptance
|
||||||
|
description: Identified ordinary full-route original/native audiovisual comparison
|
||||||
|
verification: []
|
||||||
|
human_judgment: true
|
||||||
|
rationale: "Injected fixtures, observer traces and compilation do not supply ordinary play, physical audio/input or native Windows/original-DxWnd review; later capture plans retain these obligations."
|
||||||
|
actuals:
|
||||||
|
tokens: 13375
|
||||||
|
tasks: 2
|
||||||
|
commits: 4
|
||||||
|
basis: "ceil(chars/4) over the realized five-file production/test diff (53497 characters), excluding planning metadata; commits measured from the persisted ledger."
|
||||||
|
plan_head_before: e8155348950e997462f4d097a0e323c7f17b75fb
|
||||||
|
plan_head_after: ea4dc9b5dfb84b1d590dae049cabb4a262a5138c
|
||||||
|
duration: 16 min
|
||||||
|
started: 2026-11-13T04:04:37Z
|
||||||
|
completed: 2026-11-13
|
||||||
|
status: complete
|
||||||
|
---
|
||||||
|
|
||||||
|
# Phase 01 Plan 04: Passive Port Observation Summary
|
||||||
|
|
||||||
|
**Bounded JSONL observations preserve requested input, the real accepted-input gate, control changes and retained scene identity without changing player ownership or movement.**
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
- Two tasks, five production/test files, four measured task commits. Started 04:04:37 UTC; final production verification/commit completed about 04:20 UTC, 2026-11-13.
|
||||||
|
- Final focused verification: **23 managed checks**, **7 Python process/interoperability tests in 19.126 seconds**. The tracer passed 10 managed/four process checks and repeated its automated gate before expansion.
|
||||||
|
- Protected projects: **Movement 28**, **Director 23**, **Checkpoint 4**, **BodyOwnership 3** actual passing groups. Existing projects without aggregate totals were additionally captured and counted from their executed PASS lines in `artifacts/fidelity/verification/01-04-protected.json` and per-project logs.
|
||||||
|
- Debug build and isolated self-contained Linux x64 Release publish succeed. The existing NU1900 warning concerns unavailable NuGet vulnerability metadata; no package was added or installed. All **539 original hashes** match.
|
||||||
|
|
||||||
|
## Accomplishments
|
||||||
|
|
||||||
|
- `FidelityObservation` is allocated once beside the outer presentation lifetime and passed through `Run`. A unique `launch_id`/`clock_id`, one Stopwatch and increasing sequence survive actual continuations. Simulation ticks remain explicitly separate and can reset at scene entry. Fresh observer instances get independent launch clocks even if a caller mistakenly repeats its declared session ID.
|
||||||
|
- The ordinary application input seam records the constructed `PlayerInput` and the actual `playerBinding.Step` return, or the existing direct simulation path. It copies post-step root, Euler, velocity, grounded/mode, retained-order flag and controller/body/effect counters. No recovered gameplay algorithm, orientation/reset policy, callback getter, actor admission or solver changed. Disabled observation allocates no observer or additional asset lookup; snapshots execute only through the optional observer path.
|
||||||
|
- SDL events are labeled raw before routing; only applicable keyboard/mouse union fields are copied. Requested input, returned gate and post-step control owner remain distinct. Script activity/control snapshots surround existing director calls. Explicit skip methods include startup/fixture, debug menu and actual SDL key paths; a playing-to-stopped boundary during the normal director step is identified as `natural_director_step`, without elapsed-time guesses.
|
||||||
|
- Scene composition records its actual entry path and retained-player/RETURN facts. Published continuations record departure source/destination and RETURN status; each following entry links the actual `departure_sequence`. The real existing fixture emits **LV1B → VR04 → LV1B**, retains one session/category/clock, and records two paired departures. This proves observer wiring through ordinary composition using fixture-owned setup; it is not ordinary-route acceptance.
|
||||||
|
- Output failure disables recording, retains an incomplete summary/stderr diagnostic and permits the existing game calls to continue. The managed failure regression compares 120 actual `LabSimulation` steps with failed observation versus off, including exact root/Euler/velocity and controller/body/effect counts. On/off headless and native SDL fixtures additionally preserve the existing locked body/fire/energy, first-neutral/300-idle assertions and held-input restoration.
|
||||||
|
|
||||||
|
## Task Commits
|
||||||
|
|
||||||
|
1. Task 01-04-01 RED: `773c228` — specify passive port input observation.
|
||||||
|
2. Task 01-04-01 GREEN: `72523ee` — observe accepted input with bounded passive output.
|
||||||
|
3. Task 01-04-02 RED: `6bccd47` — require retained session and dialogue observation.
|
||||||
|
4. Task 01-04-02 GREEN: `ea4dc9b` — preserve observer identity through control and scene changes.
|
||||||
|
|
||||||
|
Normal hooks ran, scoped staging preserved `tools.yaml`, and no tracked files were deleted. Main commits use the authorized configuration; the integrating primary owns push and root continuity reports.
|
||||||
|
|
||||||
|
## Files and Interfaces
|
||||||
|
|
||||||
|
- `src/GamePort/Application/FidelityObservation.cs`: optional `FromArguments`/`Create`, `RecordInput`, `RecordControl`, `RecordTransition`, `RecordSceneEntry`, `RecordRawEvent`, `RecordState`, `Complete` and `Dispose`. It holds copied diagnostic values and output ownership only.
|
||||||
|
- `src/GamePort/Program.cs`: optional CLI flags, one outer observer and post-owner/input/control/continuation seams. Skip and director-step wrappers preserve the original call and surrounding order. Existing helper-internal fixture steps remain outside this trace.
|
||||||
|
- Standalone `tests/GamePort.FidelityObservationTests` links focused observer plus existing assets/game sources, uses net10.0 and adds no packages. Its 23 Linux checks cover disabled operation, IDs/clocks, requested/rejected/accepted neutral input, ownership/ticks, bounds, write/flush/disposal failure, duplicate/unsafe output, real simulation parity and retained/fresh sequencing. Two symlink checks are Linux-specific; this run is not native Windows validation.
|
||||||
|
- `tests/test_fidelity_observation.py`: seven actual-port subprocess checks, hashed receipt interoperability, rejected fixture promotion/missing output, retained composition, explicit skip semantics and exact four-image/state equivalence. It builds current source before launching the actual DLL; if generated fixture resources are absent, it uses the existing local preparation command because the consolidated script runs Python before its own extraction step.
|
||||||
|
|
||||||
|
Example diagnostic invocation, with a **new** output directory:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source scripts/env.sh
|
||||||
|
dotnet run -- --fidelity-output artifacts/fidelity/new-session \
|
||||||
|
--fidelity-session unique-launch-session --fidelity-case fresh-natural-ordinary
|
||||||
|
```
|
||||||
|
|
||||||
|
IDs accept 1–128 safe alphanumeric/dot/underscore/hyphen characters. The output directory is caller-selected and need not live in a checkout: standalone package checkpoint results and local transfer folders work. Known original/source asset roots and Git metadata cannot overlap output in either direction. Protected asset aliases are resolved; output symlink ancestry and existing directories/files are rejected. A cooperative exclusive sibling reservation and `CreateNew` owned files prevent session reuse. Hostile concurrent filesystem replacement is outside this cooperative local model.
|
||||||
|
|
||||||
|
`events.jsonl` schema 1 fields are `session_id`, `case_id`, `evidence_kind`, unique `launch_id`, `clock_id`, increasing `sequence`, `elapsed_seconds`, separate `simulation_tick`, `name`, `scene`, `method` and immutable `data`. Names include `input_step`, `player_state`, `raw_sdl_event`, `control_observation`, `dialogue_start`, `dialogue_end`, `dialogue_skip`, `scene_departure` and `scene_entry`. Dialogue markers describe observed director script activity and explicit action paths, not inferred per-utterance audio timing. `accepted_input` copies the request only when the existing gate returned true; it does not assert that each input field dispatched an action. Independent body/fire work can continue when that gate is false.
|
||||||
|
|
||||||
|
`observation-summary.json` records UTC start/end, elapsed/clock identities, count/bytes, limits, completion/failure and overhead scope. It begins incomplete, remains incomplete after abort/error/bounds/disposal without completion, and is atomically updated after successful flush. A write failure never asks gameplay to retry, reset or step. If even the summary cannot be written, stderr explicitly reports that failure; a reserved prior incomplete summary is never promoted.
|
||||||
|
|
||||||
|
The writer uses a 64 Ki-character StreamWriter buffer, no growing record queue, at most **250000 records / 512 MiB**, and normalized UTF-8 LF output. These bounds can truncate long diagnostic sessions explicitly. `observer_seconds` measures serialization/write attempts only; caller snapshots, control comparisons, final flush and summary work are excluded, and this limitation is in provenance. No trace is represented as a clean, zero-overhead audiovisual run.
|
||||||
|
|
||||||
|
These are observer records, not shared receipt objects. The later collector must identify actual artifacts and map actual media clocks with uncertainty. Tests build an explicitly bounded `port_fixture` receipt from the trace interval, hash the actual trace, and validate it through the existing schema-1 receipt contract without changing that shared module. They do not invent a video/audio clock or promote native acceptance.
|
||||||
|
|
||||||
|
## Native Linux Evidence and Limits
|
||||||
|
|
||||||
|
Final evidence: `artifacts/fidelity/verification/01-04-native-1794543576213164551/comparison.json`, on/off `port.log`, eight retained PPM files and the actual observation directory. Both native SDL/Vulkan runs use a private Xvfb X11 display on **NVIDIA GeForce GTX 1070**, enabled validation, 32 frames and **zero Vulkan validation errors**. The existing injected Carl control fixture is muted; both runs exit 0. All four corresponding readbacks are byte-identical:
|
||||||
|
|
||||||
|
| Readback | SHA-256 |
|
||||||
|
|---|---|
|
||||||
|
| locked-start | f0d76654f1196534da20b7cf9a39c5e58931acb7f0aa22d349e87dad6ce176a2 |
|
||||||
|
| locked-fall | f0819d2dd9a43ff17b339be2bb3b487c3a94c4683e951015f38cd9b4f7c12e38 |
|
||||||
|
| returned | 642e15ad552c1c5819f41faf7b1bcbb9106462a26b6786753dd2f87f90cf4229 |
|
||||||
|
| final | e0e71f3c7f187149fc1b5b9d8c7fb7ff694f5ae3f27275a20948543a4f55fdfa |
|
||||||
|
|
||||||
|
The final observed run records **88 records / 65308 bytes**, 1.6721105 session seconds and 0.0365354 measured serialization/write seconds. Whole process durations are 1.5783 seconds off and 1.8555 seconds on; a single ordered pair is not an overhead benchmark. Actual Debug DLL SHA-256 is `778a1827d22c5359216c546b1841cea20fffca6a4bece2266a58057c8d24a348`, 776704 bytes. The report retains the actual pre-commit source identity: HEAD `6bccd47`, dirty true, diff SHA-256 `83eac9c22938f1f8d01200027e2fa3aefbe4ba123a9c58dc7bb6a7d9ce5ac33d`, plus unrelated preserved `tools.yaml` identity. Task GREEN commits that tested source; no clean-runtime claim is inferred from the later commit.
|
||||||
|
|
||||||
|
Exact state assertions and readbacks preserve the existing TSK first-story ordering correction, grounded neutral return, heading and legitimate source landing behavior. The fixture's deliberate preparatory calls remain fixture setup, not a newly invented reset. Full original playback, physical input/audio, ordinary full-route play, native Windows and broader platform compatibility remain unverified by this plan. **Actual matrix acceptance remains OPEN 0/120.** Plan 01-06 owns native full-route capture; Windows/original collection and review remain later work.
|
||||||
|
|
||||||
|
## TDD Gate Compliance
|
||||||
|
|
||||||
|
- Task 1: `artifacts/fidelity/tdd/01-04-01-red.json` contains the actual complete unittest report. The real port help succeeded but the named target failed its intended missing `--fidelity-output` assertion. Classifier result: `RED_EVIDENCE_OK`; semantic inspection confirms a planned behavior assertion rather than build/import/setup failure. The tracer's exact focused checks were repeated before expansion.
|
||||||
|
- Task 2: `artifacts/fidelity/tdd/01-04-02-red.json` contains the actual complete report. The existing real RETURN fixture succeeded, then the named target failed `[] != ['LV1B', 'VR04', 'LV1B']` because scene-entry observations were absent. Classifier result: `RED_EVIDENCE_OK`; semantic inspection confirms the intended sequencing assertion executed. Final 23 managed/seven process checks pass.
|
||||||
|
- Both RED commits precede their GREEN by ancestry. No separate refactor was required. No skipped/todo tests or unrun planned automated checks remain.
|
||||||
|
|
||||||
|
## Deviations from Plan
|
||||||
|
|
||||||
|
No architectural or gameplay scope change. Two bounded correctness adjustments remain within the planned application/test boundary:
|
||||||
|
|
||||||
|
1. **[Rule 2 — protected output]** Resolve source asset aliases and protect the checkout's known authoritative sibling even when `--assets` points to a generated copy. Otherwise lexical overlap alone could miss the original boundary. Managed source/output alias negatives pass; `ea4dc9b`.
|
||||||
|
2. **[Rule 3 — fixture preconditions]** Process tests build the current actual port and prepare missing generated resources through the existing extractor. The consolidated script schedules Python before its normal preparation/build steps; assuming prior generated files would make a clean test environment fail. No shared script or extractor was modified; `ea4dc9b`.
|
||||||
|
|
||||||
|
## Threat/Test Coverage
|
||||||
|
|
||||||
|
| Threat | Controls and actual verification |
|
||||||
|
|---|---|
|
||||||
|
| T-01-10 | New exclusive contained output, protected resolved asset/Git boundaries, symlink/reuse negatives, immutable values only; exact 120-step failed-writer parity and headless/native four-readback equivalence |
|
||||||
|
| T-01-11 | Fixed buffering, record/byte caps, incomplete initial/failure summaries, flush/disposal failure handling; managed bounds and exception regressions |
|
||||||
|
| T-01-12 | Distinct raw/requested/gate/post-step owner fields, actual director action methods, unique launch clock, ordered retained entries/departures, persistent fixture classification; process and shared-validator negatives |
|
||||||
|
| T-01-SC | Existing .NET framework/runtime, Python stdlib and already-installed native tools only; no added packages, services or downloads |
|
||||||
|
|
||||||
|
The new filesystem surface is exactly the plan's runtime-observation/local-output boundary; no additional network/auth/gameplay trust surface was introduced. Stub scan found only intentional optional/absent fields and test-only empty receipt identities, not unfinished implementation or UI mock data.
|
||||||
|
|
||||||
|
## Issues Encountered
|
||||||
|
|
||||||
|
The sandboxed first native-display attempt reported no video device. Authorized local-test escalation with explicit X11 on private Xvfb succeeded; both attempts remain in ignored diagnostics. A second `-o` passed to `scripts/build-linux.sh` was rejected by the .NET CLI, so the equivalent publish invocation used an isolated output to preserve existing `dist/` packages:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source scripts/env.sh
|
||||||
|
dotnet publish GamePort.csproj -c Release -r linux-x64 --self-contained true \
|
||||||
|
--no-restore -o artifacts/fidelity/verification/01-04-linux-publish
|
||||||
|
python3 tools/recon/inventory.py ../Original --verify docs/original-manifest.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Both commands pass on final code. Existing packaged runtime outputs were not replaced. NU1900 remains a pre-existing offline audit warning, not an observer failure. No new original-binary investigation, REA claim, Wine result or native Windows execution occurred.
|
||||||
|
|
||||||
|
## User Setup Required
|
||||||
|
|
||||||
|
None for these local checks. The later combined original/native recording and human audiovisual review session remains open; this plan creates no premature hands-on request.
|
||||||
|
|
||||||
|
## Next Phase Readiness
|
||||||
|
|
||||||
|
Plans 01-05/01-06 can launch the optional observer into a new checkpoint result directory and consume its honest trace/summary while binding actual package/artifact/media provenance separately. The primary owns root progress/tasks/decisions/compatibility integration, broader wave checks and push. Shared EVID-02/EVID-04 remain Pending until all owning plans and actual acceptance conditions close.
|
||||||
|
|
||||||
|
## Self-Check: PASSED
|
||||||
|
|
||||||
|
All created files exist; all four task commits are ancestors of HEAD and evaluation-scope resolves them on this branch. Exact counted observer commands, positive protected groups, Debug/isolated Linux publish, final native state/four-readback equality and 539 original hashes pass. Native JSONL byte count matches the summary's actual file size. No tracked deletions, skipped tests, implementation stubs or unexplained generated untracked files were introduced; unrelated `tools.yaml` is preserved.
|
||||||
@@ -49,5 +49,5 @@
|
|||||||
"label": "Advance to the next step",
|
"label": "Advance to the next step",
|
||||||
"reason": "Phase 1 of 8 · 0% · executing"
|
"reason": "Phase 1 of 8 · 0% · executing"
|
||||||
},
|
},
|
||||||
"updated_at": "2026-11-13T03:59:45.311Z"
|
"updated_at": "2026-11-13T04:23:08.932Z"
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,26 @@
|
|||||||
# Compatibility and validation
|
# Compatibility and validation
|
||||||
|
|
||||||
|
## Phase 1 wave 2 bounded observer evidence
|
||||||
|
|
||||||
|
Full authorized wave2 `scripts/test.sh` exits0:462 Python+2 HUD checks,
|
||||||
|
all existing managed projects and36 GPU/render checks pass with zero Vulkan
|
||||||
|
validation errors (GTX1070); SDL stream/lifecycle checks and539 original hashes
|
||||||
|
pass. The initial sandbox run retained8 denied-loopback errors; no tests were
|
||||||
|
skipped, and the authorized rerun passed. Viewer27 named Node checks and the
|
||||||
|
observer23 managed checks retain their separate passing receipts. Logs are
|
||||||
|
local under `artifacts/fidelity/wave2-test*.log`.
|
||||||
|
|
||||||
|
Plan01-04 passes23 managed checks,7 port-process checks and protected groups
|
||||||
|
Movement28/Director23/Checkpoint4/BodyOwnership3. The real LV1B→VR04→LV1B
|
||||||
|
fixture retains one observer clock. Native Linux SDL/Vulkan under private Xvfb
|
||||||
|
on/off passes with4 identical GPU readbacks and zero validation errors, using
|
||||||
|
actual dirty-source/diff and DLL identities recorded in its local comparison
|
||||||
|
report. No physical input/audio, full route, original-DxWnd or native Windows
|
||||||
|
acceptance follows. Debug and isolated Linux self-contained publish pass;
|
||||||
|
NU1900 is the existing unavailable vulnerability-metadata warning. All539
|
||||||
|
originals match. Exact receipts/limitations:
|
||||||
|
`../.planning/phases/01-reproducible-fidelity-baseline/01-04-SUMMARY.md`.
|
||||||
|
|
||||||
## Phase 1 resumed — capability ledger complete
|
## Phase 1 resumed — capability ledger complete
|
||||||
|
|
||||||
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# Decisions
|
# Decisions
|
||||||
|
|
||||||
|
## Passive evidence observation — phase 1 wave 2
|
||||||
|
|
||||||
|
Keep one optional application-owned clock across Run continuations. Record raw,
|
||||||
|
requested and actual gate-accepted input separately after existing owner calls;
|
||||||
|
copy state without new gameplay ownership or callback reads. Script activity,
|
||||||
|
explicit skip actions and transitions carry actual observed provenance. Observer
|
||||||
|
failures disable recording with incomplete diagnostics and do not reset/retry
|
||||||
|
simulation. Output is caller-selected for standalone packages, bounded and
|
||||||
|
exclusive; fixtures/headless/debug-injected runs are labeled port_fixture.
|
||||||
|
Observer overhead and incomplete coverage stay explicit. Existing algorithms,
|
||||||
|
TSK retained/fresh ordering and collision admission gates are preserved.
|
||||||
|
|
||||||
## Phase 1 resumed — capability ledger complete
|
## Phase 1 resumed — capability ledger complete
|
||||||
|
|
||||||
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
||||||
|
|||||||
@@ -1,5 +1,27 @@
|
|||||||
# Progress — 2026-11-07
|
# Progress — 2026-11-07
|
||||||
|
|
||||||
|
## Phase 1 wave 2 — review, ledger and passive observation
|
||||||
|
|
||||||
|
Full authorized wave2 `scripts/test.sh` exits0:462 Python+2 HUD checks,
|
||||||
|
all existing managed projects and36 GPU/render checks pass with zero Vulkan
|
||||||
|
validation errors (GTX1070); SDL stream/lifecycle checks and539 original hashes
|
||||||
|
pass. The initial sandbox run retained8 denied-loopback errors; no tests were
|
||||||
|
skipped, and the authorized rerun passed. Viewer27 named Node checks and the
|
||||||
|
observer23 managed checks retain their separate passing receipts. Logs are
|
||||||
|
local under `artifacts/fidelity/wave2-test*.log`.
|
||||||
|
|
||||||
|
Plans01-02/03/04 are implemented: paired actual-speed local playback with exclusive
|
||||||
|
audio/optional overlays;25 capabilities covering33 requirements and33 checkpoint
|
||||||
|
rows; optional bounded input/control/continuation observations. Observer checks:
|
||||||
|
23 managed,7 actual subprocesses, protected Movement28/Director23/Checkpoint4/
|
||||||
|
BodyOwnership3. Private-Xvfb native SDL/Vulkan on/off has4 identical readbacks
|
||||||
|
and zero validation errors; exact source-diff/binary identities and limits are in
|
||||||
|
`../.planning/phases/01-reproducible-fidelity-baseline/01-04-SUMMARY.md`.
|
||||||
|
Linux self-contained publish used an isolated artifact directory. All539 original
|
||||||
|
hashes match. This is bounded tooling/fixture evidence, not physical input/audio,
|
||||||
|
whole-original, full-route or native Windows acceptance; actual obligations stay
|
||||||
|
OPEN0/120. Next: Windows checkpoint bundle (plan01-05).
|
||||||
|
|
||||||
## Phase 1 resumed — capability ledger complete
|
## Phase 1 resumed — capability ledger complete
|
||||||
|
|
||||||
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# Tasks
|
# Tasks
|
||||||
|
|
||||||
|
## Phase 1 execution — wave 2
|
||||||
|
|
||||||
|
- [x]01-02 paired local review:21 Python/27 Node checks and real Chromium
|
||||||
|
synthetic-media smoke; actual audible original/native review stays open.
|
||||||
|
- [x]01-03 full ledger:25 capabilities/33 requirements/33 checkpoint rows;
|
||||||
|
31 ledger tests and103 combined fidelity Python tests pass.
|
||||||
|
- [x]01-04 passive observer:23 managed/7 process tests and protected suites;
|
||||||
|
native private-Xvfb on/off4 readbacks identical, zero validation errors.
|
||||||
|
- [ ]01-05 prepare complete Windows/DxWnd local checkpoint bundle.
|
||||||
|
- [ ]01-06 native Linux captures;01-07 combined hands-on session and strict audit.
|
||||||
|
- [ ]Actual original/native runtime acceptance OPEN0/120.
|
||||||
|
|
||||||
## Phase 1 resumed — capability ledger complete
|
## Phase 1 resumed — capability ledger complete
|
||||||
|
|
||||||
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
User resumed from the usage pause. Plan01-03 is complete:25 capabilities cover
|
||||||
|
|||||||
@@ -0,0 +1,239 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using System.Numerics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using GamePort.Game;
|
||||||
|
|
||||||
|
namespace GamePort.Application;
|
||||||
|
|
||||||
|
/// <summary>Optional application diagnostics. Owns only copied observations and output;
|
||||||
|
/// it never owns a simulation, callback, input source or continuation payload.</summary>
|
||||||
|
internal sealed class FidelityObservation : IDisposable
|
||||||
|
{
|
||||||
|
private static readonly JsonSerializerOptions Json = new() { PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower };
|
||||||
|
private readonly Stopwatch clock = Stopwatch.StartNew();
|
||||||
|
private readonly string directory, session, caseId, kind;
|
||||||
|
private readonly string launchId = Guid.NewGuid().ToString("N");
|
||||||
|
private readonly DateTimeOffset wallStart = DateTimeOffset.UtcNow;
|
||||||
|
private readonly int maxRecords;
|
||||||
|
private const long MaxBytes = 512L * 1024 * 1024;
|
||||||
|
private TextWriter? writer;
|
||||||
|
private long sequence, bytes;
|
||||||
|
private string? failure;
|
||||||
|
private bool completed, disposed, ownsDirectory;
|
||||||
|
private double overhead;
|
||||||
|
private long? pendingDeparture;
|
||||||
|
private (string Scene, bool Controlled, string? Owner, bool Playing, string? Dialogue)? control;
|
||||||
|
|
||||||
|
private FidelityObservation(string directory, string session, string caseId, string kind, int maxRecords)
|
||||||
|
{ this.directory = directory; this.session = session; this.caseId = caseId; this.kind = kind; this.maxRecords = maxRecords; }
|
||||||
|
|
||||||
|
public static FidelityObservation? FromArguments(string[] args, string project, string originals)
|
||||||
|
{
|
||||||
|
string? Option(string name)
|
||||||
|
{
|
||||||
|
var index = Array.IndexOf(args, name);
|
||||||
|
if (index < 0) return null;
|
||||||
|
if (index + 1 == args.Length || args[index + 1].StartsWith("--", StringComparison.Ordinal))
|
||||||
|
throw new ArgumentException(name + " requires a value");
|
||||||
|
if (Array.LastIndexOf(args, name) != index) throw new ArgumentException("Repeated " + name);
|
||||||
|
return args[index + 1];
|
||||||
|
}
|
||||||
|
var output = Option("--fidelity-output");
|
||||||
|
if (output == null) return null;
|
||||||
|
var session = Option("--fidelity-session") ?? throw new ArgumentException("--fidelity-session required");
|
||||||
|
var caseId = Option("--fidelity-case") ?? throw new ArgumentException("--fidelity-case required");
|
||||||
|
var fixture = args.Any(a => a.StartsWith("--smoke-", StringComparison.Ordinal)
|
||||||
|
|| a.StartsWith("--", StringComparison.Ordinal) && a.EndsWith("-smoke", StringComparison.Ordinal)
|
||||||
|
|| a is "--headless" or "--story-time" or "--time" or "--inspect" or "--skip-intro"
|
||||||
|
or "--noclip" or "--debug-menu" or "--debug-page" or "--gadget-menu");
|
||||||
|
return Create(output, session, caseId, fixture ? "port_fixture" : "native_port", project, originals);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FidelityObservation Create(string output, string session, string caseId, string kind,
|
||||||
|
string project, string originals, int maxRecords = 250000, TextWriter? sink = null)
|
||||||
|
{
|
||||||
|
foreach (var id in new[] { session, caseId })
|
||||||
|
if (!Regex.IsMatch(id, "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$", RegexOptions.CultureInvariant))
|
||||||
|
throw new ArgumentException("Observation IDs require 1..128 safe characters");
|
||||||
|
if (kind is not ("port_fixture" or "native_port") || maxRecords < 1 || maxRecords > 250000)
|
||||||
|
throw new ArgumentException("Invalid observation category or record limit");
|
||||||
|
var path = Path.TrimEndingDirectorySeparator(Path.GetFullPath(output));
|
||||||
|
static bool Within(string child, string parent) => child.Equals(parent, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| child.StartsWith(Path.TrimEndingDirectorySeparator(parent) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase);
|
||||||
|
static string ResolvedDirectory(string value)
|
||||||
|
{
|
||||||
|
var full = Path.GetFullPath(value);
|
||||||
|
var current = Path.GetPathRoot(full)!;
|
||||||
|
foreach (var part in full[current.Length..].Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries))
|
||||||
|
{
|
||||||
|
current = Path.Combine(current, part);
|
||||||
|
var info = new DirectoryInfo(current);
|
||||||
|
if (info.LinkTarget != null)
|
||||||
|
current = info.ResolveLinkTarget(true)?.FullName ?? throw new ArgumentException("Unresolved protected asset link");
|
||||||
|
}
|
||||||
|
return Path.TrimEndingDirectorySeparator(current);
|
||||||
|
}
|
||||||
|
var protectedRoots = new List<string> { ResolvedDirectory(originals), Path.Combine(ResolvedDirectory(project), ".git") };
|
||||||
|
// A generated --assets copy must not make the checkout's authoritative sibling writable.
|
||||||
|
foreach (var candidate in new[] { Path.Combine(project, "..", "Original"), Path.Combine(project, "Original"), Path.Combine(project, "assets") })
|
||||||
|
if (Directory.Exists(candidate)) protectedRoots.Add(ResolvedDirectory(candidate));
|
||||||
|
if (protectedRoots.Any(protectedRoot => Within(path, protectedRoot) || Within(protectedRoot, path)))
|
||||||
|
throw new ArgumentException("Observation output must be separate from original assets and Git metadata");
|
||||||
|
for (var parent = new DirectoryInfo(path); parent != null; parent = parent.Parent)
|
||||||
|
if (parent.LinkTarget != null) throw new ArgumentException("Observation output cannot traverse symbolic links");
|
||||||
|
if (Directory.Exists(path) || File.Exists(path)) throw new IOException("Observation requires a new output directory");
|
||||||
|
var observer = new FidelityObservation(path, session, caseId, kind, maxRecords);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||||
|
// A cooperative local reservation prevents two observers reusing the same directory.
|
||||||
|
var reservation = path + ".fidelity-reservation";
|
||||||
|
using (new FileStream(reservation, FileMode.CreateNew, FileAccess.Write, FileShare.None))
|
||||||
|
{
|
||||||
|
if (Directory.Exists(path) || File.Exists(path)) throw new IOException("Observation directory was reserved by another writer");
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
observer.ownsDirectory = true;
|
||||||
|
}
|
||||||
|
File.Delete(reservation);
|
||||||
|
observer.WriteSummary(false);
|
||||||
|
observer.writer = sink ?? new StreamWriter(new FileStream(Path.Combine(path, "events.jsonl"),
|
||||||
|
FileMode.CreateNew, FileAccess.Write, FileShare.Read), new UTF8Encoding(false), 65536);
|
||||||
|
observer.writer.NewLine = "\n";
|
||||||
|
}
|
||||||
|
catch (Exception error) when (OutputError(error)) { observer.Fail(error.Message); }
|
||||||
|
return observer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RecordInput(string scene, int simulationTick, PlayerInput requested, bool acceptsInput, string controlOwner)
|
||||||
|
=> Record("input_step", scene, simulationTick, "post_owner_step", new {
|
||||||
|
requested_input = requested, accepts_input = acceptsInput,
|
||||||
|
accepted_input = acceptsInput ? (PlayerInput?)requested : null,
|
||||||
|
control_owner = controlOwner, control_owner_phase = "post_step",
|
||||||
|
acceptance_scope = "reported binding gate only; individual command dispatch and independent body/fire work are not classified by this boolean" });
|
||||||
|
|
||||||
|
public void RecordSceneEntry(string scene, int simulationTick, bool returning, bool retainedPlayer, string entryPath)
|
||||||
|
{
|
||||||
|
control = null;
|
||||||
|
Record("scene_entry", scene, simulationTick, "application_scene_composition", new {
|
||||||
|
returning, retained_player = retainedPlayer, entry_path = entryPath, departure_sequence = pendingDeparture });
|
||||||
|
pendingDeparture = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RecordTransition(string scene, string destination, int simulationTick, bool returning)
|
||||||
|
{
|
||||||
|
Record("scene_departure", scene, simulationTick, "continuation_published", new { destination, returning });
|
||||||
|
pendingDeparture = sequence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RecordRawEvent(string scene, int simulationTick, uint eventType, uint? scancode, byte? button, byte? repeat)
|
||||||
|
=> Record("raw_sdl_event", scene, simulationTick, "sdl_poll_before_routing", new {
|
||||||
|
event_type = eventType, scancode, button, repeat, acceptance = "raw_only; routing may consume or reject this event" });
|
||||||
|
|
||||||
|
public void RecordControl(string scene, int simulationTick, bool controlled, string? owner, bool playing, string? dialogue, string boundary)
|
||||||
|
{
|
||||||
|
var current = (scene, controlled, owner, playing, dialogue);
|
||||||
|
var previous = control;
|
||||||
|
if (previous == current && !boundary.StartsWith("skip:", StringComparison.Ordinal)) return;
|
||||||
|
var data = new { controlled, control_owner = owner, playing, dialogue };
|
||||||
|
Record("control_observation", scene, simulationTick, boundary, data);
|
||||||
|
if (boundary.StartsWith("skip:", StringComparison.Ordinal) && previous is { } before && (before.Playing || !before.Controlled))
|
||||||
|
Record("dialogue_skip", scene, simulationTick, boundary, data);
|
||||||
|
if ((previous == null || previous is { Playing: false }) && playing)
|
||||||
|
Record("dialogue_start", scene, simulationTick, boundary, data);
|
||||||
|
if (previous is { Playing: true } && !playing)
|
||||||
|
Record("dialogue_end", scene, simulationTick,
|
||||||
|
boundary == "director_step" ? "natural_director_step" : boundary, data);
|
||||||
|
control = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RecordState(string scene, int simulationTick, Vector3 root, Vector3 rotation, Vector3 velocity,
|
||||||
|
bool grounded, int movementMode, bool inputAfterPlayerUpdate, int controllers, int physics, int effects)
|
||||||
|
=> Record("player_state", scene, simulationTick, "post_owner_value_snapshot", new {
|
||||||
|
actor_root = new[] { root.X, root.Y, root.Z }, euler_degrees = new[] { rotation.X, rotation.Y, rotation.Z },
|
||||||
|
velocity = new[] { velocity.X, velocity.Y, velocity.Z }, grounded, movement_mode = movementMode,
|
||||||
|
input_after_player_update = inputAfterPlayerUpdate, controller_steps = controllers, physics_steps = physics,
|
||||||
|
effect_steps = effects, interpretation = "copied state only; bank/landing/idle require explicit review" });
|
||||||
|
|
||||||
|
private void Record(string name, string scene, int simulationTick, string method, object data)
|
||||||
|
{
|
||||||
|
if (disposed || completed || failure != null) return;
|
||||||
|
var started = Stopwatch.GetTimestamp();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (sequence >= maxRecords) throw new IOException("Observation record limit reached");
|
||||||
|
var line = JsonSerializer.Serialize(new { schema_version = 1, session_id = session, case_id = caseId,
|
||||||
|
evidence_kind = kind, launch_id = launchId, clock_id = launchId + ":stopwatch", sequence = sequence + 1,
|
||||||
|
elapsed_seconds = clock.Elapsed.TotalSeconds, simulation_tick = simulationTick,
|
||||||
|
name, scene, method, data }, Json);
|
||||||
|
var length = Encoding.UTF8.GetByteCount(line) + 1;
|
||||||
|
if (bytes + length > MaxBytes) throw new IOException("Observation byte limit reached");
|
||||||
|
writer!.WriteLine(line);
|
||||||
|
sequence++; bytes += length;
|
||||||
|
}
|
||||||
|
catch (Exception error) when (OutputError(error)) { Fail(error.Message); }
|
||||||
|
finally { overhead += Stopwatch.GetElapsedTime(started).TotalSeconds; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Complete(int exitCode)
|
||||||
|
{
|
||||||
|
if (disposed || completed) return;
|
||||||
|
if (exitCode != 0) Fail("Port exited with code " + exitCode);
|
||||||
|
try { writer?.Dispose(); writer = null; }
|
||||||
|
catch (Exception error) when (OutputError(error)) { Fail(error.Message); }
|
||||||
|
completed = true;
|
||||||
|
TrySummary(exitCode == 0 && failure == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool OutputError(Exception error) => error is IOException or UnauthorizedAccessException
|
||||||
|
or System.Security.SecurityException or JsonException or ArgumentException or NotSupportedException;
|
||||||
|
|
||||||
|
private void Fail(string reason)
|
||||||
|
{
|
||||||
|
if (failure != null) return;
|
||||||
|
failure = reason;
|
||||||
|
Console.Error.WriteLine("Fidelity observation INCOMPLETE: " + reason);
|
||||||
|
try { writer?.Dispose(); } catch (Exception error) when (OutputError(error)) { }
|
||||||
|
writer = null;
|
||||||
|
TrySummary(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TrySummary(bool success)
|
||||||
|
{
|
||||||
|
if (!ownsDirectory) return;
|
||||||
|
try { WriteSummary(success); }
|
||||||
|
catch (Exception error) when (OutputError(error))
|
||||||
|
{ Console.Error.WriteLine("Fidelity observation INCOMPLETE; summary unavailable: " + error.Message); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteSummary(bool success)
|
||||||
|
{
|
||||||
|
var target = Path.Combine(directory, "observation-summary.json");
|
||||||
|
var temporary = target + "." + Guid.NewGuid().ToString("N") + ".tmp";
|
||||||
|
var summary = new { schema_version = 1, session_id = session, case_id = caseId, evidence_kind = kind,
|
||||||
|
launch_id = launchId, clock_id = launchId + ":stopwatch", wall_start = wallStart, wall_end = DateTimeOffset.UtcNow,
|
||||||
|
elapsed_seconds = clock.Elapsed.TotalSeconds, records = sequence, bytes, incomplete = !success,
|
||||||
|
status = success ? "recorded" : "incomplete", failure,
|
||||||
|
diagnostic = true, observer_seconds = overhead, max_records = maxRecords, max_bytes = MaxBytes,
|
||||||
|
overhead_scope = "Record serialization/write attempts only; excludes caller snapshots, control comparisons, final flush and summaries",
|
||||||
|
limitations = new[] { "Diagnostic observer adds serialization, buffered disk writes and state-copy overhead; not a clean audiovisual capture.",
|
||||||
|
"Observation is not a receipt or an acceptance decision; fixture and native full-route evidence remain distinct.",
|
||||||
|
"No media clock mapping is inferred. Simulation ticks are scene-local and may reset across continuations.",
|
||||||
|
"Only named application seams are observed; fixture helper-internal steps are not a complete simulation trace." } };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stream = new FileStream(temporary, FileMode.CreateNew, FileAccess.Write, FileShare.None))
|
||||||
|
JsonSerializer.Serialize(stream, summary, Json);
|
||||||
|
File.Move(temporary, target, true);
|
||||||
|
}
|
||||||
|
finally { if (File.Exists(temporary)) File.Delete(temporary); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (disposed) return;
|
||||||
|
if (!completed) { Fail("Session ended without successful completion"); TrySummary(false); }
|
||||||
|
disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
+54
-16
@@ -15,6 +15,8 @@ internal static class Program
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
using var observation = args.Contains("--help") || !args.Contains("--fidelity-output") ? null : FidelityObservation.FromArguments(args,
|
||||||
|
Directory.GetCurrentDirectory(), AssetPath.FindOriginal(Option(args, "--assets")));
|
||||||
using var presentation = new RenderSession();
|
using var presentation = new RenderSession();
|
||||||
OriginalSave? carriedSave = null;
|
OriginalSave? carriedSave = null;
|
||||||
PlayerLevelState? carriedPlayer = null;
|
PlayerLevelState? carriedPlayer = null;
|
||||||
@@ -24,8 +26,8 @@ internal static class Program
|
|||||||
var grapplerMemory = new GrapplerMemory();
|
var grapplerMemory = new GrapplerMemory();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
var result = Run(args, carriedSave, carriedPlayer, returning, diagnostics, presentation, energy, grapplerMemory, out var continuation);
|
var result = Run(args, carriedSave, carriedPlayer, returning, diagnostics, presentation, energy, grapplerMemory, observation, out var continuation);
|
||||||
if (result != 0 || continuation == null) return result;
|
if (result != 0 || continuation == null) { observation?.Complete(result); return result; }
|
||||||
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
|
args = continuation.Args; carriedSave = continuation.Save; returning = continuation.Returning;
|
||||||
carriedPlayer = continuation.Player;
|
carriedPlayer = continuation.Player;
|
||||||
}
|
}
|
||||||
@@ -45,7 +47,7 @@ internal static class Program
|
|||||||
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning, PlayerLevelState? Player);
|
private sealed record SceneContinuation(string[] Args, OriginalSave Save, bool Returning, PlayerLevelState? Player);
|
||||||
|
|
||||||
private static int Run(string[] args, OriginalSave? carriedSave, PlayerLevelState? carriedPlayer, bool returning, DebugDiagnostics diagnostics,
|
private static int Run(string[] args, OriginalSave? carriedSave, PlayerLevelState? carriedPlayer, bool returning, DebugDiagnostics diagnostics,
|
||||||
RenderSession presentation, PlayerEnergy energy, GrapplerMemory grapplerMemory, out SceneContinuation? continuation)
|
RenderSession presentation, PlayerEnergy energy, GrapplerMemory grapplerMemory, FidelityObservation? observation, out SceneContinuation? continuation)
|
||||||
{
|
{
|
||||||
continuation = null;
|
continuation = null;
|
||||||
if (args.Contains("--help"))
|
if (args.Contains("--help"))
|
||||||
@@ -69,6 +71,9 @@ internal static class Program
|
|||||||
--start TAG Use a named original STRT checkpoint
|
--start TAG Use a named original STRT checkpoint
|
||||||
--load-save PATH Resume original TSK task/items/checkpoint state
|
--load-save PATH Resume original TSK task/items/checkpoint state
|
||||||
--write-save PATH Write checkpoint state as TSK outside asset directory
|
--write-save PATH Write checkpoint state as TSK outside asset directory
|
||||||
|
--fidelity-output PATH New local diagnostic session directory
|
||||||
|
--fidelity-session ID Stable session identity across scene continuations
|
||||||
|
--fidelity-case ID Declared comparison case; does not establish acceptance
|
||||||
--mute Disable scene audio
|
--mute Disable scene audio
|
||||||
--time SECONDS Fixed animation time for comparisons
|
--time SECONDS Fixed animation time for comparisons
|
||||||
--headless Render offscreen through Vulkan
|
--headless Render offscreen through Vulkan
|
||||||
@@ -336,6 +341,24 @@ internal static class Program
|
|||||||
var debugCheckpointFile = toolsSmoke ? Path.GetFullPath("artifacts/debug-expansion/checkpoint.tsk")
|
var debugCheckpointFile = toolsSmoke ? Path.GetFullPath("artifacts/debug-expansion/checkpoint.tsk")
|
||||||
: Path.Combine(AppContext.BaseDirectory, "debug-checkpoint.tsk");
|
: Path.Combine(AppContext.BaseDirectory, "debug-checkpoint.tsk");
|
||||||
Vector3 returnRoot = loadedSave?.StoredVector ?? Vector3.Zero;
|
Vector3 returnRoot = loadedSave?.StoredVector ?? Vector3.Zero;
|
||||||
|
void ObserveControl(string boundary)
|
||||||
|
{
|
||||||
|
if (observation != null && director != null)
|
||||||
|
observation.RecordControl(level!.Code, simulation?.Steps ?? 0, director.Controlled,
|
||||||
|
director.ControlledTag, director.Playing, director.CurrentTag, boundary);
|
||||||
|
}
|
||||||
|
void SkipObservedDialogue(string source)
|
||||||
|
{
|
||||||
|
ObserveControl("before_skip");
|
||||||
|
director!.Skip();
|
||||||
|
ObserveControl("skip:" + source);
|
||||||
|
}
|
||||||
|
void StepObservedDirector(float delta)
|
||||||
|
{
|
||||||
|
ObserveControl("before_director_step");
|
||||||
|
director?.Step(delta);
|
||||||
|
ObserveControl("director_step");
|
||||||
|
}
|
||||||
void RequestTransition(LevelTransition request)
|
void RequestTransition(LevelTransition request)
|
||||||
{
|
{
|
||||||
if (transitionRequest != null) return;
|
if (transitionRequest != null) return;
|
||||||
@@ -588,6 +611,8 @@ internal static class Program
|
|||||||
var renderer = presentation.LoadScene(mesh, texture, headless,
|
var renderer = presentation.LoadScene(mesh, texture, headless,
|
||||||
walking ? WalkTitle : animations?.WindowTitle ?? "Jimmy Neutron — scene preview | C camera",
|
walking ? WalkTitle : animations?.WindowTitle ?? "Jimmy Neutron — scene preview | C camera",
|
||||||
width, height, !args.Contains("--no-validation"));
|
width, height, !args.Contains("--no-validation"));
|
||||||
|
observation?.RecordSceneEntry(level?.Code ?? "preview", simulation?.Steps ?? 0, returning,
|
||||||
|
carriedPlayer != null, carriedSave != null ? "retained" : loadedSave != null ? "tsk-story" : "fresh-direct-scene");
|
||||||
var window = presentation.Window;
|
var window = presentation.Window;
|
||||||
ShrinkSoldier? shrinkVictim = null;
|
ShrinkSoldier? shrinkVictim = null;
|
||||||
var shrinkPhaseMask = 0;
|
var shrinkPhaseMask = 0;
|
||||||
@@ -663,6 +688,7 @@ internal static class Program
|
|||||||
sceneAudio.Music(originalStart!.Text("MusicDatabase") ?? "none", originalStart.Integer("MusicIndex", -1));
|
sceneAudio.Music(originalStart!.Text("MusicDatabase") ?? "none", originalStart.Integer("MusicIndex", -1));
|
||||||
}
|
}
|
||||||
director.Begin(originalStart!, activateStartTrigger: !returning);
|
director.Begin(originalStart!, activateStartTrigger: !returning);
|
||||||
|
ObserveControl("scene_begin");
|
||||||
gadgets?.Reset();
|
gadgets?.Reset();
|
||||||
baseballs?.Reset();
|
baseballs?.Reset();
|
||||||
interactions!.Reset();
|
interactions!.Reset();
|
||||||
@@ -680,7 +706,7 @@ internal static class Program
|
|||||||
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}, retained player input order={simulation.InputAfterPlayerUpdate}, gadget availability={interactions.Inventory.State(0, 3)}.");
|
Console.WriteLine($"Practice RETURN: exact saved root={restored}, root={simulation.ActorRoot}, STRT yaw={simulation.Yaw}, intro suppressed={!director.Playing}, companion restored={companionRestored}, retained player input order={simulation.InputAfterPlayerUpdate}, gadget availability={interactions.Inventory.State(0, 3)}.");
|
||||||
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
|
if (!restored) throw new InvalidOperationException("RETURN did not restore the live departure root without replaying STRT actions");
|
||||||
}
|
}
|
||||||
if (args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke || grapplerSmoke || scooterSmoke || gadgetWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); director.Skip(); }
|
if (args.Contains("--skip-intro") || jetpackSmoke || shrinkSmoke || invisibleSmoke || bubbleSmoke || baseballSmoke || rocketSmoke || grapplerSmoke || scooterSmoke || gadgetWindowSmoke || debugSmoke || diagnosticsSmoke || toolsSmoke || controlPhaseSmoke) { sceneAudio?.StopSpeech(); SkipObservedDialogue("startup-option-or-fixture"); }
|
||||||
if (gadgetWindowSmoke) { interactions!.Inventory.SetState(0,3,1); interactions.Inventory.SelectGadget(3); }
|
if (gadgetWindowSmoke) { interactions!.Inventory.SetState(0,3,1); interactions.Inventory.SelectGadget(3); }
|
||||||
if (controlPhaseSmoke)
|
if (controlPhaseSmoke)
|
||||||
{
|
{
|
||||||
@@ -705,13 +731,13 @@ internal static class Program
|
|||||||
{
|
{
|
||||||
if (interactions!.Inventory.State(0, 3) != 1)
|
if (interactions!.Inventory.State(0, 3) != 1)
|
||||||
throw new InvalidOperationException("VR04 PostLoad tail did not re-enable its owned practice jetpack");
|
throw new InvalidOperationException("VR04 PostLoad tail did not re-enable its owned practice jetpack");
|
||||||
director.Skip();
|
SkipObservedDialogue("fixture-setup");
|
||||||
interactions!.Update(level.Entities.First(e => e.Kind == "LOAD").Position);
|
interactions!.Update(level.Entities.First(e => e.Kind == "LOAD").Position);
|
||||||
if (transitionRequest is not { Returning: true }) throw new InvalidOperationException("VR04 exit did not preserve RETURN identity");
|
if (transitionRequest is not { Returning: true }) throw new InvalidOperationException("VR04 exit did not preserve RETURN identity");
|
||||||
}
|
}
|
||||||
if (args.Contains("--smoke-transition"))
|
if (args.Contains("--smoke-transition"))
|
||||||
{
|
{
|
||||||
director.Skip();
|
SkipObservedDialogue("fixture-setup");
|
||||||
interactions!.Update(level!.Entities.First(e => e.Kind == "LOAD").Position);
|
interactions!.Update(level!.Entities.First(e => e.Kind == "LOAD").Position);
|
||||||
if (transitionRequest == null) throw new InvalidOperationException("Original VR01 RETURN contact did not request a transition");
|
if (transitionRequest == null) throw new InvalidOperationException("Original VR01 RETURN contact did not request a transition");
|
||||||
}
|
}
|
||||||
@@ -724,9 +750,9 @@ internal static class Program
|
|||||||
if (carlSmoke) LabRouteSmoke.StartCarl(level!, director, interactions!, () => practice.Key(17, Vector2.Zero));
|
if (carlSmoke) LabRouteSmoke.StartCarl(level!, director, interactions!, () => practice.Key(17, Vector2.Zero));
|
||||||
if (objectiveSmoke)
|
if (objectiveSmoke)
|
||||||
{
|
{
|
||||||
director.Skip();
|
SkipObservedDialogue("fixture-setup");
|
||||||
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
||||||
director.Skip();
|
SkipObservedDialogue("fixture-setup");
|
||||||
if (interactions!.CurrentObjective != 1) throw new InvalidOperationException("Original explanation did not assign objective1");
|
if (interactions!.CurrentObjective != 1) throw new InvalidOperationException("Original explanation did not assign objective1");
|
||||||
if (objectiveWindowSmoke) objectivePanel!.Step(9);
|
if (objectiveWindowSmoke) objectivePanel!.Step(9);
|
||||||
}
|
}
|
||||||
@@ -734,7 +760,7 @@ internal static class Program
|
|||||||
|| practiceReturnSmoke && level.Code == "LV1B" && !returning)
|
|| practiceReturnSmoke && level.Code == "LV1B" && !returning)
|
||||||
{
|
{
|
||||||
if ((!headless && !practiceWindowSmoke) || level?.Code != "LV1B") throw new ArgumentException("Practice smoke requires the original lab");
|
if ((!headless && !practiceWindowSmoke) || level?.Code != "LV1B") throw new ArgumentException("Practice smoke requires the original lab");
|
||||||
director.Skip();
|
SkipObservedDialogue("fixture-setup");
|
||||||
if (practiceReturnSmoke)
|
if (practiceReturnSmoke)
|
||||||
{
|
{
|
||||||
// Move the real player away from STRT so an accidental
|
// Move the real player away from STRT so an accidental
|
||||||
@@ -743,7 +769,7 @@ internal static class Program
|
|||||||
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, simulation.Rotation);
|
director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, simulation.Rotation);
|
||||||
}
|
}
|
||||||
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
director.Touch(level!.Player!.Tag!, level.Entities.Single(e => e.Tag == "teleportexplanation").Position);
|
||||||
director.Skip();
|
SkipObservedDialogue("fixture-setup");
|
||||||
interactions!.Update(director.FindActor("shrinkray")!.Position);
|
interactions!.Update(director.FindActor("shrinkray")!.Position);
|
||||||
if (!practice.Active) throw new InvalidOperationException("Original lab pickup did not open practice modal");
|
if (!practice.Active) throw new InvalidOperationException("Original lab pickup did not open practice modal");
|
||||||
if (args.Contains("--smoke-practice-transition") || practiceReturnSmoke) practice.Key(28, Vector2.Zero);
|
if (args.Contains("--smoke-practice-transition") || practiceReturnSmoke) practice.Key(28, Vector2.Zero);
|
||||||
@@ -756,7 +782,7 @@ internal static class Program
|
|||||||
interactions!.UpdateEnergy(simulation!.Energy);
|
interactions!.UpdateEnergy(simulation!.Energy);
|
||||||
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
||||||
mechanisms!.Step(FixedStepClock.Step);
|
mechanisms!.Step(FixedStepClock.Step);
|
||||||
director.Step(FixedStepClock.Step);
|
StepObservedDirector(FixedStepClock.Step);
|
||||||
objectivePanel!.Step(FixedStepClock.Step, director.ControlledTag != null, practice.Active);
|
objectivePanel!.Step(FixedStepClock.Step, director.ControlledTag != null, practice.Active);
|
||||||
if (animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)) initialPoseTime = 0;
|
if (animations!.SelectAction(director.FindActor(level!.Player!.Tag!)!.Animation)) initialPoseTime = 0;
|
||||||
initialPoseTime += FixedStepClock.Step;
|
initialPoseTime += FixedStepClock.Step;
|
||||||
@@ -874,6 +900,7 @@ internal static class Program
|
|||||||
if (simulation == null) { debugMenu.Message = "RESET REQUIRES PLAY MODE"; return; }
|
if (simulation == null) { debugMenu.Message = "RESET REQUIRES PLAY MODE"; return; }
|
||||||
if (practice.Active) practice.Key(17, Vector2.Zero);
|
if (practice.Active) practice.Key(17, Vector2.Zero);
|
||||||
playerBinding?.ResetVehicle();simulation.Reset(); poseTime = 0; sceneAudio?.StopSpeech(); director?.Begin(originalStart!);
|
playerBinding?.ResetVehicle();simulation.Reset(); poseTime = 0; sceneAudio?.StopSpeech(); director?.Begin(originalStart!);
|
||||||
|
ObserveControl("reset_begin");
|
||||||
rocketship?.Reset();
|
rocketship?.Reset();
|
||||||
if(scooter!=null)
|
if(scooter!=null)
|
||||||
{
|
{
|
||||||
@@ -909,7 +936,7 @@ internal static class Program
|
|||||||
case DebugAction.Camera: ToggleCamera(); debugMenu.Close(); break;
|
case DebugAction.Camera: ToggleCamera(); debugMenu.Close(); break;
|
||||||
case DebugAction.SkipCutscene:
|
case DebugAction.SkipCutscene:
|
||||||
if (director is { Playing: true } or { Blocked: true }||director is{Controlled:false}&&rocketship?.Mounted!=true)
|
if (director is { Playing: true } or { Blocked: true }||director is{Controlled:false}&&rocketship?.Mounted!=true)
|
||||||
{ sceneAudio?.StopSpeech(); director.Skip(); debugMenu.Message = "CUTSCENE SKIPPED"; }
|
{ sceneAudio?.StopSpeech(); SkipObservedDialogue("debug-menu"); debugMenu.Message = "CUTSCENE SKIPPED"; }
|
||||||
else debugMenu.Message = "NO ACTIVE CUTSCENE";
|
else debugMenu.Message = "NO ACTIVE CUTSCENE";
|
||||||
break;
|
break;
|
||||||
case DebugAction.RefillEnergy when simulation != null:
|
case DebugAction.RefillEnergy when simulation != null:
|
||||||
@@ -1132,6 +1159,10 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
while (!headless && Sdl.SDL_PollEvent(out var e))
|
while (!headless && Sdl.SDL_PollEvent(out var e))
|
||||||
{
|
{
|
||||||
|
observation?.RecordRawEvent(level?.Code ?? "preview", simulation?.Steps ?? 0,
|
||||||
|
e.Type, e.Type is Sdl.KeyDown or Sdl.KeyUp ? e.Scancode : null,
|
||||||
|
e.Type is Sdl.MouseButtonDown or Sdl.MouseButtonUp ? e.MouseButton : null,
|
||||||
|
e.Type is Sdl.KeyDown or Sdl.KeyUp ? e.Repeat : null);
|
||||||
if(scooterSmoke&&e.Type==Sdl.KeyDown)
|
if(scooterSmoke&&e.Type==Sdl.KeyDown)
|
||||||
sawScooterKeys|=e.Scancode switch{81=>1,82=>2,80=>4,225=>8,43=>16,60=>32,21=>64,_=>0};
|
sawScooterKeys|=e.Scancode switch{81=>1,82=>2,80=>4,225=>8,43=>16,60=>32,21=>64,_=>0};
|
||||||
if(grapplerSmoke&&e.Type==Sdl.KeyDown)
|
if(grapplerSmoke&&e.Type==Sdl.KeyDown)
|
||||||
@@ -1225,7 +1256,7 @@ internal static class Program
|
|||||||
if (smoke && e.Scancode == 79) sawKey = true;
|
if (smoke && e.Scancode == 79) sawKey = true;
|
||||||
if (e.Scancode is 41 or 44 && e.Repeat == 0 && director is { Controlled: false }&&rocketship?.Mounted!=true
|
if (e.Scancode is 41 or 44 && e.Repeat == 0 && director is { Controlled: false }&&rocketship?.Mounted!=true
|
||||||
&& (e.Scancode != 44 || simulation?.Noclip != true))
|
&& (e.Scancode != 44 || simulation?.Noclip != true))
|
||||||
{ sceneAudio?.StopSpeech(); director.Skip(); keys.Clear(); mouseJump = false; }
|
{ sceneAudio?.StopSpeech(); SkipObservedDialogue("sdl-key-" + e.Scancode); keys.Clear(); mouseJump = false; }
|
||||||
else if (e.Scancode == 41) running = false;
|
else if (e.Scancode == 41) running = false;
|
||||||
if (inspecting && e.Repeat == 0 && animations?.Select(e.Scancode) == true)
|
if (inspecting && e.Repeat == 0 && animations?.Select(e.Scancode) == true)
|
||||||
{
|
{
|
||||||
@@ -1294,6 +1325,12 @@ internal static class Program
|
|||||||
bool acceptsInput;
|
bool acceptsInput;
|
||||||
if (playerBinding != null) acceptsInput = playerBinding.Step(input);
|
if (playerBinding != null) acceptsInput = playerBinding.Step(input);
|
||||||
else { simulation.Step(input); acceptsInput = true; }
|
else { simulation.Step(input); acceptsInput = true; }
|
||||||
|
observation?.RecordInput(level?.Code ?? "preview", simulation.Steps, input, acceptsInput,
|
||||||
|
director?.ControlledTag ?? (playerBinding == null ? "direct-simulation" : "script"));
|
||||||
|
observation?.RecordState(level?.Code ?? "preview", simulation.Steps, simulation.ActorRoot,
|
||||||
|
simulation.Rotation, simulation.Velocity, simulation.Grounded, simulation.MovementMode,
|
||||||
|
simulation.InputAfterPlayerUpdate, simulation.ControllerSteps, simulation.PhysicsSteps, simulation.EffectSteps);
|
||||||
|
ObserveControl("player_step");
|
||||||
scooterFixture?.Received(input);
|
scooterFixture?.Received(input);
|
||||||
grapplerFixture?.Received(input);
|
grapplerFixture?.Received(input);
|
||||||
rocketFixture?.Received(input);
|
rocketFixture?.Received(input);
|
||||||
@@ -1317,7 +1354,7 @@ internal static class Program
|
|||||||
}
|
}
|
||||||
mechanisms?.Step(FixedStepClock.Step);
|
mechanisms?.Step(FixedStepClock.Step);
|
||||||
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
foreach (var patrol in patrols.Values) patrol.Step(FixedStepClock.Step);
|
||||||
director?.Step(FixedStepClock.Step);
|
StepObservedDirector(FixedStepClock.Step);
|
||||||
objectivePanel?.Key(keys.Contains(18) && director is { Controlled: true, InventoryEnabled: true });
|
objectivePanel?.Key(keys.Contains(18) && director is { Controlled: true, InventoryEnabled: true });
|
||||||
objectivePanel?.Step(FixedStepClock.Step, director?.ControlledTag != null, practice.Active);
|
objectivePanel?.Step(FixedStepClock.Step, director?.ControlledTag != null, practice.Active);
|
||||||
var switched = director is { Controlled: false } && !simulation.Noclip
|
var switched = director is { Controlled: false } && !simulation.Noclip
|
||||||
@@ -1518,8 +1555,8 @@ internal static class Program
|
|||||||
&& simulation.Energy < 20 && Vector2.Distance(new(simulation.ActorRoot.X, simulation.ActorRoot.Z), new(controlEntry.X, controlEntry.Z)) < .001f;
|
&& simulation.Energy < 20 && Vector2.Distance(new(simulation.ActorRoot.X, simulation.ActorRoot.Z), new(controlEntry.X, controlEntry.Z)) < .001f;
|
||||||
CutsceneIdleSmoke.LandWhileLocked(playerBinding!, director!, simulation!);
|
CutsceneIdleSmoke.LandWhileLocked(playerBinding!, director!, simulation!);
|
||||||
sceneAudio?.StopSpeech();
|
sceneAudio?.StopSpeech();
|
||||||
director!.Skip();
|
SkipObservedDialogue("control-phase-fixture");
|
||||||
CutsceneIdleSmoke.VerifyReturn(playerBinding!, director, simulation!);
|
CutsceneIdleSmoke.VerifyReturn(playerBinding!, director!, simulation!);
|
||||||
controlControllers = simulation!.ControllerSteps;
|
controlControllers = simulation!.ControllerSteps;
|
||||||
}
|
}
|
||||||
if (controlPhaseSmoke && count == 30)
|
if (controlPhaseSmoke && count == 30)
|
||||||
@@ -1866,6 +1903,7 @@ internal static class Program
|
|||||||
continuation = new(nextArgs.ToArray(), (debugCheckpointToLoad ?? interactions!.Snapshot()) with {
|
continuation = new(nextArgs.ToArray(), (debugCheckpointToLoad ?? interactions!.Snapshot()) with {
|
||||||
StartPoint = transitionRequest.StartPoint, StoredVector = debugCheckpointToLoad?.StoredVector ?? returnRoot }, transitionRequest.Returning,
|
StartPoint = transitionRequest.StartPoint, StoredVector = debugCheckpointToLoad?.StoredVector ?? returnRoot }, transitionRequest.Returning,
|
||||||
debugCheckpointToLoad == null ? simulation?.CaptureLevelState(interactions!.Inventory.SelectedGadget) : null);
|
debugCheckpointToLoad == null ? simulation?.CaptureLevelState(interactions!.Inventory.SelectedGadget) : null);
|
||||||
|
observation?.RecordTransition(level!.Code, transitionRequest.LevelFile, simulation?.Steps ?? 0, transitionRequest.Returning);
|
||||||
Console.WriteLine($"Loading original destination: {transitionRequest.LevelFile}, start={transitionRequest.StartPoint}; fade behavior remains unreconstructed.");
|
Console.WriteLine($"Loading original destination: {transitionRequest.LevelFile}, start={transitionRequest.StartPoint}; fade behavior remains unreconstructed.");
|
||||||
}
|
}
|
||||||
if (walkSmoke && !simulation!.SmokePassed) return 2;
|
if (walkSmoke && !simulation!.SmokePassed) return 2;
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Application/FidelityObservation.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Assets/*.cs"/>
|
||||||
|
<Compile Include="../../src/GamePort/Game/*.cs"/>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
using System.Text.Json;
|
||||||
|
using System.Numerics;
|
||||||
|
using GamePort.Assets;
|
||||||
|
using GamePort.Application;
|
||||||
|
using GamePort.Game;
|
||||||
|
|
||||||
|
var root = Path.Combine(Path.GetTempPath(), "gameport-observer-tests-" + Guid.NewGuid().ToString("N"));
|
||||||
|
Directory.CreateDirectory(root);
|
||||||
|
var checks = 0;
|
||||||
|
void Check(bool value, string message) { if (!value) throw new Exception(message); checks++; }
|
||||||
|
FidelityObservation Open(string name, int limit = 250000, TextWriter? sink = null) =>
|
||||||
|
FidelityObservation.Create(Path.Combine(root, name), "session-1", "fresh-natural-edge", "port_fixture",
|
||||||
|
Path.GetFullPath("."), Path.Combine(root, "Original"), limit, sink);
|
||||||
|
JsonElement[] Events(string name) => File.ReadAllLines(Path.Combine(root, name, "events.jsonl"))
|
||||||
|
.Select(line => JsonDocument.Parse(line).RootElement.Clone()).ToArray();
|
||||||
|
JsonElement Summary(string name) => JsonDocument.Parse(File.ReadAllText(Path.Combine(root, name, "observation-summary.json"))).RootElement.Clone();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Check(FidelityObservation.FromArguments([], ".", Path.Combine(root, "Original")) == null, "disabled must allocate no observer");
|
||||||
|
using (var observer = Open("identity"))
|
||||||
|
{
|
||||||
|
observer.RecordInput("LV1B", 17, new(true, false, true, false, true), false, "script");
|
||||||
|
observer.RecordInput("LV1B", 18, default, true, "Jimmy");
|
||||||
|
observer.Complete(0);
|
||||||
|
}
|
||||||
|
var records = Events("identity");
|
||||||
|
Check(records.All(e => e.GetProperty("session_id").GetString() == "session-1" && e.GetProperty("case_id").GetString() == "fresh-natural-edge"), "identity must be bound");
|
||||||
|
Check(records[1].GetProperty("elapsed_seconds").GetDouble() >= records[0].GetProperty("elapsed_seconds").GetDouble(), "one monotonic clock");
|
||||||
|
Check(records[0].GetProperty("data").GetProperty("requested_input").GetProperty("forward").GetBoolean()
|
||||||
|
&& !records[0].GetProperty("data").GetProperty("accepts_input").GetBoolean()
|
||||||
|
&& records[0].GetProperty("data").GetProperty("accepted_input").ValueKind == JsonValueKind.Null, "requested is distinct from accepted");
|
||||||
|
Check(records[0].GetProperty("simulation_tick").GetInt32() == 17 && records[0].GetProperty("data").GetProperty("control_owner").GetString() == "script", "owner and simulation tick are separate");
|
||||||
|
using (var observer = Open("bounded", 1))
|
||||||
|
{ observer.RecordInput("LV1B", 1, default, true, "Jimmy"); observer.RecordInput("LV1B", 2, default, true, "Jimmy"); observer.Complete(0); }
|
||||||
|
Check(Events("bounded").Length == 1 && Summary("bounded").GetProperty("incomplete").GetBoolean(), "record limit must mark incomplete");
|
||||||
|
using (var observer = Open("failure", sink: new BrokenWriter()))
|
||||||
|
{ observer.RecordInput("LV1B", 1, default, true, "Jimmy"); observer.Complete(0); }
|
||||||
|
Check(Summary("failure").GetProperty("incomplete").GetBoolean(), "write error must not escape or claim completion");
|
||||||
|
var disposed = Open("disposed"); disposed.Dispose(); disposed.Dispose(); disposed.RecordInput("LV1B", 1, default, true, "Jimmy");
|
||||||
|
Check(Summary("disposed").GetProperty("incomplete").GetBoolean(), "disposal without completion remains incomplete and idempotent");
|
||||||
|
Check(!Summary("identity").GetProperty("incomplete").GetBoolean(), "successful flush and complete");
|
||||||
|
var rejected = false;
|
||||||
|
try { using var duplicate = Open("identity"); } catch (IOException) { rejected = true; }
|
||||||
|
Check(rejected, "existing sessions cannot be overwritten");
|
||||||
|
using (var observer = Open("continuation"))
|
||||||
|
{
|
||||||
|
observer.RecordSceneEntry("LV1B", 0, false, false, "tsk-story");
|
||||||
|
observer.RecordControl("LV1B", 0, false, null, true, "Carl", "owner_snapshot");
|
||||||
|
observer.RecordInput("LV1B", 1, new(true, false, false, false, false), false, "script");
|
||||||
|
observer.RecordControl("LV1B", 1, true, "Jimmy", false, null, "director_step");
|
||||||
|
observer.RecordInput("LV1B", 2, default, true, "Jimmy");
|
||||||
|
observer.RecordTransition("LV1B", "VR04.gam", 2, false);
|
||||||
|
observer.RecordSceneEntry("VR04", 0, false, true, "retained");
|
||||||
|
observer.RecordControl("VR04", 0, false, null, true, "Intro", "owner_snapshot");
|
||||||
|
observer.RecordControl("VR04", 0, true, "Jimmy", false, null, "skip:test");
|
||||||
|
observer.RecordTransition("VR04", "LV1B.gam", 0, true);
|
||||||
|
observer.RecordSceneEntry("LV1B", 0, true, true, "retained");
|
||||||
|
observer.Complete(0);
|
||||||
|
}
|
||||||
|
var continuation = Events("continuation");
|
||||||
|
Check(continuation.Any(e => e.GetProperty("name").GetString() == "dialogue_end" && e.GetProperty("method").GetString() == "natural_director_step"), "natural completion has actual director-step method");
|
||||||
|
Check(continuation.Any(e => e.GetProperty("name").GetString() == "dialogue_skip" && e.GetProperty("method").GetString() == "skip:test"), "skip is an explicit action path");
|
||||||
|
Check(continuation.Where(e => e.GetProperty("name").GetString() == "input_step").Last().GetProperty("data").GetProperty("accepted_input").GetProperty("forward").GetBoolean() == false, "first accepted neutral is copied without mutation");
|
||||||
|
Check(continuation.Select(e => e.GetProperty("sequence").GetInt64()).SequenceEqual(Enumerable.Range(1, continuation.Length).Select(i => (long)i)), "ordered transitions share sequence");
|
||||||
|
Check(continuation.Last().GetProperty("scene").GetString() == "LV1B" && continuation.Last().GetProperty("data").GetProperty("returning").GetBoolean(), "RETURN and arrival remain paired");
|
||||||
|
Check(continuation.Zip(continuation.Skip(1)).All(p => p.First.GetProperty("elapsed_seconds").GetDouble() <= p.Second.GetProperty("elapsed_seconds").GetDouble()), "clock survives scene tick reset");
|
||||||
|
using (var fresh = FidelityObservation.Create(Path.Combine(root, "fresh"), "independent-session", "fresh-natural-ordinary", "port_fixture", ".", Path.Combine(root, "Original")))
|
||||||
|
{ fresh.RecordSceneEntry("LV1B", 0, false, false, "fresh-direct-scene"); fresh.Complete(0); }
|
||||||
|
Check(Events("fresh")[0].GetProperty("clock_id").GetString() != continuation[0].GetProperty("clock_id").GetString()
|
||||||
|
&& Events("fresh")[0].GetProperty("simulation_tick").GetInt32() == 0 && !Summary("fresh").GetProperty("incomplete").GetBoolean(), "fresh observer owns independent clock from scene ticks");
|
||||||
|
rejected = false;
|
||||||
|
try { using var invalid = FidelityObservation.Create(Path.Combine(root, "Original", "unsafe"), "safe", "case", "port_fixture", ".", Path.Combine(root, "Original")); } catch (ArgumentException) { rejected = true; }
|
||||||
|
Check(rejected && !Directory.Exists(Path.Combine(root, "Original")), "original overlap rejected before write");
|
||||||
|
using (var failedFlush = Open("flush", sink: new FlushFailureWriter())) { failedFlush.RecordInput("LV1B", 1, default, true, "Jimmy"); failedFlush.Complete(0); }
|
||||||
|
Check(Summary("flush").GetProperty("incomplete").GetBoolean(), "flush failure cannot claim success");
|
||||||
|
Check(continuation.Where(e => e.GetProperty("name").GetString() == "scene_entry").Skip(1)
|
||||||
|
.All(e => continuation.Any(d => d.GetProperty("name").GetString() == "scene_departure"
|
||||||
|
&& d.GetProperty("sequence").GetInt64() == e.GetProperty("data").GetProperty("departure_sequence").GetInt64())), "arrival links actual departure sequence");
|
||||||
|
if (!OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.Combine(root, "Original"));
|
||||||
|
Directory.CreateSymbolicLink(Path.Combine(root, "asset-alias"), Path.Combine(root, "Original"));
|
||||||
|
rejected = false;
|
||||||
|
try { using var invalid = FidelityObservation.Create(Path.Combine(root, "Original", "unsafe"), "safe", "case", "port_fixture", ".", Path.Combine(root, "asset-alias")); } catch (ArgumentException) { rejected = true; }
|
||||||
|
Check(rejected && !Directory.Exists(Path.Combine(root, "Original", "unsafe")), "asset aliases cannot bypass original containment");
|
||||||
|
rejected = false;
|
||||||
|
try { using var invalid = FidelityObservation.Create(Path.Combine(root, "asset-alias", "unsafe"), "safe", "case", "port_fixture", ".", Path.Combine(root, "unrelated")); } catch (ArgumentException) { rejected = true; }
|
||||||
|
Check(rejected, "output cannot traverse symbolic-link ancestors");
|
||||||
|
}
|
||||||
|
var positions = new[] { new Vector3(-100000, 0, -100000), new Vector3(-100000, 0, 100000), new Vector3(100000, 0, 100000),
|
||||||
|
new Vector3(-100000, 0, -100000), new Vector3(100000, 0, 100000), new Vector3(100000, 0, -100000) };
|
||||||
|
var floor = new Mesh(positions.Select(p => new MeshVertex(p, Vector2.Zero, Vector3.One)).ToArray(), [0, 1, 2, 3, 4, 5]);
|
||||||
|
var standing = new Mesh([new(new(-20, -20, -20), Vector2.Zero, Vector3.One), new(new(20, 80, 20), Vector2.Zero, Vector3.One)], []);
|
||||||
|
var off = new LabSimulation(new SceneCollision(floor), standing, new Vector3(0, 25, 0), 0f);
|
||||||
|
var failed = new LabSimulation(new SceneCollision(floor), standing, new Vector3(0, 25, 0), 0f);
|
||||||
|
using (var observer = Open("failed-simulation", sink: new BrokenWriter()))
|
||||||
|
{
|
||||||
|
for (var tick = 0; tick < 120; tick++)
|
||||||
|
{
|
||||||
|
var input = new PlayerInput(tick < 80, false, tick > 15 && tick < 45, false, tick < 20);
|
||||||
|
off.Step(input); failed.Step(input);
|
||||||
|
observer.RecordInput("fixture-floor", failed.Steps, input, true, "Jimmy");
|
||||||
|
observer.RecordState("fixture-floor", failed.Steps, failed.ActorRoot, failed.Rotation, failed.Velocity,
|
||||||
|
failed.Grounded, failed.MovementMode, failed.InputAfterPlayerUpdate, failed.ControllerSteps, failed.PhysicsSteps, failed.EffectSteps);
|
||||||
|
}
|
||||||
|
observer.Complete(0);
|
||||||
|
}
|
||||||
|
Check(off.ActorRoot == failed.ActorRoot && off.Rotation == failed.Rotation && off.Velocity == failed.Velocity
|
||||||
|
&& off.Steps == failed.Steps && off.ControllerSteps == failed.ControllerSteps && off.PhysicsSteps == failed.PhysicsSteps
|
||||||
|
&& off.EffectSteps == failed.EffectSteps && Summary("failed-simulation").GetProperty("incomplete").GetBoolean(),
|
||||||
|
"write failure preserves actual 120-step movement/body/effect state exactly");
|
||||||
|
Console.WriteLine($"Fidelity observation checks: {checks} passed");
|
||||||
|
}
|
||||||
|
finally { Directory.Delete(root, true); }
|
||||||
|
|
||||||
|
sealed class BrokenWriter : StringWriter
|
||||||
|
{
|
||||||
|
public override void WriteLine(string? value) => throw new IOException("deliberate output failure");
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class FlushFailureWriter : StringWriter
|
||||||
|
{
|
||||||
|
protected override void Dispose(bool disposing) => throw new IOException("deliberate flush failure");
|
||||||
|
}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
"""Actual port-process observation plumbing; fixtures never fill native acceptance."""
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0, str(ROOT / 'tools/recon'))
|
||||||
|
import fidelity_receipts as receipts
|
||||||
|
|
||||||
|
|
||||||
|
class FidelityObservation(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
result = subprocess.run(['bash', '-lc', 'source scripts/env.sh && dotnet build GamePort.csproj --no-restore'],
|
||||||
|
cwd=ROOT, capture_output=True, text=True, timeout=90)
|
||||||
|
if result.returncode:
|
||||||
|
raise RuntimeError(result.stdout + result.stderr)
|
||||||
|
required = ['level1b/scene.json', 'VR04/scene.json', 'ui/ui.json', 'animations/jimstop/animation.json']
|
||||||
|
if not all((ROOT / 'artifacts/extracted' / name).is_file() for name in required):
|
||||||
|
# The consolidated script runs Python before its preparation step.
|
||||||
|
# Reuse its local extractor instead of assuming generated fixtures exist.
|
||||||
|
result = subprocess.run([sys.executable, 'tools/extractors/prepare.py', '--all-scenes',
|
||||||
|
'--audio', 'sounds', 'musicsecretlab'], cwd=ROOT,
|
||||||
|
capture_output=True, text=True, timeout=300)
|
||||||
|
if result.returncode:
|
||||||
|
raise RuntimeError(result.stdout + result.stderr)
|
||||||
|
|
||||||
|
def run_port(self, *args):
|
||||||
|
# Fixed shell source; caller values are positional argv, never shell code.
|
||||||
|
return subprocess.run(['bash', '-lc', 'source scripts/env.sh && dotnet bin/Debug/net10.0/GamePort.dll "$@"',
|
||||||
|
'observer-test', *map(str, args)], cwd=ROOT, text=True,
|
||||||
|
capture_output=True, timeout=90)
|
||||||
|
|
||||||
|
def test_real_port_exposes_observation_options(self):
|
||||||
|
result = self.run_port('--help')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertIn('--fidelity-output', result.stdout, 'actual port must expose passive observation')
|
||||||
|
self.assertIn('--fidelity-session', result.stdout)
|
||||||
|
self.assertIn('--fidelity-case', result.stdout)
|
||||||
|
|
||||||
|
def fixture(self, directory, observed=True):
|
||||||
|
args = ['--headless', '--mute', '--no-validation', '--smoke-control-phases',
|
||||||
|
'--width', '320', '--height', '240', '--screenshot', directory / 'frame.ppm']
|
||||||
|
if observed:
|
||||||
|
args += ['--fidelity-output', directory / 'observation', '--fidelity-session', 'process-session',
|
||||||
|
'--fidelity-case', 'fresh-skipped-edge']
|
||||||
|
result = self.run_port(*args)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def observed_fixture(self):
|
||||||
|
temporary = tempfile.TemporaryDirectory(prefix='gameport-observer-')
|
||||||
|
self.addCleanup(temporary.cleanup)
|
||||||
|
root = Path(temporary.name)
|
||||||
|
result = self.fixture(root)
|
||||||
|
output = root / 'observation'
|
||||||
|
summary = json.loads((output / 'observation-summary.json').read_text())
|
||||||
|
records = [json.loads(line) for line in (output / 'events.jsonl').read_text().splitlines()]
|
||||||
|
self.assertTrue(records, 'real process must emit records')
|
||||||
|
return root, output, summary, records, result
|
||||||
|
|
||||||
|
def receipt(self, output, summary, records):
|
||||||
|
duration = summary['elapsed_seconds']
|
||||||
|
return dict(schema_version=1, receipt_id='observer-fixture', session_id=summary['session_id'],
|
||||||
|
case_id=summary['case_id'], evidence_kind=summary['evidence_kind'], status='captured',
|
||||||
|
platform={'os': 'linux', 'execution': 'port_fixture'}, historical=False,
|
||||||
|
scope='observer-wiring', identity={}, invocation={'argv': ['bounded-existing-fixture'], 'cwd': '.'},
|
||||||
|
clocks={'wall_start': summary['wall_start'], 'wall_end': summary['wall_end'],
|
||||||
|
'monotonic_start': 0, 'monotonic_end': duration},
|
||||||
|
artifacts=[dict(receipts.identify_file(output / 'events.jsonl'), path='events.jsonl',
|
||||||
|
role='input_events', duration_seconds=duration)], derivatives=[],
|
||||||
|
events=[dict(name=e['name'], artifact='events.jsonl', media_seconds=e['elapsed_seconds'],
|
||||||
|
elapsed_seconds=e['elapsed_seconds'], method=e['method'], uncertainty_seconds=0,
|
||||||
|
simulation_tick=e['simulation_tick']) for e in records],
|
||||||
|
limitations=['Bounded injected fixture; observer perturbs timing'], missing_evidence=[],
|
||||||
|
acceptance={'state': 'open', 'remaining': ['Full native route and audiovisual review required']})
|
||||||
|
|
||||||
|
def test_actual_fixture_emits_requested_and_accepted_input(self):
|
||||||
|
_, output, summary, records, _ = self.observed_fixture()
|
||||||
|
self.assertFalse(summary['incomplete'])
|
||||||
|
self.assertEqual(summary['evidence_kind'], 'port_fixture')
|
||||||
|
inputs = [e for e in records if e['name'] == 'input_step']
|
||||||
|
self.assertTrue(any(not e['data']['accepts_input'] and e['data']['requested_input']['forward'] for e in inputs))
|
||||||
|
self.assertTrue(any(e['data']['accepts_input'] for e in inputs))
|
||||||
|
result = receipts.validate_receipt(self.receipt(output, summary, records), output)
|
||||||
|
self.assertTrue(result['valid'])
|
||||||
|
self.assertFalse(result['accepted'])
|
||||||
|
|
||||||
|
def test_fixture_cannot_promote_native_acceptance(self):
|
||||||
|
_, output, summary, records, _ = self.observed_fixture()
|
||||||
|
receipt = self.receipt(output, summary, records)
|
||||||
|
receipt['acceptance']['state'] = 'accepted'
|
||||||
|
with self.assertRaises(ValueError): receipts.validate_receipt(receipt, output)
|
||||||
|
|
||||||
|
def test_missing_output_and_incomplete_records_do_not_qualify(self):
|
||||||
|
_, output, summary, records, _ = self.observed_fixture()
|
||||||
|
receipt = self.receipt(output, summary, records)
|
||||||
|
receipt['status'] = 'aborted'
|
||||||
|
self.assertFalse(receipts.validate_receipt(receipt, output)['accepted'])
|
||||||
|
(output / 'events.jsonl').unlink()
|
||||||
|
with self.assertRaises((ValueError, OSError)): receipts.validate_receipt(receipt, output)
|
||||||
|
|
||||||
|
def test_retained_continuation_keeps_one_ordered_session_clock(self):
|
||||||
|
with tempfile.TemporaryDirectory(prefix='gameport-observer-return-') as temporary:
|
||||||
|
output = Path(temporary) / 'observation'
|
||||||
|
result = self.run_port('--headless', '--mute', '--no-validation', '--smoke-practice-return',
|
||||||
|
'--width', '320', '--height', '240', '--fidelity-output', output,
|
||||||
|
'--fidelity-session', 'retained-process', '--fidelity-case', 'retained-skipped-edge')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||||
|
records = [json.loads(line) for line in (output / 'events.jsonl').read_text().splitlines()]
|
||||||
|
entries = [e for e in records if e['name'] == 'scene_entry']
|
||||||
|
self.assertEqual([e['scene'] for e in entries], ['LV1B', 'VR04', 'LV1B'],
|
||||||
|
'actual continuation must publish source/destination scene entries')
|
||||||
|
self.assertEqual([e['data']['returning'] for e in entries], [False, False, True])
|
||||||
|
self.assertEqual([e['data']['retained_player'] for e in entries], [False, True, True])
|
||||||
|
departures = [e for e in records if e['name'] == 'scene_departure']
|
||||||
|
self.assertEqual(len(departures), 2)
|
||||||
|
self.assertEqual([e['data']['departure_sequence'] for e in entries[1:]],
|
||||||
|
[e['sequence'] for e in departures])
|
||||||
|
self.assertEqual(departures[-1]['data']['returning'], True)
|
||||||
|
self.assertEqual({e['session_id'] for e in records}, {'retained-process'})
|
||||||
|
self.assertEqual({e['evidence_kind'] for e in records}, {'port_fixture'})
|
||||||
|
self.assertEqual([e['sequence'] for e in records], list(range(1, len(records) + 1)))
|
||||||
|
times = [e['elapsed_seconds'] for e in records]
|
||||||
|
self.assertEqual(times, sorted(times))
|
||||||
|
|
||||||
|
def test_observed_off_fixture_state_and_readbacks_match(self):
|
||||||
|
with tempfile.TemporaryDirectory(prefix='gameport-observer-parity-') as temporary:
|
||||||
|
root = Path(temporary)
|
||||||
|
on, off = root / 'on', root / 'off'
|
||||||
|
on.mkdir(); off.mkdir()
|
||||||
|
enabled, disabled = self.fixture(on), self.fixture(off, observed=False)
|
||||||
|
captures = sorted(p.name for p in on.glob('*.ppm'))
|
||||||
|
self.assertGreaterEqual(len(captures), 4)
|
||||||
|
self.assertEqual(captures, sorted(p.name for p in off.glob('*.ppm')))
|
||||||
|
for name in captures:
|
||||||
|
self.assertEqual((on / name).read_bytes(), (off / name).read_bytes(), name)
|
||||||
|
prefixes = ('Movement ', 'Carl ', 'Control-phase ', 'Scene sequence:', 'Simulation:')
|
||||||
|
self.assertEqual([s for s in enabled.stdout.splitlines() if s.startswith(prefixes)],
|
||||||
|
[s for s in disabled.stdout.splitlines() if s.startswith(prefixes)])
|
||||||
|
|
||||||
|
def test_skip_and_natural_paths_are_distinct(self):
|
||||||
|
_, _, _, records, _ = self.observed_fixture()
|
||||||
|
skips = [e for e in records if e['name'] == 'dialogue_skip']
|
||||||
|
self.assertTrue(skips, 'fixture uses actual skip paths')
|
||||||
|
self.assertTrue(all(e['method'].startswith('skip:') for e in skips))
|
||||||
|
ends = [e for e in records if e['name'] == 'dialogue_end']
|
||||||
|
self.assertTrue(any(e['method'].startswith('skip:') for e in ends))
|
||||||
|
self.assertFalse(any(e['method'] == 'natural_director_step' for e in ends))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Reference in new issue
Block a user