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: count only commits visible to the link viewer - #1416
Link statistics could count commits that are not visible in the feed, making the totals disagree with the content shown to the viewer.
Change
Applies the same visibility rules to the statistics query as the visible commit list, including approval and blocked-author filtering.
Tests
Focused link controller tests passed (7 tests, 98 assertions). Type checks and lint passed.
Summary by CodeRabbit
Bug Fixes
Link-page commit totals now match the commits visible to the current viewer, including their own pending commits and commits from organizations they belong to. Commits from blocked users and unrelated pending commits remain excluded. The displayed contributor count reflects the people who authored those visible commits.
No actionable comments were generated in the recent review.
Walkthrough
Link statistics now use the current user’s commit visibility. The link controller passes that user to the stats query. The feature test covers visible commits, including organization commits, and confirms that blocked-user commits and unrelated pending commits remain excluded.
Changes: Link statistics
Layer / File(s)
Summary
Calculate and verify visible commit statistics app/Queries/LinkCommitsQuery.php, app/Http/Controllers/LinkController.php, tests/Feature/Controllers/LinkControllerTest.php
The stats query accepts a user and counts commits visible to that user. The controller passes the current user. The test expects four visible commits by three people and checks excluded commits.
Link statistics now match the commits visible to the requesting user, including the covered pending and organization cases.
Security architecture risk: Minimal · up to a9778
Statistics now use the same visibility rules as the displayed commits. The reviewed change does not introduce a new access path, broaden viewing permissions, or alter stored data.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The changed exposure is the aggregate commit and posting-user counts for one selected link. Newly included pending commits are governed by the same viewer-specific predicate already used for the feed; the change does not independently widen feed visibility.
Trust Boundaries and Controls
observed — The statistics identity comes from the controller’s CurrentUser parameter, not from the requested URL. The same identity is passed to the feed, keeping aggregate and content authorization aligned.
Resilience and Maintainability Implications
inferred — Sharing the visibility predicate reduces the risk of aggregate authorization drifting from feed authorization. The changed path performs reads and introduces no persistent multi-step transition requiring cleanup or recovery.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% 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. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title states the main change: the link statistics now count only commits visible to the link viewer. The raw summary confirms LinkCommitsQuery::stats now takes a User and counts commits visible to…
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: the link statistics now count only commits visible to the link viewer. The raw summary confirms LinkCommitsQuery::stats now takes a User and counts commits visible to that user, and LinkController passes the current user. The title is short, specific, and follows the conventional fix: prefix format.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% 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 1 functions across 3 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
This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.
CodeRabbit Verify
Run CodeRabbit Verify to test the changes in this pull request.
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: 987191a4-4093-495f-989a-61a2c8f89454
Commits
Reviewing files that changed from the base of the PR and between c934501 and a97789c.
Files selected for processing: 3
app/Http/Controllers/LinkController.php
app/Queries/LinkCommitsQuery.php
tests/Feature/Controllers/LinkControllerTest.php
Limit details: You’ve used all 10 included reviews currently available.
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.
Problem
Link statistics could count commits that are not visible in the feed, making the totals disagree with the content shown to the viewer.
Change
Applies the same visibility rules to the statistics query as the visible commit list, including approval and blocked-author filtering.
Tests
Focused link controller tests passed (7 tests, 98 assertions). Type checks and lint passed.
Summary by CodeRabbit