Fix partner pricing to users onboarded through partner API keys - #1358
Open
ebma wants to merge 5 commits into
Open
Fix partner pricing to users onboarded through partner API keys#1358ebma wants to merge 5 commits into
ebma wants to merge 5 commits into
Conversation
✅ Deploy Preview for vortexfi canceled.
|
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vrtx-dashboard canceled.
|
Creates a profile-partner assignment from a server-resolved partner id with first-partner-wins semantics: an active, unexpired assignment is never replaced, and expired-but-active rows are deactivated so the active-assignment partial unique index cannot collide.
Children created through a partner-attributed secret credential get the credential's partner assignment inside the provisioning transaction. Never retroactive for existing children; Bearer-authenticated managers provision without attribution.
POST /v1/partner-attribution/claim assigns the validated public key's partner to the authenticated profile so widget-onboarded users keep the partner's pricing. The client presents only the key; the partner is resolved exclusively from the credential.
Fires the claim once per session when the widget was opened with a partner's public apiKey URL parameter and the user is authenticated. Failures are non-fatal and retried on the next auth change.
Security spec invariant 14 now lists the three server-controlled assignment paths and the accepted leaked-public-key residual risk; partner docs cover attribution at widget sign-in and managed-profile creation.
ebma
force-pushed
the
feat/partner-key-pricing-assignment
branch
from
August 25, 2026 17:11
7d29654 to
73bb210
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Users onboarded through a partner-attributed API credential now receive a persistent
ProfilePartnerAssignment, so the partner's pricing config (target discount, markup, fees) stays fixed to them even when they later return to Vortex outside the partner's funnel. The partner is always resolved server-side fromapi_credentials.partner_id(admin-issued; self-service keys carry no attribution), never from a client-chosen value. No schema changes.Two onboarding channels are covered:
POST /v1/partner-attribution/claim(Supabase auth + existing public-key validation, impersonation rejected). The widget fires it once after sign-in when theapiKeyURL param is present.All non-admin assignment paths are first-partner-wins: an active, unexpired assignment is never replaced (replacement stays admin-only). Expired-but-active rows are deactivated before insert so the active-assignment partial unique index cannot collide, mirroring the admin and seeded-discount paths.
Security spec
docs/security-spec/03-ramp-engine/profile-partner-pricing.mdupdated in the same change: invariant 14 now lists the three server-controlled assignment paths, plus new threat-table rows. The leaked-pk_*-key claim is documented as accepted residual risk (keys are revocable/rotatable; upgrade path is a signed short-lived token verified against the same credential).Partner docs
08-widget-integration.md: new "Pricing Attribution At Sign-In" section. Note: session creation with only theX-Public-Keyheader does not embed the key in the generated widget URL; partners must passapiKeyin the session body (or link directly withapiKey=pk_...).14-managed-profiles.md: pricing bullet documents the at-creation assignment.Tests
bun typecheck, Biome, andbun run docs:api:checkpass.