Skip to content

Rebuild the object in a reference image as a code-only, procedural, quality-gated, animation-ready Three.js model. Token-efficient image-to-3D.

fix: fail loud when a domain run's augmentation artifact is missing

kokorolx041c790f32be
diff --git a/forge/stage2_spec/new_sculpt_spec.py b/forge/stage2_spec/new_sculpt_spec.py
index f08f84b..c0e4460 100755
--- a/forge/stage2_spec/new_sculpt_spec.py
+++ b/forge/stage2_spec/new_sculpt_spec.py
@@ -1946,14 +1946,28 @@ def main(argv: list[str]) -> int:
if isinstance(assessment, dict) and isinstance(assessment.get("preSpecAssessment"), dict):
anatomy = assessment["preSpecAssessment"].get("anatomy")
apply_character_template(spec, anatomy, include_accessories=args.accessories)
- if args.augmentation is not None and args.augmentation.expanduser().is_file():
- try:
- artifact = json.loads(args.augmentation.expanduser().read_text(encoding="utf-8"))
- merge_spec_augmentation(spec, artifact, domain_id=args.domain)
- except (OSError, json.JSONDecodeError) as exc:
- parser.error(f"cannot read spec augmentation {args.augmentation}: {exc}")
- except SpecAugmentationError as exc:
- parser.error(str(exc))
+ if args.augmentation is not None:
+ source = args.augmentation.expanduser()
+ if not source.is_file():
+ # A domain run whose augmentation artifact is missing means the domain's emit step
+ # failed or was skipped. Writing the generic skeleton and exiting 0 here is the silent
+ # downgrade 02-how-it-works.md draws as FAIL LOUD (PR #106 review, finding 4). Without
+ # --domain the flag is speculative plumbing from a generic checklist, and skipping stays
+ # correct.
+ if args.domain:
+ parser.error(
+ f"--domain {args.domain} is resolved but the augmentation artifact "
+ f"{args.augmentation} does not exist; run the domain's emit step instead of "
+ f"continuing on the generic skeleton"
+ )
+ else:
+ try:
+ artifact = json.loads(source.read_text(encoding="utf-8"))
+ merge_spec_augmentation(spec, artifact, domain_id=args.domain)
+ except (OSError, json.JSONDecodeError) as exc:
+ parser.error(f"cannot read spec augmentation {args.augmentation}: {exc}")
+ except SpecAugmentationError as exc:
+ parser.error(str(exc))
payload = json.dumps(spec, indent=2, ensure_ascii=False) + "\n"
if args.out:
diff --git a/forge/tests/test_pipeline.py b/forge/tests/test_pipeline.py
index 8352649..f1e472c 100644
--- a/forge/tests/test_pipeline.py
+++ b/forge/tests/test_pipeline.py
@@ -889,6 +889,33 @@ class PipelineTest(unittest.TestCase):
self.assertIn("fixtureSection", spec, "the augmentation merge was skipped")
self.assertEqual(spec["specAugmentation"]["provider"], "fixture")
+ def test_a_domain_run_with_a_missing_augmentation_fails_loud(self):
+ """02-how-it-works draws the missing-provider case as FAIL LOUD; the code must match.
+
+ Before this test, a resolved --domain whose spec-augmentation.json was absent (emit step
+ failed, or an actor:agent step skipped) silently wrote the generic skeleton and exited 0 --
+ a whole run could finish with no domain contribution and nobody would know.
+ """
+ r = run(
+ "stage2_spec/new_sculpt_spec.py", "Knife",
+ "--domain", "fixturedom",
+ "--augmentation", self.dir / "does-not-exist.json",
+ "--out", self.spec,
+ )
+ self.assertNotEqual(r.returncode, 0)
+ self.assertIn("does-not-exist.json", r.stderr)
+ self.assertIn("fixturedom", r.stderr)
+ self.assertFalse(self.spec.exists(), "no generic skeleton may be written for a failed domain run")
+
+ def test_a_generic_run_still_skips_a_missing_augmentation(self):
+ r = run(
+ "stage2_spec/new_sculpt_spec.py", "Crate",
+ "--augmentation", self.dir / "does-not-exist.json",
+ "--out", self.spec,
+ )
+ self.assertEqual(r.returncode, 0, r.stderr)
+ self.assertTrue(self.spec.exists())
+
def test_cs2_track_skipped_for_objects(self):
run("stage2_spec/new_sculpt_spec.py", "Crate", "--out", self.spec)
spec = json.loads(self.spec.read_text())
diff --git a/forge/tests/test_suite_integrity.py b/forge/tests/test_suite_integrity.py
index c39d52e..87ba904 100644
--- a/forge/tests/test_suite_integrity.py
+++ b/forge/tests/test_suite_integrity.py
@@ -45,7 +45,7 @@ TESTS_DIR = Path(__file__).resolve().parent
# registry layout instead of assumed from a name match) added 2 tests -- a plugin whose package
# name differs from its domain id, and an in-repo domain's profile correctly attributing no
# installed plugin as its owner.
-COLLECTED_FLOOR = 1185
+COLLECTED_FLOOR = 1192
REPO_ROOT = TESTS_DIR.parents[1]