Repository navigation
refactor: let users share the ID of their profile, as organizations do - #1345
Merged
Merged
Conversation
Contributor
mnapoli
marked this pull request as ready for review
October 31, 2026 17:10
xHeaven
approved these changes
Oct 31, 2026
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.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
First layer of letting organizations post commits (#938). Organizations already share their profile's ID, but users had their own, linked to their profile by
github_id. Now each user shares their profile's ID too. Every user ID is then a profile ID, so a commit, and later a star, a follow or a mute, can point toprofilesand mean a person or an organization alike, without rewriting existing data.No behavior change.
Changes
users.idbecomes a foreign key toprofiles.id, likeorganizations.id.usersandprofilesagainst writes for the update, about 12k rows, so no user signs up with another ID before the foreign key is in place.User::profile(),Profile::user()and the joins between users and profiles link by ID. Joins that only went throughusersto reach a profile now joinprofilesdirectly.github_idstays on users for bans and timeouts.Validation
All local, on Postgres 18 with pgvector (as CI):
php -d memory_limit=-1 vendor/bin/pest --parallel --ci --coverage --exactly=100.0 --passthru-php="'-d' 'memory_limit=-1'": 5195 passed, coverage 100.0%.composer test:lint,composer test:types(PHPStan 0 errors),composer test:type-coverage(100%),bun run test:unit(791 passed).No UI change, so no device check or screenshots.
Independent review
CODE: PASS from a separate read-only review on
8dd60f13(base3c7e4bb0), after one round of notes:profiles, users, the order a sign-in writes them, so a sign-in can't deadlock with it.It checked that only organization profiles are referenced, so rewriting user profiles' IDs orphans nothing. It also checked that every user already has a profile, so the foreign key validates, and that the joins moved to IDs return the same rows.
Non-blocking: the migration sets no
lock_timeout, so writes to users and profiles queue behind it if a long transaction holds them.Limitations
Decisions for organization commits (#938), made before building
author_idpoints to the profile it's from, a person or an organization, anduser_idstays the account that posted it. Each person's profile takes their user's id, as organizations already share theirs, so profile ids cover everyone. A column that should later accept organizations, like who starred or whom someone follows, then only repoints its foreign key without rewriting data. We rejected two columns (user_id+organization_id, one moreorganization_*column per feature) and a polymorphic author (no foreign key).author_id+user_id, likestars.user_idandscheduled_commits.user_idfor the account that did it.Settled while planning, and accepted:
/@laravel/commits/{id}, and the org page gets a Commits tab, first and the default, before Mentions.Summary by CodeRabbit