peeksafe 0.0.0-stage → 0.1.0

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +78 -0
  4. package/README.md +492 -2
  5. package/RESEARCH-NOTES.md +274 -0
  6. package/dist/baseline.d.ts +45 -0
  7. package/dist/baseline.d.ts.map +1 -0
  8. package/dist/baseline.js +49 -0
  9. package/dist/baseline.js.map +1 -0
  10. package/dist/check.d.ts +64 -0
  11. package/dist/check.d.ts.map +1 -0
  12. package/dist/check.js +172 -0
  13. package/dist/check.js.map +1 -0
  14. package/dist/cluster.d.ts +328 -0
  15. package/dist/cluster.d.ts.map +1 -0
  16. package/dist/cluster.js +598 -0
  17. package/dist/cluster.js.map +1 -0
  18. package/dist/errors.d.ts +87 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +143 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/evidence.d.ts +15 -0
  23. package/dist/evidence.d.ts.map +1 -0
  24. package/dist/evidence.js +30 -0
  25. package/dist/evidence.js.map +1 -0
  26. package/dist/frontier.d.ts +269 -0
  27. package/dist/frontier.d.ts.map +1 -0
  28. package/dist/frontier.js +460 -0
  29. package/dist/frontier.js.map +1 -0
  30. package/dist/gate.d.ts +173 -0
  31. package/dist/gate.d.ts.map +1 -0
  32. package/dist/gate.js +196 -0
  33. package/dist/gate.js.map +1 -0
  34. package/dist/index.d.ts +60 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +79 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/plan.d.ts +248 -0
  39. package/dist/plan.d.ts.map +1 -0
  40. package/dist/plan.js +482 -0
  41. package/dist/plan.js.map +1 -0
  42. package/dist/rand.d.ts +17 -0
  43. package/dist/rand.d.ts.map +1 -0
  44. package/dist/rand.js +92 -0
  45. package/dist/rand.js.map +1 -0
  46. package/dist/stats.d.ts +397 -0
  47. package/dist/stats.d.ts.map +1 -0
  48. package/dist/stats.js +1245 -0
  49. package/dist/stats.js.map +1 -0
  50. package/dist/stop.d.ts +163 -0
  51. package/dist/stop.d.ts.map +1 -0
  52. package/dist/stop.js +262 -0
  53. package/dist/stop.js.map +1 -0
  54. package/package.json +64 -4
  55. package/src/baseline.ts +72 -0
  56. package/src/check.ts +238 -0
  57. package/src/cluster.ts +830 -0
  58. package/src/errors.ts +208 -0
  59. package/src/evidence.ts +62 -0
  60. package/src/frontier.ts +782 -0
  61. package/src/gate.ts +358 -0
  62. package/src/index.ts +206 -0
  63. package/src/plan.ts +778 -0
  64. package/src/rand.ts +121 -0
  65. package/src/stats.ts +1579 -0
  66. package/src/stop.ts +452 -0
@@ -0,0 +1,87 @@
1
+ /**
2
+ * errors.ts: one error class, stable codes, structured detail.
3
+ *
4
+ * Nothing in peeksafe throws a bare string. Every code below is thrown
5
+ * somewhere in `src/` and is part of the public contract: a caller may branch
6
+ * on `err.code` and we will not repurpose one.
7
+ */
8
+ export type PeeksafeErrorCode = "PEEKSAFE_E_CONFIG" | "PEEKSAFE_E_CASE_DUPLICATE" | "PEEKSAFE_E_SUITE_EMPTY" | "PEEKSAFE_E_BASELINE_MISSING" | "PEEKSAFE_E_STAT_DOMAIN";
9
+ export interface PeeksafeErrorOptions {
10
+ detail?: Record<string, unknown>;
11
+ /** what the operator should actually do about it */
12
+ hint?: string;
13
+ cause?: unknown;
14
+ }
15
+ export declare class PeeksafeError extends Error {
16
+ readonly code: PeeksafeErrorCode;
17
+ readonly detail: Record<string, unknown>;
18
+ readonly hint?: string;
19
+ constructor(code: PeeksafeErrorCode, message: string, opts?: PeeksafeErrorOptions);
20
+ /** Stable JSON shape, for logs and CI artifacts. */
21
+ toJSON(): {
22
+ name: string;
23
+ code: string;
24
+ message: string;
25
+ hint?: string;
26
+ detail: Record<string, unknown>;
27
+ };
28
+ static is(e: unknown): e is PeeksafeError;
29
+ }
30
+ /**
31
+ * Domain guard for the statistics. Every function in `stats.ts` that can be
32
+ * handed nonsense (successes > trials, a negative count, an MDE larger than the
33
+ * baseline rate) routes through here rather than returning NaN.
34
+ */
35
+ export declare function requireCounts(successes: number, trials: number, where: string): void;
36
+ /**
37
+ * A probability that must be strictly inside (0,1), a rate, an effect size, an
38
+ * error budget. `requireProbability` allows the endpoints, which is right for a
39
+ * *rate* and wrong for an *effect*: an MDE of 0 asks for a zero-point drop to be
40
+ * detected, which every design answers "no" to for reasons that look like a
41
+ * ceiling problem and are not.
42
+ */
43
+ export declare function requireOpenProbability(p: number, name: string, where: string): void;
44
+ /**
45
+ * A configuration number that must be finite and strictly positive.
46
+ *
47
+ * Shared by `gate` and `shouldStop` so the two entry points cannot drift on
48
+ * what they accept. They did drift: `gate` rejected a non-positive
49
+ * `altConcentration` and `shouldStop` passed it through to a prior floor, so
50
+ * the same options object was a refusal through one door and a verdict through
51
+ * the other.
52
+ */
53
+ export declare function requirePositiveConfig(v: number, name: string, where: string): void;
54
+ /**
55
+ * The largest `altConcentration` the default statistic accepts at a verdict.
56
+ *
57
+ * Its error control is computed rather than proven, and a concentrated
58
+ * alternative is the one known way it exceeds alpha at a rate inside the
59
+ * checked range: 1.04 times alpha at 32 (`test/error-control.test.ts`). At 16
60
+ * the worst checked cell is 0.91 of alpha.
61
+ */
62
+ export declare const MAX_ALT_CONCENTRATION = 16;
63
+ /**
64
+ * `altConcentration` for a verdict: finite and positive, and at most
65
+ * `MAX_ALT_CONCENTRATION` under the default `bayes` statistic. `universal` is
66
+ * valid at every rate by construction, so it takes any positive value.
67
+ */
68
+ export declare function requireAltConcentration(v: number, evidence: string, where: string): void;
69
+ /**
70
+ * The error rates of the sequential test a planner prices: each strictly
71
+ * between 0 and 1, and summing to less than 1.
72
+ *
73
+ * At `alpha + beta >= 1` Wald's walls meet or cross, so the test decides
74
+ * before it has seen a run. `sprtExpectedN` answers a small positive number
75
+ * there, and a plan at `alpha: 0.6, beta: 0.5` priced every case at
76
+ * `minTrials` with nothing to say the design had no error control left.
77
+ */
78
+ export declare function requireErrorRates(alpha: number, beta: number, where: string): void;
79
+ /** The four cells of a pair table, each a non-negative integer. */
80
+ export declare function requirePairedCounts(p: {
81
+ bothPass: number;
82
+ worse: number;
83
+ better: number;
84
+ bothFail: number;
85
+ }, where: string): void;
86
+ export declare function requireProbability(p: number, name: string, where: string): void;
87
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,iBAAiB,GAEzB,mBAAmB,GACnB,2BAA2B,GAC3B,wBAAwB,GAExB,6BAA6B,GAE7B,wBAAwB,CAAC;AAE7B,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB,YAAY,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,oBAAyB,EAMpF;IAED,oDAAoD;IACpD,MAAM,IAAI;QACR,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,CAQA;IAED,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,aAAa,CAExC;CACF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAkBpF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAUnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAUlF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAYxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAalF;AAED,mEAAmE;AACnE,wBAAgB,mBAAmB,CACjC,CAAC,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EACxE,KAAK,EAAE,MAAM,GACZ,IAAI,CAaN;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAU/E"}
package/dist/errors.js ADDED
@@ -0,0 +1,143 @@
1
+ /**
2
+ * errors.ts: one error class, stable codes, structured detail.
3
+ *
4
+ * Nothing in peeksafe throws a bare string. Every code below is thrown
5
+ * somewhere in `src/` and is part of the public contract: a caller may branch
6
+ * on `err.code` and we will not repurpose one.
7
+ */
8
+ export class PeeksafeError extends Error {
9
+ code;
10
+ detail;
11
+ hint;
12
+ constructor(code, message, opts = {}) {
13
+ super(message, opts.cause !== undefined ? { cause: opts.cause } : undefined);
14
+ this.name = "PeeksafeError";
15
+ this.code = code;
16
+ this.detail = opts.detail ?? {};
17
+ this.hint = opts.hint;
18
+ }
19
+ /** Stable JSON shape, for logs and CI artifacts. */
20
+ toJSON() {
21
+ return {
22
+ name: this.name,
23
+ code: this.code,
24
+ message: this.message,
25
+ ...(this.hint ? { hint: this.hint } : {}),
26
+ detail: this.detail,
27
+ };
28
+ }
29
+ static is(e) {
30
+ return e instanceof PeeksafeError;
31
+ }
32
+ }
33
+ /**
34
+ * Domain guard for the statistics. Every function in `stats.ts` that can be
35
+ * handed nonsense (successes > trials, a negative count, an MDE larger than the
36
+ * baseline rate) routes through here rather than returning NaN.
37
+ */
38
+ export function requireCounts(successes, trials, where) {
39
+ if (!Number.isFinite(successes) || !Number.isFinite(trials)) {
40
+ throw new PeeksafeError("PEEKSAFE_E_STAT_DOMAIN", `${where}: counts must be finite`, {
41
+ detail: { successes, trials, where },
42
+ });
43
+ }
44
+ if (!Number.isInteger(successes) || !Number.isInteger(trials)) {
45
+ throw new PeeksafeError("PEEKSAFE_E_STAT_DOMAIN", `${where}: counts must be integers`, {
46
+ detail: { successes, trials, where },
47
+ });
48
+ }
49
+ if (trials < 0 || successes < 0 || successes > trials) {
50
+ throw new PeeksafeError("PEEKSAFE_E_STAT_DOMAIN", `${where}: need 0 ≤ successes ≤ trials, got ${successes}/${trials}`, { detail: { successes, trials, where } });
51
+ }
52
+ }
53
+ /**
54
+ * A probability that must be strictly inside (0,1), a rate, an effect size, an
55
+ * error budget. `requireProbability` allows the endpoints, which is right for a
56
+ * *rate* and wrong for an *effect*: an MDE of 0 asks for a zero-point drop to be
57
+ * detected, which every design answers "no" to for reasons that look like a
58
+ * ceiling problem and are not.
59
+ */
60
+ export function requireOpenProbability(p, name, where) {
61
+ if (!Number.isFinite(p) || p <= 0 || p >= 1) {
62
+ throw new PeeksafeError("PEEKSAFE_E_STAT_DOMAIN", `${where}: ${name} must be strictly between 0 and 1, got ${p}`, {
63
+ detail: { [name]: p, where },
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * A configuration number that must be finite and strictly positive.
69
+ *
70
+ * Shared by `gate` and `shouldStop` so the two entry points cannot drift on
71
+ * what they accept. They did drift: `gate` rejected a non-positive
72
+ * `altConcentration` and `shouldStop` passed it through to a prior floor, so
73
+ * the same options object was a refusal through one door and a verdict through
74
+ * the other.
75
+ */
76
+ export function requirePositiveConfig(v, name, where) {
77
+ if (!Number.isFinite(v) || v <= 0) {
78
+ throw new PeeksafeError("PEEKSAFE_E_CONFIG", `${where}: ${name} must be finite and positive, got ${v}`, {
79
+ detail: { [name]: v, where },
80
+ });
81
+ }
82
+ }
83
+ /**
84
+ * The largest `altConcentration` the default statistic accepts at a verdict.
85
+ *
86
+ * Its error control is computed rather than proven, and a concentrated
87
+ * alternative is the one known way it exceeds alpha at a rate inside the
88
+ * checked range: 1.04 times alpha at 32 (`test/error-control.test.ts`). At 16
89
+ * the worst checked cell is 0.91 of alpha.
90
+ */
91
+ export const MAX_ALT_CONCENTRATION = 16;
92
+ /**
93
+ * `altConcentration` for a verdict: finite and positive, and at most
94
+ * `MAX_ALT_CONCENTRATION` under the default `bayes` statistic. `universal` is
95
+ * valid at every rate by construction, so it takes any positive value.
96
+ */
97
+ export function requireAltConcentration(v, evidence, where) {
98
+ requirePositiveConfig(v, "altConcentration", where);
99
+ if (evidence === "bayes" && v > MAX_ALT_CONCENTRATION) {
100
+ throw new PeeksafeError("PEEKSAFE_E_CONFIG", `${where}: altConcentration must be at most ${MAX_ALT_CONCENTRATION} with the default statistic, got ${v}`, {
101
+ detail: { altConcentration: v, max: MAX_ALT_CONCENTRATION, evidence, where },
102
+ hint: "Use evidence: 'universal' for a more concentrated alternative, or check the rates with typeOneError.",
103
+ });
104
+ }
105
+ }
106
+ /**
107
+ * The error rates of the sequential test a planner prices: each strictly
108
+ * between 0 and 1, and summing to less than 1.
109
+ *
110
+ * At `alpha + beta >= 1` Wald's walls meet or cross, so the test decides
111
+ * before it has seen a run. `sprtExpectedN` answers a small positive number
112
+ * there, and a plan at `alpha: 0.6, beta: 0.5` priced every case at
113
+ * `minTrials` with nothing to say the design had no error control left.
114
+ */
115
+ export function requireErrorRates(alpha, beta, where) {
116
+ requireOpenProbability(alpha, "alpha", where);
117
+ requireOpenProbability(beta, "beta", where);
118
+ if (alpha + beta >= 1) {
119
+ throw new PeeksafeError("PEEKSAFE_E_CONFIG", `${where}: alpha + beta must be under 1, got ${alpha} + ${beta}`, {
120
+ detail: { alpha, beta, where },
121
+ hint: "a test with alpha + beta >= 1 does no better than ignoring the data",
122
+ });
123
+ }
124
+ }
125
+ /** The four cells of a pair table, each a non-negative integer. */
126
+ export function requirePairedCounts(p, where) {
127
+ for (const name of ["bothPass", "worse", "better", "bothFail"]) {
128
+ const v = p[name];
129
+ if (!Number.isInteger(v) || v < 0) {
130
+ throw new PeeksafeError("PEEKSAFE_E_STAT_DOMAIN", `${where}: ${name} must be a non-negative integer, got ${v}`, {
131
+ detail: { [name]: v, where },
132
+ });
133
+ }
134
+ }
135
+ }
136
+ export function requireProbability(p, name, where) {
137
+ if (!Number.isFinite(p) || p < 0 || p > 1) {
138
+ throw new PeeksafeError("PEEKSAFE_E_STAT_DOMAIN", `${where}: ${name} must be in [0,1], got ${p}`, {
139
+ detail: { [name]: p, where },
140
+ });
141
+ }
142
+ }
143
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,CAAoB;IACxB,MAAM,CAA0B;IAChC,IAAI,CAAU;IAEvB,YAAY,IAAuB,EAAE,OAAe,EAAE,IAAI,GAAyB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;QACxE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,aAAa,CACrB,wBAAwB,EACxB,GAAG,KAAK,KAAK,IAAI,wCAAwC,CAAC,EAAE,EAC5D;gBACE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE;aAC7B,CACF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,CAAS,EAAE,IAAY,EAAE,KAAa;IACvE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,aAAa,CACrB,wBAAwB,EACxB,GAAG,KAAK,KAAK,IAAI,0BAA0B,CAAC,EAAE,EAC9C;YACE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE;SAC7B,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * evidence.ts: which two-sample e-value a decision uses, and its ceiling.
3
+ *
4
+ * `bayes` is `twoSampleLogE`, the default: more evidence per run, with error
5
+ * control checked numerically rather than proven. `universal` is
6
+ * `universalTwoSampleLogE`: valid at every rate by construction, with less
7
+ * evidence per run. README, "What that guarantee rests on", has the numbers.
8
+ */
9
+ export type Evidence = "bayes" | "universal";
10
+ export declare function requireEvidence(evidence: unknown, where: string): asserts evidence is Evidence;
11
+ export declare const logEvidence: (evidence: Evidence, cs: number, cn: number, bs: number, bn: number, mde: number, altConcentration: number) => number;
12
+ export declare const toEvalue: (logE: number) => number;
13
+ /** The most evidence a candidate at rate `p` could ever reach against this baseline. */
14
+ export declare const ceilingLogEvidence: (evidence: Evidence, p: number, bs: number, bn: number, mde: number, altConcentration: number) => number;
15
+ //# sourceMappingURL=evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;AAE7C,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAU9F;AAED,eAAO,MAAM,WAAW,aACZ,QAAQ,MACd,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,OACL,MAAM,oBACO,MAAM,KACvB,MAGuD,CAAC;AAG3D,eAAO,MAAM,QAAQ,SAAU,MAAM,KAAG,MAGvC,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,aACnB,QAAQ,KACf,MAAM,MACL,MAAM,MACN,MAAM,OACL,MAAM,oBACO,MAAM,KACvB,MAGwD,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * evidence.ts: which two-sample e-value a decision uses, and its ceiling.
3
+ *
4
+ * `bayes` is `twoSampleLogE`, the default: more evidence per run, with error
5
+ * control checked numerically rather than proven. `universal` is
6
+ * `universalTwoSampleLogE`: valid at every rate by construction, with less
7
+ * evidence per run. README, "What that guarantee rests on", has the numbers.
8
+ */
9
+ import { PeeksafeError } from "./errors.js";
10
+ import { evidenceCeilingLogE, twoSampleLogE, universalCeilingLogE, universalTwoSampleLogE, } from "./stats.js";
11
+ export function requireEvidence(evidence, where) {
12
+ if (evidence !== "bayes" && evidence !== "universal") {
13
+ throw new PeeksafeError("PEEKSAFE_E_CONFIG", `${where}: evidence must be 'bayes' or 'universal', got ${String(evidence)}`, {
14
+ detail: { evidence },
15
+ });
16
+ }
17
+ }
18
+ export const logEvidence = (evidence, cs, cn, bs, bn, mde, altConcentration) => evidence === "universal"
19
+ ? universalTwoSampleLogE(cs, cn, bs, bn, mde, altConcentration)
20
+ : twoSampleLogE(cs, cn, bs, bn, mde, altConcentration);
21
+ // exp() of a large logE overflows, and e-BH cannot rank an infinite entry; the largest double keeps the order.
22
+ export const toEvalue = (logE) => {
23
+ const e = Math.exp(logE);
24
+ return Number.isFinite(e) ? e : Number.MAX_VALUE;
25
+ };
26
+ /** The most evidence a candidate at rate `p` could ever reach against this baseline. */
27
+ export const ceilingLogEvidence = (evidence, p, bs, bn, mde, altConcentration) => evidence === "universal"
28
+ ? universalCeilingLogE(p, bs, bn)
29
+ : evidenceCeilingLogE(p, bs, bn, mde, altConcentration);
30
+ //# sourceMappingURL=evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../src/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAIpB,MAAM,UAAU,eAAe,CAAC,QAAiB,EAAE,KAAa;IAC9D,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QACrD,MAAM,IAAI,aAAa,CACrB,mBAAmB,EACnB,GAAG,KAAK,kDAAkD,MAAM,CAAC,QAAQ,CAAC,EAAE,EAC5E;YACE,MAAM,EAAE,EAAE,QAAQ,EAAE;SACrB,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,QAAkB,EAClB,EAAU,EACV,EAAU,EACV,EAAU,EACV,EAAU,EACV,GAAW,EACX,gBAAwB,EAChB,EAAE,CACV,QAAQ,KAAK,WAAW;IACtB,CAAC,CAAC,sBAAsB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,gBAAgB,CAAC;IAC/D,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAE3D,+GAA+G;AAC/G,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE;IAC/C,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;AACnD,CAAC,CAAC;AAEF,wFAAwF;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,QAAkB,EAClB,CAAS,EACT,EAAU,EACV,EAAU,EACV,GAAW,EACX,gBAAwB,EAChB,EAAE,CACV,QAAQ,KAAK,WAAW;IACtB,CAAC,CAAC,oBAAoB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;IACjC,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,269 @@
1
+ /**
2
+ * frontier.ts: what *is* certifiable at coding-agent prices, and how.
3
+ *
4
+ * ## Why this module exists
5
+ *
6
+ * At $1 a run a 200-case suite at a 15-point MDE is $1,320 a pull request, so
7
+ * peeksafe is not a per-PR gate for a coding-agent benchmark at that size. That
8
+ * is true and it is half an answer. The other half, the one a
9
+ * buyer actually needs, is **which configurations *are* affordable**, and
10
+ * nobody had drawn it.
11
+ *
12
+ * A configuration is a point in five dimensions:
13
+ *
14
+ * suite size m × MDE δ × design × screening × baseline runs n_b
15
+ *
16
+ * and it is usable only if it is *both* affordable and **certifiable**. Those
17
+ * are different constraints, and a plan that conflates them quotes the wrong
18
+ * numbers. Cheap is easy: run fewer cases. Cheap *and able to decide anything* is
19
+ * the hard part, because `evidenceCeilingLogE` says a case whose unpaired
20
+ * ceiling sits under the e-BH bar cannot be certified at any budget, and the
21
+ * bar `m/q` moves with the suite size, so shrinking the suite raises the
22
+ * ceiling's odds *and* lowers the bar at the same time. That interaction is not
23
+ * something you can eyeball.
24
+ *
25
+ * ## The cost model, and the term the plan was missing
26
+ *
27
+ * `plan.ts` prices an observation at one number, `costPerRunUsd`. That is wrong
28
+ * in two ways at coding-agent prices, and both matter:
29
+ *
30
+ * 1. **Grading is not free.** An LLM judge is a model call; a coding-agent
31
+ * grader is a test suite in a container. So
32
+ *
33
+ * cost(observation) = costPerRunUsd + costPerGradeUsd
34
+ *
35
+ * and the second term is the *only* one a cheap proxy grader can reduce.
36
+ * When `costPerGradeUsd` is 0, which is the default,
37
+ * matching this package's own free graders, a proxy screen saves exactly
38
+ * nothing, and this module says so instead of offering it as an economy.
39
+ *
40
+ * 2. **The baseline is not free either, and it is not amortised over
41
+ * infinity.** The README calls the baseline "amortised, you pay it once on
42
+ * main". At $0.002 a run that is a rounding error. At $1 a run, a 200-case
43
+ * suite with a 240-run baseline is 48,000 runs, **$48,000**, and spread
44
+ * over a hundred pull requests it is still $480 each, which is larger than
45
+ * everything else in the bill put together. The unpaired design's evidence
46
+ * ceiling is bought with baseline runs, so *the amortised baseline is the
47
+ * dominant cost of the unpaired design at coding-agent prices*, and the
48
+ * paired design's headline advantage is not variance reduction. It is that
49
+ * it does not need to buy a ceiling.
50
+ *
51
+ * ## What this module will not do
52
+ *
53
+ * It will not recommend a screened configuration whose **recall cost has not
54
+ * been measured**. Screening is the largest cost lever available and it is paid
55
+ * for in missed regressions, which the caller supplies as `screenRecall`
56
+ * against planted ground truth, and until someone has, the honest price of a
57
+ * screened plan is unknown rather than low.
58
+ */
59
+ export type FrontierDesign = "unpaired" | "paired";
60
+ /**
61
+ * What the screening pass grades with.
62
+ * - `none` every case goes straight to the sequential test
63
+ * - `expensive` the screen pays the real grader for its k runs per case
64
+ * - `proxy` the screen ranks on a cheap deterministic grader, so its runs
65
+ * cost `costPerRunUsd` and no grade. Sound, a screen chooses
66
+ * where to spend and cannot falsely certify, but it ranks on an
67
+ * effect attenuated by Youden's J, so it costs
68
+ * power, and the power is what has to be measured.
69
+ */
70
+ export type FrontierScreen = "none" | "expensive" | "proxy";
71
+ /**
72
+ * Which bill the budget is checked against. Three, because they are three
73
+ * genuinely different questions, and answering one while quoting another
74
+ * misprices the plan.
75
+ *
76
+ * `'typical'`, a pull request that changed nothing. Almost every pull request
77
+ * is this one. Budget from it and a genuine regression overruns and comes
78
+ * back uncertified, which is a survivable failure.
79
+ *
80
+ * `'certify-all'`, every case regressed by exactly the MDE and every one had
81
+ * to be certified. It was once called "the ceiling", and
82
+ * it is **not** an upper bound: at a large MDE against a sharp baseline,
83
+ * certifying a real regression is *cheaper* than clearing a case that did not
84
+ * move, so this bill can come in under the typical one. The arithmetic was
85
+ * never wrong; the word "ceiling" was.
86
+ *
87
+ * `'ceiling'`, every case the screen kept runs to the per-case cap
88
+ * (`maxTrials` observations). The gate cannot spend more than that by
89
+ * construction, so nothing can overrun it. This is the basis to use when the
90
+ * gate must return a verdict rather than a deferral, and it changes which
91
+ * *design* wins: paired costs two runs an observation and loses the typical
92
+ * basis by construction, while on the ceiling basis, and whenever the
93
+ * baseline cannot be amortised, it wins outright.
94
+ */
95
+ export type FrontierBasis = "typical" | "certify-all" | "ceiling";
96
+ export interface FrontierAxes {
97
+ cases: number[];
98
+ /** in probability units, e.g. 0.15 for 15 points */
99
+ mdes: number[];
100
+ baselineRuns: number[];
101
+ designs: FrontierDesign[];
102
+ screens: FrontierScreen[];
103
+ /** screening runs per case; only consulted for screens other than `none` */
104
+ screenRuns: number[];
105
+ }
106
+ export declare const DEFAULT_AXES: FrontierAxes;
107
+ export interface FrontierConfig {
108
+ /** the budget one pull request may spend */
109
+ budgetUsd: number;
110
+ /** which bill the budget is checked against */
111
+ basis: FrontierBasis;
112
+ /** USD to execute the agent once on one case */
113
+ costPerRunUsd: number;
114
+ /**
115
+ * USD to *grade* one output with the real grader. Zero for this package's own
116
+ * graders; a model call or a container run for anything real. This is the
117
+ * only term a proxy grader can reduce.
118
+ */
119
+ costPerGradeUsd: number;
120
+ /** the pass rate a typical case sits at, used for every power calculation */
121
+ baselineRate: number;
122
+ /** suite-level false discovery rate */
123
+ fdr: number;
124
+ /** measured pair coupling in [0,1] */
125
+ pairCoupling: number;
126
+ /**
127
+ * How many pull requests one recorded baseline is spread over before it is
128
+ * re-recorded. The README's "amortised" claim is exactly this number, and it
129
+ * had never been written down.
130
+ */
131
+ amortisePrs: number;
132
+ /**
133
+ * Baseline runs per case the *paired* design needs. The paired e-value's null
134
+ * is a point mass, so the stored baseline is not part of its validity and
135
+ * does not set a ceiling, it only feeds the SPRT stopping rule and the
136
+ * screen. A short one is enough, and that asymmetry is most of why the paired
137
+ * design wins at these prices.
138
+ */
139
+ pairedBaselineRuns: number;
140
+ /** fraction of cases a screen carries through to the expensive test */
141
+ screenKeepFraction: number;
142
+ /** past this many runs for one case, call it unaffordable regardless of budget */
143
+ runsPerCaseCeiling: number;
144
+ /**
145
+ * Measured recall of the screen, per screen kind. `null` means nobody has
146
+ * measured it, and a configuration using that screen will be reported but
147
+ * never *recommended*.
148
+ */
149
+ screenRecall: {
150
+ expensive: number | null;
151
+ proxy: number | null;
152
+ };
153
+ /** free text saying where `screenRecall` came from; printed next to it */
154
+ screenRecallSource: string;
155
+ /** the sequential design being priced; match the stopping rule you actually run */
156
+ alpha: number;
157
+ beta: number;
158
+ minTrials: number;
159
+ maxTrials: number;
160
+ batchSize: number;
161
+ nullQuantile: number;
162
+ }
163
+ export declare const DEFAULT_FRONTIER: FrontierConfig;
164
+ /** A cost broken into the three things a pull request actually pays for. */
165
+ export interface FrontierCost {
166
+ screenRuns: number;
167
+ screenUsd: number;
168
+ testRuns: number;
169
+ testUsd: number;
170
+ /** baseline runs charged to *this* pull request after amortisation */
171
+ baselineRunsAmortised: number;
172
+ baselineUsd: number;
173
+ totalUsd: number;
174
+ }
175
+ export interface FrontierPoint {
176
+ cases: number;
177
+ mde: number;
178
+ baselineRuns: number;
179
+ design: FrontierDesign;
180
+ screen: FrontierScreen;
181
+ /** 0 when `screen` is `none` */
182
+ screenRunsPerCase: number;
183
+ /** how many cases the screen carries through */
184
+ keep: number;
185
+ /** e-BH solo bar, in logs */
186
+ barLogE: number;
187
+ /** unpaired evidence ceiling at this baseline size, in logs. −∞ is not used;
188
+ * the paired design has no ceiling and this field is `null` for it. */
189
+ ceilingLogE: number | null;
190
+ feasible: boolean;
191
+ /** why not, when not. Never empty when `feasible` is false. */
192
+ infeasibleBecause: string | null;
193
+ /** observations per case to certify a case that really regressed */
194
+ certifyObservations: number;
195
+ /** observations per case on a pull request that changed nothing */
196
+ typicalObservations: number;
197
+ /**
198
+ * The per-case run cap this configuration needs. A `shouldStop` `maxTrials`
199
+ * below it stops cases short with reason `budget`, however much money is left.
200
+ */
201
+ requiresMaxRuns: number;
202
+ /** true when `requiresMaxRuns` exceeds the gate's configured cap */
203
+ exceedsGateCap: boolean;
204
+ /** a pull request that changed nothing, the number to budget from */
205
+ typical: FrontierCost;
206
+ /** every case regressed by exactly the MDE and had to be certified. A scenario, not a bound. */
207
+ certifyAll: FrontierCost;
208
+ /** every kept case ran to the per-case cap, the bill nothing can exceed */
209
+ ceiling: FrontierCost;
210
+ /** whichever of the three the configured `basis` selects, what the budget is checked against */
211
+ basisCostUsd: number;
212
+ withinBudget: boolean;
213
+ /** measured recall of this configuration's screen; null when unmeasured */
214
+ screenRecall: number | null;
215
+ /** true when this configuration may be *recommended*, not merely reported */
216
+ recommendable: boolean;
217
+ /** why it is reported but not recommendable */
218
+ caveat: string | null;
219
+ }
220
+ /** $1.00, but $0.0021 rather than $0.00, a per-run price rounds to nothing. */
221
+ export declare const fmtRate: (x: number) => string;
222
+ /**
223
+ * Observations per case on a pull request where nothing moved, clamped onto the
224
+ * gate's own batch grid.
225
+ */
226
+ export declare function typicalObservationsPerCase(rate: number, mde: number, cfg: FrontierConfig, baselineRuns: number): number;
227
+ export declare function evaluatePoint(cases: number, mde: number, baselineRuns: number, design: FrontierDesign, screen: FrontierScreen, screenRunsPerCase: number, cfg: FrontierConfig): FrontierPoint;
228
+ /** Every point in the swept space, feasible or not. */
229
+ export declare function enumerateFrontier(cfg: FrontierConfig, axes?: FrontierAxes): FrontierPoint[];
230
+ export interface FrontierCell {
231
+ cases: number;
232
+ mde: number;
233
+ /** the cheapest recommendable configuration that certifies this cell */
234
+ best: FrontierPoint;
235
+ /** the cheapest configuration ignoring the recommendable rule, when it differs */
236
+ cheapestReported: FrontierPoint | null;
237
+ }
238
+ export interface FrontierResult {
239
+ config: FrontierConfig;
240
+ axes: FrontierAxes;
241
+ /** everything swept */
242
+ points: FrontierPoint[];
243
+ /** feasible, within budget, and recommendable */
244
+ affordable: FrontierPoint[];
245
+ /**
246
+ * The frontier proper: the (cases, mde) cells that are achievable within
247
+ * budget and not dominated by another achievable cell, i.e. no other cell
248
+ * has at least as many cases *and* an MDE at least as tight.
249
+ */
250
+ frontier: FrontierCell[];
251
+ /** cheapest feasible configuration overall, whether or not it fits */
252
+ cheapestFeasible: FrontierPoint | null;
253
+ /** the smallest budget at which anything at all becomes recommendable */
254
+ minimumViableBudgetUsd: number | null;
255
+ headline: string;
256
+ }
257
+ export declare function computeFrontier(cfg: FrontierConfig, axes?: FrontierAxes): FrontierResult;
258
+ /**
259
+ * Where the money goes, for one configuration. Printed under the frontier
260
+ * because the shares are the actual finding: at coding-agent prices the
261
+ * unpaired design's amortised baseline is usually the largest line, and it is
262
+ * the one the README used to call free.
263
+ */
264
+ export declare function costShares(p: FrontierPoint, basis?: FrontierBasis): {
265
+ screen: number;
266
+ test: number;
267
+ baseline: number;
268
+ };
269
+ //# sourceMappingURL=frontier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontier.d.ts","sourceRoot":"","sources":["../src/frontier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAy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