refactor: typed PanelApp/ThreadList/ThreadView dispatch protocols #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "pr/refactor-protocols"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refactor: structural protocols replace
object+hasattrdispatch.The codebase had two silent-failure risks: panels typed their app as
object(24 mypy errors — everystatus_message/refresh_panels/update_single_threadcall was unchecked), and the controller dispatched keymap actions viahasattr()strings where a renamed method would silently no-op.protocols.py(new) —PanelApp(the interface bothDodoandAppControllersatisfy), plusruntime_checkableThreadList/ThreadViewfor the tab/preview method sets, and theLIST_METHODS/THREAD_METHODSallowlists.navigate_list,mark_and_advance,toggle_tag_hotkey,delegate_to_list,delegate_to_threadnow narrow viaisinstance(structural) and log unknown method names instead of silently no-oping.app: object→PanelApp;MessagePagewidened fromDodotoPanelApp(cast for theQWebEngineProfileparent, which needs aQObject).Keymap = Dict[str, Tuple[str, Callable[..., Any]]]), fixing the lambda inference error at the 1–9 hotkey loop.Verified headless:
SearchPanelsatisfiesThreadListstructurally,TagPaneldoes not; dispatch works on a real panel; unknown methods fail fast with a warning; everydelegate_to_list/delegate_to_threadstring in the keymap is validated against the allowlists.mypy: 182 → 152 (30 fixed, zero new).
clanker referenced this pull request2026-08-14 19:51:08 +00:00
258b26c42eto975eddfa07