Skip to content

feat: add random low-completion contribution flow - #368

Merged
Flohhhhh merged 4 commits into
mainfrom
development
Jul 16, 2026
Merged

Flohhhhh merged 4 commits into
mainfrom
development

Conversation

@Flohhhhh

Copy link
Copy Markdown
Contributor

Summary

  • add a reusable gear-service selector for random low-completion contribution targets
  • prioritize the same published candidates shown on the under-construction page, then fall back to the 20 least-complete published items
  • expose the selection through the authenticated, rate-limited GET /api/v1/gear/random-low-completion developer endpoint with a canonical URL and no-store caching
  • add a localized /contribute/random redirect and a homepage “Surprise Me” contribution banner
  • use the navigation-aware LinkButton loading state for both local homepage banner actions while disabling prefetch for the random route
  • document the completeness behavior and developer API contract, with real translations across all supported locales

User and developer impact

Contributors can jump directly from the homepage to a random gear page that needs data. Every intentional click performs a fresh server-side selection without exposing an API key or prefetching a target. Developer API consumers can retrieve the same kind of target as an absolute URL; an empty published catalog returns data.url: null.

The existing under-construction list behavior remains unchanged because both features share the same completeness-row calculation and publication filtering.

Validation

  • targeted Vitest coverage for gear selection, fallback ranking, empty catalogs, developer API routing/services/docs, localized contribution redirects, banner rendering, and shared LinkButton loading behavior
  • translation key parity
  • scoped ESLint
  • Prettier and git diff --check
  • React Doctor: no issues found

Known baseline issue

npm run typecheck remains blocked by the existing unrelated error in tests/unit/spec-registry-i18n.test.ts:257, where string | number | null | undefined is not assignable to number | null | undefined.

@vercel

vercel Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sharplyphoto Ready Ready Preview, Comment Jul 16, 2026 8:11pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Flohhhhh, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 261680a4-fecc-4e5a-876a-bed42771d75c

📥 Commits

Reviewing files that changed from the base of the PR and between d3424e9 and 0105e81.

📒 Files selected for processing (1)
  • src/app/[locale]/(pages)/developer/docs/page.tsx
📝 Walkthrough

Walkthrough

Adds random low-completion gear selection with fallback behavior, exposes it through a no-store Developer API endpoint, and connects it to a localized homepage contribution banner and redirect route. Documentation, translations, and unit tests cover the new flow.

Changes

Random Low-Completion Gear

Layer / File(s) Summary
Low-completion candidate selection
src/server/gear/service.ts, tests/unit/gear-publication-state-service.test.ts
Builds reusable completeness rows, selects under-construction candidates randomly, and falls back to the 20 least-complete published items.
Developer API endpoint
src/server/developer-api/service.ts, src/app/api/v1/gear/random-low-completion/route.ts, tests/unit/developer-api-*
Returns an absolute gear URL or null through an authenticated GET endpoint with Cache-Control: no-store.
Contribution quest navigation
src/components/home/random-contribution-banner.tsx, src/app/[locale]/(pages)/contribute/random/page.tsx, src/app/[locale]/(pages)/page.tsx, tests/unit/random-contribution-navigation.test.ts
Adds localized homepage navigation to a dynamic route that redirects to selected gear or the under-construction list.
Documentation and localized copy
docs/*.md, src/app/[locale]/(pages)/developer/docs/page.tsx, messages/*.json, tests/unit/developer-docs-page.test.ts
Documents the endpoint and routing behavior and adds home and Developer API translations. Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant HomePage
  participant RandomContributionPage
  participant GearService
  participant GearPage
  HomePage->>RandomContributionPage: Open localized contribution route
  RandomContributionPage->>GearService: Select low-completion gear URL
  GearService-->>RandomContributionPage: Gear path or null
  RandomContributionPage->>GearPage: Redirect to selected gear or fallback list
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.75% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: a random low-completion contribution flow.
Description check ✅ Passed The description matches the changeset, covering the API, redirect flow, banner, translations, and caching behavior.
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.

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.

@Flohhhhh
Flohhhhh marked this pull request as ready for review July 16, 2026 19:26

@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: 1

🤖 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 `@src/app/`[locale]/(pages)/developer/docs/page.tsx:
- Around line 262-264: Update the cURL template literal in the documentation
example so each line-continuation backslash is escaped as a literal backslash,
preserving both the multiline formatting and backslashes in the rendered
command.
🪄 Autofix (Beta)

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2432e71a-0516-44d8-9b3e-90f388d7bbe1

📥 Commits

Reviewing files that changed from the base of the PR and between 56ba0ec and d3424e9.

📒 Files selected for processing (22)
  • docs/developer-api.md
  • docs/gear-specification-system.md
  • messages/de.json
  • messages/en.json
  • messages/es.json
  • messages/fr.json
  • messages/it.json
  • messages/ja.json
  • messages/ms.json
  • messages/zh.json
  • src/app/[locale]/(pages)/contribute/random/page.tsx
  • src/app/[locale]/(pages)/developer/docs/page.tsx
  • src/app/[locale]/(pages)/page.tsx
  • src/app/api/v1/gear/random-low-completion/route.ts
  • src/components/home/random-contribution-banner.tsx
  • src/server/developer-api/service.ts
  • src/server/gear/service.ts
  • tests/unit/developer-api-random-low-completion-route.test.ts
  • tests/unit/developer-api-service.test.ts
  • tests/unit/developer-docs-page.test.ts
  • tests/unit/gear-publication-state-service.test.ts
  • tests/unit/random-contribution-navigation.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (4)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

Update all relevant documentation in /docs when code changes could cause documentation drift.

Files:

  • src/app/[locale]/(pages)/contribute/random/page.tsx
  • src/app/api/v1/gear/random-low-completion/route.ts
  • tests/unit/developer-api-service.test.ts
  • src/components/home/random-contribution-banner.tsx
  • docs/gear-specification-system.md
  • tests/unit/developer-api-random-low-completion-route.test.ts
  • messages/ja.json
  • messages/ms.json
  • src/server/developer-api/service.ts
  • src/app/[locale]/(pages)/page.tsx
  • tests/unit/developer-docs-page.test.ts
  • messages/fr.json
  • tests/unit/random-contribution-navigation.test.ts
  • messages/it.json
  • src/app/[locale]/(pages)/developer/docs/page.tsx
  • docs/developer-api.md
  • messages/en.json
  • messages/zh.json
  • messages/de.json
  • messages/es.json
  • src/server/gear/service.ts
  • tests/unit/gear-publication-state-service.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Replace new hardcoded user-facing strings with translation keys for all locales.

Files:

  • src/app/[locale]/(pages)/contribute/random/page.tsx
  • src/app/api/v1/gear/random-low-completion/route.ts
  • tests/unit/developer-api-service.test.ts
  • src/components/home/random-contribution-banner.tsx
  • tests/unit/developer-api-random-low-completion-route.test.ts
  • src/server/developer-api/service.ts
  • src/app/[locale]/(pages)/page.tsx
  • tests/unit/developer-docs-page.test.ts
  • tests/unit/random-contribution-navigation.test.ts
  • src/app/[locale]/(pages)/developer/docs/page.tsx
  • src/server/gear/service.ts
  • tests/unit/gear-publication-state-service.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Do not introduce direct database access in UI or generic lib modules; pages, API routes, and server components should prefer importing from service/.
Server actions must not be used for fetching; use them only for mutations or other client-to-server actions.
Use TypeScript type checking with npm run typecheck; for large changes, run the combined npm run check validation pass.

Files:

  • src/app/[locale]/(pages)/contribute/random/page.tsx
  • src/app/api/v1/gear/random-low-completion/route.ts
  • tests/unit/developer-api-service.test.ts
  • src/components/home/random-contribution-banner.tsx
  • tests/unit/developer-api-random-low-completion-route.test.ts
  • src/server/developer-api/service.ts
  • src/app/[locale]/(pages)/page.tsx
  • tests/unit/developer-docs-page.test.ts
  • tests/unit/random-contribution-navigation.test.ts
  • src/app/[locale]/(pages)/developer/docs/page.tsx
  • src/server/gear/service.ts
  • tests/unit/gear-publication-state-service.test.ts
messages/*.json

📄 CodeRabbit inference engine (AGENTS.md)

Maintain translation-key parity across all locale files whenever keys are added, removed, or renamed in messages/en.json.

Files:

  • messages/ja.json
  • messages/ms.json
  • messages/fr.json
  • messages/it.json
  • messages/en.json
  • messages/zh.json
  • messages/de.json
  • messages/es.json
🪛 Betterleaks (1.6.1)
src/app/[locale]/(pages)/developer/docs/page.tsx

[high] 262-263: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🔇 Additional comments (31)
src/server/developer-api/service.ts (1)

445-451: LGTM!

src/app/api/v1/gear/random-low-completion/route.ts (1)

4-9: LGTM!

tests/unit/developer-api-random-low-completion-route.test.ts (1)

1-61: LGTM!

tests/unit/developer-api-service.test.ts (1)

62-82: LGTM!

messages/it.json (2)

155-157: LGTM!


1901-1902: LGTM!

messages/ja.json (2)

155-157: LGTM!


1901-1902: LGTM!

messages/ms.json (2)

155-157: LGTM!


1901-1902: LGTM!

messages/zh.json (2)

155-157: LGTM!


1901-1902: LGTM!

docs/developer-api.md (1)

71-90: LGTM!

docs/gear-specification-system.md (1)

51-51: LGTM!

messages/en.json (2)

155-157: LGTM!


1901-1902: LGTM!

messages/de.json (2)

155-157: LGTM!


1901-1902: LGTM!

messages/es.json (2)

155-157: LGTM!


1901-1902: LGTM!

messages/fr.json (2)

155-157: LGTM!


1901-1902: LGTM!

tests/unit/developer-docs-page.test.ts (2)

67-67: LGTM!


83-91: LGTM!

src/server/gear/service.ts (1)

1371-1406: LGTM!

Also applies to: 1535-1546, 1555-1556, 1558-1574

tests/unit/gear-publication-state-service.test.ts (1)

1-1: LGTM!

Also applies to: 51-61, 70-74, 86-110, 296-334, 336-356, 358-363

src/app/[locale]/(pages)/contribute/random/page.tsx (1)

1-19: LGTM!

src/components/home/random-contribution-banner.tsx (1)

7-28: LGTM!

src/app/[locale]/(pages)/page.tsx (2)

12-15: LGTM!


250-258: LGTM!

tests/unit/random-contribution-navigation.test.ts (1)

1-92: LGTM!

Comment thread src/app/[locale]/(pages)/developer/docs/page.tsx Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Flohhhhh
Flohhhhh merged commit f93f34f into main Jul 16, 2026
5 checks passed
@Flohhhhh Flohhhhh mentioned this pull request Jul 18, 2026

This branch was successfully deployed

1 active deployment
Preview — 0105e81b Deployed Jul 16, 2026 by vercel[bot]
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.

1 participant