mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
OpenABTest 0.2-draft: goal conversions (#239)
* OpenABTest 0.2-draft: goal conversions 0.1 conversions are purchases with a price, so button, onboarding and landing-page experiments had nothing conformant to report. 0.2 adds a goal conversion: metrics.conversion "unique-participants-with-goal" with metrics.goal, metrics.profit "none", and conversion events carrying exactly one of price or goal (optional observed value). Backward compatible: every 0.1 document stays valid; goal forms require "0.2-draft". The reference implementation is w3bs.org/ab-testing. @logicsrc/schemas and @logicsrc/validators 0.5.0, @logicsrc/sdk 0.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * contract: accept any 0.x draft status (OpenABTest is 0.2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0d0a2583b1
commit
ef35139f04
16 changed files with 257 additions and 33 deletions
|
|
@ -93,6 +93,46 @@ describe("OpenABTest draft contracts", () => {
|
|||
Object.assign(event.payload, { affiliateMinor: 0, actualCostMinor: 36000, retainedProfitMinor: -1000, payoutStatus: "withheld" });
|
||||
expect(validate("openabtest-event", event).ok).toBe(true);
|
||||
});
|
||||
it("accepts 0.2 goal experiments and goal conversions", () => {
|
||||
expect(validate("openabtest-manifest", fixture("goal-manifest")).ok).toBe(true);
|
||||
expect(validate("openabtest-event", fixture("goal-conversion")).ok).toBe(true);
|
||||
const valued = fixture("goal-conversion");
|
||||
valued.payload.value = { currency: "USD", amountMinor: 4900 };
|
||||
expect(validate("openabtest-event", valued).ok).toBe(true);
|
||||
valued.payload.value.amountMinor = -1;
|
||||
expect(validate("openabtest-event", valued).ok).toBe(false);
|
||||
});
|
||||
it("keeps 0.1 documents valid and gates goal forms behind 0.2-draft", () => {
|
||||
const old = fixture("chovy-manifest");
|
||||
old.openabtest = "0.2-draft";
|
||||
expect(validate("openabtest-manifest", old).ok).toBe(true);
|
||||
const manifest = fixture("goal-manifest");
|
||||
manifest.openabtest = "0.1-draft";
|
||||
expect(validate("openabtest-manifest", manifest).ok).toBe(false);
|
||||
const event = fixture("goal-conversion");
|
||||
event.openabtest = "0.1-draft";
|
||||
expect(validate("openabtest-event", event).ok).toBe(false);
|
||||
});
|
||||
it("requires a named goal and a conversion-rate primary for goal experiments", () => {
|
||||
const manifest = fixture("goal-manifest");
|
||||
delete manifest.metrics.goal;
|
||||
expect(validate("openabtest-manifest", manifest).ok).toBe(false);
|
||||
const profit = fixture("goal-manifest");
|
||||
profit.metrics.primary = "retained-profit-per-eligible-visitor";
|
||||
expect(validate("openabtest-manifest", profit).ok).toBe(false);
|
||||
const stray = fixture("chovy-manifest");
|
||||
stray.metrics.goal = "signup-completed";
|
||||
expect(validate("openabtest-manifest", stray).ok).toBe(false);
|
||||
});
|
||||
it("takes exactly one of price or goal on a conversion", () => {
|
||||
const both = fixture("conversion");
|
||||
both.openabtest = "0.2-draft";
|
||||
both.payload.goal = "signup-completed";
|
||||
expect(validate("openabtest-event", both).ok).toBe(false);
|
||||
const neither = fixture("goal-conversion");
|
||||
delete neither.payload.goal;
|
||||
expect(validate("openabtest-event", neither).ok).toBe(false);
|
||||
});
|
||||
it("requires reconciliation evidence without bearer URLs", () => {
|
||||
const event = fixture("reconciliation");
|
||||
event.payload.proofRefs = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue