Skip to content

fix(tui): let Overview scroll through all models#484

Open
IvGolovach wants to merge 1 commit intojunhoyeo:mainfrom
IvGolovach:codex/fix-overview-scroll-481
Open

fix(tui): let Overview scroll through all models#484
IvGolovach wants to merge 1 commit intojunhoyeo:mainfrom
IvGolovach:codex/fix-overview-scroll-481

Conversation

@IvGolovach
Copy link
Copy Markdown
Contributor

@IvGolovach IvGolovach commented Apr 28, 2026

1. Summary

Fixes the Overview tab scroll range so large model lists can scroll all the way to the final rows after redraws or resize events.

Closes #481.

2. Why

The Overview tab renders each model as a two-line row, but the shared resize path was clamping scroll_offset against a full-terminal item estimate before Overview recalculated its real page size. That made lists with many models stop after only the first few scroll ranges.

3. Diff scope

Touched TUI scroll-capacity ownership only:

  • crates/tokscale-cli/src/tui/app.rs
  • crates/tokscale-cli/src/tui/ui/overview.rs
  • crates/tokscale-cli/src/tui/ui/models.rs
  • crates/tokscale-cli/src/tui/ui/daily.rs
  • crates/tokscale-cli/src/tui/ui/hourly.rs
  • crates/tokscale-cli/src/tui/ui/agents.rs

The active renderer now sets the actual visible item capacity through App::set_max_visible_items(), which clamps selection and scroll state using the rendered panel height rather than a generic terminal-height estimate.

4. Branch integrity

  • Base branch: main
  • origin/main SHA: edc8ed1fca49ec4a6936e4d4e15ca45dfd442b8e
  • Ahead/behind: ahead 1, behind 0
  • Merge-base SHA: edc8ed1fca49ec4a6936e4d4e15ca45dfd442b8e
  • Fast-forward safety: origin/main is an ancestor of this branch; no divergence detected.
git rev-list --left-right --count origin/main...HEAD
0       1

git merge-base origin/main HEAD
edc8ed1fca49ec4a6936e4d4e15ca45dfd442b8e

5. Commit integrity

Commit introduced by this PR:

d01497d987340d7c2ff6d95ecafb0769937dbda6 fix(tui): preserve rendered scroll capacity after resize
  • One logical change per commit: yes.
  • Ledger-Id trailer confirmation: Not applicable — scripts/ledger/ does not exist in this repository.
  • Unique Ledger-Id confirmation for squash-merge repositories: Not applicable — scripts/ledger/ does not exist in this repository.

6. Ledger proof

Not applicable — scripts/ledger/ does not exist in this repository.

7. Diff hygiene

git diff --name-status origin/main...HEAD
M       crates/tokscale-cli/src/tui/app.rs
M       crates/tokscale-cli/src/tui/ui/agents.rs
M       crates/tokscale-cli/src/tui/ui/daily.rs
M       crates/tokscale-cli/src/tui/ui/hourly.rs
M       crates/tokscale-cli/src/tui/ui/models.rs
M       crates/tokscale-cli/src/tui/ui/overview.rs

git diff --check origin/main...HEAD: PASS, no output.

Forbidden-file confirmation:

  • No .env files.
  • No local environment files.
  • No secrets, tokens, or credentials.
  • No ops/reports/** artifacts.
  • No __pycache__/, *.pyc, .DS_Store, .coverage, htmlcov/, or coverage.xml.
  • No build artifacts or cache files.
  • No unrelated generated files.
  • No unrelated source changes.
  • No Cyrillic text added in touched files.

8. Test proof

Regression test added:

  • test_overview_scroll_keeps_rendered_capacity_after_resize

Validation run:

cargo fmt --all -- --check
PASS

bash scripts/check-version-coherence.sh
Version coherence OK: 2.0.27

cargo test -p tokscale-cli tui::app::tests
test result: ok. 70 passed; 0 failed; 1 ignored; 0 measured; 378 filtered out

docker run --rm -v "$PWD":/work:ro -w /work rust:1.95 bash -c 'rustc --version && rustup component add clippy && cargo clippy --workspace --all-features -- -D warnings'
rustc 1.95.0 (59807616e 2026-04-14)
Finished `dev` profile [unoptimized + debuginfo]

cargo test --workspace --all-features -- --format terse
test result: ok. 448 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
test result: ok. 84 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
test result: ok. 582 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Total: 1,127 passed, 2 ignored.

9. Verification-pack proof

Not applicable — no infra/governance/replay/invariant/verification files changed.

10. Migration notes

Not applicable — no DB migration changed.

11. CI context confirmation

CI context names unchanged.

Not applicable — no CI/workflow context changes.

12. Runtime safety

Reviewed runtime files/modules:

  • TUI state and navigation: crates/tokscale-cli/src/tui/app.rs
  • TUI render capacity call sites: overview.rs, models.rs, daily.rs, hourly.rs, agents.rs

Runtime reasoning:

  • No new blocking locks: the change only moves scroll-capacity clamping from resize to renderer-owned capacity updates.
  • No new unbounded queues: no async, channel, queue, or buffering behavior changed.
  • No invariant removal: list navigation still clamps selection and scroll state through the existing clamp_selection() path.
  • No invariant regression introduced.

13. Documentation integrity

Not applicable — no docs/runbooks/commands changed.

14. Rollback plan

Use the final merged commit SHA after merge:

git revert <post_merge_commit_sha>

Replace <post_merge_commit_sha> with the final squash/merge commit SHA after merge.

  • DB downgrade required: no.
  • Data repair required: no.
  • Operational caveats: rollback only restores the previous TUI scroll-capacity behavior.

15. Known residual risks

No known residual risks.

Keep TUI list capacity owned by the active renderer so redraws do not clamp scroll state against a full-terminal height estimate before the tab computes its real page size.

Validation

- cargo fmt --all -- --check: PASS

- bash scripts/check-version-coherence.sh: PASS

- cargo test -p tokscale-cli tui::app::tests: PASS, 70 passed, 1 ignored

- docker run --rm ... rust:1.95 cargo clippy --workspace --all-features -- -D warnings: PASS

- cargo test --workspace --all-features -- --format terse: PASS, 1127 passed, 2 ignored

- git diff --check: PASS

Rollback

- git revert HEAD
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tokscale Ignored Ignored Preview Apr 28, 2026 6:41pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

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.

Overview model list stops scrolling after only a few ranges

1 participant