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

fix([issue-3483]): don't carry relief ownership down from root-level relief (review round 3)

[._.]/ Adam Eivy1c2d82c49d2c
diff --git a/client/src/lib/threejsExplode.js b/client/src/lib/threejsExplode.js
index a2719ba1d9..cace67d744 100644
--- a/client/src/lib/threejsExplode.js
+++ b/client/src/lib/threejsExplode.js
@@ -195,20 +195,22 @@ export function buildPartSelectionIndex(parts) {
const owners = Object.create(null);
const ancestry = Object.create(null);
const names = Object.create(null);
- // "Inside relief" is sticky: the layout skips a relief part's whole subtree,
- // so anything under it must resolve to the same owner. Without that, a plain
- // part nested under relief would present as its own component that the slider
- // can never separate — the exact disagreement this module exists to prevent.
+ // "Riding" is sticky: the layout skips a relief part's whole subtree, so
+ // anything under it must resolve to the same owner. Without that, a plain part
+ // nested under relief would present as its own component that the slider can
+ // never separate — the exact disagreement this module exists to prevent. It
+ // starts only where relief actually rides something: root-level relief has no
+ // parent, so the layout treats it (and its children) as ordinary parts.
const walk = (list, chain, owner, insideRelief) => {
for (const part of list || []) {
if (!part?.id) continue;
const selfChain = [...chain, part.id];
- const relief = isReliefPart(part) || insideRelief;
- const selfOwner = relief ? (owner ?? part.id) : part.id;
+ const riding = insideRelief || (isReliefPart(part) && owner !== null);
+ const selfOwner = riding ? (owner ?? part.id) : part.id;
owners[part.id] = selfOwner;
ancestry[part.id] = selfChain;
names[part.id] = part.name || part.id;
- walk(childrenOf(part), selfChain, selfOwner, relief);
+ walk(childrenOf(part), selfChain, selfOwner, riding);
}
};
walk(parts, [], null, false);
diff --git a/client/src/lib/threejsExplode.test.js b/client/src/lib/threejsExplode.test.js
index cb9a9dcfe7..dda8b6014b 100644
--- a/client/src/lib/threejsExplode.test.js
+++ b/client/src/lib/threejsExplode.test.js
@@ -68,13 +68,21 @@ describe('the shared part definition', () => {
});
it('treats root-level relief as an ordinary part, matching what the picker owns', () => {
- const parts = [part('floatingTrim', { explodeWithParent: true, position: [-1, 0, 0] }), part('body', { position: [1, 0, 0] })];
+ const parts = [
+ part('floatingTrim', { explodeWithParent: true, position: [-1, 0, 0], children: [part('realPart', { position: [0, 0, 0.5] })] }),
+ part('body', { position: [1, 0, 0] }),
+ ];
const layout = computeExplodeLayout(parts, 1);
+ const { owners } = buildPartSelectionIndex(parts);
// There is no parent to ride, and the picker self-owns it — so the two
// halves of the definition must not disagree about whether it is a part.
- expect(layout.unitIds).toEqual(['floatingTrim', 'body']);
- expect(buildPartSelectionIndex(parts).owners.floatingTrim).toBe('floatingTrim');
+ expect(layout.unitIds).toEqual(['floatingTrim', 'realPart', 'body']);
+ expect(owners.floatingTrim).toBe('floatingTrim');
+ // Nor may the ownership carry down: the layout separates this child, so the
+ // picker must name it rather than the contradictory root "relief" above it.
+ expect(layout.offsets.realPart).toBeDefined();
+ expect(owners.realPart).toBe('realPart');
});
it('does not read part ids through Object.prototype', () => {