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 (claude): pick the fusion remedy by counting homes, not by mesh-vs-group

[._.]/ Adam Eivyc59023c31120
diff --git a/client/src/pages/ThreejsModelDetail.jsx b/client/src/pages/ThreejsModelDetail.jsx
index dccb307bc1..6943edcc03 100644
--- a/client/src/pages/ThreejsModelDetail.jsx
+++ b/client/src/pages/ThreejsModelDetail.jsx
@@ -149,8 +149,12 @@ export default function ThreejsModelDetail() {
// Counted from the findings actually rendered rather than read off the stored
// tallies, so the header can never disagree with the list below it — or print
// "undefined error" for a record whose coverage arrived without its counts.
+ // An unrecognized severity counts as a note rather than being dropped — the
+ // list below still renders it (styled as a note), and a tally that omitted it
+ // would read "0 note" above a visible finding.
const coverageCounts = (coverageFindings || []).reduce((counts, finding) => {
- if (counts[finding.severity] !== undefined) counts[finding.severity] += 1;
+ const bucket = counts[finding.severity] === undefined ? 'note' : finding.severity;
+ counts[bucket] += 1;
return counts;
}, { error: 0, warning: 0, note: 0 });
diff --git a/server/lib/threejsModelCoverage.js b/server/lib/threejsModelCoverage.js
index d1190cb585..5172f9af04 100644
--- a/server/lib/threejsModelCoverage.js
+++ b/server/lib/threejsModelCoverage.js
@@ -91,13 +91,20 @@ export function evaluateThreejsPartCoverage(spec) {
const ranked = group.filter((detail) => RANKED_PRIORITIES.has(detail.priority));
if (ranked.length >= 2) {
const features = ranked.map((detail) => detail.feature);
- // A bare group whose children carry the geometry is an attribution
- // problem, not a fused mesh — the parts already exist separately, the
- // inventory just points above them. Telling the provider to "build each
- // as its own part" there would have it rebuild geometry it got right.
- const remedy = sharedPart.hasGeometry
- ? 'Build each as its own part instead of one fused mesh.'
- : 'Point each detail at the specific child part that implements it.';
+ // Re-attribute or rebuild? The answer is not "is the shared part a mesh"
+ // — it is whether enough unclaimed geometry already exists beneath it to
+ // give every ranked feature a home. Telling the provider to rebuild parts
+ // it already modelled duplicates geometry; telling it to re-attribute to
+ // children that do not exist wastes a whole provider round-trip and lands
+ // back here next pass. A shared part that is itself a mesh houses one of
+ // the features legitimately, so it only needs children for the rest.
+ const unclaimedDescendants = parts.filter((part) => part.hasGeometry
+ && part.ancestorIds.includes(partId)
+ && !implementedIds.has(part.id)).length;
+ const needHomes = ranked.length - (sharedPart.hasGeometry ? 1 : 0);
+ const remedy = unclaimedDescendants >= needHomes
+ ? 'Point each detail at the specific child part that implements it.'
+ : 'Build each as its own part instead of one fused mesh.';
findings.push({
code: 'fused-parts',
severity: 'error',
diff --git a/server/lib/threejsModelCoverage.test.js b/server/lib/threejsModelCoverage.test.js
index 63dc1bbe56..88a32dee90 100644
--- a/server/lib/threejsModelCoverage.test.js
+++ b/server/lib/threejsModelCoverage.test.js
@@ -116,7 +116,9 @@ describe('evaluateThreejsPartCoverage', () => {
}],
detailInventory: [
detail('Boxy hull', ['hull'], 'identity'),
- detail('Fine surface stria', ['stria'], 'minor'),
+ // Repeated id — the folded pass must dedupe before its arity test too,
+ // not just the fusion pass.
+ detail('Fine surface stria', ['stria', 'stria'], 'minor'),
],
}));
@@ -205,6 +207,47 @@ describe('evaluateThreejsPartCoverage', () => {
expect(codes(coverage)).toContain('orphan-geometry');
});
+ it('tells a group with too few children to build, not re-attribute', () => {
+ // Only one mesh under the group, two features riding it — re-attributing
+ // would put both on that one child and land right back here next pass,
+ // a wasted provider round-trip.
+ const coverage = evaluateThreejsPartCoverage(makeSpec({
+ parts: [{
+ id: 'head',
+ name: 'Head',
+ children: [{ id: 'skull', name: 'Skull', geometry: box(0.8), material: 'shell' }],
+ }],
+ detailInventory: [
+ detail('Domed skull', ['head'], 'identity'),
+ detail('Hinged jaw', ['head'], 'identity'),
+ ],
+ }));
+
+ const fused = coverage.findings.find((finding) => finding.code === 'fused-parts');
+ expect(fused.message).toContain('one fused mesh');
+ });
+
+ it('tells a mesh with an unclaimed geometry child to re-attribute, not rebuild it', () => {
+ // `fin` is already modelled; "build each as its own part" would have the
+ // provider duplicate geometry it got right.
+ const coverage = evaluateThreejsPartCoverage(makeSpec({
+ parts: [{
+ id: 'hull',
+ name: 'Hull',
+ geometry: box(2),
+ material: 'shell',
+ children: [{ id: 'fin', name: 'Fin', geometry: box(0.5), material: 'shell' }],
+ }],
+ detailInventory: [
+ detail('Boxy hull', ['hull'], 'identity'),
+ detail('Swept fin', ['hull'], 'identity'),
+ ],
+ }));
+
+ const fused = coverage.findings.find((finding) => finding.code === 'fused-parts');
+ expect(fused.message).toContain('Point each detail at the specific child part');
+ });
+
it('does not also call folded minor relief unbuilt when its locator part carries no geometry', () => {
// The child part is a pure locator — the relief itself lives in the parent
// mesh. Reporting "nothing was built for it" alongside "folding it in is