git.lucas.co / cce-window-manager
window management library
git clone https://git.lucas.co/cce-window-manager.git

commit393837b40bbc72c414fc6cb20876aa54d61df1da
parentab74416d92
authorLucas Galante <[email protected]>
date2026-09-19 07:34
docs: test count, test-module exceptions, and the focus-follow rule

Three claims that had drifted from the code.

- "~143 unit tests" is 175.
- The modules without a `#[cfg(test)]` block are `api.rs` and `lib.rs`, not
  `api.rs` and `state.rs` — state.rs grew tests and lib.rs is declarations.
- `FOCUS_VISIBLE_THRESHOLD` no longer exists. 8f7f4a3 (2026-09-12, "focus
  pans only as far as it must, never to centre") replaced the
  threshold-then-centre rule with `pan_into_view`: the minimal pan that
  brings a window fully into view, its corrected edge landing `VIEW_MARGIN`
  in. `visible_fraction` survives, but it feeds `recalled_origin` now, not
  focus — so the old pairing named a constant that is gone AND described
  behaviour the crate deliberately stopped having.

Co-Authored-By: Claude Opus 5 <[email protected]>

 CLAUDE.md | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/CLAUDE.md b/CLAUDE.md
index 226635f..e0baf7d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -38,7 +38,7 @@ Commit here, not at the workspace root. The crate must **build standalone** —
 
 ```sh
 cargo build                      # standalone build (fast; no compositor deps)
-cargo test                       # run all tests (~143 unit tests, all in-crate)
+cargo test                       # run all tests (~175 unit tests, all in-crate)
 cargo test snap::                # tests in one module
 cargo test -p cce-window-manager # same, from the workspace root
 ```
@@ -48,8 +48,8 @@ compositor's native `build.rs` pipeline — prefer working here directly when th
 change is policy-side.
 
 Tests live in `#[cfg(test)]` modules at the bottom of the module they cover —
-every module has one except `api.rs` and `state.rs`, which are plain-data
-vocabulary. This crate is where the DE's testable logic is concentrated —
+every module has one except `api.rs` (plain-data vocabulary) and `lib.rs`
+(module declarations only). This crate is where the DE's testable logic is concentrated —
 placement/snapping changes should come with unit tests (the existing test
 modules show the style: small numeric scenarios with worked-out expectations in
 comments).
@@ -185,8 +185,13 @@ The crate owns what a binding *means*; the compositor owns the physical half
   else to be, so the result stays predictable.
 - `camera.rs` — viewport pan/zoom math (`Camera` = pan_x/pan_y/zoom):
   `zoom_about_anchor` (wheel zoom at cursor, keyed zoom at viewport center),
-  `center_on`, `fit_bounds` (overview fit), `visible_fraction` +
-  `FOCUS_VISIBLE_THRESHOLD` (focus-follow panning), `is_overview`. The
+  `center_on`, `fit_bounds` (overview fit), `pan_into_view` (focus-follow:
+  the MINIMAL pan that brings a window fully into view, its corrected edge
+  landing `VIEW_MARGIN` in — since 2026-09-12 it replaces a
+  `FOCUS_VISIBLE_THRESHOLD` rule that centered anything less than
+  three-quarters visible, throwing away the spatial relationship the user had
+  just navigated by), `visible_fraction` (now feeding `recalled_origin`, not
+  focus), `is_overview`. The
   mechanism owns the actual fields and animation; these are pure maps.
   `recalled_origin` decides where a remembered FLOATING window reopens: its
   remembered origin when at least `RESTORE_VISIBLE_MIN` (a quarter) of it