Skip to content

Commit 13d0de3

Browse files
authored
Merge pull request #3 from ispyisail/doc/dynamic-group-gotcha
Document dynamic groups gotcha: silent data loss on PUT
2 parents 08cd1c2 + 61d44cb commit 13d0de3

1 file changed

Lines changed: 53 additions & 1 deletion

File tree

docs/gotchas.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,62 @@ client._request("PATCH", f"/member/{member_id}", json={"groups": [...]})
107107
client._request("PUT", f"/member/{member_id}", json={"groups": ["abc123"]})
108108
```
109109

110-
> **Note:** PUT requires `firstName`, `lastName`, and `gender` as mandatory fields. GET the member first to preserve existing values.
110+
> **Note:** PUT requires `firstName`, `lastName`, and `gender` as mandatory fields. GET the member first to preserve existing values. The `color` field on each group object **cannot be empty** — an empty string returns 422 (`string.empty`). Always use the color value from the group definition (`GET /memberGroup`) or from the member's existing groups.
111111
112112
> **Tested:** Mar 2026. Round-trip verified (add group → confirm → remove → confirm).
113113
114+
115+
## Dynamic (Smart) Groups Silently Ignore Manual Updates
116+
117+
**Verified.** Member groups with `isDynamic: true` (visible in `GET /memberGroup`) have their membership computed automatically from `ruleSets`. Attempting to add or remove a dynamic group via `PUT /member/{id}` will:
118+
119+
1. Return **200 OK** with the group included in the response body
120+
2. **Not persist the change** — subsequent GET requests may still show the group (cached), but the Hello Club UI will not reflect it, and the membership will revert on the next rule evaluation
121+
122+
This is a **silent data loss trap** — the API gives every indication of success.
123+
124+
### How to Detect
125+
126+
Check `isDynamic` on the group definition before attempting updates:
127+
128+
```python
129+
groups = client.get("/memberGroup", params={"limit": 100}).json()
130+
dynamic_ids = {
131+
g["id"] for g in groups.get("memberGroups", [])
132+
if g.get("isDynamic")
133+
}
134+
135+
# Before updating a member's groups, filter out dynamic ones
136+
if target_group_id in dynamic_ids:
137+
print("Cannot manually assign members to dynamic group")
138+
```
139+
140+
### Dynamic Group Structure
141+
142+
```json
143+
{
144+
"name": "Badminton All",
145+
"color": "#ffb300",
146+
"isDynamic": true,
147+
"ruleSets": [
148+
{
149+
"rules": [
150+
{
151+
"type": "group",
152+
"condition": "oneOf",
153+
"prop": "groups",
154+
"value": ["group-id-1", "group-id-2", "group-id-3"]
155+
}
156+
]
157+
}
158+
]
159+
}
160+
```
161+
162+
Dynamic groups do not appear in the member profile group checkboxes in the Hello Club admin UI — they are managed entirely by rules.
163+
164+
> **Tested:** Mar 2026. PUT returned 200 with group present in response, but group was not visible in Hello Club UI and did not persist. Confirmed across 611 member updates.
165+
114166
## Address Format Change
115167

116168
The spec documents address fields as `streetNumber` + `streetName`, but the API returns:

0 commit comments

Comments
 (0)