Repository navigation
feat: add random low-completion contribution flow - #368
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds 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. ChangesRandom Low-Completion Gear
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
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (22)
docs/developer-api.mddocs/gear-specification-system.mdmessages/de.jsonmessages/en.jsonmessages/es.jsonmessages/fr.jsonmessages/it.jsonmessages/ja.jsonmessages/ms.jsonmessages/zh.jsonsrc/app/[locale]/(pages)/contribute/random/page.tsxsrc/app/[locale]/(pages)/developer/docs/page.tsxsrc/app/[locale]/(pages)/page.tsxsrc/app/api/v1/gear/random-low-completion/route.tssrc/components/home/random-contribution-banner.tsxsrc/server/developer-api/service.tssrc/server/gear/service.tstests/unit/developer-api-random-low-completion-route.test.tstests/unit/developer-api-service.test.tstests/unit/developer-docs-page.test.tstests/unit/gear-publication-state-service.test.tstests/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
/docswhen code changes could cause documentation drift.
Files:
src/app/[locale]/(pages)/contribute/random/page.tsxsrc/app/api/v1/gear/random-low-completion/route.tstests/unit/developer-api-service.test.tssrc/components/home/random-contribution-banner.tsxdocs/gear-specification-system.mdtests/unit/developer-api-random-low-completion-route.test.tsmessages/ja.jsonmessages/ms.jsonsrc/server/developer-api/service.tssrc/app/[locale]/(pages)/page.tsxtests/unit/developer-docs-page.test.tsmessages/fr.jsontests/unit/random-contribution-navigation.test.tsmessages/it.jsonsrc/app/[locale]/(pages)/developer/docs/page.tsxdocs/developer-api.mdmessages/en.jsonmessages/zh.jsonmessages/de.jsonmessages/es.jsonsrc/server/gear/service.tstests/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.tsxsrc/app/api/v1/gear/random-low-completion/route.tstests/unit/developer-api-service.test.tssrc/components/home/random-contribution-banner.tsxtests/unit/developer-api-random-low-completion-route.test.tssrc/server/developer-api/service.tssrc/app/[locale]/(pages)/page.tsxtests/unit/developer-docs-page.test.tstests/unit/random-contribution-navigation.test.tssrc/app/[locale]/(pages)/developer/docs/page.tsxsrc/server/gear/service.tstests/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 genericlibmodules; pages, API routes, and server components should prefer importing fromservice/.
Server actions must not be used for fetching; use them only for mutations or other client-to-server actions.
Use TypeScript type checking withnpm run typecheck; for large changes, run the combinednpm run checkvalidation pass.
Files:
src/app/[locale]/(pages)/contribute/random/page.tsxsrc/app/api/v1/gear/random-low-completion/route.tstests/unit/developer-api-service.test.tssrc/components/home/random-contribution-banner.tsxtests/unit/developer-api-random-low-completion-route.test.tssrc/server/developer-api/service.tssrc/app/[locale]/(pages)/page.tsxtests/unit/developer-docs-page.test.tstests/unit/random-contribution-navigation.test.tssrc/app/[locale]/(pages)/developer/docs/page.tsxsrc/server/gear/service.tstests/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.jsonmessages/ms.jsonmessages/fr.jsonmessages/it.jsonmessages/en.jsonmessages/zh.jsonmessages/de.jsonmessages/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!
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary
GET /api/v1/gear/random-low-completiondeveloper endpoint with a canonical URL and no-store caching/contribute/randomredirect and a homepage “Surprise Me” contribution bannerLinkButtonloading state for both local homepage banner actions while disabling prefetch for the random routeUser 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
git diff --checkKnown baseline issue
npm run typecheckremains blocked by the existing unrelated error intests/unit/spec-registry-i18n.test.ts:257, wherestring | number | null | undefinedis not assignable tonumber | null | undefined.