Skip to content

feat: add colorblind-accessible mode for progress bars#54

Merged
nh13 merged 1 commit intomainfrom
nh/colorblind-accessible-mode
Mar 28, 2026
Merged

feat: add colorblind-accessible mode for progress bars#54
nh13 merged 1 commit intomainfrom
nh/colorblind-accessible-mode

Conversation

@nh13
Copy link
Copy Markdown
Collaborator

@nh13 nh13 commented Mar 28, 2026

Summary

  • Adds --colorblind CLI flag to watch command for colorblind-accessible progress bars
  • Uses distinct characters (= succeeded, X failed, · remaining, ? incomplete) instead of relying on color alone
  • Adds a key binding to toggle accessible mode at runtime
  • Always shows a text legend in accessible mode so status is fully self-describing
  • New AccessibilityConfig frozen dataclass in snakesee/tui/accessibility.py

Closes #46

Test plan

  • 8 new tests in TestAccessibility class covering:
    • Config constants use correct characters
    • Progress bar renders with accessible characters
    • Default mode regression (still uses block chars)
    • Legend always shown in accessible mode
    • Legend hidden without failures in default mode
    • a key toggles between modes
    • Incomplete workflow uses ? character
  • All 986 existing tests pass
  • ruff, mypy, ruff format all pass

Summary by CodeRabbit

  • New Features

    • Added colorblind-accessible mode for improved progress bar visibility. Press 'a' in the TUI to toggle between standard and colorblind-accessible rendering modes.
    • Accessible mode uses distinct ASCII characters and displays a legend to distinguish task statuses without relying on color perception.
  • Tests

    • Added comprehensive tests for colorblind accessibility features.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Warning

Rate limit exceeded

@nh13 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 57 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 57 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 283f04b5-3c45-4c73-94df-2709001ead07

📥 Commits

Reviewing files that changed from the base of the PR and between 63c6821 and 70d37da.

📒 Files selected for processing (6)
  • snakesee/cli.py
  • snakesee/tui/__init__.py
  • snakesee/tui/accessibility.py
  • snakesee/tui/monitor.py
  • tests/test_cli.py
  • tests/test_tui.py
📝 Walkthrough

Walkthrough

This PR introduces a colorblind-accessible progress bar rendering mode. Users can enable an alternative visual encoding via a CLI parameter or by pressing the 'a' key, which switches progress bars from color-dependent indicators to character-based representations using distinct symbols and optional text labels.

Changes

Cohort / File(s) Summary
Accessibility Infrastructure
snakesee/tui/accessibility.py, snakesee/tui/__init__.py
New accessibility.py module defines BarStyle and AccessibilityConfig dataclasses with two constant configurations: DEFAULT_CONFIG (block/light-shade Unicode characters) and ACCESSIBLE_CONFIG (ASCII symbols: =, X, ·, ?). Re-exported in __init__.py for public API exposure.
CLI Integration
snakesee/cli.py
Added colorblind: bool = False parameter to watch() function; passes ACCESSIBLE_CONFIG to WorkflowMonitorTUI when enabled, otherwise passes None for default behavior.
TUI Rendering and Interaction
snakesee/tui/monitor.py
Extended WorkflowMonitorTUI.__init__ to accept optional accessibility_config; added 'a' key handler to toggle between DEFAULT_CONFIG and ACCESSIBLE_CONFIG; updated progress bar segment rendering to use config-driven characters; modified legend display logic to show legend when failures exist or config.show_legend is True.
Test Coverage
tests/test_cli.py, tests/test_tui.py
Updated CLI test assertion to include new accessibility_config=None parameter; added comprehensive TestAccessibility class verifying character selection per config, legend visibility behavior, key toggle functionality, and incomplete-state rendering.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as CLI (watch)
    participant TUI as WorkflowMonitorTUI
    participant Config as accessibility_config
    participant Renderer as Progress Renderer

    User->>CLI: Call with colorblind=True
    CLI->>Config: Select ACCESSIBLE_CONFIG
    CLI->>TUI: __init__(accessibility_config)
    TUI->>TUI: Store accessibility_config
    
    Note over User,Renderer: Progress rendering loop
    TUI->>Renderer: _make_progress_bar(config)
    Renderer->>Renderer: Use config.succeeded.char, config.failed.char, etc.
    Renderer-->>TUI: Rendered bar with symbols
    
    Note over User,TUI: Keyboard toggle (while TUI running)
    User->>TUI: Press 'a' key
    TUI->>Config: Toggle config (DEFAULT ↔ ACCESSIBLE)
    TUI->>TUI: Force refresh
    TUI->>Renderer: Re-render with new config
    Renderer-->>TUI: Updated bar display
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 With stripes and dots where colors hide,
Progress bars now coincide!
Press 'a' to shift the symbol's grace—
Colorblind folk claim their space! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature: adding a colorblind-accessible mode for progress bars.
Description check ✅ Passed The description includes a clear summary of changes, linked issue reference, and comprehensive test plan covering all major functionality.
Linked Issues check ✅ Passed The PR fully addresses issue #46 by implementing colorblind-accessible progress bars using distinct characters instead of color-only encoding.
Out of Scope Changes check ✅ Passed All code changes directly support the colorblind-accessible mode feature with no extraneous modifications outside the scope of issue #46.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nh/colorblind-accessible-mode

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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.26%. Comparing base (684359e) to head (70d37da).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #54   +/-   ##
=======================================
  Coverage   88.25%   88.26%           
=======================================
  Files          48       48           
  Lines        4692     4694    +2     
=======================================
+ Hits         4141     4143    +2     
  Misses        551      551           
Files with missing lines Coverage Δ
snakesee/cli.py 81.75% <100.00%> (+0.24%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/test_cli.py (1)

51-67: Add a positive-path test for colorblind=True.

This only locks down the default accessibility_config=None branch. The new user-facing flag can still regress unnoticed unless we also assert that watch(..., colorblind=True) passes ACCESSIBLE_CONFIG into WorkflowMonitorTUI.

🧪 Suggested test
+    def test_watch_calls_tui_in_accessible_mode(
+        self, snakemake_dir: Path, tmp_path: Path
+    ) -> None:
+        """Test that watch enables accessible rendering when requested."""
+        from snakesee.tui.accessibility import ACCESSIBLE_CONFIG
+
+        with patch("snakesee.tui.WorkflowMonitorTUI") as mock_tui:
+            watch(tmp_path, colorblind=True)
+
+            assert mock_tui.call_args.kwargs["accessibility_config"] is ACCESSIBLE_CONFIG
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_cli.py` around lines 51 - 67, Add a positive-path unit test that
asserts the new colorblind flag passes the expected accessibility config into
the TUI: update tests/test_cli.py by adding a test alongside
test_watch_calls_tui that calls watch(tmp_path, refresh=2.0, no_estimate=True,
colorblind=True) and then asserts WorkflowMonitorTUI was called with
accessibility_config=ACCESSIBLE_CONFIG (keeping other expected args:
workflow_dir=tmp_path, refresh_rate=2.0, use_estimation=False,
profile_path=None, use_wildcard_conditioning=True, weighting_strategy="index",
half_life_logs=10, half_life_days=7.0). Ensure you import or reference
ACCESSIBLE_CONFIG in the test scope so the equality check succeeds.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@snakesee/tui/monitor.py`:
- Around line 1677-1682: The incomplete/remaining segment is using total_jobs -
completed_jobs - failed_jobs for all unfinished work; change the bar
construction (the code around bar.append calls and the WorkflowStatus.INCOMPLETE
branch) to render the interrupted portion using
len(progress.incomplete_jobs_list) (apply that to compute incomplete_width and
use config.incomplete.char) and render only the true still-pending remainder
using config.remaining.char (adjust remaining_width = total_unfinished -
len(progress.incomplete_jobs_list)). Update the same logic wherever the bar is
built for progress (including the other similar block around the later bar
construction) so the accessible label reflects interrupted jobs separately from
still-pending jobs.

---

Nitpick comments:
In `@tests/test_cli.py`:
- Around line 51-67: Add a positive-path unit test that asserts the new
colorblind flag passes the expected accessibility config into the TUI: update
tests/test_cli.py by adding a test alongside test_watch_calls_tui that calls
watch(tmp_path, refresh=2.0, no_estimate=True, colorblind=True) and then asserts
WorkflowMonitorTUI was called with accessibility_config=ACCESSIBLE_CONFIG
(keeping other expected args: workflow_dir=tmp_path, refresh_rate=2.0,
use_estimation=False, profile_path=None, use_wildcard_conditioning=True,
weighting_strategy="index", half_life_logs=10, half_life_days=7.0). Ensure you
import or reference ACCESSIBLE_CONFIG in the test scope so the equality check
succeeds.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 568bdf8f-282f-406f-9d76-35145a270c7e

📥 Commits

Reviewing files that changed from the base of the PR and between 684359e and 63c6821.

📒 Files selected for processing (6)
  • snakesee/cli.py
  • snakesee/tui/__init__.py
  • snakesee/tui/accessibility.py
  • snakesee/tui/monitor.py
  • tests/test_cli.py
  • tests/test_tui.py

Comment thread snakesee/tui/monitor.py
Add alternative visual encoding using distinct characters (=, X, ·, ?)
so progress bar status can be distinguished without color perception.

- New --colorblind CLI flag for watch command
- 'a' key toggles accessible mode at runtime
- Always-on legend in accessible mode shows character meanings
- AccessibilityConfig frozen dataclass for clean configuration

Closes #46
@nh13 nh13 force-pushed the nh/colorblind-accessible-mode branch from 63c6821 to 70d37da Compare March 28, 2026 16:08
@nh13 nh13 merged commit f40da31 into main Mar 28, 2026
8 checks passed
@nh13 nh13 deleted the nh/colorblind-accessible-mode branch March 28, 2026 21:39
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.

Add colorblind-accessible mode for progress bars

1 participant