lastlight-evals 0.13.4 → 0.14.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.
@@ -0,0 +1,444 @@
1
+ /**
2
+ * The micro-survey report contract — the shapes `scripts/micro-survey.ts` writes
3
+ * and the dashboard reads, plus the pure arithmetic over them.
4
+ *
5
+ * A micro-survey replays ONE survey branch of the pr-review pipeline against a
6
+ * preserved workspace: ~2 minutes and ~$0.25 instead of a 30-47 minute full
7
+ * case. It is the fast feedback loop for a prompt or skill edit, and it writes
8
+ * one JSON file per invocation to
9
+ * `eval-results/micro-survey/<ISO-stamp>-<label>-<family>.json`, which the
10
+ * dashboard server already serves under `/data/`.
11
+ *
12
+ * **Node-free on purpose** (same contract as `review-metrics.ts`): the harness
13
+ * scan in `report.ts` needs `node:fs`, the browser bundle must not, so the
14
+ * shapes and the arithmetic live here and both sides import them rather than
15
+ * keeping a copy that can drift.
16
+ *
17
+ * Two facts this module exists to keep honest:
18
+ *
19
+ * - **`needsProbePct` means nothing without its baseline.** The replay number
20
+ * is only ever read against what the preserved arm itself wrote for that
21
+ * family, so {@link MicroSurveyEntry} carries the two together and never the
22
+ * replay alone.
23
+ * - **A band of repeats is a RANGE, not a mean.** The survey runs at
24
+ * temperature 1 and its run-to-run variance is the dominant effect; two or
25
+ * three points support a min-max spread and nothing more. {@link microRange}
26
+ * is the only aggregate offered here — deliberately no mean and no SD.
27
+ *
28
+ * And one that arrived later, from measuring the `enforcement` family: the
29
+ * per-repeat `needsProbePct` is **bimodal**. A repeat marks ~5 rows or it marks
30
+ * none; almost nothing lands in between. So the percentage is a Bernoulli trial
31
+ * wearing a continuous disguise, and the quantity that actually varies between
32
+ * two arms is {@link microFireRate} — the fraction of repeats that asked for at
33
+ * least one probe. That is the headline; the per-repeat percentages stay visible
34
+ * beneath it as the evidence, never folded into a mean.
35
+ *
36
+ * And a third, because the first two are both COUNTS: a fire rate of 100% is a
37
+ * pass that asked for a probe on every row, which is as consistent with twelve
38
+ * clean reassurances as with twelve real risks. Neither number says whether a
39
+ * row landed on a real defect, or what it said when it did. So a report may
40
+ * also carry the case's GOLD and, per repeat, what each gold got — see
41
+ * {@link MicroGoldRepeat}. That is the quality view; the fire rate is the cost
42
+ * view, and the two are read together.
43
+ */
44
+ /**
45
+ * Fill in an index entry served by an OLDER harness.
46
+ *
47
+ * `/api/micro` is not always computed by the code reading it: the dashboard is
48
+ * a long-lived SPA against a `serve` process that may predate these fields, and
49
+ * `scripts/build-site.ts` BAKES the index into a static file that then outlives
50
+ * every rebuild of the bundle. An entry missing the live/fire-rate fields must
51
+ * therefore degrade to what an old report could still answer — a completed run
52
+ * whose fire rate is derived from its per-repeat percentages — rather than
53
+ * render `undefined/undefined`.
54
+ */
55
+ export function withMicroEntryDefaults(e) {
56
+ const hasLive = typeof e?.repeatsDone === "number" && typeof e?.firedRepeats === "number";
57
+ const hasLatency = Array.isArray(e?.durationSec) && Array.isArray(e?.turns) && Array.isArray(e?.toolCalls);
58
+ const hasGold = Array.isArray(e?.goldAsserted) && Array.isArray(e?.seed);
59
+ if (hasLive && hasLatency && hasGold)
60
+ return e;
61
+ const pcts = Array.isArray(e?.needsProbePct) ? e.needsProbePct : [];
62
+ // An older index recorded no latency at all. One `null` per completed repeat
63
+ // is the truthful filler: the repeats happened, nobody timed them.
64
+ const unmeasured = (xs) => Array.isArray(xs) ? xs : pcts.map(() => null);
65
+ const repeatsDone = typeof e?.repeatsDone === "number" ? e.repeatsDone : pcts.length;
66
+ const firedRepeats = typeof e?.firedRepeats === "number" ? e.firedRepeats : pcts.filter((p) => num(p) > 0).length;
67
+ return {
68
+ ...e,
69
+ repeatsDone,
70
+ firedRepeats,
71
+ fireRate: typeof e?.fireRate === "number" ? e.fireRate : microFireRate(firedRepeats, repeatsDone),
72
+ live: e?.live === true,
73
+ heartbeat: typeof e?.heartbeat === "string" ? e.heartbeat : null,
74
+ ambientSkills: typeof e?.ambientSkills === "boolean" ? e.ambientSkills : null,
75
+ agentsMd: typeof e?.agentsMd === "boolean" ? e.agentsMd : null,
76
+ durationSec: unmeasured(e?.durationSec),
77
+ turns: unmeasured(e?.turns),
78
+ toolCalls: unmeasured(e?.toolCalls),
79
+ // An older server knows nothing about gold. Empty series and `null` — the
80
+ // report may well carry gold, but this index cannot say, and a column of
81
+ // zeros would claim the pass hit nothing.
82
+ gold: Array.isArray(e?.gold) ? e.gold : null,
83
+ goldAsserted: Array.isArray(e?.goldAsserted) ? e.goldAsserted : [],
84
+ goldReached: Array.isArray(e?.goldReached) ? e.goldReached : [],
85
+ probesOnGold: Array.isArray(e?.probesOnGold) ? e.probesOnGold : [],
86
+ probesOffGold: Array.isArray(e?.probesOffGold) ? e.probesOffGold : [],
87
+ goldF1: Array.isArray(e?.goldF1) ? e.goldF1 : [],
88
+ goldPrecision: Array.isArray(e?.goldPrecision) ? e.goldPrecision : [],
89
+ goldRecall: Array.isArray(e?.goldRecall) ? e.goldRecall : [],
90
+ perGold: Array.isArray(e?.perGold) ? e.perGold : null,
91
+ baselineGold: e?.baselineGold ?? null,
92
+ seed: Array.isArray(e?.seed) ? e.seed : [],
93
+ baselineSeed: e?.baselineSeed ?? null,
94
+ };
95
+ }
96
+ /**
97
+ * The min-max spread of a repeat band — **the only aggregate this module
98
+ * offers**. `null` for an empty band; a single point returns `min === max` and
99
+ * the caller must still present it as one observation, not as a result.
100
+ */
101
+ export function microRange(values) {
102
+ if (!values.length)
103
+ return null;
104
+ return { min: Math.min(...values), max: Math.max(...values) };
105
+ }
106
+ /**
107
+ * A repeat FIRED if it asked for at least one probe. The one bit each repeat
108
+ * really carries — see the bimodality note at the top of this file.
109
+ */
110
+ export function microFired(r) {
111
+ return num(r?.needsProbe) > 0;
112
+ }
113
+ /**
114
+ * **The headline metric**: the fraction of completed repeats that fired.
115
+ *
116
+ * `null` below one completed repeat — a fire rate over nothing is not zero.
117
+ * Deliberately NOT a mean of `needsProbePct`: those values are bimodal (a repeat
118
+ * marks ~5 rows or none), so their mean describes no observation that ever
119
+ * happened, while this describes exactly what varied.
120
+ */
121
+ export function microFireRate(firedRepeats, repeatsDone) {
122
+ return repeatsDone > 0 ? firedRepeats / repeatsDone : null;
123
+ }
124
+ /**
125
+ * Below this many completed repeats a fire rate is **not rankable**. It is a
126
+ * count of coin flips: at 3 repeats the difference between 1/3 and 2/3 is one
127
+ * flip. The number is still shown — it is the qualifier that is mandatory, not
128
+ * the suppression.
129
+ */
130
+ export const MICRO_RANKABLE_REPEATS = 8;
131
+ export function microRankable(repeatsDone) {
132
+ return repeatsDone >= MICRO_RANKABLE_REPEATS;
133
+ }
134
+ /**
135
+ * How long a `live` report may go unwritten before it is presumed dead.
136
+ *
137
+ * The script rewrites its file after every repeat, and a repeat is ~2 minutes,
138
+ * so the heartbeat is refreshed far more often than this — but it is refreshed
139
+ * on the WRITE, not on a timer, so the bound has to clear the gap between two
140
+ * writes of a slow repeat. 90 s is the compromise: long enough that a running
141
+ * replay is never libelled as dead mid-repeat, short enough that a killed script
142
+ * stops reading as progress within one screen-refresh of noticing.
143
+ */
144
+ export const MICRO_STALE_HEARTBEAT_MS = 90_000;
145
+ /**
146
+ * {@link MicroStatus} for a report, as of `nowMs`.
147
+ *
148
+ * A `live` report carrying no parsable heartbeat reads as `interrupted`: there
149
+ * is no evidence a writer exists, and the failure mode being designed against is
150
+ * exactly "absence read as progress". A report with no `live` flag at all is
151
+ * `complete` — that is every report written before the script published
152
+ * mid-run, and each of those really was finished when it landed.
153
+ */
154
+ export function microStatus(r, nowMs) {
155
+ if (r?.live !== true)
156
+ return "complete";
157
+ const beat = typeof r.heartbeat === "string" ? Date.parse(r.heartbeat) : Number.NaN;
158
+ if (!Number.isFinite(beat))
159
+ return "interrupted";
160
+ return nowMs - beat > MICRO_STALE_HEARTBEAT_MS ? "interrupted" : "running";
161
+ }
162
+ /**
163
+ * The filename stamp back to an ISO instant.
164
+ *
165
+ * The script writes `new Date().toISOString().replace(/[:.]/g, "-")` then
166
+ * `-<label>-<family>`, so the leading 24 characters are a lossless ISO instant
167
+ * with `:` and `.` flattened to `-`. Everything after is a label that may itself
168
+ * contain dashes, hence the anchored prefix match rather than a split.
169
+ */
170
+ export function parseMicroStamp(id) {
171
+ const m = /^(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z-/.exec(id);
172
+ return m ? `${m[1]}T${m[2]}:${m[3]}:${m[4]}.${m[5]}Z` : null;
173
+ }
174
+ const num = (x) => (typeof x === "number" && Number.isFinite(x) ? x : 0);
175
+ /** The optional counterpart of {@link num}: a value that was never recorded
176
+ * stays `null` rather than becoming a measured zero. */
177
+ const opt = (x) => typeof x === "number" && Number.isFinite(x) ? x : null;
178
+ /**
179
+ * One parsed file → its index entry, or `null` if it isn't a micro-survey
180
+ * report at all (a stray JSON file in the directory, or one half-written by a
181
+ * run still in flight).
182
+ */
183
+ export function summariseMicroReport(id, raw, fallbackIso) {
184
+ const r = raw;
185
+ if (!r || typeof r !== "object" || typeof r.label !== "string" || typeof r.family !== "string") {
186
+ return null;
187
+ }
188
+ const results = Array.isArray(r.results) ? r.results : [];
189
+ const baseline = r.baseline && typeof r.baseline === "object" ? r.baseline : null;
190
+ // `repeatsDone` / `firedRepeats` / `fireRate` are all DERIVABLE from
191
+ // `results[]`, and derived is what we use when the file does not carry them —
192
+ // every report written before the script published mid-run is in that case,
193
+ // and they are perfectly good micro-surveys. The file's own value wins when
194
+ // present, because the script counts against what it launched.
195
+ const repeatsDone = typeof r.repeatsDone === "number" ? r.repeatsDone : results.length;
196
+ const firedRepeats = typeof r.firedRepeats === "number" ? r.firedRepeats : results.filter((x) => microFired(x)).length;
197
+ return {
198
+ id,
199
+ report: `/data/micro-survey/${encodeURIComponent(`${id}.json`)}`,
200
+ generatedAt: parseMicroStamp(id) ?? fallbackIso,
201
+ label: r.label,
202
+ family: r.family,
203
+ model: typeof r.model === "string" ? r.model : "—",
204
+ thinking: typeof r.thinking === "string" ? r.thinking : null,
205
+ repeats: typeof r.repeats === "number" ? r.repeats : results.length,
206
+ repeatsDone,
207
+ live: r.live === true,
208
+ heartbeat: typeof r.heartbeat === "string" ? r.heartbeat : null,
209
+ ambientSkills: typeof r.ambientSkills === "boolean" ? r.ambientSkills : null,
210
+ agentsMd: typeof r.agentsMd === "boolean" ? r.agentsMd : null,
211
+ // Recomputed rather than copied: a `fireRate` and the two counts beside it
212
+ // can only ever be read together, so one arithmetic keeps them consistent.
213
+ fireRate: microFireRate(firedRepeats, repeatsDone),
214
+ firedRepeats,
215
+ fixture: typeof r.fixture === "string" ? r.fixture : "",
216
+ baselineNeedsProbePct: baseline ? num(baseline.needsProbePct) : null,
217
+ baselineRows: baseline ? num(baseline.rows) : null,
218
+ needsProbePct: results.map((x) => num(x?.needsProbePct)),
219
+ rows: results.map((x) => num(x?.rows)),
220
+ reassuranceShaped: results.map((x) => num(x?.reassuranceShaped)),
221
+ costUsd: results.reduce((a, x) => a + num(x?.costUsd), 0),
222
+ // `opt`, not `num`: an unmeasured repeat must not land in the band as a
223
+ // zero-second one. It carries `null` all the way to the screen.
224
+ durationSec: results.map((x) => opt(x?.durationSec)),
225
+ turns: results.map((x) => opt(x?.turns)),
226
+ toolCalls: results.map((x) => opt(x?.toolCalls)),
227
+ ...microGoldSeries(Array.isArray(r.gold) ? r.gold : null, results),
228
+ baselineGold: r.baselineGold && Array.isArray(r.baselineGold.cells) ? r.baselineGold : null,
229
+ seed: results.map((x) => (x?.seed && typeof x.seed.seeded === "number" ? x.seed : null)),
230
+ baselineSeed: r.baselineSeed && typeof r.baselineSeed.seeded === "number" ? r.baselineSeed : null,
231
+ };
232
+ }
233
+ // ── latency ─────────────────────────────────────────────────────────────────
234
+ /**
235
+ * The caveat that must ride with **every arm-level latency aggregate**, in the
236
+ * list and in the detail view alike. Permanent, not a dismissible hint.
237
+ *
238
+ * Micro-surveys are run `--sandbox none`, in process, and several are routinely
239
+ * launched at once on one host (the model screen ran six side by side). Repeats
240
+ * that overlap contend for CPU, so wall clock is inflated by an amount nothing
241
+ * in the report records — there is no concurrency field to read and none is
242
+ * inferred here, because a guess would be indistinguishable from a measurement.
243
+ * Cost, fire rate, needsProbe% and severity are unaffected: they are counts over
244
+ * what the model produced, not over how long the box took to produce it.
245
+ */
246
+ export const MICRO_LATENCY_CAVEAT = "Wall clock is only comparable between runs KNOWN to have run serially. Micro-surveys run in-process (--sandbox none) and are often launched several at a time on one host; overlapping repeats contend for CPU and nothing in the report records whether that happened. Cost, fire rate and severity are unaffected.";
247
+ export function microSeries(values) {
248
+ const list = Array.isArray(values) ? values : [];
249
+ const measured = list.filter((v) => typeof v === "number" && Number.isFinite(v));
250
+ return {
251
+ measured,
252
+ missing: list.length - measured.length,
253
+ range: microRange(measured),
254
+ total: measured.length ? measured.reduce((a, b) => a + b, 0) : null,
255
+ any: measured.length > 0,
256
+ };
257
+ }
258
+ // ── gold: the quality view ───────────────────────────────────────────────────
259
+ /**
260
+ * How far from a gold's anchor line a row may cite and still count as having
261
+ * REACHED it. The anchor is where the human left the comment, which is often
262
+ * not the line a survey row names (the constant's declaration, the other end of
263
+ * a comparison) — so it is a window, and a generous one. It only ever gates the
264
+ * `reached` verdict; `asserted` is the judge's, and does not read lines at all.
265
+ */
266
+ export const MICRO_GOLD_LINE_WINDOW = 15;
267
+ const SITE = /^(.+?):(\d+)(?:-\d+)?$/;
268
+ /** Every `path:line` a row cites: its quotes, its `bothEnds`, its control site. */
269
+ export function microRowSites(row) {
270
+ const out = [];
271
+ for (const q of row?.quotes ?? []) {
272
+ if (typeof q?.path === "string" && q.path)
273
+ out.push({ path: q.path, line: typeof q.line === "number" ? q.line : null });
274
+ }
275
+ const refs = [...Object.values(row?.bothEnds ?? {}), row?.evidence?.control_site];
276
+ for (const v of refs) {
277
+ if (typeof v !== "string")
278
+ continue;
279
+ const m = SITE.exec(v.trim());
280
+ if (m)
281
+ out.push({ path: m[1], line: Number(m[2]) });
282
+ }
283
+ return out;
284
+ }
285
+ /** Same file, compared by path SUFFIX: gold records repo-relative paths, rows
286
+ * sometimes carry a leading `./` or a deeper prefix. */
287
+ function samePath(a, b) {
288
+ const x = a.replace(/^\.?\//, ""), y = b.replace(/^\.?\//, "");
289
+ return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
290
+ }
291
+ /**
292
+ * Does this row stand at this gold? A gold with no file cannot be reached by
293
+ * location (Martian-style gold is description-only) — only asserted. A gold
294
+ * with a file but no line is reached by any citation of the file.
295
+ */
296
+ export function microRowReachesGold(row, gold, window = MICRO_GOLD_LINE_WINDOW) {
297
+ if (!gold?.file)
298
+ return false;
299
+ return microRowSites(row).some((s) => samePath(s.path, gold.file) &&
300
+ (typeof gold.line !== "number" || (s.line !== null && Math.abs(s.line - gold.line) <= window)));
301
+ }
302
+ /**
303
+ * One repeat's gold overlay.
304
+ *
305
+ * `rowForGold[j]` is the index of the row the judge credited for gold `j`, or
306
+ * `null`; pass `rowForGold: null` when the judge did not run, and nothing is
307
+ * `asserted`. `probeOf` is injected rather than imported: the derivation lives
308
+ * in `lastlight-code-facts`, which this browser-safe module must not pull in.
309
+ */
310
+ export function microGoldRepeat(opts) {
311
+ const { rows, gold, rowForGold, probeOf, claimOf } = opts;
312
+ const onGold = new Set();
313
+ const cells = gold.map((g, j) => {
314
+ const credited = rowForGold?.[j];
315
+ const reaching = rows.flatMap((r, i) => (microRowReachesGold(r, g, opts.window) ? [i] : []));
316
+ for (const i of reaching)
317
+ onGold.add(i);
318
+ const idOf = (i) => rows[i]?.id ?? `row-${i}`;
319
+ if (typeof credited === "number" && rows[credited]) {
320
+ onGold.add(credited);
321
+ return { verdict: "asserted", rows: [idOf(credited)], probed: probeOf(rows[credited]) };
322
+ }
323
+ if (reaching.length) {
324
+ return { verdict: "reached", rows: reaching.map(idOf), probed: reaching.some((i) => probeOf(rows[i])) };
325
+ }
326
+ return { verdict: "missed", rows: [], probed: false };
327
+ });
328
+ let probesOnGold = 0, probesOffGold = 0;
329
+ rows.forEach((r, i) => {
330
+ if (!probeOf(r))
331
+ return;
332
+ if (onGold.has(i))
333
+ probesOnGold++;
334
+ else
335
+ probesOffGold++;
336
+ });
337
+ const credited = new Set((rowForGold ?? []).filter((i) => typeof i === "number" && !!rows[i]));
338
+ // A row the judge credited IS a claim, whatever its evidence shape: CONFIRM
339
+ // only credits a row that states the defect (one that states it and then
340
+ // calls it handled still counts — see `INTERNAL_CONFIRM_SYSTEM`). Leaving such
341
+ // a row out of the claims scored recall > 0 against precision 0, i.e. F1 0
342
+ // for a repeat that found a gold (measured: GLM 5.3 Flash, 1667 repeat 2).
343
+ const claims = claimOf ? new Set([...rows.flatMap((r, i) => (claimOf(r) ? [i] : [])), ...credited]) : null;
344
+ return {
345
+ cells,
346
+ ...(claims ? { claimed: claims.size, claimedAsserting: [...claims].filter((i) => credited.has(i)).length } : {}),
347
+ asserted: rowForGold === null ? null : cells.filter((c) => c.verdict === "asserted").length,
348
+ reached: cells.filter((c) => c.verdict === "reached").length,
349
+ probesOnGold,
350
+ probesOffGold,
351
+ };
352
+ }
353
+ /**
354
+ * An F1 for one repeat, shaped like the full eval's posted F1 so the two read
355
+ * alike:
356
+ *
357
+ * - **recall** = gold asserted ÷ ALL the case's gold. The gold spans every
358
+ * family, so one family's recall has a ceiling below 1 — comparable between
359
+ * runs on the same fixture and family, never an absolute score.
360
+ * - **precision** = rows that CLAIM a defect and were credited to a gold ÷ all
361
+ * rows that claim a defect. A reassurance row is not a claim and does not
362
+ * count against it; a row claiming a defect the gold does not hold does —
363
+ * exactly as a posted comment the gold lacks is a false positive there.
364
+ *
365
+ * `null` when the repeat was not judged, or its overlay predates the claim
366
+ * counts. A repeat that claims nothing scores precision 0, as a review that
367
+ * posts nothing does.
368
+ */
369
+ export function microGoldScore(o, goldCount) {
370
+ if (!o || o.asserted === null || typeof o.claimed !== "number" || goldCount <= 0)
371
+ return null;
372
+ const recall = o.asserted / goldCount;
373
+ const precision = o.claimed > 0 ? (o.claimedAsserting ?? 0) / o.claimed : 0;
374
+ const f1 = precision + recall > 0 ? (2 * precision * recall) / (precision + recall) : 0;
375
+ return { precision, recall, f1 };
376
+ }
377
+ /** The index-entry fields derived from a report's gold + per-repeat overlays. */
378
+ export function microGoldSeries(gold, results) {
379
+ if (!gold?.length) {
380
+ return {
381
+ gold: null, goldAsserted: [], goldReached: [], probesOnGold: [], probesOffGold: [], perGold: null,
382
+ goldF1: [], goldPrecision: [], goldRecall: [],
383
+ };
384
+ }
385
+ const overlays = results.map((r) => (r?.gold && Array.isArray(r.gold.cells) ? r.gold : null));
386
+ const perGold = gold.map((_, j) => {
387
+ const t = { asserted: 0, reached: 0, missed: 0, probedAtGold: 0, repeats: 0, judged: 0 };
388
+ for (const o of overlays) {
389
+ const c = o?.cells[j];
390
+ if (!o || !c)
391
+ continue;
392
+ t.repeats++;
393
+ if (o.asserted !== null)
394
+ t.judged++;
395
+ t[c.verdict]++;
396
+ if (c.probed)
397
+ t.probedAtGold++;
398
+ }
399
+ return t;
400
+ });
401
+ const scores = overlays.map((o) => microGoldScore(o, gold.length));
402
+ return {
403
+ gold,
404
+ goldAsserted: overlays.map((o) => (o ? o.asserted : null)),
405
+ goldReached: overlays.map((o) => (o ? o.reached : null)),
406
+ probesOnGold: overlays.map((o) => (o ? o.probesOnGold : null)),
407
+ probesOffGold: overlays.map((o) => (o ? o.probesOffGold : null)),
408
+ goldF1: scores.map((x) => x?.f1 ?? null),
409
+ goldPrecision: scores.map((x) => x?.precision ?? null),
410
+ goldRecall: scores.map((x) => x?.recall ?? null),
411
+ perGold,
412
+ };
413
+ }
414
+ /**
415
+ * Majority vote over several judge passes' `goldToFinding` arrays.
416
+ *
417
+ * The judge runs at temperature 0 and still flips on a borderline pair —
418
+ * measured: the same preserved rows judged five times came back 0/4 three
419
+ * times and 1/4 twice. A gold is credited when MORE THAN HALF the passes
420
+ * credited it, to the row most of them named (ties to the lower index, so the
421
+ * result does not depend on pass order).
422
+ */
423
+ export function microGoldVote(passes, goldCount) {
424
+ const rowForGold = [];
425
+ const creditVotes = [];
426
+ for (let j = 0; j < goldCount; j++) {
427
+ const byRow = new Map();
428
+ for (const p of passes) {
429
+ const r = p[j];
430
+ if (typeof r === "number")
431
+ byRow.set(r, (byRow.get(r) ?? 0) + 1);
432
+ }
433
+ const credited = [...byRow.values()].reduce((a, b) => a + b, 0);
434
+ creditVotes.push(credited);
435
+ if (credited * 2 <= passes.length) {
436
+ rowForGold.push(null);
437
+ continue;
438
+ }
439
+ const [row] = [...byRow.entries()].sort((a, b) => b[1] - a[1] || a[0] - b[0])[0];
440
+ rowForGold.push(row);
441
+ }
442
+ return { rowForGold, creditVotes };
443
+ }
444
+ //# sourceMappingURL=micro-survey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"micro-survey.js","sourceRoot":"","sources":["../src/micro-survey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AA0OH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,CAAmB;IACxD,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,WAAW,KAAK,QAAQ,IAAI,OAAO,CAAC,EAAE,YAAY,KAAK,QAAQ,CAAC;IAC1F,MAAM,UAAU,GACd,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,YAAY,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACzE,IAAI,OAAO,IAAI,UAAU,IAAI,OAAO;QAAE,OAAO,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EA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