Official Codebase of 3DCodeVerse
Python
cli: an option that would be dropped is refused — --reference-views without --reference, pick --judge without a pairwise verdict, render --width/--height on a graphics run
gaoypeng9b09ddd2b6d9
diff --git a/harness/codeverse3d/cli/inspect_cmd.py b/harness/codeverse3d/cli/inspect_cmd.pyindex 7db7b1dc..f5b44e37 100644--- a/harness/codeverse3d/cli/inspect_cmd.py+++ b/harness/codeverse3d/cli/inspect_cmd.py@@ -48,6 +48,9 @@ def render(raise C.CliError(f"--mode must be one of {' | '.join(RENDER_MODES)}, not {mode!r}", code=2)if mode != "shaded" and spec.track in (Track.SCENE, Track.GRAPHICS): # was silently rendered shadedraise C.CliError(f"--mode {mode} is for object runs; a {spec.track.value} run renders shaded only", code=2)+ if spec.track is Track.GRAPHICS and (width or height): # the frames are the runtime's size: dropped silently+ raise C.CliError("--width/--height do not apply to a graphics run: its frames are rendered at the runtime's size",+ code=2)idx = _render_round_or_refuse(ws, round_index)out_dir = out or ws.renders_dir(idx) / ("cli" if mode == "shaded" else f"cli_{mode}")# writes into the run (a graphics render even rebuilds it): one writer per run dirdiff --git a/harness/codeverse3d/cli/main.py b/harness/codeverse3d/cli/main.pyindex a51f62a1..fe1c0474 100644--- a/harness/codeverse3d/cli/main.py+++ b/harness/codeverse3d/cli/main.py@@ -260,15 +260,15 @@ def make(),] = False,reference_views: Annotated[- int,+ int | None,typer.Option("--reference-views",min=1,max=4,help="how many reference views to "- "synthesize (1 = 3/4 only, 2 = + straight front elevation)",+ "synthesize (1 = 3/4 only, 2 = + straight front elevation; default 2); needs --reference",),- ] = 2,+ ] = None,profile: Annotated[str | None,typer.Option(@@ -336,6 +336,9 @@ def make(if not prompt.strip(): # a blank prompt was planned, generated and judged as israise C.CliError("the prompt is empty: say what to build", code=2)C.check_minutes(max_minutes)+ if reference_views is not None and not reference: # it was dropped without a word+ raise C.CliError("--reference-views needs --reference", code=2)+ reference_views = reference_views or 2for p in image:if not p.is_file():raise C.CliError(f"reference image not found: {p}")@@ -673,6 +676,8 @@ def pick(if by not in ("score", "pairwise"):raise C.CliError(f"--by must be score or pairwise, not {by!r}", code=2)+ if judge and (by != "pairwise" or round_index is not None): # no pairwise verdict is bought: it was dropped+ raise C.CliError("--judge is the pairwise judge: it goes with --by pairwise (and no --round)", code=2)ws = C.open_workspace(slug, runs_dir)# writes deliverable/ + selection.json (a texture pass or a pairwise verdict is paid):# one writer per run dir, and the money joins the run's ledgerdiff --git a/harness/tests/flywheel_cli/test_cli.py b/harness/tests/flywheel_cli/test_cli.pyindex 7a97e28e..888d9152 100644--- a/harness/tests/flywheel_cli/test_cli.py+++ b/harness/tests/flywheel_cli/test_cli.py@@ -576,3 +576,18 @@ def test_a_reference_that_is_not_an_image_is_refused_before_the_run_exists(tmp_pbad.write_text("not an image")r = runner.invoke(app, ["make", "a cup", "--image", str(bad), "--no-run", "--runs-dir", str(tmp_path / "runs"), "--slug", "i"])assert r.exit_code == 1 and "not a readable image" in r.output and not (tmp_path / "runs" / "i").exists()+++def test_an_option_that_would_be_dropped_is_refused(tmp_path: Path, runs_dir: Path):+ """--reference-views without --reference, pick --judge without a pairwise verdict to buy, and+ render --width/--height on a graphics run were accepted and silently did nothing."""+ runs = tmp_path / "runs"+ r = runner.invoke(app, ["make", "a cup", "--reference-views", "1", "--no-run", "--runs-dir", str(runs), "--slug", "rv"])+ assert r.exit_code == 2 and "--reference-views needs --reference" in r.output and not (runs / "rv").exists()+ for extra in (["--judge", "gemini:gemini-3.7-flash"], ["--by", "pairwise", "--round", "0", "--judge", "gemini:x"]):+ r = runner.invoke(app, ["pick", "wooden_chair_ab12cd34", "--runs-dir", str(runs_dir), *extra])+ assert r.exit_code == 2 and "--judge is the pairwise judge" in r.output+ assert runner.invoke(app, ["make", "a shader", "--track", "graphics", "--no-run", "--runs-dir", str(runs),+ "--slug", "g"]).exit_code == 0+ r = runner.invoke(app, ["render", "g", "--width", "64", "--runs-dir", str(runs)])+ assert r.exit_code == 2 and "graphics run" in r.output