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: fall back to the spec when a stored rig report has no counts (#3697)
[._.]/ Adam Eivy64347c763943
diff --git a/client/src/pages/ThreejsModelDetail.jsx b/client/src/pages/ThreejsModelDetail.jsxindex be854044da..c10de8ae21 100644--- a/client/src/pages/ThreejsModelDetail.jsx+++ b/client/src/pages/ThreejsModelDetail.jsx@@ -151,9 +151,13 @@ function FamilyChecklistPanel({ family }) {function RigReadinessPanel({ rig, spec }) {const derived = summarizeThreejsArticulation(spec);const ready = rig ? rig.articulationReady === true : false;- const jointCount = rig ? rig.jointCount : derived.jointCount;- const socketCount = rig ? rig.socketCount : derived.socketCount;- const attachmentCount = rig ? rig.attachmentCount : derived.attachmentCount;+ // A report that arrived without its counts (an older or newer peer, a+ // hand-repaired row) falls back to the spec rather than printing "undefined+ // joints" — the same rule the coverage panel applies to its tallies.+ const count = (key) => (Number.isFinite(rig?.[key]) ? rig[key] : derived[key]);+ const jointCount = count('jointCount');+ const socketCount = count('socketCount');+ const attachmentCount = count('attachmentCount');const reasons = Array.isArray(rig?.reasons) ? rig.reasons : [];return (<section className="rounded-xl border border-port-border bg-port-card p-4">diff --git a/client/src/pages/ThreejsModelDetail.test.jsx b/client/src/pages/ThreejsModelDetail.test.jsxindex 638e9c8114..2a3f078add 100644--- a/client/src/pages/ThreejsModelDetail.test.jsx+++ b/client/src/pages/ThreejsModelDetail.test.jsx@@ -340,3 +340,31 @@ describe('ThreejsModelDetail rig readiness', () => {expect(screen.queryByText('Rig readiness')).not.toBeInTheDocument();});});++describe('ThreejsModelDetail rig readiness fallbacks', () => {+ beforeEach(resetMocks);++ // A report that reached this install without its counts must not print+ // "undefined joints" — it falls back to what the spec itself declares.+ it('counts from the spec when the stored report arrived without tallies', async () => {+ getThreejsModel.mockResolvedValue({+ ...baseRecord,+ spec: {+ ...baseRecord.spec,+ articulation: {+ joints: [+ { id: 'rootJoint', partId: 'torso', parentJointId: null, pivotSocket: null },+ { id: 'armJoint', partId: 'arm', parentJointId: 'rootJoint', pivotSocket: 'shoulder' },+ ],+ attachmentPartIds: ['pack'],+ },+ },+ rig: { articulationReady: true, reasons: [] },+ });+ renderDetail();++ await waitFor(() => expect(screen.getByText('Rig readiness')).toBeInTheDocument());+ expect(screen.getByText('2 joints · 1 pivot socket · 1 declared attachment')).toBeInTheDocument();+ expect(screen.queryByText(/undefined/)).not.toBeInTheDocument();+ });+});