mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-02 04:43:58 +00:00
Add OpenABTest draft experiment and accounting contracts (#180)
This commit is contained in:
parent
123ba2e39a
commit
d8b3126782
25 changed files with 1410 additions and 12 deletions
22
packages/schemas/fixtures/openabtest/adjustment.json
Normal file
22
packages/schemas/fixtures/openabtest/adjustment.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-adjustment-42",
|
||||
"kind": "adjustment",
|
||||
"payload": {
|
||||
"assignmentId": "assignment-42",
|
||||
"variantId": "signup-10",
|
||||
"conversionId": "purchase-42",
|
||||
"adjustmentId": "refund-42",
|
||||
"currency": "USD",
|
||||
"amountMinor": -3600,
|
||||
"reason": "refund",
|
||||
"proofRefs": [
|
||||
"refund-proof-42"
|
||||
]
|
||||
}
|
||||
}
|
||||
15
packages/schemas/fixtures/openabtest/assignment.json
Normal file
15
packages/schemas/fixtures/openabtest/assignment.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-assignment-42",
|
||||
"kind": "assignment",
|
||||
"payload": {
|
||||
"assignmentId": "assignment-42",
|
||||
"variantId": "signup-10",
|
||||
"cohortId": "eligible-referred-customers"
|
||||
}
|
||||
}
|
||||
69
packages/schemas/fixtures/openabtest/chovy-manifest.json
Normal file
69
packages/schemas/fixtures/openabtest/chovy-manifest.json
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"id": "chovy-signup-discount-v1",
|
||||
"revision": 1,
|
||||
"name": "Chovy referred purchase discount",
|
||||
"state": "draft",
|
||||
"cohort": {
|
||||
"id": "eligible-referred-customers",
|
||||
"eligibilityRule": "Server-verified eligible referral; exclude self-referrals and invalid attribution. Every referred purchase qualifies.",
|
||||
"purchaseScope": "all-referred-purchases"
|
||||
},
|
||||
"assignment": {
|
||||
"unit": "user",
|
||||
"authority": "server",
|
||||
"keyVersion": "1",
|
||||
"algorithm": "hmac-sha256-persisted-v1",
|
||||
"persistence": "sticky"
|
||||
},
|
||||
"variants": [
|
||||
{
|
||||
"id": "signup-5",
|
||||
"weight": 1,
|
||||
"parameters": {
|
||||
"discountBps": 500
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "signup-10",
|
||||
"weight": 1,
|
||||
"parameters": {
|
||||
"discountBps": 1000
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "signup-20",
|
||||
"weight": 1,
|
||||
"parameters": {
|
||||
"discountBps": 2000
|
||||
}
|
||||
}
|
||||
],
|
||||
"window": {
|
||||
"startsAt": "2026-09-14T00:00:00Z",
|
||||
"endsAt": "2026-10-14T00:00:00Z"
|
||||
},
|
||||
"metrics": {
|
||||
"primary": "retained-profit-per-eligible-visitor",
|
||||
"denominator": "unique-eligible-participants",
|
||||
"conversion": "unique-participants-with-confirmed-purchase",
|
||||
"profit": "reconciled-net-retained-profit",
|
||||
"minimumEligiblePerVariant": 100,
|
||||
"minimumObservationSeconds": 604800,
|
||||
"winnerPolicy": "manual-review"
|
||||
},
|
||||
"guardrails": {
|
||||
"preserveAcceptedOffers": true,
|
||||
"preserveAccruedCommissions": true,
|
||||
"requireReconciledCostsForPayout": true,
|
||||
"onBreach": "pause-new-assignments"
|
||||
},
|
||||
"economics": {
|
||||
"currency": "USD",
|
||||
"minorUnitExponent": 2,
|
||||
"unit": "agent-hour",
|
||||
"listUnitPriceMinor": 40000,
|
||||
"modeledUnitCostMinor": 10000,
|
||||
"minimumRetainedUnitProfitMinor": 5000
|
||||
}
|
||||
}
|
||||
26
packages/schemas/fixtures/openabtest/conversion.json
Normal file
26
packages/schemas/fixtures/openabtest/conversion.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-conversion-42",
|
||||
"kind": "conversion",
|
||||
"payload": {
|
||||
"assignmentId": "assignment-42",
|
||||
"variantId": "signup-10",
|
||||
"conversionId": "purchase-42",
|
||||
"price": {
|
||||
"offerId": "offer-42",
|
||||
"acceptedAt": "2026-09-15T11:59:00Z",
|
||||
"currency": "USD",
|
||||
"listUnitPriceMinor": 40000,
|
||||
"chargedUnitPriceMinor": 36000,
|
||||
"discountBps": 1000,
|
||||
"quantityMilliUnits": 1000,
|
||||
"rounding": "half-up",
|
||||
"totalMinor": 36000
|
||||
}
|
||||
}
|
||||
}
|
||||
14
packages/schemas/fixtures/openabtest/eligibility.json
Normal file
14
packages/schemas/fixtures/openabtest/eligibility.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-eligibility-42",
|
||||
"kind": "eligibility",
|
||||
"payload": {
|
||||
"cohortId": "eligible-referred-customers",
|
||||
"eligible": true
|
||||
}
|
||||
}
|
||||
16
packages/schemas/fixtures/openabtest/exposure.json
Normal file
16
packages/schemas/fixtures/openabtest/exposure.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-exposure-42",
|
||||
"kind": "exposure",
|
||||
"payload": {
|
||||
"assignmentId": "assignment-42",
|
||||
"variantId": "signup-10",
|
||||
"offerId": "offer-42",
|
||||
"surface": "checkout"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-reconciliation-pending-42",
|
||||
"kind": "reconciliation",
|
||||
"payload": {
|
||||
"assignmentId": "assignment-42",
|
||||
"variantId": "signup-10",
|
||||
"conversionId": "purchase-42",
|
||||
"accountingRevision": 1,
|
||||
"currency": "USD",
|
||||
"state": "pending",
|
||||
"revenueMinor": 36000,
|
||||
"refundsMinor": 0,
|
||||
"actualCostMinor": null,
|
||||
"feesMinor": null,
|
||||
"affiliateMinor": null,
|
||||
"retainedProfitMinor": null,
|
||||
"minimumRetainedProfitMinor": 5000,
|
||||
"payoutStatus": "withheld",
|
||||
"proofRefs": []
|
||||
}
|
||||
}
|
||||
30
packages/schemas/fixtures/openabtest/reconciliation.json
Normal file
30
packages/schemas/fixtures/openabtest/reconciliation.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"openabtest": "0.1-draft",
|
||||
"producerId": "chovy-server",
|
||||
"manifestId": "chovy-signup-discount-v1",
|
||||
"manifestRevision": 1,
|
||||
"participantId": "participant-opaque-7d12",
|
||||
"at": "2026-09-15T12:00:00Z",
|
||||
"id": "event-reconciliation-42",
|
||||
"kind": "reconciliation",
|
||||
"payload": {
|
||||
"assignmentId": "assignment-42",
|
||||
"variantId": "signup-10",
|
||||
"conversionId": "purchase-42",
|
||||
"accountingRevision": 2,
|
||||
"currency": "USD",
|
||||
"state": "reconciled",
|
||||
"revenueMinor": 36000,
|
||||
"refundsMinor": 0,
|
||||
"actualCostMinor": 10000,
|
||||
"feesMinor": 1000,
|
||||
"affiliateMinor": 20000,
|
||||
"retainedProfitMinor": 5000,
|
||||
"minimumRetainedProfitMinor": 5000,
|
||||
"payoutStatus": "eligible",
|
||||
"proofRefs": [
|
||||
"cost-proof-42",
|
||||
"fees-proof-42"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue