Skip to content

v0.22.5 — Surface funapi error `code` on group operations (PR #73)

Choose a tag to compare

@MartinHerrera69 MartinHerrera69 released this 29 Sep 15:31
· 54 commits to production since this release
Immutable release. Only release title and notes can be modified.
e191186

Surfaces funapi's error code on group participant/admin operations, so consumers can tell a benign outcome from a real failure.

Why

FunapiClient forwarded only $res->json('error'), discarding code. That string is ambiguous. Measured in device_logs over 7 days (2026-09-22..29), on addParticipants alone, the single message "group participant operation rejected" covered four different codes:

code http n
participant_already_in_group 409 26
group_resource_not_found 404 8
group_action_forbidden 403 1
group_upstream_failure 502 1

A consumer keying off the message to treat "already a participant" as success would have silently marked ten genuine failures as done.

What changed

The seven group participant/admin methods — addParticipants, addAdmins, addCommunityAdmins, removeParticipants, removeAdmins, removeCommunityAdmins, removeCommunityParticipant — now return on failure:

['error' => <canonical>, 'code' => <raw funapi code|null>, 'status' => <http status>]
  • Classification maps by code first, never by the message.
  • Codeless failures (the 503/400 family) fall back to a message table, because the inherited formatError() is z-api vocabulary and matched none of funapi's real strings — so they previously passed through raw and were classified as generic terminal failures, including the transient whatsapp client not connected.
  • An unmapped code falls through untouched rather than being reshaped into a known classification.

Upgrade notes

Additive and backward compatible. Callers that read only error keep working unchanged; code and status are new keys they can ignore.

ZApiClient is untouched — z-api never emits these codes.

First consumer: Funnelchat20/communities#1454, which is inert until this release is pulled.

Known issue inherited from v0.22.4

The 10 MetaClientBsuidTest::test_*_stays_on_the_pinned_graph_version failures introduced by the Graph API v26 bump (#72) are still present — that bump changed the version without updating its own pinning guards. Not caused by this release and not fixed by it; tracked separately.

Suite on this tag: 305 tests, 412 assertions, 10 failures — all 10 pre-existing. The 11 tests added here are green.

Full changelog: v0.22.4...v0.22.5