@yagni-app/code-staging 1.2.15-staging.2671.1 → 1.2.15-staging.2692.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.
@@ -364,7 +364,8 @@ export type TestFailureClassification = {
364
364
  * DB was down fails open rather than blocking. A missing credential or
365
365
  * prerequisite ({@link classifyMissingPrerequisite}, given the `env` the
366
366
  * command ran under) is `infra` with `needs` and the cause "needs <it>".
367
- * - recognisable failing-test lines (pnpm-wrapped vitest / jest / node:test
367
+ * - the failed tests a Playwright summary lists ({@link playwrightFailures}),
368
+ * else recognisable failing-test lines (pnpm-wrapped vitest / jest / node:test
368
369
  * TAP + spec reporters, pytest, Pest, PHPUnit, go test) → `failures` with
369
370
  * located `critical` findings
370
371
  * (capped at 25, deduped, locations attached when the runner printed them).
@@ -817,6 +817,49 @@ const FAILURE_SUMMARY = [
817
817
  /\b[1-9]\d*\s+failing\b/, // mocha / node:test "N failing"
818
818
  /[✕✖✗×]\s+failing tests:/u, // node:test spec footer header
819
819
  ];
820
+ /** Colour codes, read past before Playwright's summary lines are matched. */
821
+ const ANSI = /\u001b\[[0-9;]*[A-Za-z]/g;
822
+ /** Playwright's final summary: the count line its failed tests are listed under. */
823
+ const PLAYWRIGHT_FAILED = /^\d+ failed$/;
824
+ /** A summary that says the run was cut short: what it lists as failed may not be all. */
825
+ const PLAYWRIGHT_INTERRUPTED = /^\d+ interrupted$/;
826
+ /**
827
+ * A test under a summary count: `[project] › file:line:col › title › path`,
828
+ * padded with `─` to the screen's width when the line is short.
829
+ */
830
+ const PLAYWRIGHT_TEST = /^(?:(\[[^\]]+\]) › )?(\S.*?):(\d+)(?::\d+)? › (.+?)(?:\s+─+)?$/;
831
+ /**
832
+ * The tests a Playwright run's final summary lists as failed: the lines under
833
+ * `N failed`, up to the next line that names no test. Each is named by its
834
+ * project, file and title, never its line, so it keys as @yagni/shared's
835
+ * `playwrightFailureKeys` does (the corpus holds the two to one reading); the
836
+ * line is kept as the finding's location. No length cap: a title path runs
837
+ * long. None when there is no summary, or it says the run was interrupted.
838
+ */
839
+ function playwrightFailures(output) {
840
+ const lines = output
841
+ .replace(ANSI, "")
842
+ .split("\n")
843
+ .map((line) => line.trim())
844
+ .filter(Boolean);
845
+ if (lines.some((line) => PLAYWRIGHT_INTERRUPTED.test(line)))
846
+ return [];
847
+ const byName = new Map();
848
+ lines.forEach((line, at) => {
849
+ if (!PLAYWRIGHT_FAILED.test(line))
850
+ return;
851
+ for (const test of lines.slice(at + 1)) {
852
+ const match = PLAYWRIGHT_TEST.exec(test);
853
+ if (!match)
854
+ break;
855
+ const [, project, file, lineNo, title] = match;
856
+ const message = [project, file, title].filter(Boolean).join(" › ");
857
+ if (!byName.has(message))
858
+ byName.set(message, { message, file, line: Number(lineNo) });
859
+ }
860
+ });
861
+ return [...byName.values()];
862
+ }
820
863
  /**
821
864
  * PURE classification of one test-script run (spec §3d, invariant §0.2).
822
865
  * Deliberately asymmetric with {@link parseVerifyFailures} (which always emits
@@ -831,7 +874,8 @@ const FAILURE_SUMMARY = [
831
874
  * DB was down fails open rather than blocking. A missing credential or
832
875
  * prerequisite ({@link classifyMissingPrerequisite}, given the `env` the
833
876
  * command ran under) is `infra` with `needs` and the cause "needs <it>".
834
- * - recognisable failing-test lines (pnpm-wrapped vitest / jest / node:test
877
+ * - the failed tests a Playwright summary lists ({@link playwrightFailures}),
878
+ * else recognisable failing-test lines (pnpm-wrapped vitest / jest / node:test
835
879
  * TAP + spec reporters, pytest, Pest, PHPUnit, go test) → `failures` with
836
880
  * located `critical` findings
837
881
  * (capped at 25, deduped, locations attached when the runner printed them).
@@ -859,6 +903,9 @@ export function classifyTestFailure(output, exitCode, limit = MAX_LOCATED_FINDIN
859
903
  if (re.test(evidence))
860
904
  return { kind: "infra", reason };
861
905
  }
906
+ // Playwright's final summary names what finally failed; its `✘` lines repeat
907
+ // each retry, and a flaky test's lines name a test that passed.
908
+ const playwright = playwrightFailures(output);
862
909
  // Per-test failure lines, deduped by test name; a later duplicate that DOES
863
910
  // carry a location upgrades the located-less first sighting (node:test prints
864
911
  // the body ✖ first and the located footer ✖ later). `pendingLocation` is the
@@ -918,7 +965,7 @@ export function classifyTestFailure(output, exitCode, limit = MAX_LOCATED_FINDIN
918
965
  else if (!existing.file && parsed.file)
919
966
  byMessage.set(parsed.message, parsed);
920
967
  }
921
- const failures = [...byMessage.values()].slice(0, limit);
968
+ const failures = (playwright.length > 0 ? playwright : [...byMessage.values()]).slice(0, limit);
922
969
  if (failures.length > 0) {
923
970
  return {
924
971
  kind: "failures",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagni-app/code-staging",
3
- "version": "1.2.15-staging.2671.1",
3
+ "version": "1.2.15-staging.2692.1",
4
4
  "description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
@@ -58,5 +58,5 @@
58
58
  "turndown": "^7.2.4",
59
59
  "typebox": "^1.3.15"
60
60
  },
61
- "yagniSourceSha": "741d84f123ee8b147784d87e35c8c3c6471e5fb1"
61
+ "yagniSourceSha": "8d2989df4260fe9534c7e212ef116fb1f9188c92"
62
62
  }