Skip to content

NRA Batch 38: DecodedStructuredBlock family, Scenario base cleanup, and cycle-free import promotions - #2340

Merged
trissim merged 1 commit into
mainfrom
feat/nra-batch38
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
feat/nra-batch38

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown

Summary

NRA codemod Batch 38 on Toad — exercises OpenHCSDev/NominalRefactorAdvisor#640 (60dcc964) live on Toad's StructuredTag.decode_block hierarchy plus cycle-free hidden-import promotions, redundant-base removal, and class-name declaration references across 8 files (REL_IMPORTS=0):

  1. DecodedStructuredBlock nominal presence family (src/toad/client/structured_context.py):
    • Applied via ZeroOneTupleToFamilyOperation (b72fa25158, unlocked by NRA#640's DeclaredFamily.member_named -> type[Self] installed-module import-alias resolution).
    • Replaces 0/1 tuple[StructuredPart, ...] returns across StructuredTag.decode_block, ThinkTag.decode_block, CtxTag.decode_block, and ToolCallTag.decode_block with DecodedStructuredBlock / AbsentDecodedStructuredBlock / HeldDecodedStructuredBlock (eliminating all 3 zero_one_tuple findings in structured_context.py).
  2. Redundant base & restated class-name string (tools/qt_drive.py):
    • a5a4d4f4db: dropped redundant ABC from Scenario(DeclaredFamily, affix="Scenario") (DeclaredFamily already supplies ABC).
    • 47c0e35ef6: replaced "Divider" string identity with Divider.__name__.
  3. Cycle-free hidden-import promotions (6 modules, zero frontend-boundary or startup-order crossings):
    • src/toad/acp/agent_controller.py (7 imports promoted: AgentFail, AvailableCommandsUpdate, McpClientStopped, Plan, Renderer, RenderTask).
    • src/toad/core/events.py (AcpLogLink, TurnPresentation; removes if TYPE_CHECKING:).
    • src/toad/preferences.py (CoreEventStream, PreferenceChanged).
    • src/toad/prompt_cursor.py (CompletionPopup).
    • tools/physical_ui.py (toad.preferences).
    • tools/qt_inherit_ratchet.py (QDialog, PresentedWindow).

(Dropped during diff review: promote_hidden_imports proposals on qt/android.py & qt/main.py — splash-before-client startup order; agent_surface.py / committed_presentation.py / session_history_details.py / transcript_publication.py / workspace_frame.py — qt_inherit_ratchet confirmed those would load Textual into Qt-imported modules; tools/drive_sweep.py / tools/physical_ui_remote.py / tools/qt_drive.py — NRA promoted imports above sys.path / XDG_CONFIG_HOME script guards, tracked as an NRA promote_hidden_imports follow-up.)

Verification

  • tools/qt_inherit_ratchet.py: 0 / 0 / 0 / 0 / 0
  • tools/shadow_check.py: 0
  • tools/guarded_imports.py: 0
  • REL_IMPORTS=0
  • Focused pytest (tests/model/test_structured_context.py, tests/model/test_qt_history_width.py, tests/model/test_android_perf_ux_arrivals.py): 54 passed in 4.48s.

@trissim
trissim merged commit a249437 into main Nov 28, 2026
@trissim
trissim deleted the feat/nra-batch38 branch November 28, 2026 00:29
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