@yagni-app/code-staging 1.2.14-staging.2329.1 → 1.2.14-staging.2338.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.
|
@@ -470,6 +470,39 @@ export function detectVerifyTestCommands(cwd, opts = {}) {
|
|
|
470
470
|
const root = pickTestScript(cwd, readFile, pm);
|
|
471
471
|
return root ? [root] : [];
|
|
472
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* The shell's own line for a command it could not find, ending the line, after
|
|
475
|
+
* whatever prefix a runner adds (`[0] `, turbo's `app:test: `, `pnpm -r`'s
|
|
476
|
+
* `packages/app test: `): bash's `bash: line 1: pnpm: command not found`,
|
|
477
|
+
* `node: command not found`, make's `make[1]: tsc: Command not found`, zsh's
|
|
478
|
+
* `zsh: command not found: tsc` (`./x.zsh:12: …`, `(eval):1: …`) and dash's
|
|
479
|
+
* `sh: 1: tsc: not found`. Never the words inside a sentence: a test's name,
|
|
480
|
+
* an assertion or a fixture that quotes them is not why the run failed
|
|
481
|
+
* (BENCH-1464, YAG-1254).
|
|
482
|
+
*/
|
|
483
|
+
const SHELL_COMMAND_NOT_FOUND = [
|
|
484
|
+
/(?:^|[\s:\]>|])[\w./@+-]+: command not found\s*$/im,
|
|
485
|
+
/:(?:\d+:)? command not found: [\w./@+-]+\s*$/m,
|
|
486
|
+
/(?:^|[\s:\]>|])(?:\S*\/)?(?:da)?sh: \d+: [\w./@+-]+: not found\s*$/m,
|
|
487
|
+
];
|
|
488
|
+
/**
|
|
489
|
+
* A line a test runner prints to name a test, a suite or a result: node:test's
|
|
490
|
+
* `✔ name (1ms)` / `✖ name (1ms)` / `▶ suite`, jest's and vitest's `✓` / `✕` /
|
|
491
|
+
* `×`, TAP's `ok 1 - name` / `not ok 1 - name` / `# Subtest: name`. A test's
|
|
492
|
+
* name is not evidence of why the run failed, however it reads (a test of the
|
|
493
|
+
* infra classifier is named for what it classifies); an error printed under it
|
|
494
|
+
* is. A failure bullet counts only with the runner's duration after it, so a
|
|
495
|
+
* logger's `✖ connect ECONNREFUSED` or a diagnostic's `× …` is still read.
|
|
496
|
+
*/
|
|
497
|
+
const TEST_NAME_LINE = /^\s*(?:[✔✓▶]\s|(?:not )?ok \d+ - |# Subtest: )/u;
|
|
498
|
+
const FAILED_TEST_NAME_LINE = /^\s*[✕✖✗×]\s.*\s\(?\d+(?:\.\d+)?\s?m?s\)?\s*$/u;
|
|
499
|
+
/** The output without the lines that only name tests ({@link TEST_NAME_LINE}). */
|
|
500
|
+
function withoutTestNames(output) {
|
|
501
|
+
return output
|
|
502
|
+
.split("\n")
|
|
503
|
+
.filter((line) => !TEST_NAME_LINE.test(line) && !FAILED_TEST_NAME_LINE.test(line))
|
|
504
|
+
.join("\n");
|
|
505
|
+
}
|
|
473
506
|
/**
|
|
474
507
|
* Infra/environment failure classification for the typecheck half (spec §3b,
|
|
475
508
|
* invariant §0.2). A fresh run worktree has no node_modules until the bootstrap
|
|
@@ -491,8 +524,9 @@ export function detectVerifyTestCommands(cwd, opts = {}) {
|
|
|
491
524
|
export function classifyVerifyInfraFailure(output, exitCode) {
|
|
492
525
|
if (exitCode === 127)
|
|
493
526
|
return "command not found (exit 127; missing node_modules?)";
|
|
494
|
-
if (
|
|
527
|
+
if (SHELL_COMMAND_NOT_FOUND.some((re) => re.test(output))) {
|
|
495
528
|
return "command not found (missing node_modules?)";
|
|
529
|
+
}
|
|
496
530
|
if (/not recognized as an internal or external command/i.test(output)) {
|
|
497
531
|
return "command not found (missing node_modules?)";
|
|
498
532
|
}
|
|
@@ -812,14 +846,17 @@ const FAILURE_SUMMARY = [
|
|
|
812
846
|
export function classifyTestFailure(output, exitCode, limit = MAX_LOCATED_FINDINGS, env) {
|
|
813
847
|
if (exitCode === 0)
|
|
814
848
|
return { kind: "clean" };
|
|
815
|
-
|
|
849
|
+
// Infra evidence is read without the lines that only name tests: a test
|
|
850
|
+
// named for "command not found" or ECONNREFUSED is not why the run failed.
|
|
851
|
+
const evidence = withoutTestNames(output);
|
|
852
|
+
const spawnInfra = classifyVerifyInfraFailure(evidence, exitCode);
|
|
816
853
|
if (spawnInfra)
|
|
817
854
|
return { kind: "infra", reason: spawnInfra };
|
|
818
|
-
const needs = classifyMissingPrerequisite(
|
|
855
|
+
const needs = classifyMissingPrerequisite(evidence, env);
|
|
819
856
|
if (needs)
|
|
820
857
|
return { kind: "infra", reason: `needs ${needs}`, needs };
|
|
821
858
|
for (const [re, reason] of TEST_INFRA_PATTERNS) {
|
|
822
|
-
if (re.test(
|
|
859
|
+
if (re.test(evidence))
|
|
823
860
|
return { kind: "infra", reason };
|
|
824
861
|
}
|
|
825
862
|
// Per-test failure lines, deduped by test name; a later duplicate that DOES
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagni-app/code-staging",
|
|
3
|
-
"version": "1.2.14-staging.
|
|
3
|
+
"version": "1.2.14-staging.2338.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": "
|
|
61
|
+
"yagniSourceSha": "b21f46be1a45b4fc1810754e49f64635b25f748e"
|
|
62
62
|
}
|