v1 source realm
Package dokimi is a public registry of pre-registered experiments.
Package dokimi is a public registry of pre-registered experiments.
Before a test starts, its owner locks a plan here: the hypothesis, the one metric that decides it, the size of change that counts as a win and the number of people each arm must reach. The block height and a fingerprint of the plan are stored with it. From then on the plan cannot be edited.
While the test runs the owner reports running totals. Every report is kept and totals can only go up. A mistake is fixed by adding a correction, which is marked as one and never replaces the report it corrects. Closing the experiment judges the last report against the plan with the rules in gno.land/p/g1v9mz7rtgkvwkw90ey6496h5fk6pj6cgyawkvft/dokimi/v1.
An owner is whoever called Register: a person's account, or another realm that wants its own experiments on the public record.
1
11
func AddCorrection
crossing Action1func AddCorrection(cur realm, id uint64, controlExposures, controlConversions, variantExposures, variantConversions int64, reason string)AddCorrection replaces the running totals after a mistake, for example a mistyped count. Unlike AddReport it may lower a total, so it asks for a reason and is shown on the page as a correction. The mistaken report stays on the record: a correction is added after it, never written over it. Only the owner can correct, and only while the experiment is open.
func AddNote
crossing ActionAddNote attaches a public remark to an experiment. Only the owner can add one, at any time, including after the experiment is closed.
func AddReport
crossing Action1func AddReport(cur realm, id uint64, controlExposures, controlConversions, variantExposures, variantConversions int64, source string)AddReport records the running totals for both arms. Only the owner can report, only while the experiment is open, and no total may go down. source says where the numbers came from, for example a dashboard link.
func Close
crossing ActionClose ends an experiment and stores the verdict of its last report judged against the locked plan. Only the owner can close, once, and only after at least one report. It returns the outcome: "met", "missed" or "inconclusive".
func Count
ActionCount returns how many experiments have been registered.
func DigestOf
ActionDigestOf returns the fingerprint of the locked plan.
func LiftOf
ActionLiftOf returns the lift of the latest report in basis points. ok is false when there is no report yet or the lift is undefined.
func Matches
Action1func Matches(id uint64, title, hypothesis, metric, control, variant, direction, target string, minSample int64) boolMatches reports whether the given plan text is exactly what was locked under id. It recomputes the fingerprint from the arguments, so anyone can check a plan they were shown against the public record.
func Register
crossing Action1func Register(cur realm, title, hypothesis, metric, control, variant, direction, target string, minSample int64) uint64Register locks a new plan and returns its id. The caller becomes the owner.
direction is "increase" or "decrease". target is the smallest relative change that counts as a win, as a percentage such as "15" or "12.5". minSample is the number of exposures each arm must reach before the result can count.
func Render
func Status
ActionStatus returns "open" while an experiment is running, and afterwards its outcome: "met", "missed" or "inconclusive". Other realms can call it to act on a result, for example to release a reward only when a target was met.
3
type Experiment
structExperiment is one locked plan and everything recorded against it.
type Note
structNote is a public remark by the owner, for example a change of plan that readers should know about. Notes are added, never edited or removed.
type Report
struct 1type Report struct {
2 Height int64
3 Time time.Time
4 Control core.Tally
5 Variant core.Tally
6 Source string // where the numbers came from, in the owner's words
7
8 // Correction marks a report that replaces a mistaken one. It is the only
9 // kind of report allowed to lower a total, and it is shown as a correction
10 // with its reason for as long as the experiment exists.
11 Correction bool
12 Reason string
13}Report is one snapshot of the running totals, kept forever.