Repository navigation
fix(groups): hold a group's slug to one rule whenever it is set - #742
Merged
Merged
Conversation
A slug was checked only when a group's details were edited. One given when a group was created could hold any characters at any length, and nothing limited the length on an edit either. The same rule now applies whenever a slug is set: lowercase letters, digits and hyphens, at most 255 characters. A slug derived from the name always satisfies it, and a name with nothing a slug can be made from is refused. A migration rewrites existing slugs that break the rule.
…a rolling deploy The repair gave up after two candidates, could overwrite an owner's edit or lose a candidate to one made while it ran, could hand a group the address of the page that creates groups, and ran only once, before servers of the previous release had stopped writing unchecked slugs. It now keeps looking until a slug is free, makes writers wait while it runs, never gives out "new", and runs again each day from a job. A slug is also judged exactly as given: it is no longer trimmed first, and "new" is refused.
…he table The repair locked the whole table while it worked. An owner editing their group reads the row with a lock and then writes; holding the table between those two steps set the repair and the edit against each other, and held up writes to every other group meanwhile. Each group is now settled by a single statement that replaces the slug only while it is still the broken one that was read and only with a slug nobody has. The migration runs it outside a transaction, so no row stays locked while the next is handled.
… a contested slug The repair locked a group and then waited for its new slug while someone creating a group held that slug uncommitted, and they in turn could be waiting on a third transaction that wanted the locked group. The repair now locks the group with nothing else held, and cuts the wait for the slug short: it lets the group go and tries the next candidate. Its tests read who is waiting for whom from the database before going on.
…ding nothing Settling each group under its own row lock still left the repair holding that row while it waited for a slug another writer was claiming, a wait that could close a cycle. The repair now asks for the whole table before it touches anything and works only once it has it: at that point nobody else holds a row or an unfinished claim, so it never waits again. If the table is not free within half a second the attempt is dropped and tried again later, so writers are never held up for long. The caller's own lock wait is put back as it was found.
mwoods79
added a commit
that referenced
this pull request
Dec 1, 2026
…n-escaping * origin/main: fix(groups): hold a group's slug to one rule whenever it is set (#742) fix(huddl): copy only huddlz the actor can organize (#723) fix(auth): have open pages follow a change of access (#735) fix(groups): authorize membership changes against their roster (#739) fix(auth): bind administrator viewing credentials to the browser session (#736)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.
2F27
This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Group addresses accept 1–255 lowercase ASCII letters, digits and hyphens. The address
newis reserved for group creation. An address supplied on create or update is validated as entered, including surrounding whitespace. Owners can still edit other details on a legacy group without supplying its address.The migration repairs invalid addresses in creation order, using the group ID to resolve collisions. During a rolling deploy, a unique boot or daily job picks up invalid addresses written by older servers.
Evidence
Merge Danger
Door: one-way. The migration rewrites invalid addresses in place. Rolling back does not restore their old links.
Blast Radius: Addresses