Skip to content

NRA codemod batch 36: push 13 foreign-absence & constant-subtype checks onto owners - #2333

Merged
trissim merged 1 commit into
mainfrom
refactor/nra-codemod-batch-36
Nov 27, 2026
Merged

trissim merged 1 commit into
mainfrom
refactor/nra-codemod-batch-36

Conversation

@trissim

@trissim trissim commented Nov 27, 2026

Copy link
Copy Markdown

Summary

Applied 13 mechanical NRA codemod removals across 13 files (post-NRA#636 synthesis scan, including both newly unlocked patterns live on Toad):

  • FragmentLocation.reveal_above (src/toad/client/reader_position.py, src/toad/widgets/transcript_history.py): pushes compound and early-return guard from LineHistory.reveal_message_head onto FragmentLocation / UnloadedFragment (live proof of NRA#636 fix Add main-menu dialogs to export the wire and import a thread #3).
  • RowMetrics.extent_or + RowSize.usable_size/usable_row/measured_metrics (src/toad/qt/virtual_scroll.py): pushes 4 foreign-absence checks out of RowDocumentStore onto RowMetrics and RowSize (live proof of NRA#636 fix Validate incoming ACP session updates with the official SDK #2).
  • StructuredPart.collapses_solo_in_tree (src/toad/client/structured_context.py, src/toad/core/context_inspection.py): replaces expands_in_tree ClassVar flag with polymorphic method on StructuredPart / AnswerPart.
  • SurfaceBinding.publish_transcript_snapshot (src/toad/surface_binding.py, src/toad/acp/agent_controller.py): pushes binding.target is None check onto SurfaceBinding.
  • DECInvoke.apply_slots + TerminalState.ensure_mouse_tracking (src/toad/ansi/_ansi.py): pushes slot-application and lazy MouseTracking initialization onto DECInvoke and TerminalState (deduplicated into one ensure_mouse_tracking method).
  • SidebarState.preserve_selected_target (src/toad/client/session_tracker.py, src/toad/sidebar_navigation.py), AgentConversationCommands.default_testimonial_text (src/toad/client/commands.py, src/toad/slash_command.py), TargetContext.has_closable_session (src/toad/target_commands.py).

Dropped two bad-owner moves caught during diff review (ShellTerminalOutput.show_shell_terminal would have pulled a local Textual widget import into shared shell_output.py; SessionIdentity.open_current_relationship would have pulled Qt panel warnings into thread_identity.py).

Verification

  • REL_IMPORTS=0, qt_inherit_ratchet.py 0/0/0/0/0, shadow_check.py 0, guarded_imports.py 0.
  • 69/69 focused tests exercising touched modules passed (test_channel_partial_paint.py passed reveal_message_head at lines 49 & 71 and only hit a pre-existing ctrl+t collision on main).
  • Direct Python runtime checks verified MouseMode, MouseTrackingMode, DECInvoke.apply_slots, RowMetrics.extent_or, RowSize, and SidebarState.preserve_selected_target.

@trissim
trissim merged commit f7290bc into main Nov 27, 2026
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