authoravatarclover caruso<git@paperclover.net>2026-11-30 21:06:08-08:00
committeravatarclover caruso<git@paperclover.net>2026-11-30 21:16:22-08:00
logd5f970670c55ec4beb4f3c7c3edfd64bffcdedaa
tree883fb7aee0cfbd8627e279389eca38e3a7235844
parentd702f0abe89e0236e840be2dedb07dd5010e5669
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Fix schemas/add_tool mismatches, harden gen_compatibility --strict, fix matrix_aspect and alpha gating


6 files changed, 48 insertions(+), 28 deletions(-)

crates/app/src/add_tool.rs+1-1
......@@ -129,7 +129,7 @@ pub const TOOL_CATALOG: &[ToolEntry] = &[
129129 ToolEntry { kind: "sEllipse", display: "Shape Ellipse", aliases: "sellipse vector circle oval", category: ToolCategory::Shape2D, is_generator: true },
130130 ToolEntry { kind: "sRectangle", display: "Shape Rectangle", aliases: "srect vector box rounded", category: ToolCategory::Shape2D, is_generator: true },
131131 ToolEntry { kind: "sNGon", display: "Shape NGon", aliases: "sngon vector polygon sides", category: ToolCategory::Shape2D, is_generator: true },
132 ToolEntry { kind: "sGrid", display: "Shape Grid", aliases: "sgrid vector cells array", category: ToolCategory::Shape2D, is_generator: true },
132 ToolEntry { kind: "sGrid", display: "Shape Grid", aliases: "sgrid vector cells array", category: ToolCategory::Shape2D, is_generator: false },
133133 ToolEntry { kind: "sMerge", display: "Shape Merge", aliases: "smerge vector combine", category: ToolCategory::Shape2D, is_generator: false },
134134 ToolEntry { kind: "sTransform", display: "Shape Transform", aliases: "stransform vector move scale rotate", category: ToolCategory::Shape2D, is_generator: false },
135135 ToolEntry { kind: "sBoolean", display: "Shape Boolean", aliases: "sbool vector union subtract intersect xor", category: ToolCategory::Shape2D, is_generator: false },
crates/app/src/inspector/mod.rs+2-2
......@@ -482,8 +482,8 @@ mod tests {
482482 "TimeStretcher", "TimeSpeed",
483483 "Paint", "PaintMask", "WandMask", "BitmapMask",
484484 "Drip", "Dent", "DaySky", "GridWarp", "PerspectivePositioner",
485 "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sMerge", "sOutline", "sGrid",
486 "MtlBlinn", "MtlPhong", "MtlCookTorrance", "MtlWard",
485 "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sOutline", "sGrid",
486 "MtlBlinn", "MtlPhong", "MtlCookTorrance",
487487 "LightPoint", "LightSpot", "LightDirectional", "LightAmbient",
488488 "Cube3D", "SurfaceFBXMesh", "Custom",
489489 "ErodeDilate", "DirectionalBlur", "VariBlur", "Sharpen", "Shadow",
crates/app/src/inspector/schemas.rs+2-15
......@@ -169,11 +169,11 @@ pub const CURATED_TOOL_KINDS: &[&str] = &[
169169 // Paint & Masks
170170 "Paint", "PaintMask", "EllipseMask", "RectangleMask", "BitmapMask", "WandMask",
171171 // Vector Shapes
172 "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sMerge", "sOutline", "sGrid",
172 "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sOutline", "sGrid",
173173 // 3D Scene, Lights & Materials
174174 "Camera3D", "Shape3D", "Cube3D", "SurfaceFBXMesh",
175175 "LightPoint", "LightSpot", "LightDirectional", "LightAmbient",
176 "MtlBlinn", "MtlPhong", "MtlCookTorrance", "MtlWard",
176 "MtlBlinn", "MtlPhong", "MtlCookTorrance",
177177];
178178
179179/// Curated Fusion 21.1 parameter schemas for major compositor tools.
......@@ -528,11 +528,8 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] {
528528 boolean("Reverse", "Reverse", false),
529529 ] },
530530 "Saver" => const { &[
531 boolean("CreateDir", "Create Dir", true),
532531 boolean("SetSequenceStart", "Seq Start", false),
533532 flt("SequenceStartFrame", "Start Frame", 0.0, 10000.0, 0.0),
534 boolean("ProcessWhenBlendIs00", "Proc Blend 0", false),
535 flt("Blend", "Blend", 0.0, 1.0, 1.0),
536533 ] },
537534 "TimeStretcher" => const { &[
538535 flt("SourceTime", "Source Time", 0.0, 10000.0, 0.0),
......@@ -667,9 +664,6 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] {
667664 flt("YSize", "Y Size", 0.0, 5.0, 1.0),
668665 flt("ZRotation", "Rotation", -360.0, 360.0, 0.0),
669666 ] },
670 "sMerge" => const { &[
671 flt("Blend", "Blend", 0.0, 1.0, 1.0),
672 ] },
673667 "sOutline" => const { &[
674668 flt("Thickness", "Thickness", 0.0, 0.2, 0.01),
675669 int_enum("JoinStyle", "Join", JOIN_STYLES, 2),
......@@ -788,13 +782,6 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] {
788782 flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0),
789783 flt("Specular.Roughness", "Roughness", 0.05, 1.0, 0.6),
790784 ] },
791 "MtlWard" => const { &[
792 rgba("Diffuse", "Diffuse", "Diffuse.Color.Red", "Diffuse.Color.Green", "Diffuse.Color.Blue", Some("Diffuse.Opacity"), [1.0, 1.0, 1.0, 1.0]),
793 rgba("Specular", "Specular", "Specular.Color.Red", "Specular.Color.Green", "Specular.Color.Blue", None, [1.0, 1.0, 1.0, 1.0]),
794 flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0),
795 flt("Specular.SpreadU", "Spread U", 0.01, 1.0, 0.25),
796 flt("Specular.SpreadV", "Spread V", 0.01, 1.0, 0.25),
797 ] },
798785 _ => &[],
799786 }
800787}
scripts/diff_fuzz/matrix.py+1-1
......@@ -964,7 +964,7 @@ _ASPECT_SETUP = """\t\tBlackBG = Background { Inputs = { Width = Input { Value =
964964_ASPECT_CASES = (
965965 ("BG_Horizontal", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Horizontal" }, }, TopLeftRed = Input { Value = 0.9, }, TopLeftGreen = Input { Value = 0.2, }, TopLeftBlue = Input { Value = 0.1, }, TopLeftAlpha = Input { Value = 1, }, TopRightRed = Input { Value = 0.1, }, TopRightGreen = Input { Value = 0.3, }, TopRightBlue = Input { Value = 0.9, }, TopRightAlpha = Input { Value = 1, }, }, }'),
966966 ("BG_Vertical", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Vertical" }, }, TopLeftRed = Input { Value = 0.9, }, TopLeftGreen = Input { Value = 0.2, }, TopLeftBlue = Input { Value = 0.1, }, TopLeftAlpha = Input { Value = 1, }, BottomLeftRed = Input { Value = 0.1, }, BottomLeftGreen = Input { Value = 0.3, }, BottomLeftBlue = Input { Value = 0.9, }, BottomLeftAlpha = Input { Value = 1, }, }, }'),
967 ("BG_FourCorner", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Four Corner" }, }, TopLeftRed = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, TopRightGreen = Input { Value = 1, }, TopRightAlpha = Input { Value = 1, }, BottomLeftBlue = Input { Value = 1, }, BottomLeftAlpha = Input { Value = 1, }, BottomRightRed = Input { Value = 1, }, BottomRightGreen = Input { Value = 1, }, BottomRightAlpha = Input { Value = 1, }, }, }'),
967 ("BG_FourCorner", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Corner" }, }, TopLeftRed = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, TopRightGreen = Input { Value = 1, }, TopRightAlpha = Input { Value = 1, }, BottomLeftBlue = Input { Value = 1, }, BottomLeftAlpha = Input { Value = 1, }, BottomRightRed = Input { Value = 1, }, BottomRightGreen = Input { Value = 1, }, BottomRightAlpha = Input { Value = 1, }, }, }'),
968968 ("EllipseMask_Circle", 'Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "@MASK@", Source = "Mask", }, }, }',
969969 'EllipseMask { Inputs = { MaskWidth = Input { Value = @W@, }, MaskHeight = Input { Value = @H@, }, Width = Input { Value = 0.5, }, Height = Input { Value = 0.5, }, SoftEdge = Input { Value = 0.02, }, }, }'),
970970 ("EllipseMask_Rotated", 'Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "@MASK@", Source = "Mask", }, }, }',
scripts/diff_fuzz/runner.py+9-4
......@@ -201,6 +201,11 @@ def run_multi_graph_batch(
201201 )
202202
203203
204def _exceeds_threshold(m: Dict[str, Any], threshold_pct: float) -> bool:
205 """Return True if either RGB MAE% or Alpha MAE% exceeds threshold_pct."""
206 return m["mae_pct"] > threshold_pct or m.get("alpha_mae_pct", 0.0) > threshold_pct
207
208
204209def bisect_failing_graph(
205210 graph: FuzzGraph,
206211 threshold_pct: float,
......@@ -218,7 +223,7 @@ def bisect_failing_graph(
218223 st_comp, st_prefix, [graph.eval_frame], {graph.eval_frame: f"seed_{seed}"}, render_gt=render_gt, timeout_sec=timeout_sec
219224 )[graph.eval_frame]
220225 orig_mae = st_res["mae_pct"]
221 if orig_mae <= threshold_pct:
226 if not _exceeds_threshold(st_res, threshold_pct):
222227 return {
223228 "seed": seed,
224229 "reproduced_standalone": False,
......@@ -238,7 +243,7 @@ def bisect_failing_graph(
238243 prefix_items, f"bisect_s{seed}_prefixes", render_gt=render_gt, timeout_sec=timeout_sec
239244 )
240245 for idx, nd in enumerate(non_src):
241 if pref_res[idx]["mae_pct"] > threshold_pct:
246 if _exceeds_threshold(pref_res[idx], threshold_pct):
242247 cur = graph.prune_to(nd.name)
243248 print(f" [prefix] trimmed sink to {nd.name} ({len(cur.nodes)} nodes, MAE={pref_res[idx]['mae_pct']:.2f}%)", flush=True)
244249 break
......@@ -275,7 +280,7 @@ def bisect_failing_graph(
275280 failing: List[Tuple[Tuple[int, int, int], str, FuzzGraph, float]] = []
276281 for idx, (desc, _act, cg) in enumerate(candidates):
277282 m = cand_res[idx]
278 if m["mae_pct"] > threshold_pct:
283 if _exceeds_threshold(m, threshold_pct):
279284 mask_cnt = sum(1 for x in cg.nodes if x.mask is not None)
280285 spline_cnt = sum(
281286 1 for x in cg.nodes for v in x.params.values() if isinstance(v, SplineParam)
......@@ -328,7 +333,7 @@ def print_table(title: str, rows: List[Dict[str, Any]], threshold_pct: float) ->
328333 elif mae_pct > threshold_pct:
329334 status = "FAIL"
330335 elif a_pct > threshold_pct:
331 status = "PASS (ALPHA DIFF)"
336 status = "FAIL (ALPHA)"
332337 else:
333338 status = "PASS"
334339 print(f" {label:<44s} | {mae_pct:6.2f}% | {a_pct:6.2f}% | {mae:6.2f} | {rmse:6.2f} | {status}")
scripts/gen_compatibility.py+33-5
......@@ -22,6 +22,7 @@ SCENE3D_DIR_LABEL = "crates/engine/src/scene3d/"
2222SCENE3D_RS = REPO_ROOT / "crates" / "engine" / "src" / "scene3d" / "collect.rs"
2323COMP_RS = REPO_ROOT / "crates" / "model" / "src" / "comp.rs"
2424ADD_TOOL_RS = REPO_ROOT / "crates" / "app" / "src" / "add_tool.rs"
25SCHEMAS_RS = REPO_ROOT / "crates" / "app" / "src" / "inspector" / "schemas.rs"
2526PROBES_PY = REPO_ROOT / "scripts" / "fusion_probes.py"
2627DEFAULT_OUTPUT = REPO_ROOT / "compatibility.md"
2728
......@@ -195,7 +196,7 @@ TOOL_METADATA: Sequence[ToolMeta] = (
195196 ToolMeta("Dimension.CopyAux", "Time, Routing & Utility", "Unit tests", "Visual*", "Passes the RGBA `Input` through unchanged in both `Mode`s. *The engine carries no auxiliary planes (`Z`, `Coverage`, `ObjectID`, `Vector`, ...), so `Channel` is ignored and aux-to-color output is not produced."),
196197 ToolMeta("TimeStretcher", "Time, Routing & Utility", "Suite comps", "0.0%–0.2%", "Keyframed/expression `SourceTime` remapping with `Nearest` (`0`), `Blend` (`1`), and GPU `OpticalFlow` (`2`) bidirectional warped interpolation."),
197198 ToolMeta("TimeSpeed", "Time, Routing & Utility", "Suite comps", "0.0%", "Constant/animated `Speed` and `Delay` time remapping."),
198 ToolMeta("Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Dynamic input routing by `Which` index (`Input1`..`InputN`)."),
199 ToolMeta("Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Dynamic input routing by `Source` index (`Input0`..`InputN`)."),
199200 ToolMeta("Fuse.Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Fuse variant of `Switch` routing `Input1`..`InputN` by `Which`."),
200201 ToolMeta("PipeRouter", "Time, Routing & Utility", "Suite comps", "0.0%", "Zero-cost graph routing node."),
201202 ToolMeta("Fuse.Wireless", "Time, Routing & Utility", "Suite comps", "0.0%", "Wireless link passthrough node."),
......@@ -311,6 +312,15 @@ def parse_add_tool_catalog(path: Path) -> Set[str]:
311312 return set(re.findall(r'ToolEntry\s*\{\s*kind:\s*"([^"]+)"', path.read_text(encoding="utf-8")))
312313
313314
315def parse_curated_tool_kinds(path: Path) -> Set[str]:
316 """Return every tool kind listed in CURATED_TOOL_KINDS of inspector/schemas.rs."""
317 text = path.read_text(encoding="utf-8")
318 m = re.search(r"const CURATED_TOOL_KINDS:\s*&\[&str\]\s*=\s*&\[(.*?)\];", text, re.S)
319 if not m:
320 raise RuntimeError(f"Could not locate CURATED_TOOL_KINDS in {path}")
321 return set(re.findall(r'"([^"]+)"', re.sub(r"//[^\n]*", "", m.group(1))))
322
323
314324def parse_comp_rs_modifiers(path: Path) -> Tuple[List[str], Set[str]]:
315325 """Return (declared MODIFIER_TYPES, implemented modifier classes in parse_tools_table)."""
316326 text = path.read_text(encoding="utf-8")
......@@ -413,6 +423,7 @@ def build_markdown(
413423 impl_modifiers: Set[str],
414424 comp_supported: Set[str],
415425 catalog_kinds: Set[str],
426 curated_kinds: Set[str],
416427 probe_suites: Set[str],
417428 active_corpus: Optional[Tuple[int, Counter[str]]],
418429 archive_corpus: Optional[Tuple[int, Counter[str]]],
......@@ -470,6 +481,12 @@ def build_markdown(
470481 for name in sorted(catalog_kinds & ADD_TOOL_EXCLUDED):
471482 warnings.append(f"add_tool.rs TOOL_CATALOG lists {name} which ADD_TOOL_EXCLUDED omits")
472483
484 # Inspector curated schemas must only reference supported tools in TOOL_METADATA.
485 for name in sorted(curated_kinds - comp_supported):
486 warnings.append(f"inspector/schemas.rs CURATED_TOOL_KINDS lists {name} which is not in is_supported_tool()")
487 for name in sorted(curated_kinds - meta_all_names):
488 warnings.append(f"inspector/schemas.rs CURATED_TOOL_KINDS lists {name} which is not in TOOL_METADATA")
489
473490 all_supported_tools = live_engine_tools | non_render_tools
474491 all_supported_classes = all_supported_tools | impl_modifiers
475492
......@@ -619,7 +636,8 @@ def main() -> int:
619636 parser.add_argument("-o", "--output", type=Path, default=DEFAULT_OUTPUT, help="Output markdown path.")
620637 parser.add_argument("--active-dir", type=Path, default=ACTIVE_CORPUS_DIR, help="Active Fusion .comp directory.")
621638 parser.add_argument("--archive-dir", type=Path, default=ARCHIVE_CORPUS_DIR, help="Archive Fusion .comp directory.")
622 parser.add_argument("--strict", action="store_true", help="Exit non-zero on any registry drift: engine vs TOOL_METADATA vs is_supported_tool vs add_tool.rs.")
639 parser.add_argument("--strict", action="store_true", help="Exit non-zero on any registry drift: engine vs TOOL_METADATA vs is_supported_tool vs add_tool.rs vs inspector/schemas.rs.")
640 parser.add_argument("--check", action="store_true", help="Check if compatibility.md is up to date without rewriting it; exit non-zero if out of date.")
623641 args = parser.parse_args()
624642
625643 eval_tools = parse_eval_rs(EVAL_RS)
......@@ -636,13 +654,23 @@ def main() -> int:
636654 impl_modifiers=impl_modifiers,
637655 comp_supported=parse_is_supported_tool(COMP_RS),
638656 catalog_kinds=parse_add_tool_catalog(ADD_TOOL_RS),
657 curated_kinds=parse_curated_tool_kinds(SCHEMAS_RS),
639658 probe_suites=probe_suites,
640659 active_corpus=active_corpus,
641660 archive_corpus=archive_corpus,
642661 )
643662
644 args.output.write_text(md, encoding="utf-8")
645 print(f"Wrote {args.output} ({len(md.splitlines())} lines)")
663 out_of_date = False
664 if args.check:
665 existing = args.output.read_text(encoding="utf-8") if args.output.exists() else None
666 if existing == md:
667 print(f"{args.output} is up to date ({len(md.splitlines())} lines)")
668 else:
669 out_of_date = True
670 print(f"{args.output} is out of date; run python3 scripts/gen_compatibility.py to update.", file=sys.stderr)
671 else:
672 args.output.write_text(md, encoding="utf-8")
673 print(f"Wrote {args.output} ({len(md.splitlines())} lines)")
646674 if active_corpus is not None:
647675 print(f" Active corpus: {active_corpus[0]} comps, {sum(active_corpus[1].values()):,} entries")
648676 else:
......@@ -655,7 +683,7 @@ def main() -> int:
655683 for w in warnings:
656684 print(f"WARNING: {w}", file=sys.stderr)
657685
658 if args.strict and warnings:
686 if (args.strict and warnings) or out_of_date:
659687 return 1
660688 return 0
661689