Skip to content

chore: Prune unread mask-rebuild counters and restated tests - #1236

Merged
omesser merged 1 commit into
mainfrom
cursor/prune-dead-code-and-tests-5092
Oct 1, 2026
Merged

omesser merged 1 commit into
mainfrom
cursor/prune-dead-code-and-tests-5092

Conversation

@omesser

@omesser omesser commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Why

Nothing a user sees changes. A mask rebuild still prints its line when FIDGET_TRACE_MASK_REBUILD is set, which is what the bench scripts parse. The counters beside that print were never read, and five tests either asserted nothing, watched zeros, or repeated an assertion a stronger test already makes.

Five #[test] functions removed. 118 lines deleted, 2 added.

What changed

Location Category Action
consent.rs wanted dead attribute Dropped #[cfg_attr(target_os = "linux", allow(dead_code))]. usable calls wanted on Linux (list_window_titles, the frame loop).
platform/x11/overlay.rs, platform/windows/overlay.rs mask counters and read_mask_rebuild_stats dead Removed, with the platform.rs wrappers. Nothing read the counters. The FIDGET_TRACE_MASK_REBUILD line stays.
platform.rs mask_rebuild_stats_returns_valid_tuple test with no assertion Removed. It called the reader and discarded the tuple.
platform/x11/overlay.rs, platform/windows/overlay.rs mask_rebuild_stats_readable_and_reset tautological Removed. Two reads of counters the test never increments, so both reads are zero either way.
consent.rs windows_window_titles_prompt_is_noop test with no assertion Removed. WindowsProbe::prompt is empty, and the test did not assert that. windows_window_titles_always_granted still checks the grant.
model.rs a_model_api_turn_is_one_timeout_when_unset duplicate Removed. one_runaway_guard_caps_every_wake_on_every_host already asserts timeout_for() == TIMEOUT after the same default seed.

No follow-up issues. Compile-time Send checks, ignored desktop probes, and the rename-lever deletion already on main (#1233) stay.

How to verify

cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings

No JavaScript changed, so node --test is not part of this diff.

cargo clippy --workspace --all-targets -- -D warnings passed here. cargo test --workspace passed for every crate except three linux_secret_service tests, which need a Secret Service daemon and do not touch this diff. double_click_interval_ms_matches_gtk_settings passed when run on the main thread.

— Cursor agent, on @omesser's behalf.

Open in Web Open in Cursor 

Drop counters nothing reads, a stale dead_code allow, a no-assertion
Windows prompt test, and a timeout assertion already made next to it.

Co-authored-by: Oded Messer <odedmesser@gmail.com>

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft-gate (Architect) — CLEARED with Softs

Tip verified: 9efe777cce3a57d0331095769e12862f118c963e
Branch: cursor/prune-dead-code-and-tests-5092 → main
Hard axis: holds — no unique behavioural pin lost; unread mask-rebuild counters/attrs and assertion-free/duplicate tests only; FIDGET_TRACE_MASK_REBUILD print line kept on x11+windows (bench scripts parse it); production mask-rebuild / consent paths stay equivalent.

Soft ledger

Soft Status Evidence
(a) CI green on tip Met PR Tests checks (ubuntu-latest) 110481039935, checks (macos-latest) 110481039659, windows 110481039988, renderer 110481039977 SUCCESS; Pages build 110481039369 SUCCESS; deploy 110481152187 SKIPPED — all on 9efe777c….
(b) Scope / no unexpected behaviour change Met Diff is dead counters/attrs + five #[test] drops only (+2/−118). No production control-flow change beyond removing unread atomics beside the TRACE print.
(c) Spot-audit every removal Met See below — each drop has a named surviving seam or true deadness (rg on tip tree).
(d) Production path equivalence Met update_input_region / configure_overlay still re-exported from x11+windows; TRACE eprintln!("mask_rebuild: …") remains in both overlays; consent::usable → wanted still gates Linux list_window_titles and the frame-loop WindowNames path; no orphan read_mask_rebuild_stats exports.
(e) Merge hygiene Met Undrafted; mergeable=true, mergeable_state=clean. No Soft-conflict file overlap with open #1229/#1204/#1188/#689 on consent/platform/overlay/model paths.

Soft (c) spot-audit

  1. consent.rs drop #[cfg_attr(target_os = "linux", allow(dead_code))] on wanted → still live on Linux: usable calls wanted (consent.rs); Linux list_window_titles gates via consent::usable(WindowNames, …) (platform.rs); frame loop uses consent::usable(WindowNames, …) (frame_loop.rs). Attribute was stale, not the function.
  2. read_mask_rebuild_stats + MASK_REBUILD_* atomics (x11+windows overlays, platform.rs wrappers, mod re-exports) → rg on tip: zero remaining callers/defs in src-tauri/ (and none in scripts/). Counters were write-only; measurement is the TRACE env print, which stays.
  3. FIDGET_TRACE_MASK_REBUILD print kept → still present in platform/x11/overlay.rs and platform/windows/overlay.rs; bench scripts still export/set the env (scripts/bench-mask-rebuild-x11.sh, bench-gpu-compositing-linux.sh, bench-gpu-compositing-windows.ps1).
  4. mask_rebuild_stats_returns_valid_tuple (platform.rs) → assertion-free (called reader, discarded tuple); dead with the API.
  5. mask_rebuild_stats_readable_and_reset (x11+windows overlay tests) → tautological (two reads of never-incremented zeros); dead with the counters.
  6. windows_window_titles_prompt_is_noop → no assert that WindowsProbe::prompt is empty. Surviving: windows_window_titles_always_granted, windows_live_probe_grants_window_titles, windows_usable_follows_wanted.
  7. a_model_api_turn_is_one_timeout_when_unset → restated timeout_for() == TIMEOUT under blank env. Surviving stronger pin: one_runaway_guard_caps_every_wake_on_every_host (assert_eq!(timeout_for(), TIMEOUT, …) plus host-cap asserts).

Soft-FIX

None.

Hard

Holds (Y). No unique behavioural pin lost; TRACE mask-rebuild line kept; consent wanted/usable production gates intact; unread counters and restated/assertion-free tests only.

— Cursor agent (Architect), on @omesser's behalf.

@omesser

omesser commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Isn't this removing foundations for benchmarking (mask rebuilds)? I guess they will be used again when we improve/benchmark iteratively, no?
If I'm wrong, state why

@omesser

omesser commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

@omesser Short answer: no — this does not remove the mask-rebuild benchmarking foundation.

What iterative benchmarking actually uses (kept)

Bench / research measurement is the FIDGET_TRACE_MASK_REBUILD stderr line, not the atomics:

  • Tip still times each rebuild with Instant and, when that env is set, still prints
    mask_rebuild: {w}x{h} @{scale}x scale, {opaque} opaque pixels, {ms} ms
    in both src-tauri/src/platform/x11/overlay.rs and …/windows/overlay.rs.
  • scripts/bench-mask-rebuild-x11.sh exports FIDGET_TRACE_MASK_REBUILD=1 and aggregates with grep -c 'mask_rebuild:' / sed / awk on the log. Same log pattern in scripts/bench-gpu-compositing-linux.sh and scripts/bench-gpu-compositing-windows.ps1.
  • Research docs (docs/research/mask-rebuild-baseline-x11.md, …-windows.md, samples under those trees) cite that TRACE env and those mask_rebuild: lines.

So the path you will keep using when improving/benchmarking iteratively is still on tip.

What this PR drops (was never the bench consumer)

MASK_REBUILD_COUNT / MASK_REBUILD_TOTAL_NS and read_mask_rebuild_stats() were write-only / unread:

  • On main they were already documented as “Reserved counters; measurement is via TRACE log. The bench script parses that log and does not call this.” and wrapped in #[allow(dead_code)].
  • rg / code search: no callers outside the defs/re-exports (no scripts, no other Rust). The only “uses” were tests that never incremented the counters (two zero reads) or discarded the tuple (mask_rebuild_stats_returns_valid_tuple).

So this is unused parallel instrumentation beside the live TRACE path, not the foundation the benches hang off.

If we want in-process counters later

Reintroducing two atomics + a small reader next to the existing Instant timing is cheap (~tens of lines). We would not be rebuilding the TRACE + bench-script stack — that stack stays. Keeping dead #[allow(dead_code)] APIs “just in case” is the worse default here.

Soft CLEARED at 9efe777cce3a57d0331095769e12862f118c963e still holds (tip unchanged); no Soft re-gate from this thread.

— Cursor agent (Architect), on @omesser's behalf.

@omesser
omesser merged commit 40a8180 into main Oct 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants