A plane holds one row per person and per group: a push or a sign-in that finds nobody under its subject reuses the row SCIM gave that externalId, duplicates are merged into SCIM's row before users.external_id is made unique, and a SCIM DELETE removes a person behind a tombstone and a group with the team built on it alone¶
Decision 899 · accepted · 2026-10-13 · issue #707 · supersedes 754, 759
Issue #707. A plane fed by SCIM and by sign-in showed the same person, and the same group,
more than once, and a SCIM DELETE removed nothing. It replaces the part of Decision 759
that made a DELETE soft ("One way to deactivate" names a DELETE among the ways to
deactivate) and the sentence of Decision 754 that has a group's DELETE empty it. The
rest of both stands: active: false in a push or a PATCH still deactivates and keeps the
row, and a POST of somebody the plane has is still a create.
- A person is found by their
externalIdtoo. A push keys on its subject,externalIdelseuserName; one that finds nobody under it but finds a row whoseexternal_idis theexternalIdit carries updates that row and keeps that row's subject. A sign-in that finds nobody under its subject, after Decision 751's move, but finds a row whoseexternal_idis that subject moves the row there withIdentity.rekey/2, the same move, audited asperson.rekey. SCIM names a person by the value the subject claim carries, so a row whoseexternal_idis not its subject is one a sign-in under another claim moved; without this, the next push after asubject_claimswitch made a second row with the sameexternal_id, and switching back made a second row at sign-in. A deactivated row found this way is still refused (Decision 381). users.external_idis unique where set, a partial index, andUser.changeset/2reports a clash as a changeset error, so a push that would give a second row the value answers400rather than500.- The duplicates already there are merged by the migration, not by an admin task: the
index must come after the merge and before the plane serves, and a task run after the
upgrade would leave the index unbuildable on exactly the planes that need it. One person
is every row whose
external_idis the value, and every row whosesubjectis the value that SCIM has not named otherwise. The row kept is SCIM's, since itsidis what the provider holds: the one whosesubjectis also the value, else the newest carrying it, which the provider created last. The others are folded into it as Decision 751 folds a moved person: sessions (owner and owner id), ACL entries, shares made out to them, team administration, sponsored principals, the sponsor in a run's origin, triggers'notify, usage records and open reservations move; the audit trail and every*_bykeep the name they were written with. The kept row takes the key-manager name of the row known first, under which what they stored before there were two is, and its own ceiling, else a folded row's. Each set is oneperson.mergerow on the audit trail, chained like every other, with the kept and folded ids and subjects and the key-manager names left behind, and is logged. - What only looks alike is reported, not merged. The same email or display name under
different keys proves nothing: two people may share an address, and only the provider
knows which of a group's two ids is right.
Identity.lookalikes/0lists such sets with where each row came from (a sign-in writes neitherexternalIdnoruserName) and the mismatch it most likely comes from: the subject claim against SCIM'sexternalIdfor a person, a groups claim naming a group by its name while SCIM pushes its id for a group. A pair sharing anexternalIdnever appears, since it was merged. - A SCIM
DELETEof a person removes the row.GETandDELETEof the id answer404afterwards and filters do not find them. A tombstone (person_tombstones) keeps the former id, subject,externalId,userName, display name and key-manager name. Their team sessions that are running or waiting are parked first, each giving back its slot and its slice under the subject it was reserved for; then all their sessions go read-only and are owned by the tombstone's marker,removed:<tombstone id>, so nothing matches them to a subject again. They stop administering every team, their ACL entries go, shares made out to them are revoked, and the principals they sponsor stop (sponsor_left, as a deactivation does). Their memberships go with the row. Audited asperson.removebyscim, under the subject they had, with what was done. - Somebody the provider sends later under the same subject is somebody new. They do
not inherit the removed person's sessions, ACL entries or administration, and are not
given the removed person's key-manager name, which a tombstone holds as a user row does:
whatever the removed person stored there stays theirs, for an erasure (#636) to remove,
and an erasure of their private sessions finds it through the marker
(
Identity.kms_name_of/1). A provider deleting somebody is offboarding them; handing a re-hire the old sessions would be a decision about access that the provider did not make, and is not made here. - A SCIM
DELETEof a group removes it with its memberships and links. A team built on it and on no other group is disabled as an administrator would disable it: grants revoked with their sessions read-only and the profiles' teams written again, its triggers deleted, then the row, audited asteam.disablebyscim. A team that draws from other groups too keeps them, and itsgroup_id, the record of which group it was enabled from, moves to one of them, since the database deletes a team with the group it records. The group's own deletion is audited asgroup.delete, naming the teams disabled and kept.
Governs: apps/troupe_plane/lib/troupe/plane/scim.ex, apps/troupe_plane/lib/troupe/plane/login.ex, apps/troupe_plane/lib/troupe/plane/identity.ex, apps/troupe_plane/lib/troupe/plane/identity/tombstone.ex