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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: verify a published rig reads back before recording it as ready (#5753)
Adam Eivy97e837766ec4
diff --git a/server/services/rigging/autoSkin.js b/server/services/rigging/autoSkin.jsindex 6fe700920b..6a9f385ae5 100644--- a/server/services/rigging/autoSkin.js+++ b/server/services/rigging/autoSkin.js@@ -178,7 +178,7 @@ const rigError = (message, code, extra = {}) => new ServerError(message, { statu** @param {{modelId: string, recordDir: string, skeletonHint?: string, overrides?: object,* readiness?: object, python?: string|null, spawnImpl?: Function, rigId?: string,- * timeoutMs?: number}} opts+ * timeoutMs?: number, verify?: Function}} opts* @returns {Promise<{rigId: string, assetPath: string, reportPath: string, sha256: string,* bytes: number, summary: object, report: object}>}*/@@ -192,6 +192,7 @@ export async function runAutoSkin({spawnImpl,rigId = `rig-${randomUUID()}`,timeoutMs,+ verify = readRiggedArtifact,}) {const ready = readiness ?? await getRiggingReadiness();if (!ready.ready) {@@ -244,6 +245,14 @@ export async function runAutoSkin({if (!staged) throw rigError('The rigging worker reported success but exported no mesh.', 'RIGGING_NO_OUTPUT');const published = await publishRigArtifacts({ paths, report });+ // Read the pair back through the same reader every consumer uses, before recording+ // the rig as ready. A publish that does not verify is exactly the interrupted state+ // this contract exists to make detectable — it must not be reported as a finished+ // rig just because both moves returned.+ const verified = await verify({ publishDir: paths.publishDir });+ if (!verified.ok) {+ throw rigError(`The rig published but did not verify (${verified.reason}).`, 'RIGGING_PUBLISH_UNVERIFIED');+ }console.log(`🦴 Rigged ${modelId} as ${rigId}: ${gate.metrics.boneCount} bones, `+ `${gate.metrics.verticesAfterWeld} vertices, ${gate.metrics.nearestBoneCompleted} filled by nearest bone`);return {diff --git a/server/services/rigging/autoSkin.test.js b/server/services/rigging/autoSkin.test.jsindex 59847036a0..de135d48aa 100644--- a/server/services/rigging/autoSkin.test.js+++ b/server/services/rigging/autoSkin.test.js@@ -122,6 +122,15 @@ describe('rigging publication contract', () => {expect(existsSync(paths.stageDir)).toBe(false);});+ it('refuses to record a rig whose published pair does not read back', async () => {+ // The publish itself succeeded, but the pair does not verify — the exact state an+ // interrupted rig leaves behind. Reporting that as ready would defeat the digest.+ await expect(run({+ spawnImpl: publishCleanRig(),+ verify: async () => ({ ok: false, reason: 'digest-mismatch' }),+ })).rejects.toMatchObject({ code: 'RIGGING_PUBLISH_UNVERIFIED' });+ });+it('reports the worker exit when it produced no readable report at all', async () => {const spawnImpl = fakeWorker({ code: 3, write: async () => {} });await expect(run({ spawnImpl })).rejects.toMatchObject({ code: 'RIGGING_WORKER_FAILED' });