Skip to content

refactor: isolate TUI runtime state - #139

Merged
github-actions[bot] merged 1 commit into
mainfrom
refactor/tui-pointer-state
Aug 2, 2026
Merged

refactor: isolate TUI runtime state#139
github-actions[bot] merged 1 commit into
mainfrom
refactor/tui-pointer-state

Conversation

@mohitranka

@mohitranka mohitranka commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Group pointer hit regions, frame generations, and double-click tracking into PointerState.
  • Group filesystem watcher ownership and event channels into FileWatchState.
  • Group repository-header cache, refresh state, TTL, and cwd tracking into RepoHeaderState.
  • Preserve existing keyboard, mouse, watcher, render, and async refresh behavior.

Validation

  • cargo fmt --all -- --check
  • cargo test -p forge-tui --lib --locked (683 passed)
  • cargo clippy -p forge-tui --all-targets --locked -- -D warnings
  • git diff --check

Summary by CodeRabbit

  • Refactor
    • Consolidated file-watching, pointer interaction, and repository-header state management.
    • Preserved existing repository refresh, filesystem monitoring, mouse hit detection, and double-click behavior.
  • Tests
    • Updated coverage for repository refresh failures, cached data retention, pointer interactions, and file-change events.

@github-actions
github-actions Bot enabled auto-merge (squash) August 2, 2026 10:56
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: edd5b04c-695d-4618-bad6-578ae3f59736

📥 Commits

Reviewing files that changed from the base of the PR and between 7d7978c and b323a1e.

📒 Files selected for processing (10)
  • crates/forge-tui/src/app/chrome.rs
  • crates/forge-tui/src/app/mouse.rs
  • crates/forge-tui/src/app/new.rs
  • crates/forge-tui/src/app/tests/chrome.rs
  • crates/forge-tui/src/app/tests/edge.rs
  • crates/forge-tui/src/app/tests/helpers.rs
  • crates/forge-tui/src/app/tests/pointer.rs
  • crates/forge-tui/src/app/tests/watch.rs
  • crates/forge-tui/src/app/types.inc.rs
  • crates/forge-tui/src/app/watch.rs

📝 Walkthrough

Walkthrough

Changes

The TUI application now groups file-watcher, pointer, and repository-header fields into dedicated state structures. Runtime code and tests use the nested state fields. Existing refresh, hit-resolution, double-click, and file-change behavior remains unchanged.

TUI state consolidation

Layer / File(s) Summary
State structures and initialization
crates/forge-tui/src/app/types.inc.rs, crates/forge-tui/src/app/new.rs
FileWatchState, PointerState, and RepoHeaderState replace standalone TuiApp fields and are initialized during app creation.
Repository-header state flow
crates/forge-tui/src/app/chrome.rs, crates/forge-tui/src/app/tests/chrome.rs
Repository-header caching, refresh tracking, receiver assignment, and related tests use RepoHeaderState.
Pointer state access
crates/forge-tui/src/app/mouse.rs, crates/forge-tui/src/app/tests/helpers.rs, crates/forge-tui/src/app/tests/pointer.rs
Hit regions, frame generations, and pending double-click candidates use PointerState.
File-watch state access
crates/forge-tui/src/app/watch.rs, crates/forge-tui/src/app/tests/edge.rs, crates/forge-tui/src/app/tests/pointer.rs, crates/forge-tui/src/app/tests/watch.rs
Watcher handles and change channels use FileWatchState, including file-change test events.

Estimated code review effort: 2 (Simple) | ~15 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/tui-pointer-state

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

@github-actions
github-actions Bot merged commit 194280b into main Aug 2, 2026
6 of 7 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.

1 participant