feat: flag suspicious XP gain patterns#185
Conversation
|
@saurabhhhcodes is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey @saurabhhhcodes You have 4 open PRs right now. The limit is 3 at a time. Please get your existing PRs merged or closed before opening new ones:
This PR will remain open but won't be reviewed until you're under the limit. See our Contributing Guidelines for details. |
|
Quick housekeeping update: I closed older PR #140, so I am now back within the repo's 3-open-PR limit.\n\nThis PR is the current scoped implementation for suspicious XP gain patterns, and the claim-limit check is passing. The only visible external status is Vercel team authorization, which I cannot approve from my fork. Ready for maintainer review whenever convenient. |
|
Quick validation update for #90:
The PR is mergeable from GitHub's side. The only red status I can see is Vercel team authorization, which needs maintainer/project access and is not an app failure from this branch. For scoring on merge, this should fit |
Siddhartha-singh01
left a comment
There was a problem hiding this comment.
Much cleaner re-implementation than #136 @saurabhhhcodes sequential migration
number, pure detection helpers, sensible dedupe-on-open via the unique constraint,
RLS-enabled service-role-only audit table. Good shape overall.
Two things before this can merge:
-
Unbounded queries (regression from #136). The detection cron's three reads
xp_events,pull_requests(merged),pull_request_reviewshave no.limit()
/.range()/ pagination. Supabase caps results at 1000 rows by default, so once
the platform has >1000 events in a day (or >1000 reviews in a week), the audit
silently misses everything past the cap. We caught this same issue in #136 and
you fixed it with afetchAllAuditRowspaginator that fix didn't carry over to
this fresh PR. Please paginate again (or use an explicit ordered window). For an
anti-abuse audit, silently missing data defeats the purpose. Same applies to the
existingRowsandfetchPullRequestsByIdqueries. -
CI hasn't run, and the PR notes vitest couldn't run locally (Rollup macOS dlopen
thing). So typecheck and prettier are verified, but tests aren't let's not
merge untilCI / checkis green. A maintainer will need to approve workflows on
this fork PR each time.
Small housekeeping: #136 is still open and closes the same #90 with the same
feature. Could you close #136 explicitly (since #185 is the canonical version) so we
aren't tracking two PRs for the same thing?
Once the queries are paginated and CI is green, this is in good shape. The detection
logic itself looks right.
|
Thanks for the careful review. I pushed commit |
199ecda to
917c545
Compare
|
Rebased this PR onto the latest Validation after rebase:
Those passed locally. I also retried the focused Vitest command, but it is still blocked locally by the repo/macOS Rollup optional native package loading issue ( |
…-xp-90 # Conflicts: # src/app/api/inngest/route.ts # src/inngest/functions/maintenance.ts
|
Synced this branch with the latest |
|
Quick re-review note on the earlier requested-changes review: The three merge blockers called out there are addressed on the current branch state:
Issue #90 is still assigned to me and carries |
Summary
flagged_accountstable with Drizzle schema support for open/reviewed/dismissed flagsDetection rules
Validation
node_modules/.bin/tsc --noEmitnode_modules/.bin/eslint src/lib/xp/suspicious-patterns.ts src/lib/xp/suspicious-patterns.test.ts src/inngest/functions/maintenance.ts src/app/actions/maintainer.ts 'src/app/(app)/maintainer/page.tsx' src/app/api/inngest/route.tsgit diff --checkNote:
node_modules/.bin/vitest run src/lib/xp/suspicious-patterns.test.tsis blocked locally by Rollup's optional native@rollup/rollup-darwin-arm64package failing macOS code-signature loading in this environment. The test file is included and TypeScript/ESLint pass.Closes #90