Skip to content

agent: @U0AJM7X8FBR Admin - Privy login data.#305

Open
sweetmantech wants to merge 1 commit intotestfrom
agent/-u0ajm7x8fbr-admin---privy-log-1773755848646
Open

agent: @U0AJM7X8FBR Admin - Privy login data.#305
sweetmantech wants to merge 1 commit intotestfrom
agent/-u0ajm7x8fbr-admin---privy-log-1773755848646

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

Automated PR from coding agent.

Prompt: @U0AJM7X8FBR Admin - Privy login data.
• actual: I can't review the number of Privy logins on a daily, weekly and monthly basis. I can't see a total count nor a table of the results for any of those time frames.
• requires: Admin codebase has a page where I can review the number of Privy logins on a daily, weekly and monthly basis. I CAN see a total count and a table of the results for any of those time frames.

Returns Privy login statistics (total count + login table) filtered
by daily/weekly/monthly time period. Requires admin authentication.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ea164b0e-28b1-41c9-8ce5-b15fdc5c58c8

📥 Commits

Reviewing files that changed from the base of the PR and between 0b5421f and 4097f5c.

⛔ Files ignored due to path filters (2)
  • lib/admins/privy/__tests__/getPrivyLoginsHandler.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/admins/privy/__tests__/validateGetPrivyLoginsQuery.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (4)
  • app/api/admins/privy/route.ts
  • lib/admins/privy/fetchPrivyLogins.ts
  • lib/admins/privy/getPrivyLoginsHandler.ts
  • lib/admins/privy/validateGetPrivyLoginsQuery.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/-u0ajm7x8fbr-admin---privy-log-1773755848646
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 17, 2026

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

Project Deployment Actions Updated (UTC)
recoup-api Ready Ready Preview Mar 17, 2026 2:00pm

Request Review

Copy link
Copy Markdown
Collaborator

@recoup-coding-agent recoup-coding-agent left a comment

Choose a reason for hiding this comment

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

Code Review: Admin - Privy login data

Summary

Adds GET /api/admins/privy endpoint returning Privy login statistics (daily/weekly/monthly). Paginated Privy Management API calls with early exit when records fall outside the time window. Clean separation with test coverage.

CLEAN Code Assessment

SRP ✅ fetchPrivyLogins handles API calls, getPrivyLoginsHandler handles orchestration, validateGetPrivyLoginsQuery handles validation.

OCP ✅ Additive — no existing code modified.

DRY ⚠️ Defines its own z.enum(["daily", "weekly", "monthly"]) instead of extending the existing adminPeriodSchema used in other admin endpoints. Not blocking since the Privy endpoint intentionally excludes "all", but worth noting.

YAGNI ✅ No over-engineering.

Issues Found

🟡 Suggestions

1. Non-null assertions on unchecked env vars

const appId = process.env.PRIVY_APP_ID!;
const appSecret = process.env.PRIVY_PROJECT_SECRET!;

If these aren't set, appId will be undefined, and the Basic auth header will be Basic dW5kZWZpbmVkOnVuZGVmaW5lZA== — silently making valid-looking requests that fail at the Privy API with a cryptic error. Validate these at the top of fetchPrivyLogins and throw with a clear message if missing.

2. Unbounded pagination loop

while (true) {

If order=desc doesn't work as expected or the Privy API has a bug, this could loop indefinitely. Add a safety cap (e.g., maxPages = 100) to bound the loop.

3. adminPeriodSchema DRY opportunity

If the shared adminPeriodSchema can be extended to support a subset (or if a new adminTimePeriodSchema excluding "all" makes sense), centralizing the daily/weekly/monthly enum would avoid future drift.

Security ✅

Admin auth enforced. Privy credentials read from env (not hardcoded). No sensitive data in responses.

Verdict: approve (with suggestions)

Clean, well-tested PR. Address the env var validation before relying on this in production.

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