Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (antigravity): report an articulation graph whose animation block declares zero clips (#4542)

[._.]/ Adam Eivyac2c71c79dbf
diff --git a/server/lib/threejsModelAnimation.js b/server/lib/threejsModelAnimation.js
index a23d75ceb5..3e93eec9b2 100644
--- a/server/lib/threejsModelAnimation.js
+++ b/server/lib/threejsModelAnimation.js
@@ -172,7 +172,12 @@ function evaluateAnimationFindings(spec) {
const animation = spec?.animation || null;
const joints = Array.isArray(spec?.articulation?.joints) ? spec.articulation.joints : [];
- if (!animation) {
+ const clips = Array.isArray(animation?.clips) ? animation.clips : [];
+
+ // Keyed on having no clip to play rather than on a missing `animation` key: a
+ // block that arrived with an empty clip list demonstrates exactly as much
+ // motion as no block at all.
+ if (clips.length === 0) {
// Narrow on purpose: a static object declares no joints and gets no finding,
// so nothing here pushes every model toward motion it never showed.
if (joints.length >= MIN_JOINTS_EXPECTING_MOTION) {
@@ -186,7 +191,6 @@ function evaluateAnimationFindings(spec) {
}
const partsById = indexParts(spec?.parts);
- const clips = Array.isArray(animation.clips) ? animation.clips : [];
const findings = clips.flatMap((clip) => evaluateClipFindings(clip, partsById));
const firedCueIds = new Set(
diff --git a/server/lib/threejsModelAnimation.test.js b/server/lib/threejsModelAnimation.test.js
index 2c9b091e47..1b995894ea 100644
--- a/server/lib/threejsModelAnimation.test.js
+++ b/server/lib/threejsModelAnimation.test.js
@@ -207,6 +207,9 @@ describe('summarizeThreejsAnimation playback findings', () => {
// toward motion it never showed.
expect(codesOf({ parts: parts() })).toEqual([]);
expect(codesOf({ parts: parts(), articulation: { joints: [{ id: 'root', partId: 'panel' }] } })).toEqual([]);
+ // An animation block that arrived with an empty clip list demonstrates
+ // exactly as much motion as no block at all.
+ expect(codesOf({ ...articulated, animation: { clips: [], cues: [] } })).toEqual(['articulation-without-clips']);
});
});
diff --git a/server/lib/threejsModelPlayerSource.js b/server/lib/threejsModelPlayerSource.js
index 6edc800672..5d967e86ef 100644
--- a/server/lib/threejsModelPlayerSource.js
+++ b/server/lib/threejsModelPlayerSource.js
@@ -127,7 +127,9 @@ export function collectSculptCues(clip, fromSeconds, toSeconds) {
}
const indexAuthoredPose = (parts, into) => {
- for (const part of parts) {
+ // Defensive fallback for a hand-repaired spec whose leaf omits its empty
+ // children array — the parse this module is emitted from always fills it.
+ for (const part of parts || []) {
into[part.id] = { position: part.position, rotationDegrees: part.rotationDegrees, scale: part.scale };
indexAuthoredPose(part.children, into);
}
diff --git a/server/lib/threejsModelPlayerSource.test.js b/server/lib/threejsModelPlayerSource.test.js
index f924f0cdb2..568af90a5f 100644
--- a/server/lib/threejsModelPlayerSource.test.js
+++ b/server/lib/threejsModelPlayerSource.test.js
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
import { buildThreejsFactorySource } from './threejsModel.js';
+import { THREEJS_PLAYER_SOURCE } from './threejsModelPlayerSource.js';
// The emitted player is only worth shipping if it actually runs, so the suite
// EXECUTES it rather than grepping the string: the module is imported with the
@@ -136,6 +137,19 @@ const mountPlayer = async (input = spec(), options = undefined) => {
return { module, nodes, player: module.createSculptAnimationPlayer(root, options) };
};
+describe('THREEJS_PLAYER_SOURCE', () => {
+ // The player lives inside a template literal, so an unescaped backtick in one
+ // of its comments closes the string early and truncates the rest of the player
+ // with no syntax error anywhere — the emitted module just quietly stops
+ // exporting a player. This is the cheap tripwire for that.
+ it('carries the whole player, with every backtick in it escaped', () => {
+ for (const symbol of ['evaluateSculptClipPose', 'collectSculptCues', 'createSculptAnimationPlayer']) {
+ expect(THREEJS_PLAYER_SOURCE).toContain(`export function ${symbol}(`);
+ }
+ expect(THREEJS_PLAYER_SOURCE).toContain('return player;');
+ });
+});
+
describe('emitted clip player', () => {
it('poses the node map from a scrub without firing a cue', async () => {
const cues = [];