Skip to content

Stop sending branch as a Zetkin person field#9

Merged
conatus merged 5 commits intomainfrom
fix/zetkin-branch-assignment-invalid-parameter
Apr 20, 2026
Merged

Stop sending branch as a Zetkin person field#9
conatus merged 5 commits intomainfrom
fix/zetkin-branch-assignment-invalid-parameter

Conversation

@conatus
Copy link
Copy Markdown
Member

@conatus conatus commented Apr 16, 2026

Summary

  • BranchAssignment.php was injecting branch into customFieldsConfig and customFields on every join
  • The core join-block plugin forwards customFields as direct person fields to Zetkin's People API
  • Zetkin rejects branch as an invalid parameter — the entire signup call fails, leaving members with no branch assigned in Zetkin
  • The ck_join_flow_add_tags filter was already correctly adding the branch as a Zetkin tag; it just never fired because person creation failed first
  • Fix: remove the customFieldsConfig/customFields injection; $data['branch'] is still set so the tag filter continues to work

Test plan

  • Run ./vendor/bin/phpunit — all 231 tests pass
  • Confirm test_does_not_add_branch_to_custom_fields_config and test_does_not_set_branch_in_custom_fields are present and green
  • Deploy and verify a new member signup results in the correct branch tag appearing in Zetkin

conatus added 5 commits April 16, 2026 17:41
BranchAssignment was injecting 'branch' into customFieldsConfig and
customFields. The core join-block plugin forwards customFields as direct
fields to Zetkin's People API, which rejects 'branch' as an invalid
parameter — causing the entire Zetkin signup to fail and leaving members
with no branch assigned.

Branch assignment in Zetkin is handled correctly by the ck_join_flow_add_tags
filter; the customFields/customFieldsConfig injection was redundant and
harmful. Removed it, and updated tests accordingly.
The ck_join_flow_pre_handle_join filter no longer writes
customFields['branch'], so the second branch in the fallback chain
could never resolve. Drop it and delete the test that covered the
removed path.
These log statements reported on a key that is no longer populated
by this plugin, so they always emitted "NOT SET" and added noise
without information.
The two negative tests assert the absence of a specific field shape —
without context, future readers have no way to know they guard against
a real production incident. Add a block comment explaining the bug,
why the injection was harmful, and what the tests pin.
The hook-lifecycle table showed that tagging happens but not how or
why. Add a dedicated section covering the flow into Mailchimp /
Action Network / Zetkin, the Zetkin-specific constraint that branch
must travel as a tag rather than a custom person field, and the
no-branch fallback case.
@conatus conatus merged commit 86f813d into main Apr 20, 2026
1 check passed
@conatus conatus deleted the fix/zetkin-branch-assignment-invalid-parameter branch April 20, 2026 11:46
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