Fix controlled-launch contact intake persistence#188
Conversation
|
Deployment failed with the following error: Learn More: https://vercel.com/garciamirandaramirez-2606s-projects?upgradeToPro=build-rate-limit |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's GuideAdds a fail-closed Supabase Edge Function-based contact intake path, wires the API route to prefer Prisma when available and fall back to the gateway otherwise, ensures persistence before optional notification with throttling, honeypot, and auditing, and adds regression tests and Deno config for the new gateway. Sequence diagram for contact intake via Supabase gateway fallbacksequenceDiagram
actor User
participant ContactRoute as ContactRoute_POST
participant SupabaseGatewayClient as submitContactGateway
participant EdgeFunction as gem_contact_gateway
participant DB as support_bookings
participant Resend as ResendAPI
participant Audit as audit_logs
User->>ContactRoute: POST /api/contact
ContactRoute->>ContactRoute: shouldUseSupabaseGateway
alt use_supabase_gateway
ContactRoute->>SupabaseGatewayClient: submitContactGateway
SupabaseGatewayClient->>EdgeFunction: invokeGateway action_submit
EdgeFunction->>EdgeFunction: submitContact
EdgeFunction->>DB: enforceEmailRateLimit select_support_bookings
EdgeFunction->>DB: insert_support_bookings
EdgeFunction->>Resend: sendNotification
Resend-->>EdgeFunction: notificationDelivery
EdgeFunction->>DB: update_support_bookings_delivery_status
EdgeFunction->>Audit: insert_audit_logs
EdgeFunction-->>SupabaseGatewayClient: ContactGatewayResult
SupabaseGatewayClient-->>ContactRoute: ContactGatewayResult
ContactRoute-->>User: 200 ok_true_persistence_supabase_gateway
else gateway_unavailable
SupabaseGatewayClient--xContactRoute: error
ContactRoute-->>User: 503 ok_false_error_message
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Deployment failed with the following error: Learn More: https://vercel.com/dpj58sq6xc-2324s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/legal-9831s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/admin-25521151s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/jamesaugustine199726-2076s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/carolinasuarez8419-9338s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/alliancetrustrealtyearner-cells-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/gemassists-projects-3feb3fa9?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/geraldhoeven-4141s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/gilbertmichael561-5155s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/victoriaeleanor544-2270s-projects?upgradeToPro=build-rate-limit |
|
Deployment failed with the following error: Learn More: https://vercel.com/support-8685s-projects?upgradeToPro=build-rate-limit |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the
/api/contactroute, the catch block forsubmitContactGatewayalways returns a 503 with a generic message; consider propagating meaningful status codes (e.g. 429 for RATE_LIMITED) and/or gateway error codes/messages so clients can distinguish transient failures from spam throttling. - The contact gateway audit log currently hardcodes
action: "admin_action"; consider using a more specific action string (e.g."contact_message_received") so these events are easier to distinguish from actual admin actions in downstream audit analysis.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the `/api/contact` route, the catch block for `submitContactGateway` always returns a 503 with a generic message; consider propagating meaningful status codes (e.g. 429 for RATE_LIMITED) and/or gateway error codes/messages so clients can distinguish transient failures from spam throttling.
- The contact gateway audit log currently hardcodes `action: "admin_action"`; consider using a more specific action string (e.g. `"contact_message_received"`) so these events are easier to distinguish from actual admin actions in downstream audit analysis.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Edge Function validation smoke — passedAuthenticated invocation was executed against canonical Supabase function Evidence:
This proves the deployed function accepts authenticated invocation, executes its validation path, fails closed for invalid input, and does not persist rejected contact data. No real contact details were used. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
gem-enterprise | 026c9fd | Jul 13 2026, 05:26 PM |
Objective
Make the public GEM Enterprise contact form durable during the controlled production launch even when the canonical Vercel runtime does not have a direct Prisma/PostgreSQL connection.
Changes
gem-contact-gatewaySupabase Edge Function.support_bookingstable before returning success.503rather than claiming success when neither persistence path is available.Clean-history security remediation
This PR supersedes closed PR #187. The superseded branch temporarily duplicated an existing Supabase publishable JWT in a new client file and was blocked by GitGuardian. The replacement branch was recreated directly from
main, excludes that intermediate history, reusessrc/lib/supabase-gateway.ts, and does not add another embedded credential location.Current change set
026c9fdbbcea480d2a7560cd5ac95608b3069e3emainData and schema impact
support_bookingsandaudit_logstables.Security and privacy
Verified
gem-contact-gatewayis deployed on the canonical Supabase project as ACTIVE, version 1, withverify_jwt=true.400, codeINVALID_REQUEST, with no timeout or transport error.support_bookingsrows, proving rejected data is not persisted.Infrastructure-blocked checks
api-deployments-free-per-day.29266090608, but the job terminated before recording any step and its log object was unavailable. This is not a passing code-verification result.Merge gate
Do not merge until all of the following are recorded:
pnpm run verifycompletes successfully on Node.js 24 through a working approved runner.support_bookingsand audit records are verified.