Skip to content

feat: list an organization's own commits in the API, as its page's Commits tab - #1386

Merged
mnapoli merged 1 commit into
dev-null-sh:productionfrom
rohitsasi720:feat/api-organization-commits
Nov 2, 2026
Merged

mnapoli merged 1 commit into
dev-null-sh:productionfrom
rohitsasi720:feat/api-organization-commits

Conversation

@rohitsasi720

@rohitsasi720 rohitsasi720 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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}/commits now 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 own ListApiOrganizationCommitsRequest, named api-organization-commit.index, in the same optionally signed group as show and mentions.
  • A signed request gets the tab as the web shows it to that user, through the web's OrganizationCommitsQuery with reply previews. Members also see the organization's pending commits.
  • A guest gets the approved ones with their public preview, like the guest branch of the mentions endpoint.
  • A handle that is no organization's is not found, and looking one up never asks GitHub, as for mentions.

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:
    • guests: newest first, with replies, pending, deleted, other authors and other organizations left out;
    • signed requests: the poster and another member see the pending commit, a stranger doesn't;
    • a user's handle gets a 404.
  • pint --test, rector --dry-run and phpstan on the changed files: clean.
  • Full 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.
  • Checked end to end: the app's organization page on a Pixel 9 (Android 16, hardware) against this branch served locally, with dev-null.sh, its admins and its commit copied from the public page into the local database.

Not run locally:

  • the coverage check (--coverage --exactly=100.0), because there's no coverage driver; by inspection, both controller branches and both outcomes of authorize() run;
  • bun run test:lint, test:types and test:unit, because there's no node_modules; the change is PHP only.

CI runs all of these.

Independent review

A separate reviewer agent, read-only, reviewed d53d8079..50d1187e.

  • First pass, on 4d8da5a1: PASS. It noted the signed test never had a member who didn't post the commit.
  • That case was added, and the re-review of 50d1187e also PASSED. Controller, request and route are unchanged between the two.
  • The reviewer had the same limits as above: no coverage driver and no JS checks.

Limitations

Summary by CodeRabbit

  • New Features
    • Added an API listing for an organization’s commits, ordered with the newest first.
    • Public listings show approved top-level commits. Signed-in organization admins and teammates can also see pending commits; people without access cannot.
    • Commit listings include reply previews.

…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.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: be603264-cbad-4ffc-9900-d9a40fdd60a6
Commits

Reviewing files that changed from the base of the PR and between 90e995c and 50d1187.

Files selected for processing: 4
  • app/Http/Controllers/Api/OrganizationCommitController.php
  • app/Http/Requests/ListApiOrganizationCommitsRequest.php
  • routes/api.php
  • tests/Feature/Controllers/Api/OrganizationCommitControllerTest.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

Adds GET /v1/organizations/{handle}/commits. The endpoint resolves an organization by profile handle and returns commits for public or signed-in requests, with different visibility rules.

Changes: Organization commit listing

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
Loading

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

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: adding an API endpoint to list an organization's commits for its Commits tab.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full 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

@mnapoli mnapoli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for CI

@mnapoli
mnapoli merged commit 47381be into dev-null-sh:production Nov 2, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants