Skip to content

fix(memberships): honor the plain statuses param and default to active - #135

Open
ndellosa95 wants to merge 1 commit into
workos:mainfrom
ndellosa95:fix/org-membership-statuses-filter
Open

ndellosa95 wants to merge 1 commit into
workos:mainfrom
ndellosa95:fix/org-membership-statuses-filter

Conversation

@ndellosa95

Copy link
Copy Markdown

Summary

GET /user_management/organization_memberships read the statuses filter only from statuses[]=. The Go SDK sends statuses=active, so the emulator ignored the filter. With no statuses param, the emulator also returned memberships of every status. Production returns only active memberships.

Fixes #134

Behavior

I checked each row against the real WorkOS API in a sandbox environment. Each query also has organization_id.

Query Real API returns
no statuses only active
statuses=active only active
statuses[]=active only active
statuses%5B%5D=active only active
statuses=active&statuses=inactive active + inactive
statuses[]=active&statuses[]=inactive active + inactive
statuses=inactive only inactive
statuses=active,inactive active + inactive

The emulator now matches every row.

What changed

  • Add parseArrayParam(url, name) to src/core/pagination.ts. It reads the plain key, repeated keys, name[], indexed name[0], and comma-separated values. This is the logic /events already had inline.
  • /events now calls the helper. Its behavior does not change.
  • The membership list uses the helper for statuses and defaults to ['active'] when the request names no status.

No other endpoint changes behavior.

Tests

  • New table test in memberships.spec.ts covers every row above.
  • The existing /events tests cover the four array forms through the shared helper.
  • bun test (1352 pass), bun run lint, bun run fmt:check, bun run typecheck, bun run build, node scripts/check-package.mjs, node scripts/smoke-node.mjs, and the codegen and SUPPORTED.md drift checks all pass.

🤖 Generated with Claude Code

The organization_memberships list read only `statuses[]=` and returned
every status when the param was absent. The Go SDK sends `statuses=`.
Parse every array form production accepts and default to active.

Move the events array-param parsing into a shared parseArrayParam
helper so both routes read array params the same way.

Fixes workos#134

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The PR fixes membership status filtering and shares array query parsing with the events route.

  • Membership lists now accept plain, repeated, bracketed, indexed, and comma-separated statuses.
  • Requests without statuses return only active memberships.
  • Event parsing keeps its existing behavior.
  • New membership tests cover the reported production cases. Tests were inspected, not run.

ndellosa95 explicitly intends to return only active memberships when statuses is omitted.

Reviews (1) · Last reviewed commit: "fix(memberships): honor plain statuses p..." · Reviewed by Greptile

@ndellosa95 ndellosa95 changed the title fix: honor plain statuses param and default to active on organization_memberships list fix(memberships): honor the plain statuses param and default to active Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

organization_memberships list ignores statuses=active (the form the Go SDK sends)

1 participant