feat(01-04): preserve observer identity through control and scene changes
This commit is contained in:
1 parent
6bccd47b9b
commit
ea4dc9b5df
4 files changed
+177
-25
No files matched your search
@@ -1,6 +1,5 @@
|
||||
"""Actual port-process observation plumbing; fixtures never fill native acceptance."""
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -13,9 +12,25 @@ 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 run --no-build -- "$@"',
|
||||
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)
|
||||
|
||||
@@ -103,6 +118,8 @@ class FidelityObservation(unittest.TestCase):
|
||||
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'})
|
||||
|
||||
Reference in new issue
Block a user