Skip to content

Platforms own their notifier, app name and catalog key - #1238

Merged
trissim merged 5 commits into
mainfrom
fix/platform-family
Oct 25, 2026
Merged

trissim merged 5 commits into
mainfrom
fix/platform-family

Conversation

@trissim

@trissim trissim commented Oct 25, 2026 •

Copy link
Copy Markdown

Follows toad#1235, which merged at 2038e3e while it still chose platform behaviour with toad.os == "linux" (setting_choices.py:166) and toad.os == "macos" (:179), IMPL-1.

  • toad/platform.py declares the Platform family and the DesktopService family it answers with: DesktopService, DBusDesktop, UncheckedDBusDesktop and AbsentDesktop, moved unchanged from setting_choices.py.
  • The base answers desktop() -> DesktopService(), application_name "Toad" and select(matrix) (the exact catalog key, else "*"). LinuxPlatform overrides desktop() with UncheckedDBusDesktop(), and MacPlatform overrides the name with "🐸 Toad".
  • UnknownPlatform gets the base defaults and the wildcard key. Before this, any undeclared system (FreeBSD, say) decoded as Linux and got the D-Bus probe.
  • It's decoded once, at the bottom of toad/platform.py, as host = Platform.decode(platform.system()). Readers do from toad.platform import host, and the package root re-exports nothing.
  • Deleted:
    • both string compares;
    • _OS_map and toad.os;
    • get_os_matrix, a second copy of commands_for's exact-or-* pick;
    • the second OS literal in agent_schema;
    • agent_modal's cast;
    • the lazy import inside desktop();
    • the import platform as _platform alias, the noqa'd re-exports of OS and Platform, the unused import toad lines and setting_choices' unused ABC import.
  • The catalog's TOML key stays a string because it's an external format. Each member carries it once, as key.

Net src at f94cadd: platform.py +129, setting_choices.py −64, __init__.py −25, agent_schema −2, agent_modal −1, acp/agent −1.

Interpreter check, run instead of tests (owner order: no per-branch tests):

notifypy at import toad: False | jeepney: False
LinuxPlatform linux Toad UncheckedDBusDesktop
'FreeBSD' -> UnknownPlatform * Toad DesktopService any
''        -> UnknownPlatform * Toad DesktopService any
'Darwin'  -> MacPlatform macos 🐸 Toad DesktopService any
'Windows' -> WindowsPlatform windows Toad DesktopService any
NotificationPolicy.desktop -> UncheckedDBusDesktop

🤖 Generated with Claude Code

https://claude.ai/code/session_013ejYrMLnLWah8wCDDcb57V

trissim and others added 5 commits October 25, 2026 03:04
setting_choices chose the desktop notifier with toad.os == "linux" and the
application name with toad.os == "macos", and the catalog selection "exact
key or '*'" was written twice (get_os_matrix and commands_for), with the OS
literal declared twice (toad and agent_schema). Platform is now one family
decoded once from platform.system(): the base answers DesktopService(), "Toad"
and select(); Linux overrides desktop(), Mac overrides application_name. The
compares, _OS_map, get_os_matrix, the second OS literal and the cast are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ejYrMLnLWah8wCDDcb57V
…unknown

toad/platform.py now holds the Platform family and the DesktopService family
it answers with, so toad/__init__ and setting_choices import them at the top
and Platform.desktop() no longer imports setting_choices lazily. The decoded
value is toad.host, since toad.platform is now the module. UnknownPlatform
answers the base defaults and the catalog wildcard: a FreeBSD box used to
decode as Linux and get the D-Bus probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ejYrMLnLWah8wCDDcb57V
toad/__init__.py re-exported OS and Platform behind noqa F401 with no reader,
and kept toad.host beside an `import platform as _platform` alias dodging its
own module name (TIME-3). host is now declared at the bottom of toad/platform.py
and every reader imports it from there; the re-exports, the alias, the now
unused `import toad` lines and setting_choices' unused ABC import are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ejYrMLnLWah8wCDDcb57V
@trissim
trissim marked this pull request as ready for review October 25, 2026 07:10
Copilot AI balanced review requested due to automatic review settings October 25, 2026 07:10
@trissim
trissim merged commit 0f31a04 into main Oct 25, 2026
1 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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.

2 participants