Skip to content

Commit 8aa8800

Browse files
Merge pull request #12 from thribhuvan003/codex/trayy-production-hardening
fix: harden production ordering and portal flows
2 parents 59a1f6d + 3bd7bdb commit 8aa8800

140 files changed

Lines changed: 7277 additions & 9659 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ NEXT_PUBLIC_RAZORPAY_LIVE=
1111

1212
# Resend — transactional email (invites, admin recap). Optional; no-ops if blank.
1313
RESEND_API_KEY=
14+
RESEND_FROM_EMAIL="Tray <orders@your-verified-domain.example>"
1415

15-
# Upstash Redis — rate-limit. Optional; in-memory fallback if blank.
16+
# Upstash Redis — required in production; local development has an in-memory fallback.
1617
UPSTASH_REDIS_REST_URL=
1718
UPSTASH_REDIS_REST_TOKEN=
1819

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Security vulnerability
4-
url: https://github.com/thribhuvan003/tray/security/advisories/new
4+
url: https://github.com/thribhuvan003/trayy/security/advisories/new
55
about: Please report security issues privately via GitHub Security Advisories.

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'sb_publishable_e0_d-CRp71kmQbDbQmO1BQ_dGxGgNKz' }}
2929
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
3030
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
31+
# Build-time placeholders only. Production must provide real Upstash
32+
# credentials in its deployment environment.
33+
UPSTASH_REDIS_REST_URL: https://ci-placeholder.invalid
34+
UPSTASH_REDIS_REST_TOKEN: ci-build-placeholder
3135
QSTASH_TOKEN: ${{ secrets.QSTASH_TOKEN }}
3236
QSTASH_CURRENT_SIGNING_KEY: ${{ secrets.QSTASH_CURRENT_SIGNING_KEY }}
3337
QSTASH_NEXT_SIGNING_KEY: ${{ secrets.QSTASH_NEXT_SIGNING_KEY }}

.mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"supabase": {
4+
"type": "http",
5+
"url": "https://mcp.supabase.com/mcp?project_ref=mepowrsrbjddaqfvzvtc&features=docs%2Caccount%2Cdatabase%2Cdebugging%2Cdevelopment%2Cfunctions%2Cbranching"
6+
}
7+
}
8+
}

README.md

Lines changed: 89 additions & 375 deletions
Large diffs are not rendered by default.

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Tray handles real money (UPI payments) and PII (student emails, order history).
66

77
**Please do not open a public GitHub issue for security problems.**
88

9-
Report privately via [GitHub Security Advisories](https://github.com/thribhuvan003/tray/security/advisories/new). Include:
9+
Report privately via [GitHub Security Advisories](https://github.com/thribhuvan003/trayy/security/advisories/new). Include:
1010

1111
- A description of the issue and its impact
1212
- Steps to reproduce (or a proof of concept)
@@ -19,7 +19,7 @@ You should receive an acknowledgement within **72 hours**. We aim to triage and
1919

2020
In scope:
2121

22-
- The deployed Tray application (`*.tray.app` and preview URLs)
22+
- The deployed Tray application (`trayy.vercel.app` and its Vercel preview URLs)
2323
- This repository's source code, CI configuration, and infrastructure as code
2424
- Supabase RLS policies and database functions in `supabase/migrations/`
2525
- Razorpay webhook handling and order capture flow

docs/SEO-2026-CHECKLIST.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

docs/adr/0004-payment-mode-direct-upi.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# 0004 — Per-tenant payment_mode; direct-UPI as the default rail
22

33
## Status
4-
Accepted
4+
Accepted; implementation updated through migration `0031`
5+
6+
This record preserves the production failure and decision that introduced
7+
per-tenant payment modes. The current Razorpay path now loads Razorpay Checkout
8+
and verifies capture on the server. The direct-UPI path is confirmed atomically
9+
by staff through `safe_confirm_direct_upi_and_start`. Migration `0031` is the
10+
current deployment prerequisite for these payment and inventory guarantees.
511

612
## Context
713
Production symptom: a student paid (money debited) but the order never reached the
@@ -56,7 +62,6 @@ The canteen repays manually from their UPI app.
5662
payment at the counter (the UNVERIFIED badge already exists in the kitchen
5763
board). A dishonest student could tap-without-paying; the counter check is the
5864
guard, exactly like every small UPI shop in India.
59-
- Direct UPI refunds are manual (admin "refunds owed" payout — UI to follow).
60-
- **Deploy ordering:** migration `0024` MUST be applied to the database BEFORE the
61-
new code is deployed. The combined `select(is_open, paused_until, payment_mode)`
62-
errors out if the column is missing, which silently skips the open/paused guard.
65+
- Direct UPI refunds are manual and are tracked as refunds owed to the customer.
66+
- **Deploy ordering:** migrations must be applied in filename order before the
67+
matching application code. The current implementation requires migration `0031`.

docs/design-system-figma.md

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)