Skip to content

[ CONVEX COMPONENT · STABLE · MIT ]

@vllnt/convex-experiments

Deterministic A/B experimentation — sticky variant assignment and deduped exposure tracking

STABLE 0.1.0 · 1 GitHub star

Package details

Install

The untagged install gets the latest stable version (0.1.0). The canary tag tracks main (0.1.1-canary.131a7f7).

terminal
pnpm add @vllnt/convex-experiments
pnpm add @vllnt/convex-experiments@canary

Register the component

Add it to your app’s convex/convex.config.ts, then run npx convex dev to generate the references.

convex/convex.config.ts
import { defineApp } from "convex/server";
import experiments from "@vllnt/convex-experiments/convex.config";
const app = defineApp();
app.use(experiments);
export default app;

Use it

Usage, options and examples are in the package README.

Read the README

Downloads

Last 7 days
15
Since first publish
1,812

Downloads per week since 17 June 2026, oldest on the left. Weeks count back from 23 November 2026, so the first one may be shorter than seven days.

15 downloads in the last 7 days. 1,812 downloads since 17 June 2026. Source: npm, counted through 23 November 2026.

Show downloads per week as a table
WeekDownloads
17 June 2026 to 22 June 2026429
23 June 2026 to 29 June 202615
30 June 2026 to 6 July 202651
7 July 2026 to 13 July 202624
14 July 2026 to 20 July 20268
21 July 2026 to 27 July 20264
28 July 2026 to 3 August 20267
4 August 2026 to 10 August 202610
11 August 2026 to 17 August 202619
18 August 2026 to 24 August 20262
25 August 2026 to 31 August 2026322
1 September 2026 to 7 September 2026370
8 September 2026 to 14 September 202646
15 September 2026 to 21 September 202610
22 September 2026 to 28 September 202613
29 September 2026 to 5 October 202611
6 October 2026 to 12 October 20269
13 October 2026 to 19 October 20266
20 October 2026 to 26 October 20266
27 October 2026 to 2 November 2026335
3 November 2026 to 9 November 202682
10 November 2026 to 16 November 202618
17 November 2026 to 23 November 202615

Release history

Every release on a timeline, oldest on the left. A tall mark with its version is a stable release; a short mark is a canary build. The time axis is the one of the downloads chart, so a release stands above the week it shipped in.

1 stable release and 10 canary builds since 17 June 2026. Latest stable: 0.1.0 on 1 September 2026.

Show every release as a table
VersionKindPublished
0.1.1-canary.131a7f7canary31 October 2026
0.1.1-canary.b4e25b0canary31 October 2026
0.1.0stable1 September 2026
0.1.0-canary.cead4b6canary1 September 2026
0.1.0-canary.bc84479canary31 August 2026
0.1.0-canary.0b21dd5canary31 August 2026
0.1.0-canary.cc3e7d0canary31 August 2026
0.1.0-canary.1c87af5canary17 June 2026
0.1.0-canary.73e1118canary17 June 2026
0.1.0-canary.f2cd1bacanary17 June 2026
0.1.0-canary.207ab91canary17 June 2026

Changelog

The newest stable releases of @vllnt/convex-experiments, with the notes from its changelog.

  1. 0.1.0

    Added
    • First release of @vllnt/convex-experiments.
    • Deterministic, sticky variant assignment: pickVariant hashes (salt, subjectRef) with FNV-1a onto the cumulative-weight line, so the same subject always lands in the same weighted bucket — sticky before persistence, weight-respecting, and stable across concurrent first-assign calls.
    • define / setStatus lifecycle (draft → running → stopped); only running enrolls, and stopping freezes new enrollment while preserving recorded assignments and exposures.
    • assign returns { variant: null } (not enrolled) or { variant, isNew }, persisting the pick on first sight and replaying it afterwards.
    • logExposure dedups exposures into one tallied row per subject; results reports distinct subjects and total exposures per variant.
    • salt defaults to the experiment key and seeds the assignment hash.
    • Scopes namespace experiments per tenant / surface; server-sourced timestamps throughout.
    • Fully typed end to end — variant keys, weights, statuses, and refs are concrete types; no v.any().
    • define rejects an empty variant set, a non-positive/non-finite weight, or a duplicate variant key with ConvexError({ code: "INVALID_VARIANTS" }).
    • Optional @vllnt/convex-experiments/react entry — useVariant (flicker-free, on peek), useAssignment, useExperimentResults. Thin useQuery wrappers over the host's re-exported refs; react is an optional peer dep; render-tested in jsdom at 100%.
    • peek — a read-only, deterministic query that returns a subject's sticky variant without persisting (the SSR / flicker-free first-paint path).
    • listExperiments(scope, status?) — discovery / management surface.
    • forgetSubject — erase one subject's assignment + exposure (GDPR right-to-erasure), decrementing tallies; deleteExperiment — bounded, self-rescheduling cascade delete of an experiment + all data.
    • results now returns assigned and weight per variant (alongside subjects/exposures) so a host can check sample-ratio-mismatch, and reads maintained variantTallies in O(variants) instead of scanning every exposure row.
    • INVALID_VARIANTS errors now carry a reason (empty / non_positive_weight / duplicate_key).
    Changed
    • Treat Convex _generated output as CLI-owned, exclude it from formatting, and expose a dedicated codegen script.
    • Refresh all direct dependencies to their latest compatible releases for canary validation.
    • Require convex@^1.45.0 and update convex-test to ^0.0.56.
    • scope is folded into the assignment hash (${scope}:${salt}) so the same subjectRef buckets independently per scope — fixes cross-tenant assignment correlation.
    Fixed
    • Reject zero, fractional, non-finite, negative, and oversized experiment-deletion batches to prevent infinite self-scheduling and oversized transactions.
    • Definition immutability (EXPERIMENT_LOCKED). Changing variants or salt after a subject is assigned now throws instead of silently splitting the population across two randomizations. The earlier "change salt to re-randomize" claim was incorrect for enrolled subjects and is removed from the docs; re-randomize by defining a new experiment key.
All releases of @vllnt/convex-experiments
Stable releases
RSSAtomJSON Feed
Canary builds
RSSAtomJSON Feed

Licence

Released under the MIT licence. The full text is in the source repository.

[ PACKAGE ]

Stable
0.1.0
Canary
0.1.1-canary.131a7f7
GitHub stars
1 GitHub star
Licence
MIT

Theme