fix(projection): match owner names case-insensitively #42
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-auth-reconciler!42
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "fix/owner-name-case-insensitive"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Closes #28.
The bug
Forgejo treats owner names case-insensitively. It routes on them that way and enforces uniqueness
through a
lower_namecolumn. The projection compared them case-sensitively. A name whose casingdiffered from the declaration matched nothing.
The reconciler is authoritative. It adds the owner to the group it computed and removes it from
every other candidate. So an unmatched name does not just fail to grant. It demotes, and re-asserts
that demotion every tick. That is how a case-only rename of the platform org on 2026-08-04 blocked
every push and all CI for about 90 minutes.
The fix
ownerKey()normalises one name.ownerSet()builds the only kind of set owner names may bematched against. Both sides of every comparison go through them.
Scope is wider than the issue asked, deliberately. #28 names the two exempt lists. The seven
Kanidm-derived tier sets are matched against the same Forgejo-supplied names. They carry the same
bug in per-user form: a casing mismatch silently drops a paying seat into the fail-closed
zero-quota
participantgroup. Fixing only the exempt lists would have left that live.Why OwnerSet is branded
A plain
ReadonlySet<string>would let a later caller reintroduce a rawnew Set()that comparesthe wrong way. Nothing would catch it until the next incident. The brand makes
ownerSet()theonly way to build one. That turned "did we get them all?" from a review question into a compile
error. It located every construction site in one typecheck, including the ones in the tests.
Deliberately not changed
reconcileIdentitymatches on Kanidm UUID, not name. It never had the bug.classifyProfile's name comparison stays case-sensitive. Kanidm owns the login. Renaming Forgejoto Kanidm's casing is the intended self-heal for this kind of drift. Normalising it would disable
that.
Verification
pnpm typecheck,pnpm lintandpnpm testare clean. 118 tests pass.The new tests are not vacuous. With
ownerKeytemporarily reduced to the identity function, 5 ofthe 7 new projection tests fail:
The other two are the intended negative control (a different tenant org is still capped) and a case
the test helper alone would satisfy. That one was rewritten to build its set with the production
ownerSet().Follow-up, not in this PR
#28 also notes the demotion path is silent.
org <name>: quota=org-defaultis an INFO lineindistinguishable from the normal tenant case. Nothing alerts when the platform's own org gets
capped. That is a monitoring change in bitborg-infra, not a reconciler one. Filed as
bitborg-infra#423.