Skip to content

fix(cohort): make Brevo cohort membership sync additive-only#370

Closed
jorisjonkers-dev-agents[bot] wants to merge 1 commit into
mainfrom
platform/cohort-brevo-additive-only
Closed

fix(cohort): make Brevo cohort membership sync additive-only#370
jorisjonkers-dev-agents[bot] wants to merge 1 commit into
mainfrom
platform/cohort-brevo-additive-only

Conversation

@jorisjonkers-dev-agents

Copy link
Copy Markdown
Contributor

Summary

Cohort membership sync removed members from Brevo lists automatically: when a user dropped out of a cohort's desired set, rule evaluation enqueued a SyncCohortMembership(REMOVE) that called the provider's removeMember. A bad desired-set shrink (a rule or fact-collection error, or a bulk change) could therefore strip real entries from Brevo lists.

Automatic removal from Brevo lists is now blocked:

  • Rule evaluation no longer enqueues SyncCohortMembership(REMOVE) on a desired-set shrink. The local cohort_member row is still soft-deleted, and ADDs are unchanged. A member that should no longer be present simply remains in the Brevo list and is surfaced as a remote extra by the existing reconcile/drift path for explicit review.
  • A typed CohortMemberRemovalPolicy blocks an automatic Brevo removeMember before it reaches the provider, so the path cannot be reintroduced accidentally.
  • Explicit operator removal (the drift-panel "remove external member" action) is unaffected: it is marked EXPLICIT_OPERATOR and still calls removeMember.

deleteCohort is unchanged and remains reachable only from explicit target switch / delete-target handling, never from rule evaluation or reconcile. Contact and calendar deletion are out of scope.

Stacked on the cohort incident fix (#369).

Verification

  • ./gradlew :services:api:compileKotlin :services:api:compileTestKotlin :services:api:test --tests "*cohort*" — 111 passed

@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot added the bug Something isn't working label Jun 29, 2026
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot changed the base branch from platform/cohort-incident-fix to main June 29, 2026 21:07
@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot force-pushed the platform/cohort-brevo-additive-only branch from 1820573 to 6bf3103 Compare June 29, 2026 21:19
Keep rule-driven cohort departures local-only while preserving additive membership sync and explicit drift remediation removals.
@jorisjonkers-dev-agents

Copy link
Copy Markdown
Contributor Author

Closing: the additive-only guardrail is not wanted — manual deletion stays available and automatic removal may be desired in future, and the reconcile that triggered the incident is already a manual operation. Removal behavior reverts to the prior (additive + removal) model.

@jorisjonkers-dev-agents jorisjonkers-dev-agents Bot deleted the platform/cohort-brevo-additive-only branch June 30, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant