Skip to content

fix(settings): align icon refresh rate with capture floor - #928

Closed
CamilleGuillory wants to merge 2 commits into
thaw-app:developmentfrom
CamilleGuillory:fix/icon-refresh-rate-ceiling
Closed

fix(settings): align icon refresh rate with capture floor#928
CamilleGuillory wants to merge 2 commits into
thaw-app:developmentfrom
CamilleGuillory:fix/icon-refresh-rate-ceiling

Conversation

@CamilleGuillory

@CamilleGuillory CamilleGuillory commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cap the Icon refresh rate slider at the SCK capture floor (4 fps) so the UI cannot promise rates the engine will not deliver
  • Normalize stored iconRefreshInterval onto {Off, 1–4 fps}, clamp live-loop sleep, and tighten the URI range/docs so slow or sub-ms values cannot show as Off or spin the main actor

Test plan

  • xcodebuild test -project Thaw.xcodeproj -scheme Thaw -destination 'platform=macOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
  • Open Layout settings → Icon refresh rate tops out at 4 fps
  • At 4 fps with layout/search/Thaw Bar open, diagnostic log does not spam continuous "rate-limited" skips from over-ticking
  • thaw://set?key=iconRefreshInterval&value=2.5 clamps to 1s (1 fps); value=0 stays Off
  • Profile with a legacy slow interval (e.g. 3.0) snaps to 1 fps on apply and no longer labels as Off

Closes: N/A


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Enhancements

    • Improved icon refresh settings with consistent rate limits and supported interval values.
    • Refresh rates now support 1–30 FPS, with intervals snapped to supported values.
    • Setting the interval to 0 disables icon refreshes.
    • Updated settings controls and URI configuration to enforce the supported 0–1 second range.
  • Documentation

    • Updated icon refresh defaults, limits, snapping behavior, and disable option in the settings documentation.

The slider offered up to 30 fps while SCK capture is floored at 4 fps,
wasting main-actor wakeups. Snap stored intervals to the expressible
grid, clamp sleep, and correct the URI docs/range.
@github-actions github-actions Bot added layout Saved layouts, LayoutBar, reorder, spacing menubar Hide/show, sections, control items, backends, capacity profiles Profiles and layout snapshots labels Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Labels: menubar, layout, profiles

Caution

Convention issues found — please fix before merge.

  • DCO: commit(s) missing a Signed-off-by trailer matching the author email: c92d6f67, 8b61e0fc. Use git commit -s (or git rebase --signoff then force-push). See CONTRIBUTING.

cc @CamilleGuillory

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2fa8eab7-d46c-454e-b269-1fb6712df09e

📥 Commits

Reviewing files that changed from the base of the PR and between c92d6f6 and 8b61e0f.

📒 Files selected for processing (3)
  • Thaw/MenuBar/MenuBarItems/MenuBarItemImageCache.swift
  • ThawTests/Settings/Models/IconRefreshIntervalNormalizationTests.swift
  • docs/URI_SCHEMES.md

📝 Walkthrough

Walkthrough

The PR standardizes icon refresh intervals around a 30 FPS maximum and a 1/30-second minimum. Settings values now normalize to supported reciprocal FPS values. The UI, URI handler, documentation, and tests use the updated limits.

Changes

Icon refresh interval controls

Layer / File(s) Summary
Runtime refresh bounds
Thaw/MenuBar/MenuBarItems/MenuBarItemImageCache.swift
The image cache defines a 30 FPS maximum and derives the minimum refresh interval. Live refresh sleeps are clamped to prevent zero-duration loops.
Settings interval normalization
Thaw/Settings/Models/AdvancedSettings.swift, Thaw/Settings/SettingsPanes/MenuBarLayoutSettingsPane.swift, Thaw/Utilities/SettingsURIHandler.swift, docs/URI_SCHEMES.md
Settings normalize positive intervals to reciprocal values from 1 to 30 FPS. The slider and URI handler use the updated bounds. Documentation describes the 0–1 second range and disabled state.
Normalization validation
ThawTests/Settings/Models/*, ThawTests/Settings/URI/*
Tests cover normalization boundaries, idempotence, round trips, persisted values, profile handling, and URI clamping.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • thaw-app/Thaw#399: Modifies AdvancedSettings and SettingsURIHandler icon refresh interval validation and persistence.

Suggested labels: fix, settings, test, docs, performance

Suggested reviewers: stonerl, diazdesandi

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a useful summary, test plan, and required Closes line, but it omits the PR Type, Area, breaking-change, checklist, behavior, and follow-up sections. Add the missing template sections, select applicable options, state the new behavior, record test commands and results, and complete the checklist.
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies a settings fix that aligns icon refresh behavior with the capture limit, matching the pull request's primary change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Thaw/Utilities/SettingsURIHandler.swift`:
- Line 115: Update the iconRefreshInterval handling in SettingsURIHandler.swift
at lines 115-115 to normalize values through
AdvancedSettings.normalizedIconRefreshInterval before writing Defaults and
posting the notification; add URI tests covering 0.1 → 0.25 and 0.6 → 0.5.
Update docs/URI_SCHEMES.md at lines 157-157 to document that positive values
snap to 1/n for n in 1...4, alongside the existing range behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e1c85642-7dd8-4f73-8b43-1419e4992abd

📥 Commits

Reviewing files that changed from the base of the PR and between 2344eb3 and c92d6f6.

📒 Files selected for processing (9)
  • Thaw/MenuBar/MenuBarItems/MenuBarItemImageCache.swift
  • Thaw/Settings/Models/AdvancedSettings.swift
  • Thaw/Settings/SettingsPanes/MenuBarLayoutSettingsPane.swift
  • Thaw/Utilities/SettingsURIHandler.swift
  • ThawTests/Settings/Models/AdvancedSettingsTests.swift
  • ThawTests/Settings/Models/IconRefreshIntervalNormalizationTests.swift
  • ThawTests/Settings/Models/ProfileDecodingDefaultsTests.swift
  • ThawTests/Settings/URI/SettingsURIHandlerApplyTests.swift
  • docs/URI_SCHEMES.md

"showOnHoverDelay": (0, 5),
"tooltipDelay": (0, 5),
"iconRefreshInterval": (0, 5),
"iconRefreshInterval": (0, 1),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Normalize URI values before persistence and document the discrete grid.

iconRefreshInterval supports only 0, 1, 1/2, 1/3, and 1/4 seconds after normalization. The current URI range accepts values such as 0.1 and 0.6. handleDoubleSet stores those raw values before posting the notification. This makes correct persistence depend on an active AdvancedSettings observer.

  • Thaw/Utilities/SettingsURIHandler.swift#L115-L115: Normalize iconRefreshInterval with AdvancedSettings.normalizedIconRefreshInterval before writing Defaults and before posting the notification. Add URI tests for 0.1 -> 0.25 and 0.6 -> 0.5.
  • docs/URI_SCHEMES.md#L157-L157: State that positive values snap to 1/n for n in 1...4, rather than only describing continuous range clamping.
📍 Affects 2 files
  • Thaw/Utilities/SettingsURIHandler.swift#L115-L115 (this comment)
  • docs/URI_SCHEMES.md#L157-L157
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Thaw/Utilities/SettingsURIHandler.swift` at line 115, Update the
iconRefreshInterval handling in SettingsURIHandler.swift at lines 115-115 to
normalize values through AdvancedSettings.normalizedIconRefreshInterval before
writing Defaults and posting the notification; add URI tests covering 0.1 → 0.25
and 0.6 → 0.5. Update docs/URI_SCHEMES.md at lines 157-157 to document that
positive values snap to 1/n for n in 1...4, alongside the existing range
behavior.

The SCK floor was a deliberate CPU throttle, not an API limit. Match the
historical slider top so users who want smoother panel icons can opt in;
SkyLight offscreen stays at 1/s.
@CamilleGuillory

Copy link
Copy Markdown
Contributor Author

Follow-up: raised the SCK capture ceiling from 4 fps to 30 fps so it matches the historical slider top. Default remains 0.25 s (~4 fps). SkyLight offscreen path stays at 1/s.

Tradeoff: leaving Search/Layout/Thaw Bar open at 30 fps can pin a core again — that was why the 250 ms floor existed.

@CamilleGuillory

Copy link
Copy Markdown
Contributor Author

Superseded by a fresh single-commit PR that includes DCO sign-off, URI-side grid normalization (CodeRabbit), and the 30 fps ceiling. Closing in favor of the new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

layout Saved layouts, LayoutBar, reorder, spacing menubar Hide/show, sections, control items, backends, capacity profiles Profiles and layout snapshots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant