Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

fix: make review surfaces say what they mean (9.2 through 9.5) (#70)

Matthew Kissinger8715e94ae2a7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a82508c3..c7cbc4a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,29 @@
Changes to `@kiln/engine`. Source and installable packages are distributed through
GitHub. The package is not published on the npm registry.
+## Review surfaces say what they mean — 2026-09-11
+
+- `viewFidelity.exactArtifact` was a hard-coded `false` literal at every
+ `kiln_render` site, never computed. A flag that is always false carries no
+ information, and this one invited the opposite of the truth: a model could
+ read it as "these bytes differ from what I would export" when the bytes are
+ frequently identical. The value is still false -- this surface only ever
+ renders an in-loop build -- but it now carries the reason code
+ `IN_LOOP_BUILD_NOT_PERSISTED`, so the false value is readable rather than
+ ominous.
+- `kiln_screenshot_animation` was reported to rotate a whole asset where the
+ clip drives one joint. **It does not.** Measured on world matrices rather than
+ pixels: a one-channel clip moves the joint's subtree through a clean
+ 180-degree yaw while the un-animated sibling holds the origin at every phase.
+ An image cannot tell a turret sweeping from a scene spinning, which is why the
+ report was plausible; a regression test now stands where the doubt was.
+- `arrayLinear` and `arrayRadial` say outright that `count` is the total
+ including the source, which survives as copy 0 -- so `count: 8` gives eight
+ bolts, not nine. The program contract states that
+ `kiln_screenshot_animation` requires `clip` by name, that `frameTimes` is
+ phases in 0..1 rather than seconds, and that a clip that renders frozen means
+ a joint-name mismatch surfaced in `unresolvedTracks`.
+
## Dependency refresh — 2026-09-11
- Patch and minor bumps with no API surface change: `@types/three` 0.185.4,
diff --git a/dist/agent-run.mjs b/dist/agent-run.mjs
index cc617215..36935eec 100644
--- a/dist/agent-run.mjs
+++ b/dist/agent-run.mjs
@@ -740,7 +740,7 @@ const rock = await hull('Rock', ...rockChunks);`
signature: "arrayLinear(namePrefix, source, count, offset: [x,y,z], parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` along a constant offset vector. Copies share geometry + material via createInstance.",
+ description: "`count` is the TOTAL, source included: the source stays where it is as copy 0 and the call returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry + material via createInstance.",
example: `const post = createPart('Post0', cylinderGeo(0.05,0.05,1.5,6), wood, { position: [0,0.75,0], parent: root });
arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
},
@@ -749,7 +749,7 @@ arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
signature: "arrayRadial(namePrefix, source, count, axis?: 'x'|'y'|'z', parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` around the given axis. Source's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
+ description: "`count` is the TOTAL, source included: the source stays at its angle as copy 0 and the call returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
example: `const bolt = createPart('Bolt0', cylinderGeo(0.02,0.02,0.1,6), steel, { position: [1,0,0], parent: root });
arrayRadial('Bolt', bolt, 8, 'y', root);`
},
@@ -27463,7 +27463,8 @@ async function runRenderViews(input, context) {
exactArtifact: false,
rendererId: [...new Set(receipts.map((r) => r.rendererId))].join(", "),
inputGlbSha256: await sha256Glb(Uint8Array.from(rendered.glb)),
- degraded: !materialFaithful
+ degraded: !materialFaithful,
+ reasonCodes: ["IN_LOOP_BUILD_NOT_PERSISTED"]
},
warnings: [...structuralWarnings, ...rendered.warnings]
};
@@ -27525,7 +27526,8 @@ async function runRenderViews(input, context) {
rendererId: drawnBy.renderer,
inputGlbSha256,
degraded: drawnBy.degraded,
- ...drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {}
+ ...drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {},
+ reasonCodes: ["IN_LOOP_BUILD_NOT_PERSISTED"]
};
const viewEvidence = context.viewEvidenceHistory?.record("kiln_render", viewFidelity);
try {
diff --git a/dist/build.json b/dist/build.json
index 28cbe5e0..884eb156 100644
--- a/dist/build.json
+++ b/dist/build.json
@@ -2,10 +2,10 @@
"schemaVersion": 1,
"entries": {
"mcp": {
- "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
+ "identity": "sha256:ca1f79486d18694019163b2eb4f9089f45eae40f5473f955f82f48bb0b5d2e42",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
+ "sourceHash": "bda3bc7c8a4d11a599737fd422fa0f27e25fcfcb55abc64492f74e2c590b4104",
"dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
"@gltf-transform/core": "4.4.1",
@@ -27,13 +27,13 @@
},
"target": "node",
"file": "mcp-server.mjs",
- "bundleHash": "sha256:639f5984ce3bd837a1ffe6415430c0feb5366e8b8d1d4cc9cd6493209ccc616d"
+ "bundleHash": "sha256:9f5096592b2c5712bacab8e989dbf887ad3a26932fcf5cf81f6ce1738b7c62c9"
},
"cli": {
- "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
+ "identity": "sha256:ca1f79486d18694019163b2eb4f9089f45eae40f5473f955f82f48bb0b5d2e42",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
+ "sourceHash": "bda3bc7c8a4d11a599737fd422fa0f27e25fcfcb55abc64492f74e2c590b4104",
"dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
"@gltf-transform/core": "4.4.1",
@@ -55,13 +55,13 @@
},
"target": "node",
"file": "cli.mjs",
- "bundleHash": "sha256:0eb6b7077598c1d61761e6391f2c776980dd8aed1ebaf5f584aa54fcd8e53e2f"
+ "bundleHash": "sha256:ca28885ff6b93224c6c8d0ea9fc521b93bb09391db6b45adc1f52cce2f273550"
},
"worker": {
- "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
+ "identity": "sha256:ca1f79486d18694019163b2eb4f9089f45eae40f5473f955f82f48bb0b5d2e42",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
+ "sourceHash": "bda3bc7c8a4d11a599737fd422fa0f27e25fcfcb55abc64492f74e2c590b4104",
"dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
"@gltf-transform/core": "4.4.1",
@@ -83,13 +83,13 @@
},
"target": "node",
"file": "evaluator-worker.mjs",
- "bundleHash": "sha256:c8d8e432a5ae29b4f6621bf64bb4b7f6f7b77cf9fd4d8094779c6c5749f811f2"
+ "bundleHash": "sha256:549c013d6ca1475a5bbfa5b7be9fc63894212da382a7501af227902622fa3946"
},
"agent-run": {
- "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
+ "identity": "sha256:ca1f79486d18694019163b2eb4f9089f45eae40f5473f955f82f48bb0b5d2e42",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
+ "sourceHash": "bda3bc7c8a4d11a599737fd422fa0f27e25fcfcb55abc64492f74e2c590b4104",
"dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
"@gltf-transform/core": "4.4.1",
@@ -111,13 +111,13 @@
},
"target": "node",
"file": "agent-run.mjs",
- "bundleHash": "sha256:4253f648f9c8395aaecfa2201a69feeaa503e5c58b81a891fbd5a41df0277f6c"
+ "bundleHash": "sha256:5f9c212686fbcbc42254354ae9466e06b6b2b96ea0d49253720c7df1c512a82f"
},
"agent-providers": {
- "identity": "sha256:ea0fba82ebae9115e3ebdc3cf4f9611a841fefe2d1cd9c4ee1c6edbb90566b72",
+ "identity": "sha256:ca1f79486d18694019163b2eb4f9089f45eae40f5473f955f82f48bb0b5d2e42",
"engineVersion": "0.6.0",
"toolchain": "[email protected]",
- "sourceHash": "565273136255da40d3f931c9d8fd3cccc8dd8f5c613faa62c4631a7d65e97f88",
+ "sourceHash": "bda3bc7c8a4d11a599737fd422fa0f27e25fcfcb55abc64492f74e2c590b4104",
"dependencyHash": "664eae40f28077bfed4798d9215cb8de7297287494a59d653c451e1343c08fc3",
"dependencies": {
"@gltf-transform/core": "4.4.1",
diff --git a/dist/cli.mjs b/dist/cli.mjs
index 4e9d2464..c5b52b08 100644
--- a/dist/cli.mjs
+++ b/dist/cli.mjs
@@ -18652,7 +18652,7 @@ const rock = await hull('Rock', ...rockChunks);`
signature: "arrayLinear(namePrefix, source, count, offset: [x,y,z], parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` along a constant offset vector. Copies share geometry + material via createInstance.",
+ description: "`count` is the TOTAL, source included: the source stays where it is as copy 0 and the call returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry + material via createInstance.",
example: `const post = createPart('Post0', cylinderGeo(0.05,0.05,1.5,6), wood, { position: [0,0.75,0], parent: root });
arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
},
@@ -18661,7 +18661,7 @@ arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
signature: "arrayRadial(namePrefix, source, count, axis?: 'x'|'y'|'z', parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` around the given axis. Source's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
+ description: "`count` is the TOTAL, source included: the source stays at its angle as copy 0 and the call returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
example: `const bolt = createPart('Bolt0', cylinderGeo(0.02,0.02,0.1,6), steel, { position: [1,0,0], parent: root });
arrayRadial('Bolt', bolt, 8, 'y', root);`
},
@@ -27622,7 +27622,8 @@ async function runRenderViews(input, context) {
exactArtifact: false,
rendererId: [...new Set(receipts.map((r) => r.rendererId))].join(", "),
inputGlbSha256: await sha256Glb(Uint8Array.from(rendered.glb)),
- degraded: !materialFaithful
+ degraded: !materialFaithful,
+ reasonCodes: ["IN_LOOP_BUILD_NOT_PERSISTED"]
},
warnings: [...structuralWarnings, ...rendered.warnings]
};
@@ -27684,7 +27685,8 @@ async function runRenderViews(input, context) {
rendererId: drawnBy.renderer,
inputGlbSha256,
degraded: drawnBy.degraded,
- ...drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {}
+ ...drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {},
+ reasonCodes: ["IN_LOOP_BUILD_NOT_PERSISTED"]
};
const viewEvidence = context.viewEvidenceHistory?.record("kiln_render", viewFidelity);
try {
diff --git a/dist/evaluator-worker.mjs b/dist/evaluator-worker.mjs
index 815fc963..374c1466 100644
--- a/dist/evaluator-worker.mjs
+++ b/dist/evaluator-worker.mjs
@@ -18493,7 +18493,7 @@ const rock = await hull('Rock', ...rockChunks);`
signature: "arrayLinear(namePrefix, source, count, offset: [x,y,z], parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` along a constant offset vector. Copies share geometry + material via createInstance.",
+ description: "`count` is the TOTAL, source included: the source stays where it is as copy 0 and the call returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry + material via createInstance.",
example: `const post = createPart('Post0', cylinderGeo(0.05,0.05,1.5,6), wood, { position: [0,0.75,0], parent: root });
arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
},
@@ -18502,7 +18502,7 @@ arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
signature: "arrayRadial(namePrefix, source, count, axis?: 'x'|'y'|'z', parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` around the given axis. Source's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
+ description: "`count` is the TOTAL, source included: the source stays at its angle as copy 0 and the call returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
example: `const bolt = createPart('Bolt0', cylinderGeo(0.02,0.02,0.1,6), steel, { position: [1,0,0], parent: root });
arrayRadial('Bolt', bolt, 8, 'y', root);`
},
diff --git a/dist/mcp-server.mjs b/dist/mcp-server.mjs
index 10581025..1c407a15 100644
--- a/dist/mcp-server.mjs
+++ b/dist/mcp-server.mjs
@@ -2384,7 +2384,7 @@ const rock = await hull('Rock', ...rockChunks);`
signature: "arrayLinear(namePrefix, source, count, offset: [x,y,z], parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` along a constant offset vector. Copies share geometry + material via createInstance.",
+ description: "`count` is the TOTAL, source included: the source stays where it is as copy 0 and the call returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry + material via createInstance.",
example: `const post = createPart('Post0', cylinderGeo(0.05,0.05,1.5,6), wood, { position: [0,0.75,0], parent: root });
arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
},
@@ -2393,7 +2393,7 @@ arrayLinear('Post', post, 10, [0.5, 0, 0], root);`
signature: "arrayRadial(namePrefix, source, count, axis?: 'x'|'y'|'z', parent?)",
returns: "THREE.Object3D[]",
category: "arrays",
- description: "Places N copies of `source` around the given axis. Source's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
+ description: "`count` is the TOTAL, source included: the source stays at its angle as copy 0 and the call returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
example: `const bolt = createPart('Bolt0', cylinderGeo(0.02,0.02,0.1,6), steel, { position: [1,0,0], parent: root });
arrayRadial('Bolt', bolt, 8, 'y', root);`
},
@@ -27367,7 +27367,8 @@ async function runRenderViews(input, context) {
exactArtifact: false,
rendererId: [...new Set(receipts.map((r) => r.rendererId))].join(", "),
inputGlbSha256: await sha256Glb(Uint8Array.from(rendered.glb)),
- degraded: !materialFaithful
+ degraded: !materialFaithful,
+ reasonCodes: ["IN_LOOP_BUILD_NOT_PERSISTED"]
},
warnings: [...structuralWarnings, ...rendered.warnings]
};
@@ -27429,7 +27430,8 @@ async function runRenderViews(input, context) {
rendererId: drawnBy.renderer,
inputGlbSha256,
degraded: drawnBy.degraded,
- ...drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {}
+ ...drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {},
+ reasonCodes: ["IN_LOOP_BUILD_NOT_PERSISTED"]
};
const viewEvidence = context.viewEvidenceHistory?.record("kiln_render", viewFidelity);
try {
diff --git a/docs/plans/repo-size-and-r2-migration-2026-09-10.md b/docs/plans/repo-size-and-r2-migration-2026-09-10.md
index 9a8f7a05..cac253fa 100644
--- a/docs/plans/repo-size-and-r2-migration-2026-09-10.md
+++ b/docs/plans/repo-size-and-r2-migration-2026-09-10.md
@@ -1126,10 +1126,10 @@ independently verified; 9.2 is the one that looks like the same bug class as 9.1
| Task | Detail |
| --- | --- |
| 9.1 | `visibility: 'isolate'` and legacy `isolate: true` were silently ignored whenever a GPU service was attached. Both hide by clearing `mesh.visible`; `views/raster.ts` culls on it, but glTF has no per-mesh visibility and Kiln writes its own GLB rather than three's `GLTFExporter`, whose `onlyVisible` defaults true. `kiln_inspect` asserted "nothing in this image occludes it" about images where everything still did. **Done 2026-09-11**: `renderDerivativeCell` prunes hidden meshes from a copy. Escaped because the only prior test framed a single-mesh scene, where isolation cannot change the image |
-| 9.2 | `kiln_screenshot_animation` renders the entire asset rotating where the clip drives one joint. The run parsed the exported GLB's JSON chunk and found the `Spin` animation holds exactly one channel, targeting the spindle node, and that the node's subtree excludes the bench and seat that were visibly turning. Camera receipts were byte-identical across frames, so it is not a framing artefact. Pending; verify before trusting the report, then look for the 9.1 pattern -- a review path that re-poses or re-serializes more than the clip does |
-| 9.3 | `viewFidelity.exactArtifact` reported `false` on every render, including ones where the run independently hashed `inputGlbSha256` equal to both the exported GLB and the saved `asset.glb`. Either the flag means something narrower than its name, or it is wrong. Pending; whichever it is, a model cannot use a fidelity flag whose false value carries no meaning |
-| 9.4 | `kiln_screenshot_animation` requires a `clip` name and `frameTimes` normalized to 0..1, and neither is stated in the author skill or the camera recipes. The run guessed the clip name from its own `createClip` call and hit a validation error on seconds-valued frame times. Pending; a documentation gap, not a defect |
-| 9.5 | `arrayRadial` count semantics are not inferable from the signature plus the example: whether the source mesh survives as the copy at index 0 had to be deduced from a mesh count. Pending; documentation |
+| 9.2 | `kiln_screenshot_animation` renders the entire asset rotating where the clip drives one joint. The run parsed the exported GLB's JSON chunk and found the `Spin` animation holds exactly one channel, targeting the spindle node, and that the node's subtree excludes the bench and seat that were visibly turning. Camera receipts were byte-identical across frames, so it is not a framing artefact. **NOT REPRODUCED 2026-09-11, and the engine is correct.** Measured on world matrices rather than pixels: a one-channel clip on a two-part asset moves the joint's subtree through a clean 180-degree yaw while the un-animated sibling stays at the origin at every phase. An image cannot tell a turret sweeping from a scene spinning, which is why the report was plausible. Closed with a regression test in `views/__tests__/animation.test.ts` so the question does not recur |
+| 9.3 | `viewFidelity.exactArtifact` reported `false` on every render, including ones where the run independently hashed `inputGlbSha256` equal to both the exported GLB and the saved `asset.glb`. Either the flag means something narrower than its name, or it is wrong. **Done 2026-09-11.** It was neither the comparison nor the meaning: `exactArtifact` was a hard-coded `false` literal at every site, never computed. So its false value carried no information and invited the opposite of the truth -- a model could read it as "these bytes differ from an export" when they frequently do not. The value stays false, because this surface only ever renders an in-loop build; the new `IN_LOOP_BUILD_NOT_PERSISTED` reason code is what makes it readable |
+| 9.4 | `kiln_screenshot_animation` requires a `clip` name and `frameTimes` normalized to 0..1, and neither is stated in the author skill or the camera recipes. The run guessed the clip name from its own `createClip` call and hit a validation error on seconds-valued frame times. **Done 2026-09-11.** The program contract now states that `clip` is required and matched by name, that `frameTimes` is 1..9 strictly increasing phases in 0..1 rather than seconds, and that a frozen-looking clip means `unresolvedTracks` -- a joint-name mismatch |
+| 9.5 | `arrayRadial` count semantics are not inferable from the signature plus the example: whether the source mesh survives as the copy at index 0 had to be deduced from a mesh count. **Done 2026-09-11.** Both array helpers now say it outright: `count` is the TOTAL including the source, which survives as copy 0, so the call returns count-1 new instances |
| 9.6 | CLI `--out` does not create parent directories, failing with a bare `ENOENT` *after* the build succeeded and printed a `programRef`. Invisible from the README, whose example writes into the cwd | Done 2026-09-11 -- `prepareDestination` in `src/cli-output.ts`, applied at every CLI destination: `render --out`, `render --views`, `generate`, `source <ref> --out` and `export --out`. Guarded by `src/__tests__/cli-out-directories.test.ts` |
| 9.7 | The MCP server resolves the render service once before its first connection, so a service started afterwards is invisible until the session restarts, while the CLI picks it up on the next call. Re-probe lazily when a render needs PBR and no port is attached, with a short negative cache -- the probe's `absent` path is a refused localhost connection. Pending; collapses the guidance to "start it whenever" and deletes the restart caveat from the workspace guide and the setup skill. Not folded into the Phase 7 documentation commit because `captureViewsViaPort` owns the deadline and degrade policy and the change deserves its own TDD |
| 9.8 | Narrow the generated per-harness configuration to suppress user-level skills and MCP servers where each harness supports it. The blind run inherited roughly twenty unrelated skills and four unrelated servers. This is the only option that reduces inherited context rather than reporting it, and it needs vendor documentation per harness first: configuration that validates and silently does nothing is the `${PLUGIN_ROOT}` failure class. Pending |
diff --git a/skills/kiln-author-asset/references/program-contract.md b/skills/kiln-author-asset/references/program-contract.md
index 23d20054..d396c89e 100644
--- a/skills/kiln-author-asset/references/program-contract.md
+++ b/skills/kiln-author-asset/references/program-contract.md
@@ -19,6 +19,8 @@ function build() {
Optional `animate(root)` returns an array of `THREE.AnimationClip`. Follow catalog keyframe signatures: rotation tracks use a `rotation` field, position tracks use `position`. Grounded and moving parts need meaningful named pivots.
+To review that motion, `kiln_screenshot_animation` needs the clip **by name** -- `clip` is required, and a name that matches nothing comes back as an error listing the clips that do exist. `frameTimes` is optional and is expressed as **phases in 0..1**, not seconds: 1 to 9 strictly increasing values, scaled by the clip's own duration. Omit it and six frames are sampled evenly from start to end. A track whose target name binds to no node surfaces in `unresolvedTracks`, which is what a clip that renders frozen actually means -- a joint-name mismatch, not a broken clip.
+
## Frames and ownership
- Asset coordinates: metres; +X forward, +Y up, +Z right.
diff --git a/src/__tests__/__snapshots__/prompt-api.test.ts.snap b/src/__tests__/__snapshots__/prompt-api.test.ts.snap
index 8326e07b..c13e2d98 100644
--- a/src/__tests__/__snapshots__/prompt-api.test.ts.snap
+++ b/src/__tests__/__snapshots__/prompt-api.test.ts.snap
@@ -225,11 +225,14 @@ createInstance(name, source, opts?: { position, rotation: [xDeg, yDeg, zDeg], sc
// Arrays (replicate a source part)
arrayLinear(namePrefix, source, count, offset: [x,y,z], parent?)
- // Places N copies of \`source\` along a constant offset vector. Copies share geometry +
+ // \`count\` is the TOTAL, source included: the source stays where it is as copy 0 and the call
+ // returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry +
// material via createInstance.
arrayRadial(namePrefix, source, count, axis?: 'x'|'y'|'z', parent?)
- // Places N copies of \`source\` around the given axis. Source's local rotation is oriented
- // outward. Perfect for gear teeth, radial bolts, circle of columns.
+ // \`count\` is the TOTAL, source included: the source stays at its angle as copy 0 and the call
+ // returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's
+ // local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of
+ // columns.
mirror(name, source, axis: 'x'|'y'|'z', parent?)
// Reflects source across the plane whose normal is \`axis\`. Uses negative scale (winding flip
// handled by viewers).
@@ -745,13 +748,16 @@ createInstance(name, source, opts?: { position, rotation: [xDeg, yDeg, zDeg], sc
// Arrays (replicate a source part)
arrayLinear(namePrefix, source, count, offset: [x,y,z], parent?)
- // Places N copies of \`source\` along a constant offset vector. Copies share geometry +
+ // \`count\` is the TOTAL, source included: the source stays where it is as copy 0 and the call
+ // returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry +
// material via createInstance.
// e.g. const post = createPart('Post0', cylinderGeo(0.05,0.05,1.5,6), wood, { position:
// [0,0.75,0], parent: root }); arrayLinear('Post', post, 10, [0.5, 0, 0], root);
arrayRadial(namePrefix, source, count, axis?: 'x'|'y'|'z', parent?)
- // Places N copies of \`source\` around the given axis. Source's local rotation is oriented
- // outward. Perfect for gear teeth, radial bolts, circle of columns.
+ // \`count\` is the TOTAL, source included: the source stays at its angle as copy 0 and the call
+ // returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's
+ // local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of
+ // columns.
// e.g. const bolt = createPart('Bolt0', cylinderGeo(0.02,0.02,0.1,6), steel, { position:
// [1,0,0], parent: root }); arrayRadial('Bolt', bolt, 8, 'y', root);
mirror(name, source, axis: 'x'|'y'|'z', parent?)
diff --git a/src/composer/render-port.ts b/src/composer/render-port.ts
index 0ecbc475..0ea50df2 100644
--- a/src/composer/render-port.ts
+++ b/src/composer/render-port.ts
@@ -151,7 +151,15 @@ export type ViewFidelityReasonCode =
| 'GLB_FLAT_PARSE_FAILED'
| 'GLB_FLAT_NO_SCENE'
| 'GLB_FLAT_NO_RENDERABLE_GEOMETRY'
- | 'GLB_FLAT_INVALID_INSTANCING';
+ | 'GLB_FLAT_INVALID_INSTANCING'
+ /**
+ * The view is of a build made inside the loop, not of persisted artifact
+ * bytes. It is why `exactArtifact` is false, and it is not a degradation:
+ * the pixels can be fully material-faithful and the bytes can be identical
+ * to what an export would produce. Without it a permanently-false flag reads
+ * as a warning about the bytes, which is the opposite of the truth.
+ */
+ | 'IN_LOOP_BUILD_NOT_PERSISTED';
/**
* Truthful, model-visible provenance for a rendered view.
diff --git a/src/list-primitives.ts b/src/list-primitives.ts
index d3aae9df..329acb14 100644
--- a/src/list-primitives.ts
+++ b/src/list-primitives.ts
@@ -790,7 +790,7 @@ const PRIMITIVES: PrimitiveSpec[] = [
returns: 'THREE.Object3D[]',
category: 'arrays',
description:
- 'Places N copies of `source` along a constant offset vector. Copies share geometry + material via createInstance.',
+ '`count` is the TOTAL, source included: the source stays where it is as copy 0 and the call returns count-1 new instances, so count 10 gives 10 posts, not 11. Copies share geometry + material via createInstance.',
example:
"const post = createPart('Post0', cylinderGeo(0.05,0.05,1.5,6), wood, { position: [0,0.75,0], parent: root });\narrayLinear('Post', post, 10, [0.5, 0, 0], root);",
},
@@ -800,7 +800,7 @@ const PRIMITIVES: PrimitiveSpec[] = [
returns: 'THREE.Object3D[]',
category: 'arrays',
description:
- "Places N copies of `source` around the given axis. Source's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
+ "`count` is the TOTAL, source included: the source stays at its angle as copy 0 and the call returns count-1 new instances, so count 8 gives 8 bolts evenly spaced, not 9. Each copy's local rotation is oriented outward. Perfect for gear teeth, radial bolts, circle of columns.",
example:
"const bolt = createPart('Bolt0', cylinderGeo(0.02,0.02,0.1,6), steel, { position: [1,0,0], parent: root });\narrayRadial('Bolt', bolt, 8, 'y', root);",
},
diff --git a/src/tools/__tests__/registry-render-views.test.ts b/src/tools/__tests__/registry-render-views.test.ts
index 4d9410ca..6b913bb0 100644
--- a/src/tools/__tests__/registry-render-views.test.ts
+++ b/src/tools/__tests__/registry-render-views.test.ts
@@ -23,6 +23,21 @@ function build() {
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
describe('kilnRenderViewsDef (unified kiln_render)', () => {
+ /**
+ * `exactArtifact` is false on every result this surface can produce, because
+ * every one of them renders an in-loop build rather than persisted bytes. A
+ * flag that is always false carries no information, and worse, invites the
+ * wrong reading -- a model can take it for "these bytes differ from what I
+ * would export" when the bytes are frequently identical. The value stays
+ * false; the reason is what makes it usable.
+ */
+ test('says why exactArtifact is false instead of leaving it bare', async () => {
+ const result = (await kilnRenderViewsDef.run({ code: BOX_CODE })) as KilnRenderViewsResult;
+ expect(result.ok).toBe(true);
+ expect(result.viewFidelity?.exactArtifact).toBe(false);
+ expect(result.viewFidelity?.reasonCodes).toContain('IN_LOOP_BUILD_NOT_PERSISTED');
+ }, 30000);
+
test('is named kiln_render and is NOT part of the four-tool registry baseline', () => {
expect(kilnRenderViewsDef.name).toBe('kiln_render');
expect(kilnRenderViewsDef.media).toBe(screenshotMedia);
diff --git a/src/tools/registry.ts b/src/tools/registry.ts
index 5237896e..be0491a2 100644
--- a/src/tools/registry.ts
+++ b/src/tools/registry.ts
@@ -1210,6 +1210,7 @@ async function runRenderViews(
rendererId: [...new Set(receipts.map((r) => r.rendererId))].join(', '),
inputGlbSha256: await sha256Glb(Uint8Array.from(rendered.glb)),
degraded: !materialFaithful,
+ reasonCodes: ['IN_LOOP_BUILD_NOT_PERSISTED'],
},
warnings: [...structuralWarnings, ...rendered.warnings],
};
@@ -1307,11 +1308,14 @@ async function runRenderViews(
requested: 'full-preferred',
delivered: materialFaithful ? 'full-material' : 'geometry-flat',
materialFaithful,
+ // False here is structural, not a warning about the bytes: this surface
+ // always renders an in-loop build. Say so, or the flag reads as a defect.
exactArtifact: false,
rendererId: drawnBy.renderer,
inputGlbSha256,
degraded: drawnBy.degraded,
...(drawnBy.degradedReason ? { degradeReason: drawnBy.degradedReason } : {}),
+ reasonCodes: ['IN_LOOP_BUILD_NOT_PERSISTED'],
};
const viewEvidence = context.viewEvidenceHistory?.record('kiln_render', viewFidelity);
diff --git a/src/views/__tests__/animation.test.ts b/src/views/__tests__/animation.test.ts
index f24243d7..62172631 100644
--- a/src/views/__tests__/animation.test.ts
+++ b/src/views/__tests__/animation.test.ts
@@ -8,6 +8,7 @@ import { describe, expect, test } from 'bun:test';
import { executeKilnCode } from '../../render';
import { renderClipAnimation, planFrameTimes, prepareClip, findClip } from '../index';
+import { poseSceneAtTime } from '../pose';
// A minimal biped whose legs swing forward/back (rotation about Z) on a 1s walk.
const WALKER = `
@@ -57,6 +58,27 @@ test('planFrameTimes samples endpoints inclusively', () => {
expect(planFrameTimes(0, 6)).toEqual([0, 0, 0, 0, 0, 0]); // a static "clip"
});
+// One joint, two parts: the clip drives the turret only, and the base must not
+// follow it. Reported as `kiln_screenshot_animation` rotating the whole asset --
+// it does not, and this fixture is what says so for good.
+const TURRET = `
+const meta = { name: 'turret', category: 'prop' };
+function build() {
+ const root = createRoot('Root');
+ createPart('Base', boxGeo(1, 0.3, 1), gameMaterial('#555555'), { parent: root });
+ const yaw = createPivot('Turret', [0, 0.3, 0], root);
+ createPart('Barrel', boxGeo(0.2, 0.2, 1.2), gameMaterial('#aa3333'), { parent: yaw, position: [0, 0, 0.6] });
+ return root;
+}
+function animate(root) {
+ return [createClip('Spin', 1, [
+ rotationTrack('Joint_Turret', [
+ { time: 0, rotation: [0, 0, 0] }, { time: 1, rotation: [0, 180, 0] },
+ ]),
+ ])];
+}
+`;
+
describe('renderClipAnimation', () => {
test('renders a 6-frame grid for a named clip with correct metadata', async () => {
const { root, clips } = await executeKilnCode(WALKER);
@@ -113,6 +135,46 @@ describe('renderClipAnimation', () => {
expect(findClip(clips, 'nope')).toBeUndefined();
});
+ /**
+ * A single-channel clip must move that joint's subtree and nothing else.
+ *
+ * `poseSceneAtTime` resolves each track by node name against a map built from
+ * a full traversal, first match winning, so a mis-resolution would silently
+ * drive an ancestor and take the whole asset with it -- the shape of a report
+ * that `kiln_screenshot_animation` rotates everything. Measured on world
+ * matrices rather than pixels: an image cannot distinguish a turret sweeping
+ * from a scene spinning, which is exactly why the report was plausible.
+ */
+ test('a one-joint clip moves that joint alone, not the whole asset', async () => {
+ const { root, clips } = await executeKilnCode(TURRET);
+ const prepared = prepareClip(root, findClip(clips, 'Spin')!);
+ expect(prepared.tracks).toHaveLength(1);
+ expect(prepared.unresolved).toHaveLength(0);
+
+ const worldOf = (name: string) => {
+ let found: { matrixWorld: { elements: number[] } } | undefined;
+ (root as { traverse(cb: (o: { name?: string }) => void): void }).traverse((node) => {
+ if (node.name === name && !found) found = node as never;
+ });
+ (root as { updateMatrixWorld(force: boolean): void }).updateMatrixWorld(true);
+ const e = found!.matrixWorld.elements;
+ return [e[12]!, e[13]!, e[14]!].map((n) => Number(n.toFixed(4)));
+ };
+
+ const barrel: number[][] = [];
+ for (const phase of [0, 0.5, 1]) {
+ poseSceneAtTime(root as never, prepared, phase * prepared.duration);
+ expect(worldOf('Mesh_Base')).toEqual([0, 0, 0]);
+ barrel.push(worldOf('Mesh_Barrel'));
+ }
+ // A 180-degree yaw about the pivot: +Z to +X to -Z, at constant height.
+ expect(barrel).toEqual([
+ [0, 0.3, 0.6],
+ [0.6, 0.3, 0],
+ [0, 0.3, -0.6],
+ ]);
+ });
+
test('prepareClip parses tracks + derives duration', async () => {
const { root, clips } = await executeKilnCode(WALKER);
const prepared = prepareClip(root, clips[0]!);