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.

raea make status and raea judge say why a brief was refused: raea spec prints its refusal on stdout and they read only stderr, so a brief with one wrong value gave an empty reason. MK21-MK24 are done: proven on a job (the render's lod-closer from the brief's level, raea scene lod's table, the make gate open then clear when answered in NOTES.md or replanned, the blockout's boxes named with their level)

shinyobjectz38f49d623f4f
diff --git a/apps/judge/src/lib.rs b/apps/judge/src/lib.rs
index f72f310c..7f87dcf3 100644
--- a/apps/judge/src/lib.rs
+++ b/apps/judge/src/lib.rs
@@ -58,7 +58,7 @@ fn brief_of(path: Option<&str>) -> Result<Value, String> {
let exe = std::env::current_exe().map_err(|e| e.to_string())?;
let out = std::process::Command::new(exe).args(["spec", p, "--as", "brief"]).output().map_err(|e| e.to_string())?;
let text = String::from_utf8_lossy(&out.stdout);
- let start = text.find('{').ok_or_else(|| format!("judge: {p} didn't read as a brief: {}", String::from_utf8_lossy(&out.stderr).lines().last().unwrap_or("")))?;
+ let start = text.find('{').ok_or_else(|| format!("judge: {p} didn't read as a brief: {}", why_refused(&out)))?;
let v: Value = serde_json::from_str(&text[start..]).map_err(|e| format!("judge: {p}: {e}"))?;
Ok(v.get("brief").cloned().unwrap_or(v))
}
@@ -226,3 +226,10 @@ fn finish(args: &[String], kind: Option<&str>, dir: &Path, scores: serde_json::M
#[cfg(test)]
mod tests;
+
+/// Why `raea spec` refused a brief, in its own words: its refusal is the last line it printed, on whichever stream
+/// (a REFUSED line goes to stdout, a thrown module's error to stderr). Reading stderr alone left the reason empty.
+fn why_refused(out: &std::process::Output) -> String {
+ let last = |b: &[u8]| String::from_utf8_lossy(b).lines().rev().find(|l| !l.trim().is_empty()).map(|l| l.trim().trim_start_matches("REFUSED").trim().to_string());
+ last(&out.stderr).or_else(|| last(&out.stdout)).unwrap_or_else(|| "raea spec printed nothing".into())
+}
diff --git a/apps/make/src/lib.rs b/apps/make/src/lib.rs
index 0c8f47ab..fa1de4ca 100644
--- a/apps/make/src/lib.rs
+++ b/apps/make/src/lib.rs
@@ -58,7 +58,7 @@ pub fn read_make(brief: &Path) -> Result<Option<Make>, String> {
let exe = std::env::current_exe().map_err(|e| e.to_string())?;
let out = std::process::Command::new(exe).arg("spec").arg(brief).args(["--as", "brief"]).env("RAEA_RECORD", "off").output().map_err(|e| e.to_string())?;
let text = String::from_utf8_lossy(&out.stdout);
- let start = text.find('{').ok_or_else(|| format!("{} didn't read as a brief: {}", brief.display(), String::from_utf8_lossy(&out.stderr).lines().last().unwrap_or("")))?;
+ let start = text.find('{').ok_or_else(|| format!("{} didn't read as a brief: {}", brief.display(), why_refused(&out)))?;
let v: Value = serde_json::from_str(&text[start..]).map_err(|e| format!("{}: {e}", brief.display()))?;
let b = v.get("brief").cloned().unwrap_or(v);
match b.get("make") {
@@ -212,3 +212,10 @@ pub fn cli(args: &[String]) -> Result<String, String> {
mod tests;
#[cfg(test)]
mod tests_steps;
+
+/// Why `raea spec` refused a brief, in its own words: its refusal is the last line it printed, on whichever stream
+/// (a REFUSED line goes to stdout, a thrown module's error to stderr). Reading stderr alone left the reason empty.
+fn why_refused(out: &std::process::Output) -> String {
+ let last = |b: &[u8]| String::from_utf8_lossy(b).lines().rev().find(|l| !l.trim().is_empty()).map(|l| l.trim().trim_start_matches("REFUSED").trim().to_string());
+ last(&out.stderr).or_else(|| last(&out.stdout)).unwrap_or_else(|| "raea spec printed nothing".into())
+}
diff --git a/docs/make.feature b/docs/make.feature
index 84ac6b74..2d77766f 100644
--- a/docs/make.feature
+++ b/docs/make.feature
@@ -204,6 +204,7 @@ Feature: Make: scenes, kits and shots built to a frozen plan and held to a revie
much of it gets built; the frames are measured against it on every render, so a camera move added later, or a
box that was meant to be replaced, is said the next time anything is drawn.
+ @done
Scenario: MK21. A part shown closer than its planned detail is said
Given a level is how much of the frame a part's box spans through the frame's camera, the larger of its width's
and its height's share: 0 the hero (50% or more), 1 featured (20%), 2 dressing (8%), 3 background (2%), 4 far
@@ -217,7 +218,7 @@ Feature: Make: scenes, kits and shots built to a frozen plan and held to a revie
And a part out of the frame, behind the camera, or with another mesh's box across every line to it isn't seen;
a part the camera stands in or beside is measured at its nearest point; RAEA_LOD_CHECK=0 leaves the check out
- @needs:MK21
+ @needs:MK21 @done
Scenario: MK22. The plan carries each object's level
Given `lod: 0..4` on an object of `make` in brief.ts (core/brief make.rs; `doctor` refuses a level past 4)
Then a render of a composition under that brief holds the parts named as the objects' ids to those levels
@@ -225,7 +226,7 @@ Feature: Make: scenes, kits and shots built to a frozen plan and held to a revie
And `raea make plan` labels each footprint with its level and writes each grey box with its object's id as its
name and its `lod`, so the blockout is held to the plan it draws
- @needs:MK21
+ @needs:MK21 @done
Scenario: MK23. `raea scene lod`: every part's plan beside what the frames show
When `raea scene lod EDIT.tsx [--from N] [--to N] [--json]` steps the frames without drawing
Then it lists every part: its planned level, the finest level a frame shows it at, how much of the frame it
@@ -235,7 +236,7 @@ Feature: Make: scenes, kits and shots built to a frozen plan and held to a revie
And a level the plan gives a name that no part in the frames goes by is listed, since it holds nothing
And it exits 1 when a part is seen two or more levels finer than planned
- @needs:MK22
+ @needs:MK22 @done
Scenario: MK24. A job is held at a part seen closer than planned
Given a job whose composition's last render or check found `lod-closer`
Then `raea make status` has a `lod` gate for that composition, open with the parts' names, until each is built