Repository navigation
Fix DM black-screen paint crash (HistoryFragment.retain_painted), 17.9x sticky-header threshold, and hoist 7 shared-frontend patterns - #2327
Merged
Conversation
…speedup, and hoist 7 shared-frontend parallel patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
1. Fix DM / thread view solid-black render crash (
HistoryFragment.retain_painted+QPainter.end())6358df80amovedReadMarkedHistory.retain_paintedontoEvidencedFragmentbased on its narrowed parameter annotation, even thoughQtHistoryWindow.row_paintedpasses every paintedHistoryFragment(tool calls, thinking blocks, context summaries, live turns). The firstQtToolTranscriptFragmentorQtThinkingTranscriptFragmentraisedAttributeErrorinsideVirtualRowCanvas.paintEvent, leaking an activeQPainter(QBackingStore::endPaint() called with active painter) and leaving the entire DM viewport solid black.HistoryFragment.retain_painted(self, owner)insrc/toad/client/fragments.py(overridden byEvidencedFragment.retain_painted), widenedReadMarkedHistory.retain_paintedparameter annotation toHistoryFragment, and wrappedVirtualRowCanvas.paintEventintry: ... finally: painter.end().toad-qtDM at412x915(QtMailboxView, 160 rows, zero tracebacks, full tool/thinking transcript painted cleanly) and added regression testtest_every_history_fragment_subclass_supports_retain_painted.2. Qt scroll performance:
HistoryRowDelegate.header_pin_threshold(17.9x wall-clock speedup)BusMessageFragmenthasleading == (Gap(), Divider)(header_blocks == 2), andsticky_header(block, row)pins iff(block, row) > (header_blocks - 1, 0), i.e.y >= sum(height(blocks[0..k-2])) + line. Measuring theDividerviaQTextDocument.setHtml+size()inblock_rowwas mathematically redundant — only the single globally cachedGap()block ever needs measuring.BusMessagefragments x 5yoffsets, 1 warm-up + 5 alternating runs, 100% parity withblock_row+sticky_header):block_row): median 20.42 ms ([17.95, 20.42, 22.49, 19.80, 24.98]), 81QTextDocuments builtheader_pin_threshold): median 1.14 ms ([1.03, 0.95, 1.14, 1.17, 1.20]), 1QTextDocumentbuilt (17.9x speedup)#comms412x915cProfile:repin_header/top_message_header/pinned_header/block_rowdropped from 29 ms (top 35) to vanished from top 35 (<3 ms).AnimatesArrivals.refresh_visible_notifications->SavedHistory.check_visible_notifications/SourceNotifications.check_visible_notifications) so arrival glides refresh receipts without re-arming source page reads.3. Factor out 7 NRA-flagged shared-frontend parallel patterns (zero slop,
REL_IMPORTS=0)AnimatesArrivals.animated_travel&shift_travel(src/toad/arrivals.py,qt/history.py,widgets/history_anchor.py)ModelSelectionCore.filter_models,search_changed,note_highlight_moved,submit(client/model_selection.py,qt/model_selection.py,widgets/model_selection.py)WireView(ConversationActivity, ComposerPoolHost)owningcomposer_placeholder&show_mention_candidatesonce (client/history.py,qt/window.py,widgets/comms_chat.py)RebindableComposer.rebind_conversation(client/composer_pool.py,qt/composer.py,widgets/prompt.py)SubmissionView.refresh_composerovercan_refresh_composer&apply_compose_access(client/bus_submission.py,delivery_failure_view.py,qt/submission_view.py)OpensExpandedItem(SidebarItem)insrc/toad/qt/window.pyRawTextPart&BodyTextPartinsrc/toad/client/structured_context.py4. Test & tool fixes met on the path
tests/textual/test_worker_failed_toasts.pystub (retire_core,observe_core_callback,events).tests/textual/test_channel_scrolling.py:210race waiting forhistory.state.accepts_source_workafter 4pageups before asserting scroll stability.tools/qt_scroll_profile.pyprocessEvents(ExcludeSocketNotifiers)to avoid re-entering qasync socket notifiers.Verification
REL_IMPORTS=0tools/qt_inherit_ratchet.py: 0/0/0/0/0tools/shadow_check.py: 0tools/guarded_imports.py: 0tests/textual/test_channel_scrolling.pyand the newheader_pin_threshold&retain_paintedtests).