Skip to content

refactor(tui): prompt deep-module PR 6 — façade reduction + verification#230

Merged
elkaix merged 4 commits into
mainfrom
refactor/tui-prompt-deep-module-pr6
Jul 21, 2026
Merged

refactor(tui): prompt deep-module PR 6 — façade reduction + verification#230
elkaix merged 4 commits into
mainfrom
refactor/tui-prompt-deep-module-pr6

Conversation

@elkaix

@elkaix elkaix commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Final part of the TUI prompt deep-module refactor (plan: docs/superpowers/plans/2026-07-19-tui-prompt-deep-module-refactor.md; stacked on #229; series: #218 #219 #220 #228 #229).

Task 12 — reduce CustomPromptSession to a compatibility façade

  • New prompting/config.py: frozen PromptConfig + PromptProviders (plus BgTaskCounts, re-imported by prompt.py so identity is preserved); __init__ keeps its exact keyword signature.
  • New prompting/keybindings.py: the entire key-binding block as build_prompt_key_bindings(controller) over a PromptController typing.Protocol; every binding/filter/eager flag preserved verbatim.
  • New prompting/completion/menus.py: SlashCommandMenuControl / LocalFileMentionMenuControl and width helpers; layout installation stays in the façade.
  • Five narrow façade methods (input_text, input_state, clear_input, build_user_input, serialize_for_history) replace all seven external reach-ins into _session.default_buffer / _get_placeholder_manager() from ui/shell/__init__.py and visualize/_interactive.py; all reportPrivateUsage ignores at those sites removed.
  • Interface report (AST): prompt.py 3,182 lines (from 4,111), 7 classes, 27 module functions. Acceptance checks: no filesystem/Git subprocess implementation, no history JSONL implementation, no delegate rendering duplication, no private prompt_toolkit method assignment — all verified by grep.

Task 13 — verification and documentation

  • Unicode/cell-width coverage in test_prompt_height_budget.py (+112 parametrized cases): combining marks, emoji, CJK, RTL, wide key labels, ASCII glyph mode — rows/columns measured in terminal cells and scenes stay within budget.
  • docs/en/customization/architecture.md: new "Shell prompt deep modules" section — façade role, per-module ownership, one-frame snapshot flow, state-reducer events, generation-owned workspace/Git snapshot publish, and the compatibility policy for underscore re-exports.

Verification

  • make check-pythinker-code: all checks passed (ruff, strict pyright, ty).
  • Unit suite: 8,377 passed, 7 skipped, 1 xfailed. Wire e2e (tests_e2e): 65 passed, 4 skipped.
  • Two PTY e2e tests failed locally (test_shell_cancel_running_command_kills_process_and_recovers, test_mid_turn_queued_input_renders_once_and_executes_once) — verified to fail identically on untouched origin/main on this machine (known local PTY-flake state), so CI is the arbiter for them.
  • Outstanding from the plan's Task 13: the manual calm-motion terminal verification (step 7) still needs a human pass in a real terminal; cancellation-boundary sweep (step 3) and CI-matrix confirmation (step 4) are covered by existing lifecycle tests and the standard 3.12/3.13/3.14 CI matrix respectively.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ac3214de-b6e9-4255-8fb9-ee1f2f76e08a

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9353e and 395ee69.

⛔ Files ignored due to path filters (1)
  • docs/en/customization/architecture.md is excluded by !docs/**
📒 Files selected for processing (13)
  • CHANGELOG.md
  • src/pythinker_code/ui/shell/__init__.py
  • src/pythinker_code/ui/shell/prompt.py
  • src/pythinker_code/ui/shell/prompting/__init__.py
  • src/pythinker_code/ui/shell/prompting/completion/__init__.py
  • src/pythinker_code/ui/shell/prompting/completion/menus.py
  • src/pythinker_code/ui/shell/prompting/config.py
  • src/pythinker_code/ui/shell/prompting/keybindings.py
  • src/pythinker_code/ui/shell/visualize/_interactive.py
  • tests/ui_and_conv/test_modal_lifecycle.py
  • tests/ui_and_conv/test_prompt_height_budget.py
  • tests/ui_and_conv/test_prompt_public_contract.py
  • tests/ui_and_conv/test_shell_task_slash.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/tui-prompt-deep-module-pr6

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

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

@elkaix
elkaix force-pushed the refactor/tui-prompt-deep-module-pr5 branch from 22b0f07 to 993deb7 Compare July 21, 2026 16:33
@elkaix
elkaix force-pushed the refactor/tui-prompt-deep-module-pr6 branch from 38ca9ce to 395ee69 Compare July 21, 2026 17:14
@elkaix
elkaix changed the base branch from refactor/tui-prompt-deep-module-pr5 to main July 21, 2026 17:15
@elkaix

elkaix commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@elkaix

elkaix commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Ran the CodeRabbit CLI locally (v0.7.0, coderabbit review --committed --base main) since the GitHub CodeRabbit bot is rate-limited on this account. Result: 0 findings across all 14 reviewed files (prompt module deepening + extracted config/keybindings/completion menus, docs, and tests). The refactor is a clean extraction — verified locally with make check-pythinker-code (ruff+pyright+ty clean) and 3164 ui_and_conv tests passing.

@elkaix elkaix closed this Jul 21, 2026
@elkaix elkaix reopened this Jul 21, 2026
@elkaix
elkaix merged commit f84091b into main Jul 21, 2026
27 of 28 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