From d1ed5d9db176136ad1c1dc7541acdb67e105872b Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 15 Jun 2026 02:36:22 +1000 Subject: [PATCH] fix: deterministic component ordering Keep manifest order for package installation --- src/caelestia/utils/dots/manifest.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/caelestia/utils/dots/manifest.py b/src/caelestia/utils/dots/manifest.py index 01fbd0a3..016c56c1 100644 --- a/src/caelestia/utils/dots/manifest.py +++ b/src/caelestia/utils/dots/manifest.py @@ -173,8 +173,19 @@ class Manifest: return [p[len(_LOCAL_PREFIX) :] for p in self._all_packages() if p.startswith(_LOCAL_PREFIX)] def _all_packages(self) -> list[str]: - """The manifest's top-level packages plus enabled components'.""" - return list(set(self.packages) | set(p for c in self._data.enabled_comps for p in self.components[c].packages)) + """The manifest's top-level packages plus enabled components', in manifest order. + + Top-level packages come first, then each enabled component's packages in + component order. Only the first occurrence of each package is kept. + """ + + seen: set[str] = set() + ordered: list[str] = [] + for pkg in (*self.packages, *(p for c in self._data.enabled_comps for p in self.components[c].packages)): + if pkg not in seen: + seen.add(pkg) + ordered.append(pkg) + return ordered def _require_key(d: dict[str, Any], key: str, ctx: str) -> Any: