Skip to content

Add user/profile search endpoints and UI - #157

Merged
livrasand merged 3 commits into
mainfrom
Add-user/profile-search-endpoints-and-UI
Aug 7, 2026
Merged

Add user/profile search endpoints and UI#157
livrasand merged 3 commits into
mainfrom
Add-user/profile-search-endpoints-and-UI

Conversation

@livrasand

@livrasand livrasand commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Backend: add user-focused APIs (users search, user profile, user repos, user readme, code search, GitHub packages) and improve GitLab avatar fallback and Codeberg contributor 404 handling. Router serves profile.html for /gh|/gl|/cb clean routes. Frontend: add users tab, user search, profile modal, full SPA profile page (web/profile.html), many repo.html UX features (mermaid support, repo search, tags, contributors, deployments, last-commit row) and star/icon improvements. Service worker: bump cache and treat profile routes network-first. CI: update actions versions, gradle flags and verify APK artifact.

Summary by CodeRabbit

  • New Features
    • Added cross-provider user discovery and profile pages for GitHub, GitLab, and Codeberg.
    • Added repository code search, file search, tags, contributors, deployments, packages, security policies, and richer metadata.
    • Added Mermaid diagrams, improved Markdown rendering, and expanded repository navigation.
  • Bug Fixes
    • Improved avatar fallbacks, rate-limit handling, error responses, and profile-route loading.
  • Improvements
    • Enhanced responsive layouts, navigation, loading states, provider links, and offline cache behavior.

Backend: add user-focused APIs (users search, user profile, user repos, user readme, code search, GitHub packages) and improve GitLab avatar fallback and Codeberg contributor 404 handling. Router serves profile.html for /gh|/gl|/cb clean routes. Frontend: add users tab, user search, profile modal, full SPA profile page (web/profile.html), many repo.html UX features (mermaid support, repo search, tags, contributors, deployments, last-commit row) and star/icon improvements. Service worker: bump cache and treat profile routes network-first. CI: update actions versions, gradle flags and verify APK artifact.
@livrasand livrasand self-assigned this Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds multi-provider user search, profile pages, backend APIs, repository search and metadata views, Mermaid rendering, profile routing, service-worker cache updates, and Android APK build validation.

Changes

Provider discovery and profiles

Layer / File(s) Summary
Provider API handlers and routes
internal/http/handlers.go, internal/http/router.go
Adds normalized GitHub, GitLab, and Codeberg handlers for user search, profiles, repositories, READMEs, code search, and packages.
User search and repository profile links
web/index.html
Adds the users tab, cross-provider search, profile previews, provider links, star icons, and token-aware rate-limit handling.
Multi-provider profile SPA
web/profile.html, web/sw.js
Adds profile rendering for repositories, people, READMEs, contributions, starred repositories, service status, and sanitized Markdown. Profile routes use network-first service-worker handling.

Repository exploration

Layer / File(s) Summary
Repository navigation and metadata
web/repo.html
Adds provider-aware repository metadata, tags, contributors, deployments, security-policy access, homepage links, package loading, and profile links across repository activity.
Repository file and code search
web/repo.html
Adds file indexing, provider code search, bounded Codeberg content search, metadata-aware file loading, and latest-commit details.
README Mermaid rendering
web/repo.html
Adds Mermaid parsing, queued rendering, theme-aware rerendering, and source-preserving fallbacks.

Android build validation

Layer / File(s) Summary
Android APK workflow
.github/workflows/android-apk.yml
Updates action pins, removes cache settings, adds Gradle diagnostics, disables the Gradle daemon, and verifies the generated APK.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Visitor
  participant WebApp
  participant Backend
  participant ProviderAPIs
  Visitor->>WebApp: search users or open a profile
  WebApp->>Backend: request normalized provider data
  Backend->>ProviderAPIs: query selected provider APIs
  ProviderAPIs-->>Backend: return provider responses
  Backend-->>WebApp: return normalized data
  WebApp-->>Visitor: render users, profiles, and repositories
Loading

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: gitgost-anonymous

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary addition of user and profile search endpoints and user-facing UI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Add-user/profile-search-endpoints-and-UI

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread web/profile.html Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 13

🧹 Nitpick comments (9)
web/repo.html (5)

5549-5603: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

The GitHub tag count is an upper-bound estimate.

total = parseInt(match[1]) * 100 assumes the last page holds 100 tags. The sidebar then reports a count that can exceed the real number, while loadTags computes the exact count. Consider labelling the value as approximate, or fetching the last page to get the exact count.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` around lines 5549 - 5603, Update loadTagCount so the GitHub
branch does not present parseInt(match[1]) * 100 as an exact tag count. Either
fetch the final GitHub tags page and calculate the precise total, or clearly
label the derived value as approximate while preserving exact counts for GitLab
and Codeberg.

2254-2260: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the duplicated search markup.

This block duplicates the _fileTreeSearch template string at lines 5811-5817, including the repo-search-input id. Two sources for the same markup will diverge. Render the initial shell from _fileTreeShell() instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` around lines 2254 - 2260, Remove the duplicated repo-search
markup from the surrounding HTML and have the initial shell render it through
_fileTreeShell(), reusing the existing _fileTreeSearch template output and
repo-search-input wiring instead of maintaining a second copy.

5867-5887: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Bound the Codeberg content search more strictly.

The loop can issue up to 200 content requests for one search, each decoding a full file. On rate-limited Codeberg tokens this can exhaust the quota and leave the search slow. Consider a lower candidate cap, a size filter from the tree metadata, and a visible note that the search covers only part of the repository.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` around lines 5867 - 5887, Tighten the client-side search in
the repository search flow around _allRepositoryFiles by lowering the candidate
cap, filtering out oversized files using available tree metadata before fetching
content, and displaying a visible note that results cover only a repository
subset. Preserve the existing binary-file exclusion, batching, matching, and
100-result limit.

3902-3949: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Add a page cap to the tag pagination loops.

Each while (true) loop depends only on the provider response to terminate. loadContributorsView and loadDeploymentsView cap pagination at 10 pages. Apply the same cap here to bound requests on repositories with many tags.

♻️ Proposed change (GitHub branch shown; apply the same to `cb` and `gl`)
                     let page = 1;
                     while (true) {
                         const res = await ghFetch(`https://api.github.com/repos/${rv.owner}/${rv.repo}/tags?per_page=100&page=${page}`);
                         if (!res.ok) break;
                         const data = await res.json();
                         if (!Array.isArray(data) || data.length === 0) break;
                         tags.push(...data);
                         const link = res.headers.get('Link') || '';
                         if (!/<[^>]+>;\s*rel="next"/.test(link)) break;
                         page++;
+                        if (page > 10) break;
                     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` around lines 3902 - 3949, Update all three pagination loops in
loadTags for GitHub, Codeberg, and GitLab to enforce the existing 10-page
maximum used by loadContributorsView and loadDeploymentsView. Preserve the
current response and Link-header termination checks, while ensuring no provider
requests beyond page 10 are made.

20-20: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin Mermaid to an exact release and validate the fetched script at runtime.

web/repo.html:20 loads mermaid@11 from jsDelivr; any patch update under that major version can execute as trusted page code. Use an exact version, validate the fetched bytes before execution, and set crossorigin="anonymous" if the script tag needs to enforce that validation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` at line 20, Update the Mermaid script tag in repo.html to pin
jsDelivr to an exact Mermaid release rather than the floating `@11` range, and add
the required integrity hash for the fetched script plus crossorigin="anonymous"
so the browser validates the bytes before execution.
internal/http/handlers.go (3)

3612-3681: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Move the response body close out of the loop.

defer resp.Body.Close() at Line 3641 runs only when the function returns. The code path is safe today because it returns immediately after the deferred call is registered. The pattern breaks if a later change adds another loop iteration after a successful response. Close the body explicitly in the success branch instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/http/handlers.go` around lines 3612 - 3681, Update
searchCodebergUsers so the successful response body is closed explicitly within
the success branch before returning, replacing defer resp.Body.Close(). Preserve
the existing decoding, result construction, and immediate return behavior.

4391-4419: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Close the first response body once, and re-check the organization fallback.

Line 4402 registers defer resp.Body.Close() on the first response. Line 4406 closes that same body again before the reassignment. The double close is harmless for an HTTP body, but the intent is unclear. Also, the fallback keeps the current token, which may be empty after the 403 retry; that is intended, so only the close sequence needs cleanup.

♻️ Proposed cleanup
 	resp, err := doReq(apiURL, token)
 	if err == nil && resp.StatusCode == http.StatusForbidden {
 		// Scope read:user faltante: reintentar sin token (la API pública funciona).
 		resp.Body.Close()
 		token = ""
 		resp, err = doReq(apiURL, token)
 	}
 	if err != nil {
 		utils.Log("Codeberg user repos error: %v", err)
 		return nil
 	}
-	defer resp.Body.Close()
 
 	// Si el usuario no existe, probar como organización.
 	if resp.StatusCode != http.StatusOK && userType != "org" {
 		resp.Body.Close()
 		apiURL = fmt.Sprintf("https://codeberg.org/api/v1/orgs/%s/repos?limit=30&sort=updated", url.PathEscape(username))
 		resp, err = doReq(apiURL, token)
 		if err != nil {
 			utils.Log("Codeberg org repos error: %v", err)
 			return nil
 		}
-		defer resp.Body.Close()
 	}
+	defer resp.Body.Close()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/http/handlers.go` around lines 4391 - 4419, Clean up the
response-body lifecycle in the Codeberg repository request flow around doReq:
ensure the initial response body is closed exactly once before replacing resp
for the organization fallback, while retaining the existing defer for the normal
return path. Leave the fallback token behavior unchanged, including the empty
token after a forbidden retry.

3425-3429: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Do not forward every upstream status code verbatim.

GitHub returns 403 for rate limiting and 422 for invalid queries. The handler returns those codes to the browser, so a server-side rate limit appears as a client authorization failure. Map upstream failures to 502, and keep 403/404 only when they describe the client request.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/http/handlers.go` around lines 3425 - 3429, Update the non-OK
response handling in the GitHub code search handler to return HTTP 502 for
upstream GitHub failures instead of forwarding resp.StatusCode. Preserve 403 and
404 only for locally validated client-request conditions, while retaining the
existing logging and error response behavior.
web/profile.html (1)

7-10: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Add integrity attributes to the CDN scripts.

CodeQL flags these three tags. The page loads highlight.js, marked, and dompurify from third-party CDNs without integrity or crossorigin. A compromised or substituted CDN response executes with full page privileges, and DOMPurify is the sanitizer for README output. Pin each script with a subresource integrity hash, or serve the files from /assets.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/profile.html` around lines 7 - 10, Add Subresource Integrity integrity
hashes and crossorigin attributes to the highlight.js, marked, and DOMPurify CDN
script tags in web/profile.html. Use hashes matching the exact pinned script
contents and preserve the existing loading order and initialization behavior;
alternatively, serve these scripts from local /assets paths.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/android-apk.yml:
- Around line 21-23: Disable dependency caching in the release-producing
workflow: update the actions/setup-node step to set package-manager-cache to
false, and remove or disable both npm and Gradle cache restore/save steps in the
tag build job while preserving the existing APK and release flow.
- Around line 18-19: Update the comment above the checkout action to state that
Node 24 is now the default runtime, removing the inaccurate claim that the
runner no longer supports Node 20 actions. Preserve the existing action
reference and workflow behavior.

In `@internal/http/handlers.go`:
- Around line 3683-3721: Update UserProfileHandler and the corresponding
provider helper flow around gitLabUserProfile, gitLabGroupProfile,
codebergUserProfile, codebergOrgProfile, and gitHubUserProfile so missing
profiles remain distinguishable from transport, timeout, rate-limit, status, and
decode failures. Propagate a distinct upstream error value and return HTTP 502
for those failures, while retaining HTTP 404 only when the provider confirms the
user or organization does not exist.
- Around line 3349-3380: Update UsersSearchHandler to fan out the applicable
searchGitHubUsers, searchGitLabUsers, and searchCodebergUsers calls concurrently
instead of invoking them sequentially, then safely collect and merge each result
before responding. Preserve provider filtering and request validation, and
ensure the request has a bounded context/deadline so slow provider retries
cannot extend total latency indefinitely.

In `@internal/http/router.go`:
- Around line 283-288: Apply the existing prCheckLimiter() middleware to each of
the six newly registered proxy routes—UsersSearchHandler, CodeSearchHandler,
GitHubPackagesHandler, UserProfileHandler, UserReposHandler, and
UserReadmeHandler—so anonymous requests are rate-limited while preserving their
current paths and handlers.

In `@web/index.html`:
- Around line 3434-3494: Update searchGitHubUsers, searchGitLabUsers, and
searchCodebergUsers to throw when their fetch response is not OK instead of
returning an empty array. Preserve returning data.results for successful
responses so the existing catch handlers in searchUsers set anyFailed and
display the API-unavailable state.

In `@web/profile.html`:
- Line 2: Update the document language declaration on the root html element to
lang="en", and translate the Spanish string “aún no tiene commits” near the
affected interface text into English while preserving the surrounding UI
behavior.
- Around line 599-610: Add the missing profile header container and profile
section-title element inside main-content, using the IDs profile-header and
profile-section-title referenced by renderProfile and showError. Place them
before the existing README and repository sections so the profile identity
content renders in the intended header area.
- Line 745: Update the document.title assignment in the _currentView ===
'overview' branch to use the original unescaped name and user values instead of
safeName and safeUser, while preserving the existing fallback and title format.
- Around line 781-785: Restrict the user-controlled URLs used by the profile
website and profile link rendering to http: or https: schemes, rejecting
javascript: and other protocols before generating anchors. Update the relevant
URL sanitization flow around safeWebsite and safeUrl, and remove the second
escAttr application in the website href so the already-escaped value is not
double-escaped.

In `@web/repo.html`:
- Around line 5363-5369: The deployment mapping before renderDeploymentsView
hardcodes status to an empty string, so the full view cannot display deployment
status. Resolve each visible deployment’s status using its statuses_url,
matching the sidebar behavior, and populate status before rendering; if
resolution is unavailable, explicitly display an unavailable-status state
instead of silently omitting it.
- Around line 4802-4810: The GitLab Pages fallback in the project-loading logic
must not overwrite an existing homepage or assume Pages exists. Update the block
around setRepoHomepage(siteUrl) to first preserve the project homepage value,
and only derive and apply the GitLab Pages URL when no homepage is present and
the project data explicitly confirms Pages is published.
- Around line 6882-6901: Restore the `mermaid` class on the original element
within `_renderMermaid`’s `catch` block before logging the failure, preserving
the visible source styling without re-queuing the element for rendering.

---

Nitpick comments:
In `@internal/http/handlers.go`:
- Around line 3612-3681: Update searchCodebergUsers so the successful response
body is closed explicitly within the success branch before returning, replacing
defer resp.Body.Close(). Preserve the existing decoding, result construction,
and immediate return behavior.
- Around line 4391-4419: Clean up the response-body lifecycle in the Codeberg
repository request flow around doReq: ensure the initial response body is closed
exactly once before replacing resp for the organization fallback, while
retaining the existing defer for the normal return path. Leave the fallback
token behavior unchanged, including the empty token after a forbidden retry.
- Around line 3425-3429: Update the non-OK response handling in the GitHub code
search handler to return HTTP 502 for upstream GitHub failures instead of
forwarding resp.StatusCode. Preserve 403 and 404 only for locally validated
client-request conditions, while retaining the existing logging and error
response behavior.

In `@web/profile.html`:
- Around line 7-10: Add Subresource Integrity integrity hashes and crossorigin
attributes to the highlight.js, marked, and DOMPurify CDN script tags in
web/profile.html. Use hashes matching the exact pinned script contents and
preserve the existing loading order and initialization behavior; alternatively,
serve these scripts from local /assets paths.

In `@web/repo.html`:
- Around line 5549-5603: Update loadTagCount so the GitHub branch does not
present parseInt(match[1]) * 100 as an exact tag count. Either fetch the final
GitHub tags page and calculate the precise total, or clearly label the derived
value as approximate while preserving exact counts for GitLab and Codeberg.
- Around line 2254-2260: Remove the duplicated repo-search markup from the
surrounding HTML and have the initial shell render it through _fileTreeShell(),
reusing the existing _fileTreeSearch template output and repo-search-input
wiring instead of maintaining a second copy.
- Around line 5867-5887: Tighten the client-side search in the repository search
flow around _allRepositoryFiles by lowering the candidate cap, filtering out
oversized files using available tree metadata before fetching content, and
displaying a visible note that results cover only a repository subset. Preserve
the existing binary-file exclusion, batching, matching, and 100-result limit.
- Around line 3902-3949: Update all three pagination loops in loadTags for
GitHub, Codeberg, and GitLab to enforce the existing 10-page maximum used by
loadContributorsView and loadDeploymentsView. Preserve the current response and
Link-header termination checks, while ensuring no provider requests beyond page
10 are made.
- Line 20: Update the Mermaid script tag in repo.html to pin jsDelivr to an
exact Mermaid release rather than the floating `@11` range, and add the required
integrity hash for the fetched script plus crossorigin="anonymous" so the
browser validates the bytes before execution.
🪄 Autofix

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2f4b3b3f-ab99-4128-a67d-4ae5678b4830

📥 Commits

Reviewing files that changed from the base of the PR and between d402597 and b36ba65.

📒 Files selected for processing (7)
  • .github/workflows/android-apk.yml
  • internal/http/handlers.go
  • internal/http/router.go
  • web/index.html
  • web/profile.html
  • web/repo.html
  • web/sw.js

Comment thread .github/workflows/android-apk.yml Outdated
Comment thread .github/workflows/android-apk.yml
Comment thread internal/http/handlers.go
Comment thread internal/http/handlers.go
Comment thread internal/http/router.go Outdated
Comment thread web/profile.html Outdated
Comment thread web/profile.html
Comment thread web/repo.html Outdated
Comment thread web/repo.html Outdated
Comment thread web/repo.html
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes Applied Successfully

Fixed 5 file(s) based on 13 unresolved review comments.

Files modified:

  • internal/http/handlers.go
  • internal/http/router.go
  • web/index.html
  • web/profile.html
  • web/repo.html

Commit: 2a4f02986b99d9d0512b67aafc29fae2ae227a83

The changes have been pushed to the Add-user/profile-search-endpoints-and-UI branch.

Time taken: 10m 40s


⚠️ 1 file(s) could not be committed — the agent does not have permission to push to .github/workflows/. Please apply these changes manually:

.github/workflows/android-apk.yml — 3 changes:

Lines 15–21
 
     steps:
       - name: Checkout
-        # v5 runs on Node 24 (the runner no longer supports Node 20 actions).
+        # v5 runs on Node 24 (now the default runtime).
         uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
 
       - name: Set up Node
Lines 23–29
         uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
         with:
           node-version: 22
-          cache: npm
 
       - name: Install Node dependencies
         run: npm ci
Lines 37–43
         with:
           distribution: temurin
           java-version: 21
-          cache: gradle
 
       - name: Make gradlew executable
         run: chmod +x ./android/gradlew

Fixed 5 file(s) based on 13 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Introduce a 45s context timeout for UsersSearchHandler and return 504 if upstream searches exceed it. Wait on goroutines with a cancellable select. Return 502 for failed GitHub code search. Fix multiple response body handling to avoid leaks by closing bodies promptly. Update CI Node setup/cache in android-apk workflow. Add SRI and crossorigin attributes to third-party scripts and pin mermaid version. Improve repo UI: simplify file-tree shell, include file sizes, cap pagination pages, compute exact tag totals by fetching last page, and limit client-side code-search to a bounded subset with a user notice.
@livrasand
livrasand merged commit de9e329 into main Aug 7, 2026
4 of 6 checks passed
@livrasand
livrasand deleted the Add-user/profile-search-endpoints-and-UI branch August 7, 2026 03:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/repo.html`:
- Line 3909: Remove the fixed ten-page truncation from the GitHub, Codeberg, and
GitLab tag-loading loops in web/repo.html at lines 3909-3909, 3922-3922, and
3936-3936. Add user-driven pagination for each provider, or expose a clear
partial-results state and continuation control when more pages remain.
- Around line 5352-5368: Update the deployment-status resolution around the
statuses Promise.all block to cache requests by statuses_url before fetching and
route unique URL lookups through a small-concurrency or serial queue. Reuse
cached results for duplicate URLs, while preserving empty-status handling for
missing URLs, failed requests, and empty responses.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 39801923-021e-4100-ba0c-5d32317f7d01

📥 Commits

Reviewing files that changed from the base of the PR and between b36ba65 and 30dfcd7.

📒 Files selected for processing (6)
  • .github/workflows/android-apk.yml
  • internal/http/handlers.go
  • internal/http/router.go
  • web/index.html
  • web/profile.html
  • web/repo.html
🚧 Files skipped from review as they are similar to previous changes (5)
  • .github/workflows/android-apk.yml
  • web/profile.html
  • internal/http/router.go
  • web/index.html
  • internal/http/handlers.go

Comment thread web/repo.html
const link = res.headers.get('Link') || '';
if (!/<[^>]+>;\s*rel="next"/.test(link)) break;
page++;
if (page > 10) break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not silently truncate tag lists after ten pages.

Each provider stops loading after page 10. Repositories beyond this limit omit tags without a continuation control or partial-results notice. Add user-driven pagination, or clearly state that the list is partial.

  • web/repo.html#L3909-L3909: replace the GitHub fixed cap with pagination or a partial-results state.
  • web/repo.html#L3922-L3922: replace the Codeberg fixed cap with pagination or a partial-results state.
  • web/repo.html#L3936-L3936: replace the GitLab fixed cap with pagination or a partial-results state.
📍 Affects 1 file
  • web/repo.html#L3909-L3909 (this comment)
  • web/repo.html#L3922-L3922
  • web/repo.html#L3936-L3936
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` at line 3909, Remove the fixed ten-page truncation from the
GitHub, Codeberg, and GitLab tag-loading loops in web/repo.html at lines
3909-3909, 3922-3922, and 3936-3936. Add user-driven pagination for each
provider, or expose a clear partial-results state and continuation control when
more pages remain.

Comment thread web/repo.html
Comment on lines +5352 to +5368
// Resolve deployment statuses from statuses_url
const statuses = await Promise.all(items.map(async d => {
if (!d || !d.statuses_url) return '';
try {
const sRes = await ghFetch(d.statuses_url);
if (sRes.ok) {
const list = await sRes.json();
return Array.isArray(list) && list.length > 0 ? list[0].state : '';
}
} catch(_) {}
return '';
}));
items = items.map((d, i) => ({
env: d.environment || '',
ref: d.ref || '',
created_at: d.created_at || '',
status: statuses[i] || '',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🌐 Web query:

What GitHub REST API secondary rate limits apply to concurrent requests, and what concurrency does GitHub recommend for REST API clients?

💡 Result:

The GitHub REST API enforces a secondary rate limit of no more than 100 concurrent requests, which is a limit shared across both the REST API and the GraphQL API [1][2]. To avoid triggering these secondary rate limits, GitHub explicitly recommends that clients make requests serially instead of concurrently [3][4][5]. To achieve this serial execution, GitHub suggests implementing a queue system for your API requests [3][5]. If your application makes a large number of mutative requests—specifically POST, PATCH, PUT, or DELETE requests—GitHub also recommends waiting at least one second between each request to help prevent hitting these limits [3][4][5]. If you do encounter a rate limit, the API may return a 403 or 429 response, and you should follow standard retry guidance: respect the "retry-after" header if provided, or use an exponentially increasing wait time between retries [1][6][4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repo files containing repo.html:"
fd -a 'repo\.html$' . | sed 's#^\./##'

file="$(fd 'repo\.html$' . | head -n 1)"
echo
echo "File: $file"
echo "Line count:"
wc -l "$file" | awk '{print $1}'

echo
echo "Relevant lines around deployment status handling:"
sed -n '5335,5382p' "$file" | cat -n

echo
echo "Definitions/usages of ghFetch:"
rg -n "function\s+ghFetch|const\s+ghFetch|gitHub|github|statuses_url|deployment" "$file" | sed -n '1,120p'

Repository: livrasand/gitGost

Length of output: 14114


Limit concurrent deployment-status requests.

Promise.all starts one ghFetch(d.statuses_url) request for each deployment at once. Large deployment pages can approach or exceed GitHub REST API secondary rate limits, which recommend serializing API requests with a queue. Cache by statuses_url before starting requests, and process them through a small-concurrency or serial queue.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/repo.html` around lines 5352 - 5368, Update the deployment-status
resolution around the statuses Promise.all block to cache requests by
statuses_url before fetching and route unique URL lookups through a
small-concurrency or serial queue. Reuse cached results for duplicate URLs,
while preserving empty-status handling for missing URLs, failed requests, and
empty responses.

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.

3 participants