Repository navigation
Stripe payments for paid event quotas - #81
ccruzkauppila wants to merge 27 commits into
Conversation
paymentsEnabled() is the single switch for Stripe payments
(PAYMENTS_ENABLED=1 plus STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET).
Fee helpers work in integer cents: totalChargeCents, guildReceivesCents
(halves round up, computed without float drift), isValidTicketPriceCents
and formatEuro ("18,00 €" in every language). Adds a jest project for
@app/lib with unit tests, and the stripe package (v23) to @app/server
and @app/worker.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
PaymentsPlugin adds Query.paymentsEnabled (mirroring ssoLoginEnabled) and SharedLayout_Query fetches it so every page knows whether payment UI exists. utils/stripe.ts builds the Stripe client on first use and throws while payments are disabled. The server logs "payments disabled" at startup when the flag is off, and the setup script prompts for the three env vars next to the Keycloak ones (.env.ci gets commented placeholders). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
Adds current/5-payments-schema.sql (idempotent): - Types payment_mode, payment_method, payment_status, registration_payment_status and event_payment_summary. - events.payment_mode (default NONE), send_unpaid_email_on_close (forced on in AFTER_REGISTRATION mode by a check constraint and by create_event/update_event), unpaid_close_email_sent_at, last_payment_reminder_sent_at; quotas.price_cents (0 or >= 25); registrations.price_cents (price snapshot, null = no payment). - event_input and the create/update_event_quotas types gain the new fields; create_event, update_event, create_event_quotas and update_event_quotas (built on current/2-*) write them. Null fields keep existing values, and the original statements are kept as they were so events without payment settings are handled exactly as before. - Switching an event from NONE to a paid mode backfills price_cents on finished registrations in paid quotas (app_hidden helper, since update_event runs as the visitor). - A before trigger snapshots the quota price when a registration of a paid event is finished, so create_registration itself is unchanged and the confirmation email still fires once. - app_public.payments (rows survive registration/event/quota deletion via on delete set null, one PAID row per registration via a partial unique index, select-only RLS for admins and event organization members, no write grants) and app_private.stripe_events for webhook idempotency. - registrations_payment_status and events_payment_summary computed columns, null unless the user may manage the event's payments. - admin_mark_registration_paid / admin_unmark_registration_paid, admin_send_payment_reminders, and refund jobs (payment__refund) queued by admin_delete_registration(id, refund default true) and delete_registration for paid Stripe payments. The new composite field breaks positional row() casts, so the existing update_event_quotas test passes a price, and the adminDeleteRegistration error snapshots now show the (uuid,boolean) signature. data/schema.graphql is re-exported; data/schema.sql only holds committed migrations and is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
- Refunds on delete now come from one before delete trigger on registrations (_200_queue_payment_refund) instead of the two delete functions, so deleting an event (registrations cascade) also queues payment__refund for paid Stripe payments, and a row can only queue its refund once. admin_delete_registration(refund => false) switches the trigger off for its own delete only through the transaction-local setting ilmo.refund_deleted_registrations (app_private.delete_registration_without_refund). The GDPR job turns it off too: deleting registrations 60 days after the event is retention, not a cancellation. - delete_registration locks the registration row (for update) before deleting and raises "not found" when the row is gone, so concurrent calls with the same token can't both succeed. Lines up to the signup check keep their numbers, so the server error snapshots are unchanged. - events_payment_summary computes the guild share in numeric, so large amounts can't overflow integer maths; quotas.price_cents is capped at 1 000 000 cents (10 000 EUR), mirrored by MAX_TICKET_PRICE_CENTS and isValidTicketPriceCents in @app/lib. - data/schema.sql was checked against a fresh dump (plus the PG14 deparse fix) and already matches: it only holds committed migrations. Tests cover event deletion, the refund opt-out's scope, the GDPR job not refunding, a real concurrent delete_registration race, the price cap and a large-amount summary. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
Mutation.createCheckoutSession(updateToken, language) starts Stripe Checkout for a registration and returns the session URL. It runs on the root pool in one transaction that holds the registration's row lock: refuse with a PaymentErrorCode (PAYMENTS_DISABLED, REGISTRATION_NOT_FOUND, PAYMENT_NOT_REQUIRED, ALREADY_PAID, PAYMENT_REFUNDED, IN_QUEUE, PAYMENT_NOT_OPEN) when it can't be paid, expire the registration's other open sessions (a session completed meanwhile refuses as ALREADY_PAID), insert a PENDING payment, create the session and store its id. The session is card only (allowed_payment_method_types, since stripe 23 dropped payment_method_types), in the request language (fi, en, se -> sv), with the ticket and the "Service fee / Palvelumaksu" line items, the registration/event/quota/payment/slug metadata on the session and the PaymentIntent, an idempotency key per payment, and success/cancel URLs back to /<lang>/pay/<token>. If saving fails after Stripe created the session, the session is expired again. Query.paymentByUpdateToken returns what the /pay page needs: event, quota, name, price, fee and total, payment status, paid/refund details, queue status and position, registration close time, payment mode and blockedReason (the same PaymentErrorCode). Null while payments are off. POST /api/stripe/webhook (installStripeWebhook, registered only while payments are enabled) reads the raw body through a content type parser scoped to its own encapsulated plugin, verifies the signature with webhooks.constructEvent and records the event id in app_private.stripe_events in the same transaction as its effect, so redeliveries are skipped and failures (500) are retried by Stripe: - checkout.session.completed (paid): mark the payment PAID and queue payment__send_received_email; for a deleted registration keep it PAID and queue payment__refund; when the registration already has a PAID payment, detach this one (one PAID row per registration) and queue payment__refund with full: true. Falls back to the payment id in the metadata when the session id was never stored. - checkout.session.expired: PENDING -> EXPIRED. - charge.refunded: record the refunded amount; REFUNDED once at least the ticket price is refunded. Unknown payment intents are logged and ignored. The exact path is exempt from CSRF protection while payments are enabled. app_private.registration_payment_status(registration) is the status logic without the permission guard, shared by the guarded computed column and the server. Tests mock the Stripe client (webhook signatures use the real helper): session params snapshot, languages, every refusal, expiry of an older session, rollback on Stripe errors; webhook signature checks, idempotency, each event's effect, both refund cases, the metadata fallback, a database failure, and the CSRF bypass on the exact path only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
…rdown setup() only stored its resources once every step succeeded, and teardown() returned early without them. When setup threw (e.g. the test database was dropped by a concurrent setup:db) or was still running when afterAll fired, the ioredis client stayed connected and jest never exited. Track resources as they are created, wait for an in-flight setup, and always disconnect. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
New graphile-worker tasks (everything is a no-op, or for refunds a retried
failure, while paymentsEnabled() is false):
- payment__refund { paymentId, full? }: refunds a PAID card payment with
stripe.refunds.create (ticket price, or ticket + service fee with full),
idempotency key refund-<paymentId>, then in one transaction marks the
payment REFUNDED (refunded amount, refund id) and queues
payment__send_refund_email. Stripe errors and failed refunds throw so
graphile-worker retries; manual, pending, expired, already refunded and
intent-less payments are skipped with a log line.
- payment__send_reminder { registrationId, closed? }: payment reminder
(board 13) with the /pay link; skipped if the registration was paid,
refunded, queued, deleted or needs no payment by the time it runs.
- payment__send_received_email { paymentId }: payment received (board 14);
manual payments leave out the service fee row.
- payment__send_refund_email { paymentId, amountCents?, full? }: refund
issued (board 15). Payment rows hold no personal data, so when the
registration is gone (or a duplicate was detached from it) the address
comes from the Stripe Checkout Session.
- event__send_unpaid_on_close (crontab, every minute): for paid events with
the close email on whose registration has ended and whose
unpaid_close_email_sent_at is null, sets it and queues reminders with
closed: true for unpaid registrations holding a spot, in one transaction
with for update skip locked, so each event is handled once.
Existing tasks:
- registration__send_confirmation_email adds price, serviceFee, total
(cents), paymentMode, isQueued, isPaid, payLink (/pay/<update token>, only
when payable now) and the registration end date/time.
- registration__process_queue adds the payment variables and payLink when
the event is paid and either the mode is DURING_REGISTRATION or signup has
closed.
Both add nothing when no payment applies, so events without payments send
the same payload as before.
Templates: event_registration and spot_from_queue get a payment block inside
{%- if price ... %} with whitespace control, so non-paid events render byte
for byte as before (snapshotted from the old templates). New
payment_reminder, payment_received and payment_refund templates, bilingual,
built from payment_macros.njk (box, pay button, amount table). Amounts are
cents in variables; a `euro` nunjucks filter (formatEuro) formats them in
both the worker and the server environment. The plain text versions lay out
.amounts tables as tables.
EmailsPlugin: payment variables on EmailTemplateVariables; the Emails page
lists only *.mjml.njk files, and lists the payment emails with example
payment variables only while payments are on, so its output is unchanged
with payments off.
Tests: @app/worker gets a jest project; tasks run directly against the test
database with a mocked Stripe client: refund amounts (ticket vs full),
idempotency key on retry, skips, reminder skip-if-paid/queued, received and
refund email contents and recipients, close job once per event and skip
locked, confirmation and queue email variables (unchanged for non-paid
events), template snapshots. Server: renderEmailTemplates with payments on
and off.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
Lets parallel test runs point at separate redis databases. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Event form: Payments section on the General tab (mode radio group and the close-of-registration email toggle, locked on in after mode), quota ticket prices in euros with a live "Guild receives" estimate, the price-change warning and footnotes. Prices are sent as cents. - Registrations tab: summary tiles, All / Unpaid / Paid filter, last reminder time and "Send reminder to N unpaid" with a confirm dialog, Payment column, row actions at the right end with a menu for Mark as paid / Undo manual payment. - Delete dialog offers the ticket refund for card payments and warns about manual ones; passes refund to adminDeleteRegistration. - CSV download adds payment status and price columns when payments show. - Everything is hidden when payments are disabled or the event has no payments, keeping the existing UI and requests unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Everything is hidden while paymentsEnabled() is false or the event's
payment mode is NONE; the forms and pages then render as before.
- Event page (board 1): EventQuotasCard shows each quota's ticket price
("18,00 €") or "Free" inside its button, and a card/Apple Pay/Google
Pay note when any quota is paid. paymentMode and priceCents are added to
the event page fragments.
- Registration form (board 2): for paid quotas a payment block with
ticket, service fee and total and a "Register and pay X €" button
(during mode), the "payment link when registration closes" block
(after mode), or a queue notice and "Join the queue" when the spot
claimed on opening the form is queued (new ClaimedRegistrationStatus
query). In during mode a successful registration calls
createCheckoutSession and redirects to Stripe Checkout; if that fails
the normal success flow runs and the email carries the link.
- New /pay/[updateToken] page with PaymentCard (boards 4 and 5): unpaid,
returned without paying, confirming (polls every 2 s for up to 30 s
after status=success), paid, paid manually, refunded, in queue, opens
later, free, payments disabled and not found.
- Update registration page (board 6): paid/unpaid banner with a pay link;
deleting a card-paid registration opens a dialog with the paid amount,
the non-refunded service fee and the refund; a manually paid one notes
that it is not refunded automatically.
- @app/lib paymentStates: pure helpers for the form variant, the /pay
state and the cancel refund, with unit tests.
- Graphcache keys for the keyless RegistrationPayment and
CreateCheckoutSessionPayload types.
- Translations fi/en/se (payments.json, register_event.json,
events.json). Server mutation snapshots gain paymentMode/priceCents.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Add `_one` forms for the quota price-change warning (fi, en). - Warn when switching an event with registrations from no payments to a paid mode. - Show the refund-aware delete dialog for every paid row, even before the payment summary loads. - Disable the payment menu while a request runs and confirm Undo manual payment with a Popconfirm. - Correct the quota price comment in EventForm. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- createCheckoutSession logs any non-PaymentError (Stripe, database) and throws a generic CHECKOUT_FAILED error instead, so no server or Stripe error text reaches the caller. New server test. - /pay shows only "Could not open the payment page" for errors that are not a known blocking code. - The pay page and the registration form redirect only to https://checkout.stripe.com URLs (isStripeCheckoutUrl, with tests); anything else takes the fallback path. - RegistrationPayment.paidTicketCents exposes the stored ticket amount; the cancel dialog shows it as the refund instead of recomputing it from the current service fee. - The delete-and-refund dialog closes only when deleting succeeds and shows the error otherwise. - Submit waits (loading, plain "Register" label) until the claimed spot's queue status is known for paid quotas. - The claimed update token is cleared once the registration is created, so a page restored from the back/forward cache can't delete it on "back". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> # Conflicts: # @app/graphql/.persisted_operations/0a07a6d1844498a77610cf13a1247ff6ce109ba265c359fcc428b7ae5b2ff843.graphql # @app/graphql/.persisted_operations/3e6aaeedc384cbd89e914b9da302ccf0f39fae55fa66caab56fcac6e8c8310f8.graphql # @app/graphql/.persisted_operations/53a3d56c3c2ee2010857b15fffa6d2e117c243be1c4e76cc133644b62677d6b4.graphql # @app/graphql/.persisted_operations/d2e30e317d3ce345395e0df06d8f98b65de42c73a2d66abfcee4be32563c985c.graphql # @app/graphql/.persisted_operations/ee194a404f71f86061a2bf2a0720010115cf1b9de8fdb72b3088935ab9d15e1b.graphql # @app/graphql/.persisted_operations/f8a8bf398770887fbfe0f7c66bc55e6c87d92d3a8d3a43bbbfed47c331a27f65.graphql # @app/graphql/client.json # @app/graphql/server.json # @app/lib/src/withUrql.ts
Cypress specs for the paid flows (payments_admin, payments_register) with Checkout stubbed and payments completed by a new completeStripeCheckout server command that posts a signed checkout.session.completed event to the webhook. createTestEventData takes paymentMode and priceCents. The sharded CI Cypress job runs with payments on (dummy keys); the payments specs skip themselves when payments are off. docs/payments.md: local testing with your own Stripe test-mode keys and the Stripe CLI, refunds, Stripe dashboard setup, turning the flag off. pnpm setup optionally asks for the Stripe keys. README links the doc. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Webhook: charge.refunded arriving before checkout.session.completed is kept in app_private.stripe_early_refunds and applied when the payment is recorded; refunded amounts only grow, so out-of-order events can't lower them. - Webhook: checkout.session.completed checks amount_total and currency against the payment row; a mismatch is detached and refunded by payment intent. - Webhook: a paid session with no payment row is refunded by payment intent when its metadata names this Ilmo (new ilmo_url metadata = ROOT_URL), so instances sharing a Stripe account never refund each other's payments. - Checkout: no transaction or row lock is held across Stripe calls. A short transaction reserves a PENDING row; old sessions are expired and the new one created outside it; the session id is stored only while the row is still PENDING (a newer click wins). Failures expire the session and remove the row. - paymentByUpdateToken maps unexpected errors to PAYMENT_LOOKUP_FAILED instead of passing database text to the client. - payment__refund: refunds at most what is still refundable after partial dashboard refunds (skips when nothing is left), adds to refunded_amount_cents, fails visibly when the payment intent is missing, can refund a bare payment intent, and documents the idempotency-key window and the lost-email gap. - GDPR deletion turns refunds off in an explicit transaction instead of a set_config CTE. - admin_mark_registration_paid refuses NONE-mode events and queued registrations; admin_send_payment_reminders has a 10-minute server-side cooldown and orders by (created_at, id). - payment_actions / payment_status tests no longer assume which registration is queued when created_at ties (the flaky :228 case). - jest.config.base sets IN_TESTS so direct jest runs behave like pnpm test. - New tests: webhook ordering, amount/currency check, orphan sessions, makeApp webhook registration, checkout lock and supersede, refund amounts, GDPR task, lookup error masking. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Pay page shows the event time with the full year and an en dash (31.10.2026 18:00 – 1.11.2026 02:00), as in the design. - Paid events show "N / M · K in queue" under each quota (board 1); other events keep the plain label. - Payment mode choices are bordered option cards (board 7). - The Payment column of the registrations table is sortable (unpaid first). - The CSV export writes translated payment status labels, and a question labelled "paymentStatus" or "price" no longer overwrites the payment columns (they get an " (Ilmo)" suffix instead). - PaymentCard dividers use the antd colorSplit token; the delete-and-refund button's data-cy no longer needs @ts-ignore. - fi and en translations for the queue count. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Advisory lock per payment intent in checkout.session.completed and charge.refunded, so an early refund can't slip past the completed handler. - Early refunds older than 30 days are purged. - Duplicate and mismatched payments apply an early refund first and still refund whatever of the charge is left. - payment__refund: a partial dashboard refund counts towards the ticket price (the fee is still kept); charge_already_refunded counts as done. - GDPR task: a failing rollback no longer hides the original error. - docs: instances sharing a test account and ROOT_URL may refund each other's orphan sessions. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Resolve the e2e.yml conflict by keeping both changes: the payments env vars and main's watch --once step for current migrations. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
📦 Next.js Bundle Analysis for @app/clientThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
| Page | Size (compressed) |
|---|---|
global |
268.38 KB (🟡 +2.37 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
New Page Added
The following page was added to the bundle from the code in this PR:
| Page | Size (compressed) | First Load | % of Budget (450 KB) |
|---|---|---|---|
/pay/[updateToken] |
246.5 KB |
514.88 KB | 114.42% |
Twenty-six Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load | % of Budget (450 KB) |
|---|---|---|---|
/ |
345.54 KB |
613.92 KB | 136.43% (🟡 +0.28%) |
/404 |
222.79 KB |
491.17 KB | 109.15% (🟡 +0.24%) |
/_error |
227.66 KB |
496.04 KB | 110.23% (🟡 +0.23%) |
/admin/emails |
251.73 KB |
520.12 KB | 115.58% (🟡 +0.23%) |
/admin/event-category/create |
284.35 KB |
552.73 KB | 122.83% (🟡 +0.37%) |
/admin/event-category/list |
335.94 KB |
604.32 KB | 134.29% (🟡 +0.37%) |
/admin/event-category/update/[id] |
284.53 KB |
552.91 KB | 122.87% (🟡 +0.37%) |
/admin/event/create |
534.91 KB |
803.29 KB | 178.51% (🟡 +3.05%) |
/admin/event/list |
342.68 KB |
611.06 KB | 135.79% (🟡 +0.11%) |
/admin/event/update/[id] |
535.38 KB |
803.76 KB | 178.61% (🟡 +3.06%) |
/admin/organization/[slug] |
311.52 KB |
579.91 KB | 128.87% (🟡 +0.18%) |
/admin/organization/create |
260.42 KB |
528.81 KB | 117.51% (🟡 +0.20%) |
/admin/users/list |
336.25 KB |
604.63 KB | 134.36% (🟡 +0.37%) |
/event/[slug] |
369.34 KB |
637.72 KB | 141.72% (🟡 +0.52%) |
/event/[slug]/register/[quotaId] |
303.02 KB |
571.4 KB | 126.98% (🟡 +3.47%) |
/forgot |
240.49 KB |
508.87 KB | 113.08% (🟡 +0.23%) |
/invitations/accept |
224.28 KB |
492.66 KB | 109.48% (🟡 +0.23%) |
/login |
254.15 KB |
522.54 KB | 116.12% (🟡 +0.23%) |
/reset |
246.69 KB |
515.08 KB | 114.46% (🟡 +0.24%) |
/settings/accounts |
309.75 KB |
578.14 KB | 128.47% (🟡 +0.23%) |
/settings/delete |
244.28 KB |
512.67 KB | 113.93% (🟡 +0.23%) |
/settings/emails |
287.97 KB |
556.35 KB | 123.63% (🟡 +0.26%) |
/settings/profile |
249.89 KB |
518.27 KB | 115.17% (🟡 +0.25%) |
/settings/security |
256.65 KB |
525.04 KB | 116.68% (🟡 +0.25%) |
/update-registration/[updateToken] |
265.06 KB |
533.45 KB | 118.54% (🟡 +3.67%) |
/verify |
223.21 KB |
491.59 KB | 109.24% (🟡 +0.23%) |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.
depcheck failed in CI because @app/worker/__tests__/helpers.ts imports pg, which the worker package did not declare. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RKSTTfRBbDMSCoT7Y56nnd
📦 Next.js Bundle Analysis for @app/clientThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
| Page | Size (compressed) |
|---|---|
global |
268.38 KB (🟡 +2.37 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
New Page Added
The following page was added to the bundle from the code in this PR:
| Page | Size (compressed) | First Load | % of Budget (450 KB) |
|---|---|---|---|
/pay/[updateToken] |
246.5 KB |
514.88 KB | 114.42% |
Twenty-six Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load | % of Budget (450 KB) |
|---|---|---|---|
/ |
345.54 KB |
613.92 KB | 136.43% (🟡 +0.28%) |
/404 |
222.79 KB |
491.17 KB | 109.15% (🟡 +0.24%) |
/_error |
227.66 KB |
496.04 KB | 110.23% (🟡 +0.23%) |
/admin/emails |
251.73 KB |
520.12 KB | 115.58% (🟡 +0.23%) |
/admin/event-category/create |
284.35 KB |
552.73 KB | 122.83% (🟡 +0.37%) |
/admin/event-category/list |
335.94 KB |
604.32 KB | 134.29% (🟡 +0.37%) |
/admin/event-category/update/[id] |
284.53 KB |
552.91 KB | 122.87% (🟡 +0.37%) |
/admin/event/create |
534.91 KB |
803.29 KB | 178.51% (🟡 +3.05%) |
/admin/event/list |
342.68 KB |
611.06 KB | 135.79% (🟡 +0.11%) |
/admin/event/update/[id] |
535.38 KB |
803.76 KB | 178.61% (🟡 +3.06%) |
/admin/organization/[slug] |
311.52 KB |
579.91 KB | 128.87% (🟡 +0.18%) |
/admin/organization/create |
260.42 KB |
528.81 KB | 117.51% (🟡 +0.20%) |
/admin/users/list |
336.25 KB |
604.63 KB | 134.36% (🟡 +0.37%) |
/event/[slug] |
369.34 KB |
637.72 KB | 141.72% (🟡 +0.52%) |
/event/[slug]/register/[quotaId] |
303.02 KB |
571.4 KB | 126.98% (🟡 +3.47%) |
/forgot |
240.49 KB |
508.87 KB | 113.08% (🟡 +0.23%) |
/invitations/accept |
224.28 KB |
492.66 KB | 109.48% (🟡 +0.23%) |
/login |
254.15 KB |
522.54 KB | 116.12% (🟡 +0.23%) |
/reset |
246.69 KB |
515.08 KB | 114.46% (🟡 +0.24%) |
/settings/accounts |
309.75 KB |
578.14 KB | 128.47% (🟡 +0.23%) |
/settings/delete |
244.28 KB |
512.67 KB | 113.93% (🟡 +0.23%) |
/settings/emails |
287.97 KB |
556.35 KB | 123.63% (🟡 +0.26%) |
/settings/profile |
249.89 KB |
518.27 KB | 115.17% (🟡 +0.25%) |
/settings/security |
256.65 KB |
525.04 KB | 116.68% (🟡 +0.25%) |
/update-registration/[updateToken] |
265.06 KB |
533.45 KB | 118.54% (🟡 +3.67%) |
/verify |
223.21 KB |
491.59 KB | 109.24% (🟡 +0.23%) |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.
|
I can't see which spec failed. The log download and the screenshot artifacts are hosted on a domain this environment can't reach, and the API only returns the tail of the log, which is Postgres container output. I've re-run the failed job once. If it fails again, I'll treat it as a real failure and debug it locally with Cypress. Generated by Claude Code |
Cut tests that duplicate coverage at another layer, test Postgres or Stripe rather than our code, or can't fail, and fold copy-pasted siblings into it.each tables. No new cases. - worker: drop templates.test.ts and its 1,049-line snapshot; the task tests already check the email text and variables - server: drop the payment email snapshots, CSRF/webhook overlap with app.test, and redundant locale and env cases - db: drop refund-trigger re-checks, column default and constraint re-tests, the GDPR duplicate and the concurrency test that passed without its lock - lib: drop tautological and brute-force tests 434 -> 342 it/test calls (609 -> 556 cases); full suite green. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SuMT8eDVzX1Leqhv6y3yGy
📦 Next.js Bundle Analysis for @app/clientThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
| Page | Size (compressed) |
|---|---|
global |
268.38 KB (🟡 +2.37 KB) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
New Page Added
The following page was added to the bundle from the code in this PR:
| Page | Size (compressed) | First Load | % of Budget (450 KB) |
|---|---|---|---|
/pay/[updateToken] |
246.5 KB |
514.88 KB | 114.42% |
Twenty-six Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load | % of Budget (450 KB) |
|---|---|---|---|
/ |
345.54 KB |
613.92 KB | 136.43% (🟡 +0.28%) |
/404 |
222.79 KB |
491.17 KB | 109.15% (🟡 +0.24%) |
/_error |
227.66 KB |
496.04 KB | 110.23% (🟡 +0.23%) |
/admin/emails |
251.73 KB |
520.12 KB | 115.58% (🟡 +0.23%) |
/admin/event-category/create |
284.35 KB |
552.73 KB | 122.83% (🟡 +0.37%) |
/admin/event-category/list |
335.94 KB |
604.32 KB | 134.29% (🟡 +0.37%) |
/admin/event-category/update/[id] |
284.53 KB |
552.91 KB | 122.87% (🟡 +0.37%) |
/admin/event/create |
534.91 KB |
803.29 KB | 178.51% (🟡 +3.05%) |
/admin/event/list |
342.68 KB |
611.06 KB | 135.79% (🟡 +0.11%) |
/admin/event/update/[id] |
535.38 KB |
803.76 KB | 178.61% (🟡 +3.06%) |
/admin/organization/[slug] |
311.52 KB |
579.91 KB | 128.87% (🟡 +0.18%) |
/admin/organization/create |
260.42 KB |
528.81 KB | 117.51% (🟡 +0.20%) |
/admin/users/list |
336.25 KB |
604.63 KB | 134.36% (🟡 +0.37%) |
/event/[slug] |
369.34 KB |
637.72 KB | 141.72% (🟡 +0.52%) |
/event/[slug]/register/[quotaId] |
303.02 KB |
571.4 KB | 126.98% (🟡 +3.47%) |
/forgot |
240.49 KB |
508.87 KB | 113.08% (🟡 +0.23%) |
/invitations/accept |
224.28 KB |
492.66 KB | 109.48% (🟡 +0.23%) |
/login |
254.15 KB |
522.54 KB | 116.12% (🟡 +0.23%) |
/reset |
246.69 KB |
515.08 KB | 114.46% (🟡 +0.24%) |
/settings/accounts |
309.75 KB |
578.14 KB | 128.47% (🟡 +0.23%) |
/settings/delete |
244.28 KB |
512.67 KB | 113.93% (🟡 +0.23%) |
/settings/emails |
287.97 KB |
556.35 KB | 123.63% (🟡 +0.26%) |
/settings/profile |
249.89 KB |
518.27 KB | 115.17% (🟡 +0.25%) |
/settings/security |
256.65 KB |
525.04 KB | 116.68% (🟡 +0.25%) |
/update-registration/[updateToken] |
265.06 KB |
533.45 KB | 118.54% (🟡 +3.67%) |
/verify |
223.21 KB |
491.59 KB | 109.24% (🟡 +0.23%) |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.
|
I can't tell from here which spec fails. The full job log and the screenshots/videos artifacts are on a host this environment can't reach, and the log tail the API returns is only Postgres container output. The next step is to reproduce it locally by running the Cypress suite a few times, then fix the spec. Generated by Claude Code |
Paid quotas through Stripe Checkout: prices, the pay page, refunds, organizer payment tools, payment emails and the Stripe webhook, behind the `payments` feature flag. - Migration in current/70-payments.sql (idempotent), with create_event and update_event written on top of current/30-event-ribbon-text.sql and the `payments` flag row. While the flag is off, paid payment modes and non-zero quota prices are refused (FTOFF), registrations get no price snapshot and the organizer payment actions refuse to run. The refund trigger and delete paths are not gated. - `payments` in the flag registry, requiring STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET. PAYMENTS_ENABLED and Query.paymentsEnabled are removed; paymentsEnabled() becomes paymentsConfigured(). - Server: createCheckoutSession and the payment email previews follow the flag; paymentByUpdateToken answers while it is off and blocks Pay with PAYMENTS_DISABLED. The Stripe webhook is an external route (csrfExempt, gateWhenOff: false) instead of an app.ts block and a hand-written CSRF exemption. - Worker: the payment block of the registration emails is a contributor in registrationEmail.ts. Reminders and the close email run under withFeature; the close email skips events that closed before the flag was last switched. Refunds and the received and refund emails are not gated. - Client: payment fields go through EventForm/values.ts; settings and price inputs are field components; the client reads one switch, PAYMENTS_FEATURE_ENABLED in featureSwitches.ts. - Tests switch the flag with setFeatureFlag; the env togglers and the paymentsEnabled Cypress command are removed. New flags-off tests. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0156kYgzTdmw7ZBY2vrLwQmA
Before: every Ilmo event is free. There is no way to charge for a quota, and organizers collect money outside Ilmo.
After: an organizer can set a ticket price per quota. Participants pay through Stripe Checkout (cards, Apple Pay, Google Pay), either while registering or later from a pay link. Ilmo then sends payment reminders, receipts and refund emails, and refunds the ticket price when a paid registration is deleted. With the feature switched off, or on events with payment mode
NONE, Ilmo behaves exactly as before.Everything is behind one switch: payments are on only when
PAYMENTS_ENABLED=1,STRIPE_SECRET_KEYandSTRIPE_WEBHOOK_SECRETare all set for both the server and the worker. Money is stored as integer cents. A participant pays the ticket price plus a 0,25 € service fee, and refunds return the ticket price only.How
@app/db/migrations/current/5-payments-*.sql): event payment settings, quota prices, apaymentstable with RLS, and payment status functions. A delete trigger queues the refund job.createCheckoutSessionmutation,paymentByUpdateToken, and the Stripe webhook at/api/stripe/webhook. The webhook verifies the signature against the raw body and handlescheckout.session.completed,checkout.session.expiredandcharge.refundedidempotently.payments_registerandpayments_admin. In CI the e2e job runs with dummy Stripe keys, because Checkout is stubbed and the webhook receives signed fake events.docs/payments.mdexplains how to test locally with your own Stripe test-mode keys andstripe listen.pnpm setupcan ask for the keys.Draft for CI and review. It should not be merged until a maintainer has tested it with real Stripe test keys.
Generated by Claude Code