refactor: demonolith convex backend into domain-based folder structure#51
Conversation
Code Review Roast 🔥Verdict: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: The Didit webhook signature verification is actually solid — HMAC with constant-time comparison, timestamp validation, and fingerprint tracking for brute-force protection. Someone read the OWASP cheatsheet on this one, and I'm genuinely impressed. 💀 Worst part: Those 📊 Overall: Like watching someone meticulously organize their desk by throwing everything into different drawers — technically a "refactor," but you hope they labeled the drawers correctly. The PR claims it compiles clean, but I'd feel better with a quick test of the cron job paths before merging. Files Reviewed (18 files)
Reviewed by minimax-m2.7 · 2,807,567 tokens |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58adb41a3b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const createStudioPaymentOfferV2 = useMutation(api.paymentsV2.createStudioPaymentOfferV2); | ||
| const createStudioPaymentOrderV2 = useMutation(api.paymentsV2.createStudioPaymentOrderV2); | ||
| const createStripePaymentSheetForPaymentOrderV2 = useAction( | ||
| api.paymentsV2Actions.createStripePaymentSheetForPaymentOrderV2, |
There was a problem hiding this comment.
Migrate client calls to new Convex module paths
This refactor removed monolith modules like paymentsV2, jobs, and users in favor of nested paths (e.g. payments/core, jobs/applications, users/getCurrent), but this code still calls old references such as api.paymentsV2.createStudioPaymentOfferV2. Those references resolve to function names that no longer exist in Convex, so these mutations/queries fail at runtime with “function not found,” breaking core studio job/payment flows.
Useful? React with 👍 / 👎.
| await ctx.runMutation(internal.security.webhookSecurity.recordInvalidSignatureAttempt, { | ||
| provider: "didit", | ||
| fingerprint, | ||
| }); |
There was a problem hiding this comment.
Enforce Didit webhook throttle before processing
Invalid-signature attempts are recorded, but this handler never checks throttle state before continuing to process incoming requests. As a result, fingerprints that should be blocked can still hit this endpoint indefinitely and force full verification/mutation work on every retry, effectively disabling the intended invalid-signature rate limiting for the Didit webhook path.
Useful? React with 👍 / 👎.
Summary
internal.*andapi.*paths updated to match new file structure.env.local)npx convex dev --onceFolder structure
Key changes
jobs.ts(3,175 lines) → 11 focused filesusers.ts(2,023 lines) → 4 files + settings split toinstructors/andstudios/paymentsV2.ts(2,350 lines) → 5 filesinternal.jobs.cleanupCancelledJobs→internal.jobs.cancellation.cleanupCancelledJobs)This PR rewrites history to scrub a Mapbox token from old commits. Must be merged with force-push to master (temporarily unprotect the branch).