Skip to content

feat(tickets): native Konf ticketing in admin pages, plan gate for 'konf' - #2249

Merged
Starefossen merged 8 commits into
mainfrom
feat/native-ticketing-admin
Nov 10, 2026
Merged

Starefossen merged 8 commits into
mainfrom
feat/native-ticketing-admin

Conversation

@Starefossen

@Starefossen Starefossen commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Closes #2238, closes #2247.

What

  • Provider src/lib/tickets/provider/konf.ts: reads ticketOrders (and ticketSales.byType for the types page) through the Konf API as the signed-in organizer (identityJwt(), host from the request — no client conference id). Refuses before any request when there is no session.

  • Mapping konf-orders.ts (pure): one ticket row per seat (line quantity), cancelled orders dropped, paid from status, outstanding = unit price for pending. Null buyerName → customer_name: null, empty crm name. Existing pages (stats, progression, orders, attendees, dashboard widget) consume it unchanged.

  • VAT: amountsIncludeVat is undefined for Konf (interface widened to boolean | undefined); the revenue card shows no incl./ex. label, since the platform records no VAT basis.

  • Binding: 'konf' added to TicketingProviderType, the zod enum, the D1 read check, Sanity option list (append-only addition), EditConferenceCard, conference/activation/legal type copies. Activation checklist counts konf as bound.

  • Access (admin-access.ts): after the deny kill switch, konf is ready iff isTicketingEnabledForOrg, else unavailable. No credentials. resolveTicketingProvider / hasTicketingBinding return unconfigured for konf, so webhook, speaker-ticket and public paths skip it.

  • Native ticketing: plan gate for selling with provider 'konf' #2247: sellsTickets (packages/tenancy and src/lib/billing, kept identical) returns true for ticketingProvider: 'konf'. Choosing native ticketing is the decision to sell; there is no vendor event to bind. The existing router gates (binding change, publish) therefore require basic before a free tenant switches to or publishes a konf edition. Because services use packages/tenancy, the gateway gate applies too (no services/* code changed).

  • services test: services/conference/src/worker.test.ts asserted that picking konf alone is never gated, which is exactly what Native ticketing: plan gate for selling with provider 'konf' #2247 changes. Test updated (free refused with PLAN_REQUIRED, basic allowed). No services code changed. The original assertion failing in CI on the first push is the sabotage proof for the gateway side.

Evidence

Sabotage (each removed, test failed, restored green):

guard removed failing test
`'konf'
konf branch in resolveTicketingAdminAccess "is READY with the Konf provider…"
cancelled-order filter "mints one row per seat…"

Local: 148 files / 3805 tests green across tickets, billing, tenancy, legal, settings, server. npx eslint . 0 errors, lint:tenancy OK, tsc clean.

Visual: Storybook Systems/Tickets/Admin/TicketSalesChartDisplay → NativeKonf: native orders → ticketsFromOrders → real TicketSalesProcessor. Viewed at 1280: cards and chart render, revenue card has no VAT label. (The page itself is a server component with no story; this is the component it renders in ready state.)

Gaps / follow-ups

  • Demo seed binding (ticketingProvider: 'konf' + ticketing grant for kkdemo) is not built here; follow-up.
  • Discounts and payment details are unsupported for Konf (capability flags off, typed ProviderUnsupportedError).
  • Callers without a request session (e.g. marketing snapshots) get the provider error path for konf.
  • Picking "sells tickets" = "provider is konf" rather than "has ticket types": the sync check has no ticket-type data; open to change.

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
konf Ready Ready Preview Nov 10, 2026 12:33am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ff50e07-fae5-4276-a3db-ef80322ab208
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Starefossen
Starefossen deployed to workers-preview November 9, 2026 23:45 — with GitHub Actions Active
@Starefossen
Starefossen marked this pull request as ready for review November 9, 2026 23:50
@Starefossen
Starefossen requested a review from a team as a code owner November 9, 2026 23:51
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@Starefossen
Starefossen marked this pull request as draft November 9, 2026 23:51
@Starefossen

Copy link
Copy Markdown
Member Author

Review of 02ded98: CHANGES REQUESTED

Read-only adversarial review of the head commit (CI green, 22 files, no deletions, Sanity change is an added list option only; schema-shape.baseline.json unaffected).

What holds

  • Tenant isolation. The conference is never named by the client: requestHost() reads the request Host (src/lib/conference/request-domain.ts:8), the site asserts that host (src/lib/konf-api/client.ts:81), the gateway resolves the tenant from the assertion (api/src/gateway.ts:596-604), and the organizer's identity JWT must carry an origin claim for that same host or the call is 401 (api/src/gateway.ts:670-679). orgRole is looked up live for that org (gateway.ts:744-749) and orders() checks attendee.read_pii before any query (services/ticketing/src/data/index.ts:379). An org-A organizer cannot reach org-B orders or buyer PII through this provider. KonfProvider.query refuses before any request without host or JWT (konf.ts:712-714, tested).
  • Billing. Both sellsTickets copies are identical; 'konf' || short-circuits only on konf, so checkin/tito tenants are unchanged. No production conference has ticketingProvider == 'konf' (Sanity query returns []), so nobody is locked out. The worker.test.ts flip is exactly Native ticketing: plan gate for selling with provider 'konf' #2247's intent. "Already bound is never asked" holds for konf on both sides by code: gateway services/conference/src/data/index.ts:146 (sellsTickets(next) && (!sellsTickets(row) || goesPublic): a konf-bound free row only trips on going public), site src/server/routers/conference.ts:908-911 (!sellsTickets(current) is false). Other site mutations never call the gate. No test covers it on either side: the gateway test's last step (worker.test.ts:1577-1583) switches a free row away from konf, and conference.test.ts has only tito/checkin cases. One assertion each (konf-bound free row, patch {title}, no error) would close it.

Findings

  1. Medium, src/lib/tickets/provider/konf.ts:741 and :748. data?.ticketOrders ?? [] / data?.ticketSales?.byType ?? []. The gateway answers null, not an error, when the caller lacks attendee.read_pii/ticketing.read (orgRole member, or a site is_organizer with no D1 membership). The admin sees "0 tickets sold, 0 revenue" as a normal ready page, and the dashboard widget renders a healthy zero (widget-data.ts:937). Treat null as a refusal and throw, so the page shows the error state instead of a false zero.
  2. Medium, src/lib/tickets/provider/konf.ts:760. vat: '0' for every konf ticket type. TicketTypeCard.tsx:121-135 renders ({incl} incl. 0% VAT) for each price, which is a VAT claim the PR says the platform cannot make (the revenue card correctly shows none). Either drop the parenthetical when the basis is unknown or use the existing absent-rate path in formatTicketPrice.
  3. Low, src/lib/tickets/provider/index.ts:67-69 via src/lib/features/workshops.ts:100 and src/lib/system-status/checks.ts:1093-1098. ticketingCredentialsConfigured('konf', …) and resolveTicketingCredentials(orgId, 'konf') fall into the Checkin branch: workshops for a konf tenant are enabled iff Checkin credentials resolve, and the system-status "Ticketing API credentials" check reports Checkin keys for a konf conference. Not wrong data on the ticket pages, but the two callers were not updated for the new provider.
  4. Low, src/lib/marketing/snapshots/sanity.ts:316-325. Runs with no request session; for a konf edition resolveTicketingAdminAccess is ready, then fetchEventTickets throws "needs a signed-in organizer". The PR names this gap; it will surface as a failed snapshot, not a silent zero, so acceptable as a follow-up issue. Same message is thrown when IDENTITY_URL is unset (conference-write.ts:280), which would mislead on a misconfigured environment.
  5. Low, tests. See the missing "already bound konf on free saves other settings" assertions above.

Nothing out of scope; no deletions; the conference schema stays append-only.

@Starefossen

Copy link
Copy Markdown
Member Author

Review of 546df6f: APPROVE

Verified each fix against 02ded98 (git diff 02ded982..546df6f7, 12 files, all within the findings' scope, no deletions, CI green on this head):

  1. Null read → error: src/lib/tickets/provider/konf.ts:75-78 and :86-87 throw on ticketOrders/ticketSales null; konf.test.ts:176-191 covers both with a real JWT and a null answer. A legitimate empty list ([]) still maps to zero rows.
  2. VAT: konf.ts:102 now vat: ''; TicketTypeCard.tsx:134 renders no VAT text for an empty rate, with a positive test (25% still shown) and a negative one (TicketTypeCard.test.tsx:186-209). The String(p.vat ?? '') guard is purely defensive.
  3. Credential paths: resolveTicketingCredentials returns null for konf before the chain (provider/index.ts:150), ticketingCredentialsConfigured/canReadTicketsForOrg return true for konf (index.ts:68, features/ticketing.ts:224), checks.ts:1112-1114 reports konf as on with no webhook secret. All three are early returns keyed on 'konf' only; the checkin/tito branches are byte-identical to before, and provider.test.ts:546-550 proves the platform org and a mapped tenant never receive Checkin keys for konf.
  4. "Already bound konf on free saves other settings" is now tested on both sides: gateway services/conference/src/worker.test.ts:1570-1574, site src/server/routers/conference.test.ts:2184-2190; plus the free konf pick refusal on the site (:2176-2182). Plan-gate logic itself is unchanged since 02ded98.

Nit, non-blocking: TicketTypeCard.tsx:122 still computes incl for an empty rate before the condition, so parseVatPercent('') logs "missing VAT rate treated as 0%" per price on every konf types-page render. Moving the formatTicketPrice(..., { includeVat: true }) call inside the vat !== '' branch silences it.

The sessionless caller (marketing/snapshots/sanity.ts:316) remains the stated follow-up.

@Starefossen
Starefossen added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit a33f407 Nov 10, 2026
16 checks passed
@Starefossen
Starefossen deleted the feat/native-ticketing-admin branch November 10, 2026 00:54

This branch was successfully deployed

2 active deployments
Preview — 546df6f7 Deployed Nov 10, 2026 by vercel[bot]
workers-preview — 546df6f7 Deployed Nov 10, 2026 by Starefossen via Deploy (preview) #470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native ticketing: plan gate for selling with provider 'konf' Admin ticket pages: read native Konf ticketing from the platform API

1 participant