feat(nix): Snapshot, the daemon's state in one shape for every port

komorebic state prints a different JSON on kfde and on kfw: a window is
{id, rect, details} on one and {hwnd, title, exe, class, rect} on the
other, and a monitor and the state itself have fields the other lacks.
core.snapshot.parse reads either into monitors, workspaces, containers and
windows with the same names, keeping what only one has in Snapshot.extra,
so that a scenario does not have to care which port it runs on.

The fixtures in its tests are written from the two serializers, not
recorded; they are replaced by recorded states once a run on each port
exists.
This commit is contained in:
LGUG2Z committed 2026-10-30 12:02:55 -07:00
1 parent a37a9faf3d
commit b02df47e34
3 files changed
+283

No files matched your search

+6
View File
@@ -143,6 +143,12 @@ the run.
`Rect` and the pixel helpers. It imports nothing of KDE, so that it can move to
the Windows port unchanged. `komorebi_vm` re-exports them, so that a suite
imports them from the same place as before.
- `Snapshot` (`core/snapshot.py`) is the daemon's state in one shape for every port:
`snapshot.parse(json)` reads the `komorebic state` of kfde and of kfw into
monitors, workspaces, containers and windows. What only one port's state has
goes in `Snapshot.extra`. Its unit tests use fixtures written from the two
ports' serializers; recorded states replace them once a run on each port
exists.
- `Checks` counts checks and fails once, at the end, so that one failure does
not hide the ones after it. `finish()` prints `passed: N failed: M`, and its
error names the checks that failed, which `nix build` shows in the last lines