Skip to content

refactor(mattermost): bump Mattermost.NET to 5.0 and delete HTTP-bypass shim - #1163

Merged
Aaronontheweb merged 1 commit into
netclaw-dev:devfrom
Aaronontheweb:claude-wt-mattermost-5.0
May 24, 2026
Merged

refactor(mattermost): bump Mattermost.NET to 5.0 and delete HTTP-bypass shim#1163
Aaronontheweb merged 1 commit into
netclaw-dev:devfrom
Aaronontheweb:claude-wt-mattermost-5.0

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

  • Bump Mattermost.NET 4.0.4 → 5.0.0 (the version on Dependabot PR Bump Mattermost.NET from 4.0.4 to 5.0.0 #1144).
  • Delete the HTTP-bypass path in MattermostNetReplyClient and its six hand-rolled DTOs (CreatePostPayload, UpdatePostPayload, PropsPayload, AttachmentPayload, ActionPayload, IntegrationPayload). Replace with MattermostClient.CreatePostAsync(..., PostProps?) / UpdatePostAsync(..., PostProps?), using 5.0's new PostPropsButtonAction so the literal "button" string disappears.
  • Drop the unused mattermost-api named HttpClient registration and the parsedServerUri parsing it depended on.

Why

The shim was built on the assumption that the SDK didn't support attachment props. It always has — PostProps.Attachments with action buttons shipped in 4.0.4. The 5.0 bump is a tiny additive release (typed PostActionType enum + PostPropsButtonAction/PostPropsSelectAction convenience subclasses), but it's the natural moment to delete the shim: bundle the cleanup with a version event reviewers will scrutinize, and adopt PostPropsButtonAction to type away the "button" magic string. PostPropsSelectAction for multi-option dropdown approvals is explicitly deferred.

Test plan

  • dotnet build clean, 0 warnings
  • Full unit/integration suite: 4,271 tests pass
  • Netclaw.Channels.Mattermost.IntegrationTests against a real Mattermost Testcontainer: 12/12 pass, including a new test asserting that PostPropsButtonAction round-trips through the server with PostActionType.Button + ActionStyle.Primary/Danger preserved
  • dotnet slopwatch analyze — 0 issues
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify — all files have headers

Closes #1144 by superseding the bare dependency bump with the corresponding code cleanup.

Net delta: +103 / -156 LOC across 5 files.

…ss shim

MattermostNetReplyClient carried a parallel HttpClient path with six
hand-rolled DTOs (CreatePostPayload, UpdatePostPayload, PropsPayload,
AttachmentPayload, ActionPayload, IntegrationPayload) and a snake_case
JsonSerializerOptions, built on the assumption that the SDK didn't
support attachment props. The SDK has supported PostProps.Attachments
with actions since 4.0.4 — the shim duplicated types we could have
consumed directly.

5.0 itself is small and additive (typed PostActionType enum,
PostPropsButtonAction / PostPropsSelectAction convenience subclasses).
The version bump is the natural moment to delete the shim and replace
it with `_client.CreatePostAsync(..., PostProps?)` / `_client.UpdatePostAsync(..., PostProps?)`,
using PostPropsButtonAction so the literal "button" string disappears.

- Drop HttpClient ctor dependency on MattermostNetReplyClient.
- Drop the unused `mattermost-api` named HttpClient registration and
  the parsedServerUri parsing it depended on.
- Drop the dead 3-arg `UpdatePostAsync` overload (not on the interface).
- Add an integration test asserting that attachments + button actions
  round-trip via the SDK (Id, Name, PostActionType.Button, ActionStyle).
  Mattermost server intentionally strips integration.url on read-back
  (it's the private callback URL) — assertion notes that.

All 4,271 unit tests pass; all 12 Mattermost integration tests pass
against a real Mattermost container.
@Aaronontheweb
Aaronontheweb force-pushed the claude-wt-mattermost-5.0 branch from 7689beb to 9df06b0 Compare May 24, 2026 11:04
@Aaronontheweb Aaronontheweb added the channels Discord, Slack, and other channels. label May 24, 2026
@Aaronontheweb
Aaronontheweb merged commit 721cfbe into netclaw-dev:dev May 24, 2026
14 checks passed
@Aaronontheweb Aaronontheweb mentioned this pull request May 26, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels Discord, Slack, and other channels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant