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: apply the character template and the augmentation independently

kokorolx9f7b5fb81e0c
diff --git a/forge/stage2_spec/new_sculpt_spec.py b/forge/stage2_spec/new_sculpt_spec.py
index a44ce71..f08f84b 100755
--- a/forge/stage2_spec/new_sculpt_spec.py
+++ b/forge/stage2_spec/new_sculpt_spec.py
@@ -1935,6 +1935,17 @@ def main(argv: list[str]) -> int:
# here. With none installed the spec keeps the skeleton this pipeline authored and the agent
# infers the shape from the reference, which is what a run without a domain plugin has always
# done for any other object.
+ # The template and the augmentation are independent contributions, applied in that order: the
+ # template authors the track's own spec content (componentTree, rig, buildPasses), and the
+ # guarded merge then layers plugin sections on the completed spec. These two used to be joined
+ # by an `elif`, which meant any run handed an augmentation file silently skipped the character
+ # template -- the emitted spec lost `rig` entirely and still exited 0 (PR #106 review, finding
+ # 4: "apply_character_template never runs. Exit 0, plausible-looking spec.").
+ if routing is not None and routing["track"] == "character-v1.5":
+ anatomy = None
+ 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"))
@@ -1943,11 +1954,6 @@ def main(argv: list[str]) -> int:
parser.error(f"cannot read spec augmentation {args.augmentation}: {exc}")
except SpecAugmentationError as exc:
parser.error(str(exc))
- elif routing is not None and routing["track"] == "character-v1.5":
- anatomy = None
- if isinstance(assessment, dict) and isinstance(assessment.get("preSpecAssessment"), dict):
- anatomy = assessment["preSpecAssessment"].get("anatomy")
- apply_character_template(spec, anatomy, include_accessories=args.accessories)
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 0a2c6a5..8352649 100644
--- a/forge/tests/test_pipeline.py
+++ b/forge/tests/test_pipeline.py
@@ -864,6 +864,31 @@ class PipelineTest(unittest.TestCase):
self.assertIn("createPersonModel", ts)
self.assertIn('meshes["head"]', ts)
+ def test_character_template_survives_an_augmentation_file(self):
+ """Both contributions apply; neither silences the other.
+
+ These two blocks used to be joined by an `elif`: a character run handed an augmentation
+ file skipped `apply_character_template` entirely, so the emitted spec lost `rig` and still
+ exited 0 -- the silent data loss PR #106's review demonstrated by diffing the same
+ assessment run with and without an augmentation. This pins the fix from both sides.
+ """
+ aug = self.dir / "spec-augmentation.json"
+ aug.write_text(
+ json.dumps(
+ {
+ "kind": "spec-augmentation-v1",
+ "provenance": {"provider": "fixture", "version": "0.0.1"},
+ "specSections": {"fixtureSection": {"marker": True}},
+ }
+ ),
+ encoding="utf-8",
+ )
+ run("stage2_spec/new_sculpt_spec.py", "Person", "--character", "--augmentation", aug, "--out", self.spec)
+ spec = json.loads(self.spec.read_text())
+ self.assertIn("rig", spec, "the character template was skipped: `rig` is missing")
+ self.assertIn("fixtureSection", spec, "the augmentation merge was skipped")
+ self.assertEqual(spec["specAugmentation"]["provider"], "fixture")
+
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 d95f7b9..c39d52e 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 = 1184
+COLLECTED_FLOOR = 1185
REPO_ROOT = TESTS_DIR.parents[1]