Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

UI conformance runs again: 0/19 to 18 pass + 1 slow on 0.1.9's page. Each world starts the app's own host (host/node.ts, or an installed app's host.mjs) beside raea-page-host and points the page's /host/* at it (RAEA_PAGE_HOST), as raea.app does; without it the page waited on "raea is starting" and every case failed at its first step. The app is built with its demo world (RAEA_FIXTURES=1, since 11-14 a plain build has none) into blitz/out-conformance. --app takes an installed raea.app's feed folder. Three cases follow 0.1.9's UI: the feed opens on i-set then i-ideas, the card menu's hide is menu-feed-item-hide, and the rail's project rows replace the feed rows (rail-project-select).

shinyobjectza616f42b7ca4
diff --git a/sdk/ui/conformance/README.md b/sdk/ui/conformance/README.md
index becdabd5..47e912c8 100644
--- a/sdk/ui/conformance/README.md
+++ b/sdk/ui/conformance/README.md
@@ -13,8 +13,16 @@ It's its own Cargo workspace (it doesn't link the engine). Build and test it thr
Run it:
target/release/conformance --tier quick # the feed on target/release/raea-page-host
- target/release/conformance --no-build --only 'scroll/*' # apps/app's blitz/out as it is
+ target/release/conformance --no-build --only 'scroll/*' # apps/app's last build as it is
target/release/conformance --tier full --only 'pointer/*' --keep # every size; keep worlds and logs
+ target/release/conformance --app ~/raea-trial/a/apps/app # another checkout of the app (a release's)
+
+The cases are written against the app's demo world (the Ides of March, Pong, the reel and the tutorial), which a
+build has only when asked for since 11-14 (a shipped app has none): the runner builds it with `RAEA_FIXTURES=1` into
+`blitz/out-conformance`, and `--no-build` reads that build (else an older app's `blitz/out`). raea-page-host is only
+the window: the page's `/host/*` (onboarding's state, workspaces, kept items) is the feed's host's, so each world starts
+the app's `host/node.ts` on a free port first and points the page at it (`RAEA_PAGE_HOST`), as raea.app does; without
+it the page waits on "raea is starting" and every case fails at its first step.
Exit 0: every case passed or was only slow; 1: a case failed; 2: the run couldn't start.
diff --git a/sdk/ui/conformance/cases/focus/j-k-select.toml b/sdk/ui/conformance/cases/focus/j-k-select.toml
index 6387e842..e07b5b7e 100644
--- a/sdk/ui/conformance/cases/focus/j-k-select.toml
+++ b/sdk/ui/conformance/cases/focus/j-k-select.toml
@@ -3,12 +3,12 @@ title = "j selects the next card and k the one before, one card selected at a ti
window = [1440, 900]
[[steps]]
-wait = { id = "card-i-steps", state = "data-selected" }
+wait = { id = "card-i-set", state = "data-selected" }
[[steps]]
input = { type = "press", key = "j" }
[[steps]]
-expect = { all = [{ id = "card-i-hero", state = "data-selected" }, { id = "card-*", state = "data-selected", count = 1 }] }
+expect = { all = [{ id = "card-i-ideas", state = "data-selected" }, { id = "card-*", state = "data-selected", count = 1 }] }
[[steps]]
input = { type = "press", key = "k" }
[[steps]]
-expect = { all = [{ id = "card-i-steps", state = "data-selected" }, { id = "card-*", state = "data-selected", count = 1 }] }
+expect = { all = [{ id = "card-i-set", state = "data-selected" }, { id = "card-*", state = "data-selected", count = 1 }] }
diff --git a/sdk/ui/conformance/cases/pointer/card-menu.toml b/sdk/ui/conformance/cases/pointer/card-menu.toml
index 5ae0dbca..4d7f322c 100644
--- a/sdk/ui/conformance/cases/pointer/card-menu.toml
+++ b/sdk/ui/conformance/cases/pointer/card-menu.toml
@@ -9,8 +9,8 @@ input = { type = "move", at = "card-*" }
[[steps]]
input = { type = "click", at = "menu-*" }
[[steps]]
-expect = { all = [{ id = "hide-item", visible = true }, { id = "detail-*", visible = true, count = 0 }] }
+expect = { all = [{ id = "menu-feed-item-hide", visible = true }, { id = "detail-*", visible = true, count = 0 }] }
[[steps]]
input = { type = "press", key = "Escape" }
[[steps]]
-expect = { all = [{ id = "hide-item", exists = false }, { id = "card-*", visible = true, quant = "any" }] }
+expect = { all = [{ id = "menu-feed-item-hide", exists = false }, { id = "card-*", visible = true, quant = "any" }] }
diff --git a/sdk/ui/conformance/cases/pointer/rail-project-select.toml b/sdk/ui/conformance/cases/pointer/rail-project-select.toml
new file mode 100644
index 00000000..4220f1ce
--- /dev/null
+++ b/sdk/ui/conformance/cases/pointer/rail-project-select.toml
@@ -0,0 +1,13 @@
+area = "pointer"
+title = "a press on a project in the rail makes it the current one and no other"
+window = [1440, 900]
+
+# the rail's rows are the workspace's projects since the shell's rework (0.1.9); the feed rows it had before are gone
+[[steps]]
+wait = { id = "project-p-pong", visible = true }
+[[steps]]
+expect = { all = [{ id = "project-p-ides", current = true }, { id = "project-p-*", current = true, count = 1 }] }
+[[steps]]
+input = { type = "click", at = "project-p-pong" }
+[[steps]]
+expect = { all = [{ id = "project-p-pong", current = true }, { id = "project-p-*", current = true, count = 1 }] }
diff --git a/sdk/ui/conformance/cases/pointer/sidebar-feed-select.toml b/sdk/ui/conformance/cases/pointer/sidebar-feed-select.toml
deleted file mode 100644
index e1239db3..00000000
--- a/sdk/ui/conformance/cases/pointer/sidebar-feed-select.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-area = "pointer"
-title = "a press on a feed row in the sidebar makes that row the current one and no other"
-window = [1440, 900]
-
-[[steps]]
-wait = { id = "feed-f-ides-dailies", visible = true }
-[[steps]]
-expect = { all = [{ id = "feed-f-ides-all", current = true }, { id = "feed-f-*", current = true, count = 1 }] }
-[[steps]]
-input = { type = "click", at = "feed-f-ides-dailies" }
-[[steps]]
-expect = { all = [{ id = "feed-f-ides-dailies", current = true }, { id = "feed-f-*", current = true, count = 1 }] }
diff --git a/sdk/ui/conformance/conformance.feature b/sdk/ui/conformance/conformance.feature
index 9feee4ea..2ee0c293 100644
--- a/sdk/ui/conformance/conformance.feature
+++ b/sdk/ui/conformance/conformance.feature
@@ -55,7 +55,7 @@ Feature: the UI conformance suite: the bar the interface is held to
expectation (predicates on node fields), and a budget in frames (default 2 at 60 Hz for pointer and text, 1 for
a live update, 3 for a resize or a panel reflow)
And a case runs the feed (apps/app) on raea-page-host at its `route` (default /feed/f-ides-all) and names the
- feed's own data-testids (feed, card-*, search, feed-f-*, menu-*, detail-*); a node's aria-current is its
+ feed's own data-testids (feed, card-*, search, project-*, menu-*, detail-*); a node's aria-current is its
`current` field, and a boolean data-* flag (data-selected) a state token of its name
And sdk/ui/conformance/fake-cases/ holds the legacy app's cases, whose tree the runner's fake serves: they test
the runner, not an app
diff --git a/sdk/ui/conformance/src/run.rs b/sdk/ui/conformance/src/run.rs
index e945f459..96e14973 100644
--- a/sdk/ui/conformance/src/run.rs
+++ b/sdk/ui/conformance/src/run.rs
@@ -26,7 +26,8 @@ pub const USAGE: &str = "usage: conformance [--bin PATH] [--substrate NAME] [--e
[--attach PORT [--workspace DIR]] [--settle-ms MS] [--app DIR] [--no-build] [--list]
--bin the substrate's binary (default: the repo's target/release/raea-page-host). raea-page-host runs the
app's Blitz build (BIN BUNDLE --css --root, at the case's route); any other binary runs as BIN WORKSPACE
- --app the app raea-page-host runs (default: the repo's apps/app); --no-build: its blitz/out as it is
+ --app the app raea-page-host runs (default: the repo's apps/app), built with its demo world into
+ blitz/out-conformance; --no-build: that build as it is (else blitz/out)
--substrate a name for the results (default: current)
--env more environment for it (e.g. RAEA_FEED_AGENT=echo), after the suite's own
--tier quick: each case at its first window size; full: at every size, and the full-only cases (default quick)
@@ -71,9 +72,12 @@ fn location(route: &str) -> String {
format!("globalThis.location ??= {at};")
}
-/// The app's Blitz build (blitz/out/app.js and app.css): `vite build -c blitz/vite.config.ts`, as `ui-parity app` makes it.
+/// The app's Blitz build with the demo world the cases are written against (RAEA_FIXTURES=1: since 11-14 a plain build
+/// has none, as a shipped app has none), in blitz/out-conformance.
fn build_app(app: &Path) -> Result<(), String> {
- let o = Command::new("npx").args(["vite", "build", "-c", "blitz/vite.config.ts", "--logLevel", "error"]).current_dir(app).output().map_err(|e| format!("vite: {e}"))?;
+ let mut vite = Command::new("npx");
+ vite.args(["vite", "build", "-c", "blitz/vite.config.ts", "--logLevel", "error", "--outDir"]).arg(app.join(CONFORMANCE_OUT));
+ let o = vite.env("RAEA_FIXTURES", "1").current_dir(app).output().map_err(|e| format!("vite: {e}"))?;
if !o.status.success() {
return Err(format!("{}: vite build -c blitz/vite.config.ts: {}", app.display(), String::from_utf8_lossy(&o.stderr).lines().rev().take(8).collect::<Vec<_>>().join(" | ")));
}
diff --git a/sdk/ui/conformance/src/run/launch.rs b/sdk/ui/conformance/src/run/launch.rs
index f03ca05e..c1b17b1f 100644
--- a/sdk/ui/conformance/src/run/launch.rs
+++ b/sdk/ui/conformance/src/run/launch.rs
@@ -5,7 +5,7 @@ use super::*;
pub(crate) fn launch(o: &Opts, c: &Case, inst: &str, logs: &Path) -> Result<World, String> {
if let Some(port) = o.attach {
let ws = o.workspace.clone().unwrap_or_else(|| base().join("attached-workspace"));
- return Ok(World { proc: None, dir: None, workspace: ws, log: None, mcp: Mcp::new(port) });
+ return Ok(World { proc: None, host: None, dir: None, workspace: ws, log: None, mcp: Mcp::new(port) });
}
let fx = fixture(&o.fixture)?;
let dir = base().join("runs").join(std::process::id().to_string()).join(inst.replace(['/', '@'], "-"));
@@ -39,7 +39,7 @@ pub(crate) fn launch(o: &Opts, c: &Case, inst: &str, logs: &Path) -> Result<Worl
let mut cmd = Command::new(&o.bin);
if page {
// the app's Blitz build at the case's route; its own-origin fetches from blitz/out, then public/
- let out = o.app.join("blitz/out");
+ let out = Some(o.app.join(CONFORMANCE_OUT)).filter(|d| d.join("app.js").is_file()).unwrap_or(o.app.join("blitz/out"));
let js = std::fs::read_to_string(out.join("app.js")).map_err(|e| format!("{}: {e}", out.join("app.js").display()))?;
let bundle = dir.join("app.js");
std::fs::write(&bundle, format!("{}\n{js}", location(c.route.as_deref().unwrap_or(ROUTE)))).map_err(|e| e.to_string())?;
@@ -88,16 +88,44 @@ pub(crate) fn launch(o: &Opts, c: &Case, inst: &str, logs: &Path) -> Result<Worl
}
env.extend(c.env.iter().cloned());
env.extend(o.env.iter().cloned());
+ std::fs::create_dir_all(logs).map_err(|e| e.to_string())?;
+ let log = logs.join(format!("{}.log", inst.replace(['/', '@'], "-")));
+ // the page's /host/* is the feed's host's, started first as raea.app does (without it, "raea is starting" for ever)
+ let host = if page { Some(feed_host(o, &env, &log.with_extension("host.log"))?) } else { None };
+ if let Some((_, hp)) = &host {
+ env.push(("RAEA_PAGE_HOST".into(), format!("http://127.0.0.1:{hp}")));
+ }
for (k, v) in &env {
cmd.env(k, v);
}
- std::fs::create_dir_all(logs).map_err(|e| e.to_string())?;
- let log = logs.join(format!("{}.log", inst.replace(['/', '@'], "-")));
let f = std::fs::File::create(&log).map_err(|e| e.to_string())?;
cmd.stdout(Stdio::from(f.try_clone().map_err(|e| e.to_string())?)).stderr(Stdio::from(f)).stdin(Stdio::null());
let child = cmd.spawn().map_err(|e| format!("launching {}: {e}", o.bin.display()))?;
PGID.store(child.id() as i32, Ordering::SeqCst);
- Ok(World { proc: Some(Proc { child }), dir: Some(dir), workspace: ws, log: Some(log), mcp: Mcp::new(port) })
+ Ok(World { proc: Some(Proc { child, group: &PGID }), host: host.map(|h| h.0), dir: Some(dir), workspace: ws, log: Some(log), mcp: Mcp::new(port) })
+}
+
+/// Where build_app puts the app's Blitz build with its demo world (else an older app's blitz/out is run).
+pub(crate) const CONFORMANCE_OUT: &str = "blitz/out-conformance";
+
+/// The feed's host (the app's host/node.ts) on a free port in the world's environment, once it takes connections.
+fn feed_host(o: &Opts, env: &[(String, String)], log: &Path) -> Result<(Proc, u16), String> {
+ let (hp, f) = (free_port()?, std::fs::File::create(log).map_err(|e| e.to_string())?);
+ let mut cmd = Command::new("node");
+ cmd.args(["host/node.ts", "--port", &hp.to_string()]).current_dir(&o.app).env_clear().envs(env.iter().cloned()).process_group(0);
+ cmd.stdout(Stdio::from(f.try_clone().map_err(|e| e.to_string())?)).stderr(Stdio::from(f)).stdin(Stdio::null());
+ let child = cmd.spawn().map_err(|e| format!("the feed's host (node host/node.ts in {}): {e}", o.app.display()))?;
+ HOST_PGID.store(child.id() as i32, Ordering::SeqCst);
+ let mut p = Proc { child, group: &HOST_PGID };
+ let t = Instant::now();
+ while std::net::TcpStream::connect_timeout(&([127, 0, 0, 1], hp).into(), Duration::from_millis(200)).is_err() {
+ match p.child.try_wait() {
+ Ok(Some(st)) => return Err(format!("the feed's host exited ({st}) before it listened: {}", log.display())),
+ _ if t.elapsed() > Duration::from_secs(30) => return Err(format!("the feed's host never listened on :{hp} in 30 s: {}", log.display())),
+ _ => std::thread::sleep(Duration::from_millis(100)),
+ }
+ }
+ Ok((p, hp))
}
/// Until the substrate's MCP answers (or it dies, or `secs` pass); then its tools.
diff --git a/sdk/ui/conformance/src/run/procs.rs b/sdk/ui/conformance/src/run/procs.rs
index 58703fba..d26dff8a 100644
--- a/sdk/ui/conformance/src/run/procs.rs
+++ b/sdk/ui/conformance/src/run/procs.rs
@@ -3,11 +3,12 @@
use super::*;
pub(crate) static PGID: AtomicI32 = AtomicI32::new(0);
+/// the feed's host beside raea-page-host (launch.rs feed_host)
+pub(crate) static HOST_PGID: AtomicI32 = AtomicI32::new(0);
extern "C" fn on_signal(sig: libc::c_int) {
- let g = PGID.load(Ordering::SeqCst);
unsafe {
- if g > 0 {
+ for g in [PGID.load(Ordering::SeqCst), HOST_PGID.load(Ordering::SeqCst)].into_iter().filter(|g| *g > 0) {
libc::killpg(g, libc::SIGKILL);
}
libc::_exit(128 + sig);
@@ -40,6 +41,8 @@ pub(crate) fn sweep() {
pub(crate) struct Proc {
pub(crate) child: Child,
+ /// where the signal handler finds its process group (PGID, HOST_PGID), cleared once it's stopped
+ pub(crate) group: &'static AtomicI32,
}
impl Drop for Proc {
@@ -55,13 +58,14 @@ impl Drop for Proc {
}
unsafe { libc::killpg(g, libc::SIGKILL) };
let _ = self.child.wait();
- PGID.store(0, Ordering::SeqCst);
+ self.group.store(0, Ordering::SeqCst);
}
}
-/// One case's world: a launched substrate (or an attached one), its folder, its log.
+/// One case's world: a launched substrate (or an attached one) and the feed's host beside it, its folder, its log.
pub(crate) struct World {
pub(crate) proc: Option<Proc>,
+ pub(crate) host: Option<Proc>,
pub(crate) dir: Option<PathBuf>,
pub(crate) workspace: PathBuf,
pub(crate) log: Option<PathBuf>,
@@ -71,6 +75,7 @@ pub(crate) struct World {
impl Drop for World {
fn drop(&mut self) {
self.proc.take();
+ self.host.take();
if let Some(d) = self.dir.take() {
let _ = std::fs::remove_dir_all(d);
}