Skip to content

A service's slug derives from its class name - #303

Merged
czpython merged 1 commit into
mainfrom
service-slug-derives
Aug 22, 2026
Merged

A service's slug derives from its class name#303
czpython merged 1 commit into
mainfrom
service-slug-derives

Conversation

@czpython

@czpython czpython commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Service.name is now Service.slug, and nobody declares it: the slug derives from the class name (Gmailgmail, GoogleCalendargoogle_calendar), and the card heading derives from the slug. A minimal service is a class name and a Settings model:

class Gmail(GoogleOauth):
    pass

slug = "..." stays as the escape route — set it only to keep a key the class name does not spell, because the slug keys the service_identities row and the connect wire: renaming a class without pinning its slug rekeys the card and orphans the connected identity. The docs say exactly that.

Every derived slug matches the string its row already uses (GitHubApp is renamed Github to keep "github"), so existing installs are untouched — no migration.

The contract stays loud: declaring name raises with the migration hint, declaring title raises, an abstract base that pins a slug raises, and an explicit slug is still validated against the key pattern. The stray-capability probe in doctor now also skips abstract service bases instead of tripping on their missing key.

Wire and mirror move together: ServiceResponse.nameslug, the frontend Service type, SettingsModal, and the oauth-callback broadcast page follow in the same commit. Path values are unchanged — /api/services/gmail and /api/oauth/gmail/connect read as before.

@czpython
czpython force-pushed the service-slug-derives branch 3 times, most recently from 5350d71 to 49eadcb Compare August 22, 2026 09:51
@czpython
czpython enabled auto-merge (squash) August 22, 2026 09:53
@czpython
czpython force-pushed the service-slug-derives branch from 49eadcb to 345df66 Compare August 22, 2026 09:55
@czpython
czpython force-pushed the service-slug-derives branch from 345df66 to 873b3ca Compare August 22, 2026 09:56
@czpython
czpython merged commit dc7651a into main Aug 22, 2026
2 checks passed
@czpython
czpython deleted the service-slug-derives branch August 22, 2026 09:59
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