Skip to content

feat(intel): master toggle for intel-aware preview chrome#78

Merged
AreteDriver merged 4 commits into
mainfrom
feat/intel-chrome-toggle
Apr 26, 2026
Merged

feat(intel): master toggle for intel-aware preview chrome#78
AreteDriver merged 4 commits into
mainfrom
feat/intel-chrome-toggle

Conversation

@AreteDriver
Copy link
Copy Markdown
Owner

Summary

Some users won't want the v3.2.0 threat tints — may not use chat-log intel, may find chrome distracting, or may prefer plain previews. Adds a master toggle (`intel.preview_chrome_enabled`, default true) that suppresses all threat chrome on previews and chips while leaving everything else running.

What the toggle controls

Surface Affected by toggle?
Threat-tint borders on frames (PR #62) ✅ suppressed when off
Threat dots on chips (PR #63) ✅ suppressed when off
Pulse animation on danger upgrade ✅ suppressed when off
"+Nj" distance badges (PRs #68, #71) ✅ suppressed when off
Per-character accent border (PR #70) ❌ stays on (it's identity, not threat)
Status dock chips themselves (PR #63) ❌ stay visible (system labels still update)
Replay strip (PR #72) ❌ orthogonal
Intel parser, audio alerts, tray notifications ❌ keep running
System labels on chips (PR #65) ❌ keep updating

Implementation

  • `intel.preview_chrome_enabled` added to `SettingsManager.DEFAULT_SETTINGS`. Also formalized the other v3.2.0 defaults (`track_character_locations`, `threat_jumps_threshold`) which existed only as inline `get(key, default)` calls.
  • `MainWindowV21._on_intel_alert` reads the toggle and gates the fan-out to `apply_threat_state` + `set_threat_state`. Other AlertTypes (audio, tray) keep firing — only the visual chrome is gated.
  • `MainWindowV21._clear_threat_chrome` flushes both surfaces with `ThreatLevel.CLEAR` so toggle-off takes effect immediately rather than waiting for the 30s decay timer.
  • `MainWindowV21._apply_setting` routes toggle-off through `_clear_threat_chrome`.
  • `IntelPanel` adds the checkbox at the top with a tooltip spelling out exactly what's affected.

Test plan

  • 19 new tests
    • `TestMainWindowV21ChromeMasterToggle` (4): on/off fan-out, critical-tray independence, default-on for missing settings_manager
    • `TestMainWindowV21ClearThreatChrome` (3): both-surface coverage, no-main_tab safe, dock-optional
    • `TestMainWindowV21ApplySettingChromeToggle` (3): toggle-off clears, toggle-on doesn't, unrelated key passthrough
    • `TestIntelPanel` (+3): checkbox default-on, init-off honors setting, signal emission
    • Plus 6 existing IntelPanel tests still pass with the new checkbox
  • Full suite: 2411 passed, 5 skipped, 0 failures
  • `ruff check` + `ruff format --check` clean

🤖 Generated with Claude Code

AreteDriver and others added 4 commits April 26, 2026 03:17
Adds an "Intel" panel to the Settings tab with controls for the new
v3.2.0 keys, so users can tune them from the UI instead of editing
settings.json:

  - intel.track_character_locations (checkbox)
    Toggles the per-character Local-log tracker. Tooltip explains it
    drives smart fan-out and chip system labels. Restart-required.

  - intel.threat_jumps_threshold (spinbox, 0-5)
    How many jumps from an alert system a character can be and still
    see a threat tint. 0 = exact-match only. Tooltip explains the
    falloff.

  - replay_strip_enabled (read-only summary)
    Shows how many characters have the per-character toggle enabled
    and points users to the right-click menu where it lives. Surfacing
    the feature here is the discoverability fix; the actual toggle
    stays per-frame.

Wires the panel into SettingsTab's panel stack and category tree
between Hotkeys and Appearance.

7 new tests (6 IntelPanel state/wiring + 1 updated existing
test_setup_ui_creates_all_panels for the new mock). Suite: 2397 passed,
5 skipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Some users won't want the v3.2.0 threat tints — they may not use chat-log
intel, may find the chrome distracting, or may prefer plain previews.
Adds a master toggle (intel.preview_chrome_enabled, default true) that
suppresses ALL threat chrome on previews and chips while leaving the
parser, audio alerts, tray notifications, system labels, and replay
strip untouched.

Implementation:
- New setting intel.preview_chrome_enabled (default true) added to
  SettingsManager.DEFAULT_SETTINGS, alongside formalized defaults for
  the other v3.2.0 keys (track_character_locations, threat_jumps_threshold).
- MainWindowV21._on_intel_alert reads the setting (defensive getattr
  for bypassed-init test sites) and skips the fan-out to
  WindowManager.apply_threat_state and StatusDock.set_threat_state when
  off. Other AlertTypes (audio, tray) keep firing.
- MainWindowV21._clear_threat_chrome flushes both surfaces with CLEAR
  so a toggle-off takes effect immediately rather than waiting for
  the 30s decay timer.
- MainWindowV21._apply_setting routes the toggle-off case through it.
- IntelPanel adds the checkbox at the top of the panel with a tooltip
  spelling out exactly what the toggle does and does NOT affect.

19 new tests covering on/off fan-out, critical-tray independence,
default-on for missing settings, _clear_threat_chrome surface coverage,
_apply_setting routing, and IntelPanel checkbox state/signal. Suite:
2411 passed, 5 skipped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AreteDriver AreteDriver enabled auto-merge (squash) April 26, 2026 10:28
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AreteDriver AreteDriver merged commit 2a98a7f into main Apr 26, 2026
15 checks passed
@AreteDriver AreteDriver deleted the feat/intel-chrome-toggle branch April 26, 2026 10:33
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a master toggle for 'Intel-Aware Preview Chrome,' allowing users to suppress visual threat indicators like tints and badges while keeping other alert types active. The changes include a new setting in the SettingsManager, a UI checkbox in the SettingsTab, and logic in MainWindowV21 to gate visual updates and immediately clear active tints when the feature is disabled. Comprehensive unit tests were added to verify the toggle's behavior and the clearing mechanism. Feedback suggests refactoring the setting retrieval into a helper property for cleaner code and using the toggled signal for the checkbox to follow PySide6 idioms.

Comment on lines +717 to +718
sm = getattr(self, "settings_manager", None)
chrome_enabled = sm.get("intel.preview_chrome_enabled", True) if sm is not None else True
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic for retrieving the intel.preview_chrome_enabled setting is repeated and slightly verbose. Consider adding a private helper property to encapsulate this check, which would also make gating other visual effects (like the border flash) cleaner.

    @property
    def _intel_chrome_enabled(self) -> bool:
        sm = getattr(self, "settings_manager", None)
        if sm is None:
            return True
        return sm.get("intel.preview_chrome_enabled", True)

Comment on lines +441 to +446
self.chrome_enabled_check.stateChanged.connect(
lambda: self.setting_changed.emit(
"intel.preview_chrome_enabled",
self.chrome_enabled_check.isChecked(),
)
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For boolean settings controlled by a QCheckBox, it is more idiomatic in PySide6 to use the toggled(bool) signal instead of stateChanged(int). This avoids the need to manually call isChecked() inside the lambda and provides a cleaner boolean interface.

        self.chrome_enabled_check.toggled.connect(
            lambda checked: self.setting_changed.emit(
                "intel.preview_chrome_enabled",
                checked,
            )
        )

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.

1 participant