@vllnt/convex-experiments 0.2.0-canary.59133b0 → 0.2.0-canary.a9170fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -44
- package/README.md +9 -4
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/component/queries.d.ts +4 -1
- package/dist/component/queries.d.ts.map +1 -1
- package/dist/component/queries.js +4 -1
- package/dist/component/queries.js.map +1 -1
- package/dist/shared.d.ts +8 -5
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +23 -6
- package/dist/shared.js.map +1 -1
- package/docs/API.md +9 -2
- package/llms.txt +2 -1
- package/package.json +1 -5
- package/src/client/index.ts +1 -1
- package/src/component/queries.ts +4 -1
- package/src/shared.ts +24 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,64 +4,71 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## [0.2.0] -
|
|
7
|
+
## [0.2.0] - 2026-11-28
|
|
8
8
|
|
|
9
9
|
### Added
|
|
10
10
|
|
|
11
11
|
- Ship `docs/API.md`, `CHANGELOG.md` and `llms.txt` in the npm package, so coding agents can read
|
|
12
12
|
docs that match the installed version from `node_modules/@vllnt/convex-experiments/`. `llms.txt`
|
|
13
|
-
links shipped files relatively
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
links the shipped files relatively.
|
|
14
|
+
- `docs/API.md` documents the `./react`, `./test` and `./convex.config` entry points and the
|
|
15
|
+
exported types, and every public export has TSDoc.
|
|
16
|
+
- Document that `listExperiments` returns rows in creation order, and that `convex-test` 0.0.72 and
|
|
17
|
+
later need `convex ^1.46.0` (use 0.0.71 or older on `convex` 1.45).
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **Breaking:** Assignment now mixes the hash: FNV-1a over the UTF-16 code units of
|
|
22
|
+
`"<scope>:<salt>:<subjectRef>"` is followed by a 32-bit finalizer (murmur3 `fmix32`), so weights
|
|
23
|
+
hold for similar or sequential `subjectRef`s. Stored assignments are kept. A subject not yet
|
|
24
|
+
assigned in an experiment that runs across the upgrade, `peek` for such a subject, and a subject
|
|
25
|
+
re-enrolled after `forgetSubject` can land in a different variant than 0.1.0 picked. What to do:
|
|
26
|
+
finish such experiments before upgrading, or stop them and do not restart them after the upgrade
|
|
27
|
+
(a restarted experiment mixes the two hashes), or define a new experiment key.
|
|
28
|
+
- **Breaking:** `define`, `setStatus`, `assign`, `logExposure`, `forgetSubject` and
|
|
29
|
+
`deleteExperiment` reject an empty `scope`, `key` or `subjectRef` with
|
|
30
|
+
`ConvexError({ code: "INVALID_ARGUMENT" })`, and `define` rejects an empty variant key with
|
|
31
|
+
`INVALID_VARIANTS` (`reason: "empty_key"`); 0.1.0 accepted them. What to do: pass non-empty
|
|
32
|
+
identifiers (including `defaultScope`), or validate them before calling. Before upgrading, erase
|
|
33
|
+
or delete with 0.1.0 any data stored under an empty identifier; after the upgrade, `forgetSubject`
|
|
34
|
+
and `deleteExperiment` reject it too.
|
|
35
|
+
- `define` and `setStatus` skip the write when nothing changed, so an idempotent re-define or a
|
|
36
|
+
repeated `setStatus` no longer invalidates subscriptions that read the definition (`getExperiment`,
|
|
37
|
+
`listExperiments`, `peek`, `results`). Return values are unchanged.
|
|
38
|
+
- `deleteExperiment` deletes the definition in the same pass once every child table returns fewer
|
|
39
|
+
rows than `batch`, so a small experiment is gone after one call instead of after a scheduled
|
|
40
|
+
follow-up pass. It still returns the child rows removed by that pass.
|
|
41
|
+
- A `logExposure` that enrolls a subject updates its variant tally once instead of twice (same
|
|
42
|
+
counts, one write fewer).
|
|
43
|
+
- `engines.node` moved from `>=18` to `>=20`, because the oldest supported `convex` peer (1.45) needs
|
|
44
|
+
Node >=20. The `convex` peer range stays `^1.45.0` and `react >=18` stays an optional peer
|
|
45
|
+
(both unchanged).
|
|
46
|
+
- Rework the README for coding agents (fixed section order, type-checked examples, an errors table,
|
|
47
|
+
a limits list, "For coding agents" and "Related packages" sections) and rewrite `docs/API.md` with
|
|
48
|
+
one heading per export. `llms.txt` is the single LLM index; the generated `llms-full.txt` is gone.
|
|
49
|
+
- Package metadata: `description` and `keywords` match the code, and `homepage` points at
|
|
50
|
+
`https://oss.vllnt.com/packages/convex-experiments`.
|
|
51
|
+
- Internal: CI, publishing, tests and dev tooling hardened and upgraded; no effect on the published
|
|
52
|
+
API.
|
|
53
|
+
|
|
54
|
+
### Removed
|
|
55
|
+
|
|
56
|
+
- Test files (`src/**/*.test.*`, `src/**/*.spec.*`) are no longer in the published package.
|
|
18
57
|
|
|
19
58
|
### Fixed
|
|
20
59
|
|
|
60
|
+
- Weighted splits now hold for similar or sequential `subjectRef`s. The bucket hash had no final
|
|
61
|
+
mixing, so refs such as `u0..u199` landed next to each other: on a real backend a 90:10 split gave
|
|
62
|
+
200/0 and a 1:1 split over `u0..u19` gave 20/0. Random UUIDs were not skewed.
|
|
21
63
|
- Correct shipped doc comments: `results` returns a zeroed row per defined variant (not `[]`) for an
|
|
22
|
-
experiment with no enrollment, `weight` is never `0`,
|
|
23
|
-
experiment exists
|
|
24
|
-
|
|
25
|
-
`assign`, `logExposure`, `forgetSubject`, and `deleteExperiment` with
|
|
26
|
-
`ConvexError({ code: "INVALID_ARGUMENT" })`, and an empty variant key in `define` with
|
|
27
|
-
`INVALID_VARIANTS` (`reason: "empty_key"`). Callers passing an empty `scope`, `key`, `subjectRef`
|
|
28
|
-
or variant key now get a `ConvexError` instead of success.
|
|
64
|
+
experiment with no enrollment, `weight` is never `0`, `setStatus` returns `true` whenever the
|
|
65
|
+
experiment exists, and `define` sets `status` on every call (omitting it on a re-define resets it
|
|
66
|
+
to the client `defaultStatus`).
|
|
29
67
|
- Make the `/test` entry type-check for consumers using `moduleResolution: nodenext`: relative imports
|
|
30
68
|
in `src/` use explicit `.js` extensions and `src/test.ts` references `vite/client` types.
|
|
31
69
|
- `register()` from `/test` accepts a host app's `convexTest(hostSchema, modules)` instance. It was
|
|
32
70
|
typed against the component's own schema, so any host schema with other tables failed with TS2345.
|
|
33
71
|
|
|
34
|
-
### Changed
|
|
35
|
-
|
|
36
|
-
- The publish workflow runs `pnpm test:package` before every canary and release; it now installs the
|
|
37
|
-
packed tarball in a clean project, imports its runtime entries and type-checks every export. The
|
|
38
|
-
tarball check also blocks `*.spec.mts` and `*.spec.cts` files.
|
|
39
|
-
- `engines.node` is now `>=20`, matching the oldest supported `convex` peer (1.45 requires Node
|
|
40
|
-
>=20; 1.51 requires >=22).
|
|
41
|
-
- Rework the README for coding agents (fixed section order, type-checked examples, an errors table
|
|
42
|
-
and a limits list), rewrite `docs/API.md` with one heading per export, refresh `llms.txt`, add
|
|
43
|
-
TSDoc to every public export, and set the `description` and `keywords` to match the code.
|
|
44
|
-
`pnpm test:package` now also runs `scripts/check-docs.mjs`, which enforces these docs.
|
|
45
|
-
`pnpm typecheck:ci` now also type-checks `example/` and the tests.
|
|
46
|
-
- `deleteExperiment` deletes the definition in the same pass once every child table returns fewer rows
|
|
47
|
-
than `batch`, which can save the final scheduled mutation of a delete.
|
|
48
|
-
- `define` and `setStatus` skip the write when nothing changed, so idempotent re-defines no longer
|
|
49
|
-
invalidate `peek`/`getExperiment`/`results` subscriptions.
|
|
50
|
-
- The first `logExposure` for a subject updates its variant tally once instead of twice.
|
|
51
|
-
- Clarify installation and usage documentation; retain `llms.txt` as the single
|
|
52
|
-
maintained LLM index and remove the generated `llms-full.txt` bundle.
|
|
53
|
-
- Adopt pnpm 10 with a seven-day release-age gate and blocked dependency install scripts; drop
|
|
54
|
-
dependency overrides that no longer change the lockfile.
|
|
55
|
-
- Develop and test against `convex` 1.51 and `convex-test` 0.0.73, and move the development
|
|
56
|
-
toolchain to ESLint 10, jsdom 31, `@vllnt/typescript` 3 and Vitest 5.1.1. The `convex` peer range
|
|
57
|
-
(`^1.45.0`) is unchanged.
|
|
58
|
-
- Publish `@latest` only from a `vX.Y.Z` tag on `main` (npm trusted publishing with provenance); pin all
|
|
59
|
-
workflow actions and scope their permissions. No local publish scripts remain.
|
|
60
|
-
- Exclude test files from the published package.
|
|
61
|
-
- Publish a canary on every push to `main` that touches the package or its shipped docs, and remove the
|
|
62
|
-
repository-variable gate. The canary job still publishes under the `canary` dist-tag
|
|
63
|
-
only and never moves `latest`; the `homepage` now points at `https://oss.vllnt.com/packages/convex-experiments`.
|
|
64
|
-
|
|
65
72
|
## [0.1.0] - 2026-09-01
|
|
66
73
|
|
|
67
74
|
### Added
|
package/README.md
CHANGED
|
@@ -367,8 +367,10 @@ other errors of its own: absent experiments and wrong scopes return `null`,
|
|
|
367
367
|
- The variant is computed from `scope`, `salt` (default: the experiment key),
|
|
368
368
|
`subjectRef` and the ordered variants and weights, with a 32-bit FNV-1a hash
|
|
369
369
|
over the UTF-16 code units (`charCodeAt`) of `"<scope>:<salt>:<subjectRef>"`,
|
|
370
|
-
not its UTF-8 bytes
|
|
371
|
-
|
|
370
|
+
not its UTF-8 bytes, followed by a 32-bit finalizer (murmur3 `fmix32`), so
|
|
371
|
+
similar or sequential refs such as `u1`, `u2` still split by the weights. It
|
|
372
|
+
is deterministic bucketing, not randomness or a secret: anyone who knows those
|
|
373
|
+
inputs can compute a subject's variant.
|
|
372
374
|
- Every `logExposure` call adds 1 to `exposures`; there is no idempotency key, so
|
|
373
375
|
a retried call counts again. `subjects` counts each subject once. `assign`
|
|
374
376
|
alone adds to `assigned`, not to `subjects` or `exposures`.
|
|
@@ -380,7 +382,8 @@ other errors of its own: absent experiments and wrong scopes return `null`,
|
|
|
380
382
|
the last pass, so a `running` experiment keeps enrolling meanwhile: stop it first.
|
|
381
383
|
- `listExperiments` and `results` are not paginated. `listExperiments` reads
|
|
382
384
|
every experiment in the scope; calls that omit `scope` use the client
|
|
383
|
-
`defaultScope` (`"global"`), never all scopes.
|
|
385
|
+
`defaultScope` (`"global"`), never all scopes. Rows come back in creation
|
|
386
|
+
order within the scope (oldest first), not sorted by key.
|
|
384
387
|
- `results` returns `[]` for an absent experiment and one zeroed row per defined
|
|
385
388
|
variant before anyone enrolls.
|
|
386
389
|
- Only mutations reject empty `scope`, `key` and `subjectRef` (`INVALID_ARGUMENT`).
|
|
@@ -406,7 +409,9 @@ other errors of its own: absent experiments and wrong scopes return `null`,
|
|
|
406
409
|
`>=22`. Check with `npm view convex@1.51.0 engines`. ES modules only.
|
|
407
410
|
- `@vllnt/convex-experiments/test` ships as TypeScript source (`src/test.ts`) and
|
|
408
411
|
needs `convex-test` and Vite's `import.meta.glob`, for example through
|
|
409
|
-
`vitest`, with `vite/client` types.
|
|
412
|
+
`vitest`, with `vite/client` types. `convex-test` 0.0.72 and later require
|
|
413
|
+
`convex ^1.46.0`, so on `convex` 1.45 use `convex-test` 0.0.71 or older. Check
|
|
414
|
+
with `npm view convex-test@0.0.72 peerDependencies`.
|
|
410
415
|
|
|
411
416
|
## Testing
|
|
412
417
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ export declare class Experiments {
|
|
|
143
143
|
* flicker-free first paint, then call `logExposure` to enroll + tally.
|
|
144
144
|
*/
|
|
145
145
|
peek(ctx: RunQueryCtx, key: string, subjectRef: string, scope?: string): Promise<ExposureOutcome>;
|
|
146
|
-
/** Every experiment in a scope, optionally filtered by `status
|
|
146
|
+
/** Every experiment in a scope, optionally filtered by `status`, in creation order. */
|
|
147
147
|
listExperiments(ctx: RunQueryCtx, opts?: {
|
|
148
148
|
scope?: string;
|
|
149
149
|
status?: ExperimentStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,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IAED,2DAA2D;IAC3D,aAAa,CACX,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAKtC;IAED,gEAAgE;IAChE,aAAa,CACX,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAM5B;IAED;;;;;OAKG;IACH,IAAI,CACF,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC,CAM1B;IAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,aAAa,EACd,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE;QACT,MAAM,EAAE,iBAAiB,CACvB,UAAU,EACV,UAAU,EACV;YACE,KAAK,EAAE,MAAM,CAAC;YACd,GAAG,EAAE,MAAM,CAAC;YACZ,QAAQ,EAAE,OAAO,EAAE,CAAC;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,gBAAgB,CAAC;SAC1B,EACD;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CACrB,CAAC;QACF,SAAS,EAAE,iBAAiB,CAC1B,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE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A;KAAO,GACvD,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAKjC;IAED;;;;OAIG;IACH,OAAO,CACL,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,EAAE,CAAC,CAK1B;IAED;;;;OAIG;IACH,aAAa,CACX,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAMlB;IAED;;;;;OAKG;IACH,gBAAgB,CACd,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC5C,OAAO,CAAC,MAAM,CAAC,CAMjB;CACF;AAED,YAAY,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,aAAa,GACd,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -114,7 +114,7 @@ export class Experiments {
|
|
|
114
114
|
subjectRef,
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
/** Every experiment in a scope, optionally filtered by `status
|
|
117
|
+
/** Every experiment in a scope, optionally filtered by `status`, in creation order. */
|
|
118
118
|
listExperiments(ctx, opts = {}) {
|
|
119
119
|
return ctx.runQuery(this.component.queries.listExperiments, {
|
|
120
120
|
scope: this.scopeOf(opts.scope),
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoGnF;;;;;;;;;;;;;;;;;;;;G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iment: import("convex/server").RegisteredQuery<"pub
|
|
|
13
13
|
salt: string;
|
|
14
14
|
createdAt: number;
|
|
15
15
|
} | null>>;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Every experiment in a scope, optionally filtered by `status`, in creation order
|
|
18
|
+
* (the `by_scope` index breaks ties on `_creationTime`).
|
|
19
|
+
*/
|
|
17
20
|
export declare const listExperiments: import("convex/server").RegisteredQuery<"public", {
|
|
18
21
|
scope: string;
|
|
19
22
|
status?: "draft" | "running" | "stopped";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAWA,8EAA8E;AAC9E,eAAO,MAAM,aAAa;;;;;;;;;;;;;UAsBxB,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAWA,8EAA8E;AAC9E,eAAO,MAAM,aAAa;;;;;;;;;;;;;UAsBxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;KAqB1B,CAAC;AAEH,kFAAkF;AAClF,eAAO,MAAM,aAAa;;;;;;;UAkBxB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;GAiCf,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;;;;;KA+BlB,CAAC"}
|
|
@@ -24,7 +24,10 @@ export const getExperiment = query({
|
|
|
24
24
|
};
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Every experiment in a scope, optionally filtered by `status`, in creation order
|
|
29
|
+
* (the `by_scope` index breaks ties on `_creationTime`).
|
|
30
|
+
*/
|
|
28
31
|
export const listExperiments = query({
|
|
29
32
|
args: { scope: v.string(), status: v.optional(experimentStatus) },
|
|
30
33
|
returns: v.array(experimentDef),
|
|
@@ -1 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MAAM;aACvB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -22,11 +22,14 @@ export interface Variant {
|
|
|
22
22
|
export declare function fnv1a(input: string): number;
|
|
23
23
|
/**
|
|
24
24
|
* Deterministically pick a variant for `subjectRef` from `variants`, weighted by
|
|
25
|
-
* each variant's `weight`. The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* each variant's `weight`. The bucket is FNV-1a over the UTF-16 code units of
|
|
26
|
+
* `"<salt>:<subjectRef>"`, then the murmur3 `fmix32` finalizer, mapped onto the
|
|
27
|
+
* cumulative-weight line in definition order. The same `(salt, subjectRef)`
|
|
28
|
+
* always maps to the same variant — sticky assignment with no storage — and each
|
|
29
|
+
* variant's share is `weight / sum(weights)`, also for similar or sequential
|
|
30
|
+
* `subjectRef`s. The component folds `scope` into the salt so the same subject
|
|
31
|
+
* buckets independently per scope. Assumes a non-empty `variants` with positive
|
|
32
|
+
* weights; the caller validates that upstream.
|
|
30
33
|
*/
|
|
31
34
|
export declare function pickVariant(variants: readonly Variant[], salt: string, subjectRef: string): string;
|
|
32
35
|
//# sourceMappingURL=shared.d.ts.map
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,oEAAoE;AACpE,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,mFAAmF;AACnF,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3C;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,oEAAoE;AACpE,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,iFAAiF;AACjF,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,mFAAmF;AACnF,MAAM,WAAW,OAAO;IACtB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO3C;AAiBD;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,MAAM,CAoBR"}
|
package/dist/shared.js
CHANGED
|
@@ -20,13 +20,30 @@ export function fnv1a(input) {
|
|
|
20
20
|
}
|
|
21
21
|
return hash >>> 0;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The murmur3 32-bit finalizer (`fmix32`): spreads every input bit across the
|
|
25
|
+
* whole output. FNV-1a alone leaves inputs that differ only in their last
|
|
26
|
+
* characters (`u1`, `u2`, …) close together, which skews a weighted split.
|
|
27
|
+
*/
|
|
28
|
+
function fmix32(input) {
|
|
29
|
+
let hash = input;
|
|
30
|
+
hash ^= hash >>> 16;
|
|
31
|
+
hash = Math.imul(hash, 0x85ebca6b);
|
|
32
|
+
hash ^= hash >>> 13;
|
|
33
|
+
hash = Math.imul(hash, 0xc2b2ae35);
|
|
34
|
+
hash ^= hash >>> 16;
|
|
35
|
+
return hash >>> 0;
|
|
36
|
+
}
|
|
23
37
|
/**
|
|
24
38
|
* Deterministically pick a variant for `subjectRef` from `variants`, weighted by
|
|
25
|
-
* each variant's `weight`. The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
39
|
+
* each variant's `weight`. The bucket is FNV-1a over the UTF-16 code units of
|
|
40
|
+
* `"<salt>:<subjectRef>"`, then the murmur3 `fmix32` finalizer, mapped onto the
|
|
41
|
+
* cumulative-weight line in definition order. The same `(salt, subjectRef)`
|
|
42
|
+
* always maps to the same variant — sticky assignment with no storage — and each
|
|
43
|
+
* variant's share is `weight / sum(weights)`, also for similar or sequential
|
|
44
|
+
* `subjectRef`s. The component folds `scope` into the salt so the same subject
|
|
45
|
+
* buckets independently per scope. Assumes a non-empty `variants` with positive
|
|
46
|
+
* weights; the caller validates that upstream.
|
|
30
47
|
*/
|
|
31
48
|
export function pickVariant(variants, salt, subjectRef) {
|
|
32
49
|
const lastVariant = variants[variants.length - 1];
|
|
@@ -38,7 +55,7 @@ export function pickVariant(variants, salt, subjectRef) {
|
|
|
38
55
|
total += variant.weight;
|
|
39
56
|
}
|
|
40
57
|
// Map the hash into [0, total): a point on the cumulative-weight line.
|
|
41
|
-
let target = (fnv1a(`${salt}:${subjectRef}`) / 0x100000000) * total;
|
|
58
|
+
let target = (fmix32(fnv1a(`${salt}:${subjectRef}`)) / 0x100000000) * total;
|
|
42
59
|
// Walk every variant but the last, subtracting its bucket width.
|
|
43
60
|
for (const variant of variants.slice(0, -1)) {
|
|
44
61
|
target -= variant.weight;
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C,oEAAoE;AACpE,MAAM,CAAC,M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IACH,CAAC;IACD,+EAA+E;IAC/E,OAAO,WAAW,CAAC,GAAG,CAAC;AACzB,CAAC"}
|
package/docs/API.md
CHANGED
|
@@ -48,8 +48,11 @@ generic to narrow.
|
|
|
48
48
|
`pickVariant(variants, "<scope>:<salt>", subjectRef)` (an internal function in
|
|
49
49
|
`src/shared.ts`, not exported by any entry point): a 32-bit FNV-1a hash of
|
|
50
50
|
`"<scope>:<salt>:<subjectRef>"`, computed over its UTF-16 code units
|
|
51
|
-
(`charCodeAt`) rather than UTF-8 bytes,
|
|
52
|
-
|
|
51
|
+
(`charCodeAt`) rather than UTF-8 bytes, followed by a 32-bit finalizer (murmur3
|
|
52
|
+
`fmix32`), mapped onto the cumulative-weight line of the experiment's variants,
|
|
53
|
+
in their defined order. The finalizer keeps each variant's share at
|
|
54
|
+
`weight / sum(weights)` for similar or sequential `subjectRef`s (`u1`, `u2`, …),
|
|
55
|
+
not only for random IDs. The same subject always lands in
|
|
53
56
|
the same weighted bucket, and `scope` is part of the input, so one `subjectRef`
|
|
54
57
|
buckets independently in each scope. `salt` defaults to the experiment key and
|
|
55
58
|
is fixed once a subject is assigned (see [`define`](#define)).
|
|
@@ -167,6 +170,8 @@ The [`ExperimentDefinition`](#experimentdefinition), or `null`.
|
|
|
167
170
|
`opts`: `{ scope?: string; status?: "draft" | "running" | "stopped" }`. Every
|
|
168
171
|
experiment in one scope (the client `defaultScope` when omitted), optionally
|
|
169
172
|
filtered by `status`. Not paginated: it reads every experiment in the scope.
|
|
173
|
+
Rows come back in creation order within the scope (oldest first), not sorted by
|
|
174
|
+
key.
|
|
170
175
|
|
|
171
176
|
### `getAssignment`
|
|
172
177
|
|
|
@@ -293,6 +298,8 @@ Calls `t.registerComponent(name, schema, modules)` with the component's schema
|
|
|
293
298
|
and modules. `t` is the host app's own `convexTest(hostSchema, modules)`
|
|
294
299
|
instance, whatever its tables. The entry ships as TypeScript source and needs
|
|
295
300
|
`convex-test` and Vite's `import.meta.glob` (for example through `vitest`).
|
|
301
|
+
`convex-test` 0.0.72 and later require `convex ^1.46.0`, so on `convex` 1.45 use
|
|
302
|
+
`convex-test` 0.0.71 or older.
|
|
296
303
|
|
|
297
304
|
### `ComponentApi`
|
|
298
305
|
|
package/llms.txt
CHANGED
|
@@ -13,7 +13,8 @@ Mutations: `define`, `setStatus`, `assign`, `logExposure`, `forgetSubject`,
|
|
|
13
13
|
`stopped`; only `running` enrolls, and `assign`/`logExposure`/`peek` return
|
|
14
14
|
`{ variant: null }` otherwise (also for an absent experiment). A variant is a
|
|
15
15
|
32-bit FNV-1a hash over the UTF-16 code units of `${scope}:${salt}:${subjectRef}`
|
|
16
|
-
|
|
16
|
+
followed by a 32-bit finalizer (murmur3 fmix32), on the ordered cumulative-weight
|
|
17
|
+
line, so sequential refs split by the weights too; `salt` defaults to the key. `variants`
|
|
17
18
|
and `salt` are immutable once a subject is assigned (`EXPERIMENT_LOCKED`); define
|
|
18
19
|
a new key to re-randomize. Re-running `define` without `status` resets the status
|
|
19
20
|
to the client `defaultStatus` (restarting a stopped experiment). Queries do not
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vllnt/convex-experiments",
|
|
3
|
-
"version": "0.2.0-canary.
|
|
3
|
+
"version": "0.2.0-canary.a9170fc",
|
|
4
4
|
"description": "Deterministic A/B testing for Convex: sticky weighted variant assignment, deduped exposure tracking and per-variant tallies, as a Convex component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -123,10 +123,6 @@
|
|
|
123
123
|
"react"
|
|
124
124
|
],
|
|
125
125
|
"pnpm": {
|
|
126
|
-
"minimumReleaseAge": 10080,
|
|
127
|
-
"minimumReleaseAgeExclude": [
|
|
128
|
-
"@vllnt/*"
|
|
129
|
-
],
|
|
130
126
|
"ignoredBuiltDependencies": [
|
|
131
127
|
"esbuild"
|
|
132
128
|
],
|
package/src/client/index.ts
CHANGED
|
@@ -273,7 +273,7 @@ export class Experiments {
|
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
/** Every experiment in a scope, optionally filtered by `status
|
|
276
|
+
/** Every experiment in a scope, optionally filtered by `status`, in creation order. */
|
|
277
277
|
listExperiments(
|
|
278
278
|
ctx: RunQueryCtx,
|
|
279
279
|
opts: { scope?: string; status?: ExperimentStatus } = {},
|
package/src/component/queries.ts
CHANGED
|
@@ -34,7 +34,10 @@ export const getExperiment = query({
|
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Every experiment in a scope, optionally filtered by `status`, in creation order
|
|
39
|
+
* (the `by_scope` index breaks ties on `_creationTime`).
|
|
40
|
+
*/
|
|
38
41
|
export const listExperiments = query({
|
|
39
42
|
args: { scope: v.string(), status: v.optional(experimentStatus) },
|
|
40
43
|
returns: v.array(experimentDef),
|
package/src/shared.ts
CHANGED
|
@@ -34,13 +34,31 @@ export function fnv1a(input: string): number {
|
|
|
34
34
|
return hash >>> 0;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The murmur3 32-bit finalizer (`fmix32`): spreads every input bit across the
|
|
39
|
+
* whole output. FNV-1a alone leaves inputs that differ only in their last
|
|
40
|
+
* characters (`u1`, `u2`, …) close together, which skews a weighted split.
|
|
41
|
+
*/
|
|
42
|
+
function fmix32(input: number): number {
|
|
43
|
+
let hash = input;
|
|
44
|
+
hash ^= hash >>> 16;
|
|
45
|
+
hash = Math.imul(hash, 0x85ebca6b);
|
|
46
|
+
hash ^= hash >>> 13;
|
|
47
|
+
hash = Math.imul(hash, 0xc2b2ae35);
|
|
48
|
+
hash ^= hash >>> 16;
|
|
49
|
+
return hash >>> 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
/**
|
|
38
53
|
* Deterministically pick a variant for `subjectRef` from `variants`, weighted by
|
|
39
|
-
* each variant's `weight`. The
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
54
|
+
* each variant's `weight`. The bucket is FNV-1a over the UTF-16 code units of
|
|
55
|
+
* `"<salt>:<subjectRef>"`, then the murmur3 `fmix32` finalizer, mapped onto the
|
|
56
|
+
* cumulative-weight line in definition order. The same `(salt, subjectRef)`
|
|
57
|
+
* always maps to the same variant — sticky assignment with no storage — and each
|
|
58
|
+
* variant's share is `weight / sum(weights)`, also for similar or sequential
|
|
59
|
+
* `subjectRef`s. The component folds `scope` into the salt so the same subject
|
|
60
|
+
* buckets independently per scope. Assumes a non-empty `variants` with positive
|
|
61
|
+
* weights; the caller validates that upstream.
|
|
44
62
|
*/
|
|
45
63
|
export function pickVariant(
|
|
46
64
|
variants: readonly Variant[],
|
|
@@ -56,7 +74,7 @@ export function pickVariant(
|
|
|
56
74
|
total += variant.weight;
|
|
57
75
|
}
|
|
58
76
|
// Map the hash into [0, total): a point on the cumulative-weight line.
|
|
59
|
-
let target = (fnv1a(`${salt}:${subjectRef}`) / 0x100000000) * total;
|
|
77
|
+
let target = (fmix32(fnv1a(`${salt}:${subjectRef}`)) / 0x100000000) * total;
|
|
60
78
|
// Walk every variant but the last, subtracting its bucket width.
|
|
61
79
|
for (const variant of variants.slice(0, -1)) {
|
|
62
80
|
target -= variant.weight;
|