You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: let every member of an organization see who starred its commits through the API - #1619
On the web, any member of an organization can open the list of who starred one of its commits. ListCommitStarsRequest checks Commit::isOwnedBy(), so the organization's commits count as every member's own.
The signed API checked user_id instead, which is the member who posted the commit. So through the API only that one member got the list and every other member got a 404. The mobile app (NativePHP/dev-null-app#182) treats an organization's commits as every member's, as the web does, and it currently has to tell the other members that only the poster can see who starred it.
This brings the API in line with the web.
Changes
ListApiCommitStarsRequest now uses $commit->isOwnedBy($user), the same check as ListCommitStarsRequest. Every other API commit request already used it.
The list itself is unchanged. It only holds the people who starred the commit, so nothing in it says which member posted it.
One line in the signed API list in KNOWLEDGE_BASE.md.
API
GET /api/v1/commits/{commit}/stars
Who asks
Before
After
Author of a person's own commit
200
200
Org member who posted the commit
200
200
Another member of the org
404
200
Poster who has since left the org
200
404
Non-member, site admin included
404
404
Unsigned
401
401
Validation
Local, PHP 8.5.12, PostgreSQL with its own test database:
New tests in tests/Feature/Controllers/Api/CommitStarControllerTest.php for org commits: the poster and another member get the list, while someone outside the org, a site admin outside it and a poster who left get 404. The "another member" and "poster who left" cases fail on unchanged production. The existing tests for a person's own commits and for unsigned requests pass unchanged.
vendor/bin/pint --test on the changed files: pass
rector --dry-run: pass
phpstan: pass, no errors
pest --type-coverage --min=100: 100%
Relevant files (Api/CommitStarControllerTest, the web CommitStarControllerTest, OrganizationCommitsTest, ArchTest): 87 passed
Whole suite, serially with --ci: 6223 tests, 6221 passed and 2 failed. Both are in tests/Feature/Controllers/GuildMembershipControllerTest.php and fail the same way on unchanged production here. The local Vite build is older than the new guild members page, so that page can't render. They are not from this change.
Coverage: not run, there is no coverage driver (pcov or Xdebug) on this machine. Both sides of the changed line are tested, but CI is the real check.
bun run test:unit, test:lint, test:types: not run, no JS or TS changed.
Independent review
A read-only Claude review agent with the repo's .ai/guidelines and the diff against production at 88f2ea0, head 964359d: CODE: PASS. It confirmed the API and web checks are now the same line, and pointed out the one behaviour change, covered below. Visual review doesn't apply, nothing in the UI changed.
Limitations
A member who posted an organization's commit and then left the organization can no longer read its stars through the API. The web already works this way.
Summary by CodeRabbit
New Features
Organization members can view who starred commits owned by their organization. Other users continue to see only the star count.
Documentation
Clarified that stargazer lists include organization-owned commits and are ordered newest first, with 20 entries per page.
The API now allows organization members to list stargazers for organization commits through ownership-based authorization. Tests cover access for members and 404 responses for nonmembers. The Signed API documentation now includes organization commits.
Authorization uses Commit::isOwnedBy($user). Tests cover members, nonmembers, site admins who are not members, and former members. The API documentation includes organization commits. Both the newest-first order and 20-per-page details remain.
Organization members can now list who starred their organization's commits through the API, matching the web behavior. A member who posted a commit and later left the organization loses that access, as intended. Nothing found blocks merging; the remaining comment only suggests a test improvement.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title states the main change: organization members can now see who starred the organization's commits through the API. The raw summary and objectives confirm this change in ListApiCommitStarsReque…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title states the main change: organization members can now see who starred the organization's commits through the API. The raw summary and objectives confirm this change in ListApiCommitStarsRequest authorization and its tests. The title is specific and matches the changeset. It uses the fix: prefix, which fits a behavior correction. The title is 84 characters, slightly long but still a single clear sentence.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Test access before and after the poster leaves.
This case creates an organization commit for a poster who was never a member. It checks the 404 for a non-member, but it cannot catch a leave operation that fails to remove the membership. Add a test that gets 200 for the poster, uses the application's leave workflow, then gets 404 for the same poster and commit.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: e4e6bf68-547e-4d9e-b373-cdd73feccf58
Commits
Reviewing files that changed from the base of the PR and between 88f2ea0 and 964359d.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
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
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
On the web, any member of an organization can open the list of who starred one of its commits.
ListCommitStarsRequestchecksCommit::isOwnedBy(), so the organization's commits count as every member's own.The signed API checked
user_idinstead, which is the member who posted the commit. So through the API only that one member got the list and every other member got a 404. The mobile app (NativePHP/dev-null-app#182) treats an organization's commits as every member's, as the web does, and it currently has to tell the other members that only the poster can see who starred it.This brings the API in line with the web.
Changes
ListApiCommitStarsRequestnow uses$commit->isOwnedBy($user), the same check asListCommitStarsRequest. Every other API commit request already used it.KNOWLEDGE_BASE.md.API
GET /api/v1/commits/{commit}/starsValidation
Local, PHP 8.5.12, PostgreSQL with its own test database:
tests/Feature/Controllers/Api/CommitStarControllerTest.phpfor org commits: the poster and another member get the list, while someone outside the org, a site admin outside it and a poster who left get 404. The "another member" and "poster who left" cases fail on unchangedproduction. The existing tests for a person's own commits and for unsigned requests pass unchanged.vendor/bin/pint --teston the changed files: passrector --dry-run: passphpstan: pass, no errorspest --type-coverage --min=100: 100%Api/CommitStarControllerTest, the webCommitStarControllerTest,OrganizationCommitsTest,ArchTest): 87 passed--ci: 6223 tests, 6221 passed and 2 failed. Both are intests/Feature/Controllers/GuildMembershipControllerTest.phpand fail the same way on unchangedproductionhere. The local Vite build is older than the new guild members page, so that page can't render. They are not from this change.bun run test:unit,test:lint,test:types: not run, no JS or TS changed.Independent review
A read-only Claude review agent with the repo's
.ai/guidelinesand the diff againstproductionat 88f2ea0, head 964359d: CODE: PASS. It confirmed the API and web checks are now the same line, and pointed out the one behaviour change, covered below. Visual review doesn't apply, nothing in the UI changed.Limitations
Summary by CodeRabbit