Move bridge smokes to Rust

This commit is contained in:
Meta Vens 2026-05-06 09:44:20 +01:00
commit bd13c416b4
8 changed files with 737 additions and 492 deletions

View file

@ -0,0 +1,253 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
fn main() -> Result<()> {
let result = run_smoke()?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
fn run_smoke() -> Result<Value> {
let root = env::current_dir().context("failed to resolve current dir")?;
let workspace = root.join(".epiphany-smoke").join("rider-bridge-workspace");
let artifact_root = root.join(".epiphany-smoke").join("rider-bridge-artifacts");
let fake_rider_root = root.join(".epiphany-smoke").join("rider-bridge-install");
let result_path = root
.join(".epiphany-smoke")
.join("rider-bridge-smoke-result.json");
let source = prepare_workspace(&workspace)?;
reset_path(&artifact_root)?;
reset_path(&fake_rider_root)?;
let fake_rider = create_fake_rider(&fake_rider_root)?;
let status = run_bridge(&root, &workspace, &artifact_root, &fake_rider, &["status"])?;
require(
status["status"] == "ready",
"fake Rider path should make status ready",
)?;
require(
status["riderPath"] == fake_rider.to_string_lossy().as_ref(),
"status should resolve fake Rider path",
)?;
require(
status
.get("solutionPath")
.and_then(Value::as_str)
.is_some_and(|path| path.ends_with("Aetheria.sln")),
"status should find the workspace solution",
)?;
require_artifact(&status, "rider-bridge-summary.json")?;
require_artifact(&status, "rider-bridge-status.md")?;
let context = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_rider,
&[
"context",
"--file",
source.to_str().unwrap_or_default(),
"--selection-start",
"3",
"--selection-end",
"5",
"--symbol-name",
"GravityTileRenderer",
"--symbol-kind",
"class",
"--symbol-namespace",
"Aetheria.Rendering",
],
)?;
require(
context["status"] == "captured",
"context command should capture a packet",
)?;
require(
context["filePath"] == "Assets/Scripts/GravityTileRenderer.cs",
"context file should be project-relative",
)?;
require_artifact(&context, "rider-context.json")?;
require_artifact(&context, "rider-context.md")?;
let open_ref = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_rider,
&[
"open-ref",
"--file",
source.to_str().unwrap_or_default(),
"--line",
"3",
],
)?;
require(
open_ref["status"] == "planned",
"open-ref should plan without launch",
)?;
require(
open_ref
.get("command")
.and_then(Value::as_array)
.and_then(|items| items.first())
.and_then(Value::as_str)
== Some(fake_rider.to_str().unwrap_or_default()),
"open-ref should use discovered Rider path",
)?;
require_artifact(&open_ref, "rider-open-ref.json")?;
let result = json!({
"workspace": workspace,
"artifactRoot": artifact_root,
"status": status["status"],
"contextStatus": context["status"],
"openRefStatus": open_ref["status"],
"riderPath": status["riderPath"],
});
write_json(&result_path, &result)?;
Ok(result)
}
fn run_bridge(
root: &Path,
workspace: &Path,
artifact_root: &Path,
rider_path: &Path,
args: &[&str],
) -> Result<Value> {
let bridge = native_bridge_exe()?;
ensure_bridge_built(root, "epiphany-rider-bridge", &bridge)?;
let output = Command::new(bridge)
.current_dir(root)
.env("EPIPHANY_RIDER_PATH", rider_path)
.arg(args[0])
.arg("--project-root")
.arg(workspace)
.arg("--artifact-root")
.arg(artifact_root)
.args(&args[1..])
.output()
.context("failed to run native rider bridge")?;
require(
output.status.success(),
&format!(
"rider bridge failed: {}",
String::from_utf8_lossy(&output.stderr)
),
)?;
serde_json::from_slice(&output.stdout).with_context(|| {
format!(
"rider bridge did not return JSON: {}",
String::from_utf8_lossy(&output.stdout)
)
})
}
fn prepare_workspace(workspace: &Path) -> Result<PathBuf> {
reset_path(workspace)?;
fs::write(
workspace.join("Aetheria.sln"),
"Microsoft Visual Studio Solution File\n",
)?;
let source = workspace
.join("Assets")
.join("Scripts")
.join("GravityTileRenderer.cs");
fs::create_dir_all(source.parent().expect("source path has parent"))?;
fs::write(
&source,
"namespace Aetheria.Rendering\n{\n public sealed class GravityTileRenderer\n {\n }\n}\n",
)?;
Ok(source)
}
fn create_fake_rider(root: &Path) -> Result<PathBuf> {
let rider = root
.join("JetBrains Rider 2026.1.0.1")
.join("bin")
.join("rider64.exe");
fs::create_dir_all(rider.parent().expect("rider path has parent"))?;
fs::write(&rider, "fake rider binary for smoke planning only\n")?;
Ok(rider)
}
fn require_artifact(summary: &Value, name: &str) -> Result<()> {
let artifact_path = summary
.get("artifactPath")
.and_then(Value::as_str)
.map(PathBuf::from)
.ok_or_else(|| anyhow!("missing artifactPath"))?;
require(
artifact_path.join(name).exists(),
&format!("missing rider artifact: {name}"),
)
}
fn native_bridge_exe() -> Result<PathBuf> {
let target_dir = env::var_os("CARGO_TARGET_DIR")
.unwrap_or_else(|| r"C:\Users\Meta\.cargo-target-codex".into());
Ok(PathBuf::from(target_dir)
.join("debug")
.join(format!("epiphany-rider-bridge{}", env::consts::EXE_SUFFIX)))
}
fn ensure_bridge_built(root: &Path, bin: &str, exe: &Path) -> Result<()> {
if exe.exists() {
return Ok(());
}
let status = Command::new("cargo")
.current_dir(root)
.arg("build")
.arg("--manifest-path")
.arg(root.join("epiphany-core").join("Cargo.toml"))
.arg("--bin")
.arg(bin)
.status()
.with_context(|| format!("failed to build native {bin}"))?;
require(
status.success() && exe.exists(),
&format!("native {bin} executable was not built at {}", exe.display()),
)
}
fn reset_path(path: &Path) -> Result<()> {
if path.exists() {
let root = env::current_dir()?.join(".epiphany-smoke").canonicalize()?;
let resolved = path.canonicalize()?;
if resolved == root || !resolved.starts_with(&root) {
return Err(anyhow!(
"refusing to reset non-smoke path: {}",
path.display()
));
}
fs::remove_dir_all(path)?;
}
fs::create_dir_all(path)?;
Ok(())
}
fn write_json(path: &Path, value: &Value) -> Result<()> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;
}
fs::write(path, format!("{}\n", serde_json::to_string_pretty(value)?))?;
Ok(())
}
fn require(condition: bool, message: &str) -> Result<()> {
if condition {
Ok(())
} else {
Err(anyhow!("{message}"))
}
}

View file

@ -0,0 +1,478 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
const PROJECT_VERSION: &str = "6000.1.10f1";
const WRONG_VERSION: &str = "6000.4.2f1";
fn main() -> Result<()> {
let result = run_smoke()?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
fn run_smoke() -> Result<Value> {
let root = env::current_dir().context("failed to resolve current dir")?;
let workspace = root.join(".epiphany-smoke").join("unity-bridge-workspace");
let artifact_root = root.join(".epiphany-smoke").join("unity-bridge-artifacts");
let fake_roots = root.join(".epiphany-smoke").join("unity-bridge-editors");
let result_path = root
.join(".epiphany-smoke")
.join("unity-bridge-smoke-result.json");
prepare_project(&workspace, false)?;
reset_path(&artifact_root)?;
reset_path(&fake_roots)?;
let wrong_editor = create_fake_editor(&fake_roots, WRONG_VERSION)?;
let missing = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&["inspect"],
true,
)?;
require(
missing["status"] == "missingEditor",
"wrong-only Hub root should not satisfy pin",
)?;
require(
missing["projectVersion"] == PROJECT_VERSION,
"inspection should report the project-pinned version",
)?;
require_artifact(&missing, "unity-bridge-summary.json")?;
require_artifact(&missing, "unity-bridge-inspection.md")?;
let exact_editor = create_fake_editor(&fake_roots, PROJECT_VERSION)?;
let ready = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&["inspect"],
true,
)?;
require(
ready["status"] == "ready",
"exact editor should satisfy pin",
)?;
require(
ready["editorPath"] == exact_editor.to_string_lossy().as_ref(),
"inspection should resolve exact editor",
)?;
require(
ready
.pointer("/editorBridge/exists")
.and_then(Value::as_bool)
== Some(false),
"fresh smoke project should not have bridge package yet",
)?;
let planned = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&[
"run",
"--dry-run",
"--",
"-executeMethod",
"Epiphany.SmokeProbe",
],
true,
)?;
require(
planned["status"] == "ready",
"dry run should still require exact editor",
)?;
require(
planned["runStatus"] == "planned",
"dry run should plan instead of executing",
)?;
let command = value_array(&planned, "command")?;
require(
command.first().and_then(Value::as_str) == Some(exact_editor.to_str().unwrap_or_default()),
"command should use exact editor path",
)?;
require_command_contains(command, "-batchmode")?;
require_command_contains(command, "-quit")?;
require_command_contains(command, "-projectPath")?;
require_command_contains(command, "-logFile")?;
require_command_contains(command, &workspace.to_string_lossy())?;
require(
!command
.iter()
.any(|item| item.as_str() == Some(wrong_editor.to_str().unwrap_or_default())),
"command must not use wrong editor",
)?;
require_artifact(&planned, "unity-command.json")?;
let missing_package = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&[
"probe",
"--dry-run",
"--operation",
"scene-facts",
"--scene",
"Assets/Scenes/Main.unity",
],
false,
)?;
require(
missing_package["status"] == "missingEditorBridgePackage",
"named probes should require the resident editor package",
)?;
require(
missing_package["runStatus"] == "blocked",
"missing package probe should be blocked",
)?;
prepare_project(&workspace, true)?;
let bridged = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&["inspect"],
true,
)?;
require(
bridged["status"] == "ready",
"bridge project should still resolve exact editor",
)?;
require(
bridged
.pointer("/editorBridge/exists")
.and_then(Value::as_bool)
== Some(true),
"resident editor bridge should be detected",
)?;
let scene_probe = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&[
"probe",
"--dry-run",
"--operation",
"scene-facts",
"--scene",
"Assets/Scenes/Main.unity",
"--max-objects",
"25",
"--max-properties",
"12",
],
true,
)?;
require(
scene_probe["runStatus"] == "planned",
"scene probe should plan under dry run",
)?;
let scene_command = value_array(&scene_probe, "command")?;
require(
scene_command.first().and_then(Value::as_str)
== Some(exact_editor.to_str().unwrap_or_default()),
"scene probe should use exact editor path",
)?;
require_command_contains(scene_command, "-executeMethod")?;
require_command_contains(
scene_command,
"GameCult.Epiphany.Unity.EpiphanyEditorBridge.RunProbe",
)?;
require_command_contains(scene_command, "-epiphanyArtifactDir")?;
let scene_artifact_path = path_value(&scene_probe, "artifactPath")?;
require_command_contains(scene_command, &scene_artifact_path.to_string_lossy())?;
require_command_contains(scene_command, "-epiphanyOperation")?;
require_command_contains(scene_command, "scene-facts")?;
require_command_contains(scene_command, "-epiphanyScene")?;
require_command_contains(scene_command, "Assets/Scenes/Main.unity")?;
require_command_contains(scene_command, "-epiphanyMaxObjects")?;
require_command_contains(scene_command, "25")?;
let scene_artifact = read_command_artifact(&scene_probe)?;
require(
scene_artifact["operation"] == "scene-facts",
"scene command artifact should name operation",
)?;
require(
array_contains(scene_artifact.get("expectedArtifacts"), "scene-facts.json"),
"scene facts artifact should be expected",
)?;
let compilation = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&["check-compilation", "--dry-run"],
true,
)?;
require(
compilation["runStatus"] == "planned",
"compilation probe should plan under dry run",
)?;
let compilation_artifact = read_command_artifact(&compilation)?;
require(
array_contains(
compilation_artifact.get("expectedArtifacts"),
"compilation.json",
),
"compilation artifact should be expected",
)?;
let tests = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots,
&[
"run-tests",
"--dry-run",
"--platform",
"editmode",
"--filter",
"SmokeSuite",
],
true,
)?;
require(
tests["runStatus"] == "planned",
"Unity test run should plan under dry run",
)?;
let test_command = value_array(&tests, "command")?;
require_command_contains(test_command, "-runTests")?;
require_command_contains(test_command, "-testPlatform")?;
require_command_contains(test_command, "editmode")?;
require_command_contains(test_command, "-testFilter")?;
require_command_contains(test_command, "SmokeSuite")?;
let tests_artifact = read_command_artifact(&tests)?;
require(
array_contains(tests_artifact.get("expectedArtifacts"), "test-results.xml"),
"test results should be expected",
)?;
let blocked = run_bridge(
&root,
&workspace,
&artifact_root,
&fake_roots.join("missing"),
&[
"run",
"--dry-run",
"--",
"-executeMethod",
"Epiphany.SmokeProbe",
],
false,
)?;
require(
blocked["runStatus"] == "blocked",
"missing editor run should be blocked",
)?;
let result = json!({
"workspace": workspace,
"artifactRoot": artifact_root,
"missingStatus": missing["status"],
"readyStatus": ready["status"],
"plannedStatus": planned["runStatus"],
"missingPackageStatus": missing_package["status"],
"sceneProbeStatus": scene_probe["runStatus"],
"testStatus": tests["runStatus"],
"blockedStatus": blocked["runStatus"],
"resolvedEditor": ready["editorPath"],
});
write_json(&result_path, &result)?;
Ok(result)
}
fn run_bridge(
root: &Path,
workspace: &Path,
artifact_root: &Path,
editor_roots: &Path,
args: &[&str],
expect_success: bool,
) -> Result<Value> {
let bridge = native_bridge_exe()?;
ensure_bridge_built(root, "epiphany-unity-bridge", &bridge)?;
let output = Command::new(bridge)
.current_dir(root)
.env("EPIPHANY_UNITY_EDITOR_ROOTS", editor_roots)
.arg(args[0])
.arg("--project-path")
.arg(workspace)
.arg("--artifact-root")
.arg(artifact_root)
.args(&args[1..])
.output()
.context("failed to run native unity bridge")?;
if expect_success {
require(
output.status.success(),
&format!(
"bridge should succeed, got {:?}: {}",
output.status.code(),
String::from_utf8_lossy(&output.stderr)
),
)?;
} else {
require(
!output.status.success(),
"bridge should fail for blocked runtime execution",
)?;
}
serde_json::from_slice(&output.stdout).with_context(|| {
format!(
"bridge did not return JSON: {}",
String::from_utf8_lossy(&output.stdout)
)
})
}
fn prepare_project(workspace: &Path, include_bridge: bool) -> Result<()> {
reset_path(workspace)?;
let settings = workspace.join("ProjectSettings");
fs::create_dir_all(&settings)?;
fs::write(
settings.join("ProjectVersion.txt"),
format!(
"m_EditorVersion: {PROJECT_VERSION}\nm_EditorVersionWithRevision: {PROJECT_VERSION} (3c681a6c22ff)\n"
),
)?;
if include_bridge {
let bridge = workspace
.join("Assets")
.join("Editor")
.join("Epiphany")
.join("EpiphanyEditorBridge.cs");
fs::create_dir_all(bridge.parent().expect("bridge path has parent"))?;
fs::write(
bridge,
"// smoke marker for resident Epiphany editor bridge\n",
)?;
}
Ok(())
}
fn create_fake_editor(root: &Path, version: &str) -> Result<PathBuf> {
let editor = root.join(version).join("Editor").join("Unity.exe");
fs::create_dir_all(editor.parent().expect("editor path has parent"))?;
fs::write(&editor, "fake unity binary for dry-run smoke only\n")?;
Ok(editor)
}
fn read_command_artifact(summary: &Value) -> Result<Value> {
let command_path = path_value(summary, "artifactPath")?.join("unity-command.json");
require(command_path.exists(), "missing unity-command.json")?;
let bytes = fs::read(&command_path)?;
serde_json::from_slice(&bytes).context("failed to parse unity-command.json")
}
fn require_artifact(summary: &Value, name: &str) -> Result<()> {
let artifact_path = path_value(summary, "artifactPath")?;
require(
artifact_path.join(name).exists(),
&format!("missing bridge artifact: {name}"),
)
}
fn require_command_contains(command: &[Value], value: &str) -> Result<()> {
require(
command.iter().any(|item| item.as_str() == Some(value)),
&format!("command should contain {value:?}: {command:?}"),
)
}
fn native_bridge_exe() -> Result<PathBuf> {
let target_dir = env::var_os("CARGO_TARGET_DIR")
.unwrap_or_else(|| r"C:\Users\Meta\.cargo-target-codex".into());
Ok(PathBuf::from(target_dir)
.join("debug")
.join(format!("epiphany-unity-bridge{}", env::consts::EXE_SUFFIX)))
}
fn ensure_bridge_built(root: &Path, bin: &str, exe: &Path) -> Result<()> {
if exe.exists() {
return Ok(());
}
let status = Command::new("cargo")
.current_dir(root)
.arg("build")
.arg("--manifest-path")
.arg(root.join("epiphany-core").join("Cargo.toml"))
.arg("--bin")
.arg(bin)
.status()
.with_context(|| format!("failed to build native {bin}"))?;
require(
status.success() && exe.exists(),
&format!("native {bin} executable was not built at {}", exe.display()),
)
}
fn value_array<'a>(value: &'a Value, key: &str) -> Result<&'a Vec<Value>> {
value
.get(key)
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("missing array field {key}"))
}
fn path_value(value: &Value, key: &str) -> Result<PathBuf> {
value
.get(key)
.and_then(Value::as_str)
.map(PathBuf::from)
.ok_or_else(|| anyhow!("missing path field {key}"))
}
fn array_contains(value: Option<&Value>, needle: &str) -> bool {
value
.and_then(Value::as_array)
.is_some_and(|items| items.iter().any(|item| item.as_str() == Some(needle)))
}
fn reset_path(path: &Path) -> Result<()> {
if path.exists() {
let root = env::current_dir()?.join(".epiphany-smoke").canonicalize()?;
let resolved = path.canonicalize()?;
if resolved == root || !resolved.starts_with(&root) {
return Err(anyhow!(
"refusing to reset non-smoke path: {}",
path.display()
));
}
fs::remove_dir_all(path)?;
}
fs::create_dir_all(path)?;
Ok(())
}
fn write_json(path: &Path, value: &Value) -> Result<()> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;
}
fs::write(path, format!("{}\n", serde_json::to_string_pretty(value)?))?;
Ok(())
}
fn require(condition: bool, message: &str) -> Result<()> {
if condition {
Ok(())
} else {
Err(anyhow!("{message}"))
}
}

View file

@ -88,7 +88,7 @@ The landed machine now has:
- first Codex-independent native runtime vertebra through `epiphany-runtime-spine`, storing runtime identity, sessions, jobs, job results, and events as typed CultCache MessagePack documents, opening/completing native jobs, projecting job-result counts, and emitting a framed CultNet hello message for the native contract
- first auditable Phase 6 live-specialist runner through `tools/epiphany_mvp_live_specialist.py`, proving `roleLaunch -> agent_jobs worker -> report_agent_job_result -> roleResult` without manual backend completion
- first Phase 6 Aquarium operator shell extracted to sibling repo `E:\Projects\EpiphanyAquarium`, a Tauri v2 + React/WebGL client over the existing status bridge, dogfood artifacts, and GUI action artifacts, with its own distilled interface state/memory/doctrine plus durable checkpoint preparation, bounded status/coordinator artifact buttons, fixed modeling/verification/reorient launch and read-back buttons, and explicit review-gated reorient acceptance
- first Unity editor/runtime bridge through native `epiphany-unity-bridge`, `tools/epiphany_unity_bridge_smoke.py`, and the GUI Inspect Unity action, resolving exact project-pinned editors and writing runtime artifacts while refusing wrong or missing versions
- first Unity editor/runtime bridge through native `epiphany-unity-bridge`, native `epiphany-unity-bridge-smoke`, and the GUI Inspect Unity action, resolving exact project-pinned editors and writing runtime artifacts while refusing wrong or missing versions
- prompt-file ownership for major Epiphany prompt surfaces: rendered state intro/doctrine lives under `epiphany-core/src/prompts/`, while modeling/Body, research/Eyes, implementation/Hands, verification/Soul, reorientation/Life, coordinator/Self, and CRRC templates live in `vendor/codex/codex-rs/app-server/src/prompts/epiphany_specialists.toml`
- prompt-level anti-Greenspun guardrails: Epiphany keeps Codex's useful operator discipline and requires a bounded research/scout check before agents invent bespoke versions of known algorithms, parsers, schedulers, renderers, protocols, storage layers, security mechanisms, or workflow engines
- live Phase 6 reorientation app-server smoke coverage in `tools/epiphany_phase6_reorient_smoke.py`
@ -387,7 +387,7 @@ Implementation slices:
Verification:
- Keep the existing CLI smokes as backend guardrails.
- Keep `tools/epiphany_unity_bridge_smoke.py` for Unity bridge regressions.
- Keep native `epiphany-unity-bridge-smoke` for Unity bridge regressions.
- Keep `npm run smoke:visual` for browser-layout regressions and bounded
browser-fallback action clicks in `E:\Projects\EpiphanyAquarium`.
- For native Aquarium changes, run `npm run build`, `cargo fmt --check`,

View file

@ -140,8 +140,8 @@ The current spine, blessed but not yet finished:
- Ghostlight-derived heartbeat initiative scheduling through the native `epiphany-heartbeat-store` binary, with Self and Face included as first-class participants, idle rumination routed through normal `selfPatch` review/application, and the heartbeat state round-tripped through the typed CultCache MessagePack store in `state/agent-heartbeats.msgpack`
- Face as the public #aquarium-only surface for translating agent thought-weather into short chats or candidate drafts, without moderator authority
- Ghostlight-shaped role dossiers in `state/agents.msgpack`, plus `selfPatch` review projection through `roleResult`/`roleAccept` and accepted memory application through the native `epiphany-agent-memory-store` binary
- first Unity runtime bridge through native `epiphany-unity-bridge`, `tools/epiphany_unity_bridge_smoke.py`, GUI Inspect Unity, runtime artifact listing, and implementation prompt guardrails
- first Rider source-context bridge through native `epiphany-rider-bridge`, `tools/epiphany_rider_bridge_smoke.py`, GUI Inspect Rider, Rider artifact listing, implementation prompt guardrails, and a source scaffold under `integrations/rider`
- first Unity runtime bridge through native `epiphany-unity-bridge`, native `epiphany-unity-bridge-smoke`, GUI Inspect Unity, runtime artifact listing, and implementation prompt guardrails
- first Rider source-context bridge through native `epiphany-rider-bridge`, native `epiphany-rider-bridge-smoke`, GUI Inspect Rider, Rider artifact listing, implementation prompt guardrails, and a source scaffold under `integrations/rider`
- first GUI graph dashboard through the adjacent `@epiphanygraph/epiphany-graph-viewer` package over typed Epiphany graph state
- live scene app-server smoke through `tools/epiphany_phase6_scene_smoke.py`
- live jobs app-server smoke through `tools/epiphany_phase6_jobs_smoke.py`

Binary file not shown.

View file

@ -219,8 +219,8 @@ landed_baseline:
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-agent-memory-store -- smoke --store .\state\agents.msgpack` before modifying role self-memory dossiers or `selfPatch` persistence policy.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-heartbeat-store -- smoke --agent-store .\state\agents.msgpack` before modifying heartbeat initiative timing, idle rumination, or role slot selection.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-face-discord -- smoke` before modifying Face's #aquarium posting/draft guardrails.
- Use `tools/epiphany_unity_bridge_smoke.py` before modifying the Unity editor/runtime bridge.
- Use `tools/epiphany_rider_bridge_smoke.py` before modifying the Rider source-context bridge.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-unity-bridge-smoke` before modifying the Unity editor/runtime bridge.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-rider-bridge-smoke` before modifying the Rider source-context bridge.
- Use `tools/epiphany_mvp_live_specialist.py` before claiming live specialist execution still works end to end.
- Use `npm run build`, `npm run smoke:visual`, `cargo fmt --check`, `cargo check`, and `npm run tauri -- build --debug --no-bundle` under `E:\Projects\EpiphanyAquarium` before claiming Aquarium operator changes are usable.
- Use focused scene/jobs/context/pressure/reorient/protocol/schema checks for reflection-only changes.

View file

@ -1,178 +0,0 @@
from __future__ import annotations
import json
import os
from pathlib import Path
import shutil
import subprocess
from typing import Any
from epiphany_phase5_smoke import ROOT
from epiphany_phase5_smoke import require
DEFAULT_WORKSPACE = ROOT / ".epiphany-smoke" / "rider-bridge-workspace"
DEFAULT_ARTIFACT_ROOT = ROOT / ".epiphany-smoke" / "rider-bridge-artifacts"
DEFAULT_RESULT = ROOT / ".epiphany-smoke" / "rider-bridge-smoke-result.json"
def reset_path(path: Path) -> None:
if path.exists():
shutil.rmtree(path)
path.mkdir(parents=True, exist_ok=True)
def prepare_workspace(workspace: Path) -> Path:
reset_path(workspace)
(workspace / "Aetheria.sln").write_text("Microsoft Visual Studio Solution File\n", encoding="utf-8")
source = workspace / "Assets" / "Scripts" / "GravityTileRenderer.cs"
source.parent.mkdir(parents=True, exist_ok=True)
source.write_text(
"\n".join(
[
"namespace Aetheria.Rendering",
"{",
" public sealed class GravityTileRenderer",
" {",
" }",
"}",
"",
]
),
encoding="utf-8",
)
return source
def create_fake_rider(root: Path) -> Path:
rider = root / "JetBrains Rider 2026.1.0.1" / "bin" / "rider64.exe"
rider.parent.mkdir(parents=True, exist_ok=True)
rider.write_text("fake rider binary for smoke planning only\n", encoding="utf-8")
return rider
def run_bridge(workspace: Path, artifact_root: Path, env: dict[str, str], args: list[str]) -> dict[str, Any]:
completed = subprocess.run(
[
str(native_bridge_exe()),
args[0],
"--project-root",
str(workspace),
"--artifact-root",
str(artifact_root),
*args[1:],
],
cwd=ROOT,
env=env,
capture_output=True,
encoding="utf-8",
errors="replace",
check=False,
)
require(completed.returncode == 0, f"rider bridge failed: {completed.stderr}")
try:
return json.loads(completed.stdout)
except json.JSONDecodeError as error:
raise AssertionError(f"rider bridge did not return JSON: {error}\n{completed.stdout}") from error
def require_artifact(summary: dict[str, Any], name: str) -> None:
artifact_path = Path(str(summary["artifactPath"]))
require((artifact_path / name).exists(), f"missing rider artifact: {name}")
def main() -> int:
workspace = DEFAULT_WORKSPACE.resolve()
artifact_root = DEFAULT_ARTIFACT_ROOT.resolve()
fake_rider_root = ROOT / ".epiphany-smoke" / "rider-bridge-install"
result_path = DEFAULT_RESULT.resolve()
source = prepare_workspace(workspace)
reset_path(artifact_root)
reset_path(fake_rider_root)
fake_rider = create_fake_rider(fake_rider_root)
env = os.environ.copy()
env["EPIPHANY_RIDER_PATH"] = str(fake_rider)
status = run_bridge(workspace, artifact_root, env, ["status"])
require(status["status"] == "ready", "fake Rider path should make status ready")
require(status["riderPath"] == str(fake_rider), "status should resolve fake Rider path")
require(status["solutionPath"].endswith("Aetheria.sln"), "status should find the workspace solution")
require_artifact(status, "rider-bridge-summary.json")
require_artifact(status, "rider-bridge-status.md")
context = run_bridge(
workspace,
artifact_root,
env,
[
"context",
"--file",
str(source),
"--selection-start",
"3",
"--selection-end",
"5",
"--symbol-name",
"GravityTileRenderer",
"--symbol-kind",
"class",
"--symbol-namespace",
"Aetheria.Rendering",
],
)
require(context["status"] == "captured", "context command should capture a packet")
require(context["filePath"] == "Assets/Scripts/GravityTileRenderer.cs", "context file should be project-relative")
require_artifact(context, "rider-context.json")
require_artifact(context, "rider-context.md")
open_ref = run_bridge(
workspace,
artifact_root,
env,
["open-ref", "--file", str(source), "--line", "3"],
)
require(open_ref["status"] == "planned", "open-ref should plan without launch")
require(open_ref["command"][0] == str(fake_rider), "open-ref should use discovered Rider path")
require_artifact(open_ref, "rider-open-ref.json")
result = {
"workspace": str(workspace),
"artifactRoot": str(artifact_root),
"status": status["status"],
"contextStatus": context["status"],
"openRefStatus": open_ref["status"],
"riderPath": status["riderPath"],
}
result_path.parent.mkdir(parents=True, exist_ok=True)
result_path.write_text(json.dumps(result, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
print(json.dumps(result, indent=2, ensure_ascii=False))
return 0
def native_bridge_exe() -> Path:
exe = Path(os.environ.get("CARGO_TARGET_DIR", r"C:\Users\Meta\.cargo-target-codex")) / "debug" / "epiphany-rider-bridge.exe"
if exe.exists():
return exe
completed = subprocess.run(
[
"cargo",
"build",
"--manifest-path",
str(ROOT / "epiphany-core" / "Cargo.toml"),
"--bin",
"epiphany-rider-bridge",
],
cwd=ROOT,
capture_output=True,
encoding="utf-8",
errors="replace",
check=False,
)
require(completed.returncode == 0, f"failed to build native rider bridge: {completed.stderr}")
require(exe.exists(), f"native rider bridge executable was not built at {exe}")
return exe
if __name__ == "__main__":
raise SystemExit(main())

View file

@ -1,308 +0,0 @@
from __future__ import annotations
import json
import os
from pathlib import Path
import shutil
import subprocess
from typing import Any
from epiphany_phase5_smoke import ROOT
from epiphany_phase5_smoke import require
DEFAULT_WORKSPACE = ROOT / ".epiphany-smoke" / "unity-bridge-workspace"
DEFAULT_ARTIFACT_ROOT = ROOT / ".epiphany-smoke" / "unity-bridge-artifacts"
DEFAULT_RESULT = ROOT / ".epiphany-smoke" / "unity-bridge-smoke-result.json"
PROJECT_VERSION = "6000.1.10f1"
WRONG_VERSION = "6000.4.2f1"
def reset_path(path: Path) -> None:
if path.exists():
shutil.rmtree(path)
path.mkdir(parents=True, exist_ok=True)
def prepare_project(workspace: Path, *, include_bridge: bool = False) -> None:
reset_path(workspace)
settings = workspace / "ProjectSettings"
settings.mkdir(parents=True, exist_ok=True)
(settings / "ProjectVersion.txt").write_text(
"\n".join(
[
f"m_EditorVersion: {PROJECT_VERSION}",
f"m_EditorVersionWithRevision: {PROJECT_VERSION} (3c681a6c22ff)",
"",
]
),
encoding="utf-8",
)
if include_bridge:
bridge = workspace / "Assets" / "Editor" / "Epiphany" / "EpiphanyEditorBridge.cs"
bridge.parent.mkdir(parents=True, exist_ok=True)
bridge.write_text("// smoke marker for resident Epiphany editor bridge\n", encoding="utf-8")
def create_fake_editor(root: Path, version: str) -> Path:
editor = root / version / "Editor" / "Unity.exe"
editor.parent.mkdir(parents=True, exist_ok=True)
editor.write_text("fake unity binary for dry-run smoke only\n", encoding="utf-8")
return editor
def run_bridge(
workspace: Path,
artifact_root: Path,
*,
roots: Path,
args: list[str],
expect_success: bool = True,
) -> dict[str, Any]:
env = os.environ.copy()
env["EPIPHANY_UNITY_EDITOR_ROOTS"] = str(roots)
completed = subprocess.run(
[
str(native_bridge_exe()),
args[0],
"--project-path",
str(workspace),
"--artifact-root",
str(artifact_root),
*args[1:],
],
cwd=ROOT,
env=env,
capture_output=True,
encoding="utf-8",
errors="replace",
check=False,
)
if expect_success:
require(
completed.returncode == 0,
f"bridge should succeed, got {completed.returncode}: {completed.stderr}",
)
else:
require(completed.returncode != 0, "bridge should fail for blocked runtime execution")
try:
return json.loads(completed.stdout)
except json.JSONDecodeError as error:
raise AssertionError(f"bridge did not return JSON: {error}\n{completed.stdout}") from error
def require_artifact(summary: dict[str, Any], name: str) -> None:
artifact_path = Path(str(summary["artifactPath"]))
require((artifact_path / name).exists(), f"missing bridge artifact: {name}")
def read_command_artifact(summary: dict[str, Any]) -> dict[str, Any]:
artifact_path = Path(str(summary["artifactPath"]))
command_path = artifact_path / "unity-command.json"
require(command_path.exists(), "missing unity-command.json")
return json.loads(command_path.read_text(encoding="utf-8"))
def require_command_contains(command: list[str], value: str) -> None:
require(value in command, f"command should contain {value!r}: {command}")
def main() -> int:
workspace = DEFAULT_WORKSPACE.resolve()
artifact_root = DEFAULT_ARTIFACT_ROOT.resolve()
fake_roots = ROOT / ".epiphany-smoke" / "unity-bridge-editors"
result_path = DEFAULT_RESULT.resolve()
prepare_project(workspace)
reset_path(artifact_root)
reset_path(fake_roots)
wrong_editor = create_fake_editor(fake_roots, WRONG_VERSION)
missing = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["inspect"],
)
require(missing["status"] == "missingEditor", "wrong-only Hub root should not satisfy pin")
require(
missing["projectVersion"] == PROJECT_VERSION,
"inspection should report the project-pinned version",
)
require_artifact(missing, "unity-bridge-summary.json")
require_artifact(missing, "unity-bridge-inspection.md")
exact_editor = create_fake_editor(fake_roots, PROJECT_VERSION)
ready = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["inspect"],
)
require(ready["status"] == "ready", "exact editor should satisfy pin")
require(ready["editorPath"] == str(exact_editor), "inspection should resolve exact editor")
require(ready["editorBridge"]["exists"] is False, "fresh smoke project should not have bridge package yet")
planned = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["run", "--dry-run", "--", "-executeMethod", "Epiphany.SmokeProbe"],
)
require(planned["status"] == "ready", "dry run should still require exact editor")
require(planned["runStatus"] == "planned", "dry run should plan instead of executing")
command = planned["command"]
require(command[0] == str(exact_editor), "command should use exact editor path")
require_command_contains(command, "-batchmode")
require_command_contains(command, "-quit")
require_command_contains(command, "-projectPath")
require_command_contains(command, "-logFile")
require_command_contains(command, str(workspace))
require(str(wrong_editor) not in command, "command must not use wrong editor")
require_artifact(planned, "unity-command.json")
missing_package = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=[
"probe",
"--dry-run",
"--operation",
"scene-facts",
"--scene",
"Assets/Scenes/Main.unity",
],
expect_success=False,
)
require(
missing_package["status"] == "missingEditorBridgePackage",
"named probes should require the resident editor package",
)
require(missing_package["runStatus"] == "blocked", "missing package probe should be blocked")
prepare_project(workspace, include_bridge=True)
bridged = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["inspect"],
)
require(bridged["status"] == "ready", "bridge project should still resolve exact editor")
require(bridged["editorBridge"]["exists"] is True, "resident editor bridge should be detected")
scene_probe = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=[
"probe",
"--dry-run",
"--operation",
"scene-facts",
"--scene",
"Assets/Scenes/Main.unity",
"--max-objects",
"25",
"--max-properties",
"12",
],
)
require(scene_probe["runStatus"] == "planned", "scene probe should plan under dry run")
scene_command = scene_probe["command"]
require(scene_command[0] == str(exact_editor), "scene probe should use exact editor path")
require_command_contains(scene_command, "-executeMethod")
require_command_contains(scene_command, "GameCult.Epiphany.Unity.EpiphanyEditorBridge.RunProbe")
require_command_contains(scene_command, "-epiphanyArtifactDir")
require_command_contains(scene_command, str(Path(str(scene_probe["artifactPath"]))))
require_command_contains(scene_command, "-epiphanyOperation")
require_command_contains(scene_command, "scene-facts")
require_command_contains(scene_command, "-epiphanyScene")
require_command_contains(scene_command, "Assets/Scenes/Main.unity")
require_command_contains(scene_command, "-epiphanyMaxObjects")
require_command_contains(scene_command, "25")
scene_artifact = read_command_artifact(scene_probe)
require(scene_artifact["operation"] == "scene-facts", "scene command artifact should name operation")
require("scene-facts.json" in scene_artifact["expectedArtifacts"], "scene facts artifact should be expected")
compilation = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["check-compilation", "--dry-run"],
)
require(compilation["runStatus"] == "planned", "compilation probe should plan under dry run")
compilation_artifact = read_command_artifact(compilation)
require(
"compilation.json" in compilation_artifact["expectedArtifacts"],
"compilation artifact should be expected",
)
tests = run_bridge(
workspace,
artifact_root,
roots=fake_roots,
args=["run-tests", "--dry-run", "--platform", "editmode", "--filter", "SmokeSuite"],
)
require(tests["runStatus"] == "planned", "Unity test run should plan under dry run")
test_command = tests["command"]
require_command_contains(test_command, "-runTests")
require_command_contains(test_command, "-testPlatform")
require_command_contains(test_command, "editmode")
require_command_contains(test_command, "-testFilter")
require_command_contains(test_command, "SmokeSuite")
tests_artifact = read_command_artifact(tests)
require("test-results.xml" in tests_artifact["expectedArtifacts"], "test results should be expected")
blocked = run_bridge(
workspace,
artifact_root,
roots=fake_roots / "missing",
args=["run", "--dry-run", "--", "-executeMethod", "Epiphany.SmokeProbe"],
expect_success=False,
)
require(blocked["runStatus"] == "blocked", "missing editor run should be blocked")
result = {
"workspace": str(workspace),
"artifactRoot": str(artifact_root),
"missingStatus": missing["status"],
"readyStatus": ready["status"],
"plannedStatus": planned["runStatus"],
"missingPackageStatus": missing_package["status"],
"sceneProbeStatus": scene_probe["runStatus"],
"testStatus": tests["runStatus"],
"blockedStatus": blocked["runStatus"],
"resolvedEditor": ready["editorPath"],
}
result_path.parent.mkdir(parents=True, exist_ok=True)
result_path.write_text(json.dumps(result, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
print(json.dumps(result, indent=2, ensure_ascii=False))
return 0
def native_bridge_exe() -> Path:
exe = Path(os.environ.get("CARGO_TARGET_DIR", r"C:\Users\Meta\.cargo-target-codex")) / "debug" / "epiphany-unity-bridge.exe"
if exe.exists():
return exe
completed = subprocess.run(
[
"cargo",
"build",
"--manifest-path",
str(ROOT / "epiphany-core" / "Cargo.toml"),
"--bin",
"epiphany-unity-bridge",
],
cwd=ROOT,
capture_output=True,
encoding="utf-8",
errors="replace",
check=False,
)
require(completed.returncode == 0, f"failed to build native unity bridge: {completed.stderr}")
require(exe.exists(), f"native unity bridge executable was not built at {exe}")
return exe
if __name__ == "__main__":
raise SystemExit(main())