Skip to content

feat(seed): pin organization membership ids - #174

Merged
gjtorikian merged 2 commits into
workos:mainfrom
wadakatu:feat/seed-pin-membership-ids
Oct 28, 2026
Merged

gjtorikian merged 2 commits into
workos:mainfrom
wadakatu:feat/seed-pin-membership-ids

Conversation

@wadakatu

Copy link
Copy Markdown
Contributor

Summary

  • Seeded organization memberships now accept an optional id, forwarded to the store on insert — the same shape feat(seed): pin organization and user ids #19 added for organizations and users. Omit it and an id is generated as before.
  • Why: a backend that stores the membership id and later addresses the membership by it (PUT / DELETE /user_management/organization_memberships/:id for a role change or a removal) loses that link on every emulator restart: the seed mints a new om_… id and the stored one points at nothing. Pinned user and organization ids keep logins stable across restarts, but membership-addressed calls still break. We hit this with a PHP OIDC provider (workos-php) pointed at the emulator, which records the membership id at first login and never re-reads it.
  • validateSeedConfig checks the new field with the existing pinned-id rule (non-empty, URL-safe) and requires it to be unique across the memberships of all organizations, since they share one store collection.
  • docs/seeding.md: the pinning section now covers memberships.

Test plan

  • seed-pinned-ids.spec.ts: a seeded membership with a pinned id is returned by the list (?user_id=), and PUT (role change) and DELETE by that id succeed; validator coverage for an id shared across organizations and for a path delimiter. The three new tests fail without the change.
  • Full suite: 1899 tests pass; typecheck, lint, fmt, build and gen:supported are clean (bun 1.4.2).

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Seeded organization memberships can now use a pinned id, keeping stored membership references stable across emulator restarts.

  • Seeded memberships keep the same ID across restarts.

Since the previous review, only a comma in the documentation heading changed. No new issues or rule violations were found. No previous finding threads were supplied.

Reviews (2) · Last reviewed commit: "Fix punctuation in seeding documentation" · Reviewed by Greptile

Corrected punctuation in section heading about pinning IDs.
@gjtorikian

Copy link
Copy Markdown
Collaborator

thanks !

@gjtorikian
gjtorikian merged commit 90d0c92 into workos:main Oct 28, 2026
10 checks passed
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.

2 participants