oracular 0.12.0 → 0.12.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#64](https://github.com/Yuribenjamin/oracular/pull/64) [`c108ca9`](https://github.com/Yuribenjamin/oracular/commit/c108ca92b4b66b90749664379bc676a230462726) Thanks [@Yuribenjamin](https://github.com/Yuribenjamin)! - **`replay` shows the reveals it could not score.** A reveal whose window runs past the end of the log is not scored for precision, since its verdict is not in yet, but an outcome it preceded still counts for recall, so a short log printed `reveals 0` beside `recall 100.0% of 1`, and `--json` showed `reveals: 0, caught: 1, censored: 1`. Both numbers were right and the table did not say why. The text table now shows such reveals in the row (`0 (+1 censored)`) with a footnote that says what recall still counts, and a log shorter than an intent's scoring window, in which every reveal and point is censored, gets a warning on stderr that points at `--window`. The `--json` report is unchanged: `censored` was already there. Found by the second production integration on a one-minute log with the default one-hour window.
8
+
3
9
  ## 0.12.0
4
10
 
5
11
  ### Minor Changes
package/dist/cli.js CHANGED
@@ -363,7 +363,7 @@ function formatIntent(intent) {
363
363
  ["threshold", "reveals", "per user", "precision", "recall", "median lead time"],
364
364
  intent.thresholds.map((t) => [
365
365
  `${t.threshold}${t.configured ? " *" : ""}`,
366
- String(t.reveals),
366
+ t.censored > 0 ? `${t.reveals} (+${t.censored} censored)` : String(t.reveals),
367
367
  num(t.revealsPerUser, 2),
368
368
  pct(t.precision),
369
369
  `${pct(t.recall)} of ${t.outcomes}`,
@@ -371,9 +371,9 @@ function formatIntent(intent) {
371
371
  ])
372
372
  )
373
373
  );
374
- const censored = intent.thresholds.reduce((acc, t) => Math.max(acc, t.censored), 0);
374
+ const censored = intent.thresholds.some((t) => t.censored > 0);
375
375
  out.push(
376
- `* the threshold your config resolves for this intent.${censored > 0 ? ` Reveals whose window runs past the end of the log are not scored (up to ${censored} per threshold).` : ""}`
376
+ `* the threshold your config resolves for this intent.${censored ? " A reveal whose window runs past the end of the log (the +n) is not scored for precision, since its verdict is not in yet; an outcome it preceded still counts as caught for recall." : ""}`
377
377
  );
378
378
  out.push("");
379
379
  out.push(
@@ -1310,9 +1310,22 @@ async function replayCommand(argv, io) {
1310
1310
  if (error instanceof RangeError) throw new UsageError(error.message);
1311
1311
  throw error;
1312
1312
  }
1313
+ warnShortLog(report, io);
1313
1314
  io.stdout(args.json ? formatJson(report) : formatText(report));
1314
1315
  return 0;
1315
1316
  }
1317
+ function warnShortLog(report, io) {
1318
+ if (report.start === null || report.end === null) return;
1319
+ const span = report.end - report.start;
1320
+ for (const intent of report.intents) {
1321
+ if (span < intent.window) {
1322
+ io.stderr(
1323
+ `oracular: warning: ${intent.intent}: the log spans ${formatDuration(span)}, less than its ${formatDuration(intent.window)} scoring window, so every reveal and point is censored and only recall can be counted. Pass --window with a duration shorter than the log, or record for longer than the window.
1324
+ `
1325
+ );
1326
+ }
1327
+ }
1328
+ }
1316
1329
  async function tuneCommand(argv, io) {
1317
1330
  const args = parseTuneArgs(argv);
1318
1331
  if (args.help) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oracular",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "On-device intent engine. Your app learns when the user is ready. Nothing leaves the device.",
5
5
  "keywords": [
6
6
  "oracular",