channels: deduplicate probe and token resolution types with shared base types#16986
Merged
thewilloftheshadow merged 1 commit intoopenclaw:mainfrom Feb 15, 2026
Merged
Conversation
thewilloftheshadow
added a commit
that referenced
this pull request
Feb 15, 2026
thewilloftheshadow
added a commit
that referenced
this pull request
Feb 15, 2026
1c44b8c to
f1e7e28
Compare
Member
|
Landed via temp rebase onto main.
Thanks @iyoda! |
This was referenced Feb 15, 2026
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
Introduces
BaseProbeResultandBaseTokenResolutionshared base types, then unifies 15 channel probe types and 3 token resolution types to extend them — eliminating repeatedok: boolean; error?: string | nullandtoken: string; source: stringfield declarations across core channels and extensions.Motivation
Every channel probe type independently declared
okanderrorfields with slightly varying signatures (stringvsstring | null). Similarly, token resolution types repeatedtokenandsourcefields. This made it harder to write generic probe/token handling code and increased maintenance surface.Changes
Commit 1: Foundation types
BaseProbeResult = { ok: boolean; error?: string | null }andBaseTokenResolution = { token: string; source: string }tosrc/channels/plugins/types.core.tstypes.tsandplugin-sdk/index.tsexpectTypeOf)Commit 2: Core probe unification (6 types)
TelegramProbe,DiscordProbe,SlackProbe,SignalProbe,IMessageProbe,LineProbeResult→ extendBaseProbeResultCommit 3: Extension probe unification (9 types)
BlueBubblesProbe,ProbeMSTeamsResult,ZaloProbeResult,MatrixProbe,MattermostProbe,ProbeTwitchResult,FeishuProbeResult,IrcProbe,ZalouserProbeResult→ extendBaseProbeResultCommit 4: Token type unification (3 types)
TelegramTokenResolution,DiscordTokenResolution,ZaloTokenResolution→ extendBaseTokenResolutionDesign decisions
&) instead ofinterface extends— preserves existing type narrowing (e.g.,error?: stringstays narrower thanstring | null)Verification
tsc --noEmit: zero new errors (all errors are pre-existing extension dependency issues)vitest run: 855 passed, 10 failed (same pre-existing failures), zero regressionsStats
Greptile Summary
This PR successfully eliminates type duplication across 18 channel implementations by introducing two shared base types. The refactoring is purely type-level with zero runtime changes - all probe and token resolution functions continue to work identically.
Key changes:
BaseProbeResult(ok, error) andBaseTokenResolution(token, source) tosrc/channels/plugins/types.core.tsBaseProbeResultBaseTokenResolutionType safety impact:
Some types that previously declared
error?: stringnow inheriterror?: string | nullfromBaseProbeResult. This slightly widens the type but better reflects actual runtime behavior where implementations do seterrortonull. The change is backward compatible - all existing error checks (if (result.error)) continue to work correctly.Verification:
The commit structure is clean and logical (foundation → core → extensions → tokens). The PR's statistics (22 files, +100/-54 lines, 18 types unified) are accurate. Type assignability tests ensure no regressions in type compatibility.
Confidence Score: 5/5
stringtostring | nullfor some error fields actually improves type accuracy to match runtime behaviorLast reviewed commit: 2b7cd6e
(2/5) Greptile learns from your feedback when you react with thumbs up/down!