Repository navigation
feat: list an organization's own commits in the API, as its page's Commits tab - #1386
Conversation
…mmits tab
The app's organization page needs the Commits tab the web shows, but the
API only had the organization itself and its mentions. GET
api/v1/organizations/{handle}/commits now lists the commits the
organization posted, newest first, without its replies.
A signed request gets them as the web shows them to its user, through
OrganizationCommitsQuery with reply previews, so a member also sees the
organization's pending commits. A guest gets the approved ones with
their public preview, like the mentions endpoint. A handle that is no
organization is not found.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Organization resolution and route app/Http/Requests/ListApiOrganizationCommitsRequest.php, routes/api.php |
The request resolves an organization from the route handle and allows access when that organization exists. The API registers the endpoint in the optional signed-request group. |
Commit listing and response app/Http/Controllers/Api/OrganizationCommitController.php, tests/Feature/Controllers/Api/OrganizationCommitControllerTest.php |
Signed-in requests use OrganizationCommitsQuery and load reply previews. Public requests return approved, top-level organization commits with public previews. Tests cover visibility, ordering, and handles that belong to users. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Client
participant Route
participant ListApiOrganizationCommitsRequest
participant OrganizationCommitController
participant OrganizationCommitsQuery
participant ReplyPreviewsQuery
participant CommitResource
Client->>Route: GET /v1/organizations/{handle}/commits
Route->>ListApiOrganizationCommitsRequest: Resolve and authorize organization
ListApiOrganizationCommitsRequest->>OrganizationCommitController: Pass authorized request
alt Signed-in request
OrganizationCommitController->>OrganizationCommitsQuery: Retrieve paginated organization commits
OrganizationCommitController->>ReplyPreviewsQuery: Load previews for paginated results
else Public request
OrganizationCommitController->>OrganizationCommitController: Select approved top-level commits with public previews
end
OrganizationCommitController->>CommitResource: Return commit collection
CommitResource->>Client: Respond with commits
Possibly related issues
- Issue 938: Proposes organization profiles with organization commits that users can read. This PR adds an API endpoint with member and guest visibility rules.
- Issue 1363: Defines gists as building on organization commits. This PR adds the organization-commit API surface but does not implement gists.
Possibly related PRs
- dev-null-sh/dev-null.sh#1361: Adds organization-authored commits and
OrganizationCommitsQuery, which this endpoint uses. - dev-null-sh/dev-null.sh#1368: Changes visibility for organization-authored commits, which the signed endpoint uses.
- dev-null-sh/dev-null.sh#1316: Updates organization model behavior and request/query contracts used by this endpoint.
Merge Risk: 
Minimal · up to 50d11
-
The endpoint provides public and signed organization commit listings with no identified merge-blocking issue.
Security architecture risk: 
Minimal · up to 50d11
-
The new endpoint preserves the separation between public commits and viewer-specific organization content. The inspected request, authentication, query, and response paths did not reveal a new authorization bypass or material security risk.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- observed — The new entrypoint is publicly reachable for existing organization handles. Each listing is constrained to the requested organization’s authorship; unauthenticated callers do not receive the signed branch’s additional visibility.
Security Findings and Attack Paths
- inferred — The inspected handle-to-response path did not establish unauthorized access to unapproved organization commits or nonpublic reply previews. Parent visibility is viewer-scoped, preview IDs are selected using viewer visibility, and the subsequent loader hydrates those selected IDs rather than caller-supplied reply IDs.
Trust Boundaries and Controls
- observed — The route uses the existing optional signed-request boundary. Unsigned requests proceed as guests; signed requests require successful verification and an approved device before its user becomes the request identity. Invalid signed requests are rejected rather than downgraded to guests.
- observed — Commit serialization gates signed-only fields, including reply previews, on the authenticated request identity. The guest branch uses public-preview query data and does not load the signed reply-preview relation.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Summary
Organizations can now post commits, and the web's organization page shows them on its Commits tab. The API had the organization itself (
GET /api/v1/organizations/{handle}) and its Mentions tab, but nothing for the organization's own commits, so the mobile app's organization page couldn't show them.GET /api/v1/organizations/{handle}/commitsnow lists the commits an organization posted, newest first, without its replies, 20 a page by cursor, like the mentions endpoint.Changes
Api\OrganizationCommitController@index, with its ownListApiOrganizationCommitsRequest, namedapi-organization-commit.index, in the same optionally signed group asshowandmentions.OrganizationCommitsQuerywith reply previews. Members also see the organization's pending commits.Validation
Local, PHP 8.5, Postgres 14:
pest tests/Feature/Controllers/Api/OrganizationCommitControllerTest.php tests/Feature/Controllers/Api/OrganizationMentionControllerTest.php tests/Unit/ArchTest.php: 18 passed. The new tests cover:pint --test,rector --dry-runandphpstanon the changed files: clean.pest --parallel --ci: 4,709 passed and 681 failed. Every failure traced comes from this worktree having no built frontend: web pages fail with "Vite manifest not found" or "Not a valid Inertia response", and their 500s log the same Vite error. None touch the new endpoint, and the change only adds files and one route.Not run locally:
--coverage --exactly=100.0), because there's no coverage driver; by inspection, both controller branches and both outcomes ofauthorize()run;bun run test:lint,test:typesandtest:unit, because there's nonode_modules; the change is PHP only.CI runs all of these.
Independent review
A separate reviewer agent, read-only, reviewed
d53d8079..50d1187e.4d8da5a1: PASS. It noted the signed test never had a member who didn't post the commit.50d1187ealso PASSED. Controller, request and route are unchanged between the two.Limitations
OrganizationCommitsQuerywith no viewer, as the mentions and user commits endpoints do. The reviewer noted this and didn't ask for a change.Summary by CodeRabbit