@keepsnappy/agent 0.1.0-alpha.17 → 0.1.0-alpha.18

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/README.md CHANGED
@@ -137,7 +137,7 @@ runner. It writes:
137
137
  run with data. A measured iteration sends nothing until its end-of-iteration flush, so a run with data completed and
138
138
  is never blamed; a Maestro failure stops the session, so later iterations have no data;
139
139
  3. finishes every run not yet finished (a run without a single batch is reported as "no data", never judged), closes the
140
- set (`--wait`: verdicts inline; else on read) and prints the iterations and the same plain-words verdict as
140
+ set (`--wait`: verdicts inline; else on read). It then prints the iterations and the same plain-words verdict as
141
141
  `keepsnappy run --upload --wait`, plus `$GITHUB_STEP_SUMMARY` and `<out>/keepsnappy-result.json` (`--out`, default the
142
142
  state's directory);
143
143
  4. puts the empty stub back into the tokens file, also when a step above failed. The example workflow also deletes the
@@ -149,10 +149,10 @@ result, `3` with `--fail-on-worse` when the verdict computed on that run set is
149
149
  verdict it checks nothing and says so, exit `0`), `2` for configuration, `1` when the API fails or nothing could be
150
150
  judged ("Blocked": no iteration sent any data).
151
151
 
152
- Slack: set `KEEPSNAPPY_SLACK_WEBHOOK` (an incoming-webhook URL kept as a CI secret) and `farm close --wait` posts the
153
- result: a pull request only when something got worse (a table of the 3 biggest changes, main vs PR), main only when
154
- something changed (`KEEPSNAPPY_SLACK_ALWAYS=1` also posts "no change"), and a measurement that sent no data always. The
155
- commit's title and author come from `git log` in the checkout. A Slack failure is printed and never changes the exit code.
152
+ Slack: set `KEEPSNAPPY_SLACK_WEBHOOK` (an incoming-webhook URL kept as a CI secret) and `farm close` posts a measurement that sent
153
+ no data ("No result") at once. Results are posted after the verdict is computed, by the operator's recompute job (decision 0031), in
154
+ two lines and one button (docs/mockups/2026-10-26-slack, present `resultSlackPayload`). `$GITHUB_STEP_SUMMARY` gets the same two
155
+ lines: "No result", the computed result, or "Not judged yet · <branch> / Waiting for the judgement" with the run set's page. A Slack failure is printed and never changes the exit code.
156
156
 
157
157
  Declared steps on the farm: `maestro/keepsnappy/step.yaml` / `step.js` / `send-markers.js` (copy them into the suite).
158
158
  With a token set, `step.js` only records the marker; `send-markers.js`, run in `end-run.yaml` after each iteration,
@@ -726,7 +726,7 @@ import { dirname, join, relative, resolve } from "node:path";
726
726
  import { fileURLToPath } from "node:url";
727
727
  var DRIVER_NAME = "appium";
728
728
  function driverVersion() {
729
- const built = "0.1.0-alpha.17";
729
+ const built = "0.1.0-alpha.18";
730
730
  if (built)
731
731
  return built;
732
732
  let dir = dirname(fileURLToPath(import.meta.url));
@@ -800,7 +800,7 @@ async function sendMarkers(fetchImpl, api, markers, opts = {}) {
800
800
  const url = `${base}/v1/markers`;
801
801
  const version = (opts.driverVersion ?? driverVersion)();
802
802
  const reported = opts.reported ?? new Set;
803
- const driverField = { driver: { name: DRIVER_NAME, ...version ? { version } : {}, ...opts.deviceUnit ? { unit: opts.deviceUnit.slice(0, 200) } : {} } };
803
+ const driverField = { driver: { name: DRIVER_NAME, ...version ? { version } : {}, ...opts.deviceUnit ? { unit: opts.deviceUnit.slice(0, 200) } : {}, ...opts.capture ? { capture: opts.capture } : {} } };
804
804
  let sent = 0;
805
805
  for (const [token, list] of byToken) {
806
806
  const trips = [];
@@ -902,9 +902,11 @@ class Session {
902
902
  readyWaits = [];
903
903
  actionGc;
904
904
  endGc;
905
+ capture;
905
906
  gcN = 0;
906
907
  stepDepth = 0;
907
908
  stepLog = [];
909
+ defects = { gestureRetry: 0, items: [] };
908
910
  onStepChange = null;
909
911
  refinds = 0;
910
912
  get staleRefinds() {
@@ -917,6 +919,7 @@ class Session {
917
919
  this.api = o.api ?? "";
918
920
  this.actionGc = o.actionGc ? "step" : "off";
919
921
  this.endGc = o.endGc ?? END_GC_DEFAULT;
922
+ this.capture = o.capture;
920
923
  }
921
924
  async gc(atEnd = false) {
922
925
  if (this.actionGc !== "step" && !(atEnd && this.endGc && this.actionGc === "off"))
@@ -1293,7 +1296,7 @@ class Session {
1293
1296
  async endRun() {
1294
1297
  if (this.markers.some((m) => m.phase === "start"))
1295
1298
  await this.memRead(await this.gc(true));
1296
- await sendMarkers(this.fetch, this.api, this.markers, { sleep: (ms) => this.driver.sleep(ms), now: () => this.now(), deviceUnit: this.driver.deviceUnit, tokens: [...this.opened], reported: this.told, note: (line) => this.driver.log.push({ ...this.driver.context, cmd: "driver-report", t: this.now(), ms: 0, status: 1, answer: line }) });
1299
+ await sendMarkers(this.fetch, this.api, this.markers, { sleep: (ms) => this.driver.sleep(ms), now: () => this.now(), deviceUnit: this.driver.deviceUnit, capture: this.capture, tokens: [...this.opened], reported: this.told, note: (line) => this.driver.log.push({ ...this.driver.context, cmd: "driver-report", t: this.now(), ms: 0, status: 1, answer: line }) });
1297
1300
  const evidence = { linkAt: this.now(), resentAt: null, ackAt: null, gaveUpAt: null };
1298
1301
  this.lastFlush = evidence;
1299
1302
  const acks = new Set;
@@ -1460,7 +1463,7 @@ async function runDriver(argv, module, deps = realRunDeps()) {
1460
1463
  const { api, tokens } = parseTokensJs(readFileSync2(String(a["tokens-js"]), "utf8"));
1461
1464
  const log = [];
1462
1465
  const driver = new Driver({ hub: HUB, log, headers: { Authorization: auth }, bundleId: module.app.bundleId, platform, fetch: deps.fetch, now: deps.now, sleep: deps.sleep });
1463
- const t = new Session({ driver, scheme: module.app.scheme, fetch: deps.fetch, api, actionGc: a["action-gc"] === "on", endGc: a["end-gc"] === "on" });
1466
+ const t = new Session({ driver, scheme: module.app.scheme, fetch: deps.fetch, api, actionGc: a["action-gc"] === "on", endGc: a["end-gc"] === "on", capture: capture ? "on" : "off" });
1464
1467
  const sessionName = module.sessionName ?? "keepsnappy (appium)";
1465
1468
  const device = String(a.device);
1466
1469
  const ctx = { fetch: deps.fetch, tokens, journeys, repeat, args: a };
@@ -1503,6 +1506,7 @@ async function runDriver(argv, module, deps = realRunDeps()) {
1503
1506
  flushError,
1504
1507
  flushOff,
1505
1508
  finalFlush,
1509
+ defects: t.defects,
1506
1510
  steps: t.stepLog,
1507
1511
  iterations,
1508
1512
  commands: log