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: make findImportCycleComponents' sort a total order (#5693)

[._.]/ Adam Eivydd9e1ec82d61
diff --git a/server/lib/staticImportGraph.js b/server/lib/staticImportGraph.js
index fbe568d218..02a7963890 100644
--- a/server/lib/staticImportGraph.js
+++ b/server/lib/staticImportGraph.js
@@ -232,5 +232,12 @@ export function findImportCycleComponents(graph) {
};
for (const node of graph.keys()) if (!index.has(node)) visit(node);
- return components.sort((a, b) => (a.join() < b.join() ? -1 : 1));
+ // Components partition the nodes, so the first member of each is unique and
+ // orders them totally. Compared by code point rather than `localeCompare`:
+ // locale-dependent order is exactly the machine-to-machine variation this
+ // function exists to keep out of a baseline.
+ return components.sort((a, b) => {
+ if (a[0] === b[0]) return 0;
+ return a[0] < b[0] ? -1 : 1;
+ });
}