Skip to content

feat(nhis): count NHIs as members in the org limits - #162

Merged
albanm merged 1 commit into
masterfrom
chore-nhi-quotas
Oct 2, 2026
Merged

albanm merged 1 commit into
masterfrom
chore-nhi-quotas

Conversation

@albanm

@albanm albanm commented Oct 2, 2026

Copy link
Copy Markdown
Member

NHIs now consume a store_nb_members slot, like human members:

  • getNbMembers no longer filters out NHIs, so every existing recompute (user deletion, cleanup cron, SSO sync, invitations) includes them.
  • POST /api/organizations/:id/nhis is refused with a 429 (maxNbMembers) when the org is full; NHI creation and deletion recompute the counter.
  • UI: the add-NHI menu shows the "maximum number of members" warning when the org is full, and NHI changes refresh the org limits so the invite button stays in sync.
  • Architecture doc updated; the API test now asserts the opposite of the previous behavior.

Why: an NHI holds an org membership and acts with its role, so it should count against the org's member quota.

Heads-up:

  • Reverses fix(limits): keep member counts in sync, exclude NHIs, drop orphans #143's exclusion. Counters are only recomputed on membership changes, so existing orgs with NHIs keep an undercounted consumption until their next member change (no migration included).
  • store_nb_members.consumption is read by external services through the limits endpoint; their numbers will grow for orgs with NHIs, and it can now exceed the default (human only) member listing count.
  • An org at its limit after the recompute will also block invitations, not only NHI creation.

NHIs hold an org membership and act with its role, so they now consume a
store_nb_members slot: getNbMembers counts them, NHI creation is refused
with a 429 when the org is full, and NHI creation/deletion recompute the
counter. The UI disables NHI creation at the limit and refreshes the
limits after NHI changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@albanm
albanm merged commit 07b18cd into master Oct 2, 2026
4 checks passed
@albanm
albanm deleted the chore-nhi-quotas branch October 2, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant