@kitman-sh/software-engineering 0.13.11 → 0.13.12

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/dist/bundle.js CHANGED
@@ -14000,6 +14000,7 @@ var RunEvidence = Struct({
14000
14000
  durationMs: Int.check(isGreaterThanOrEqualTo2(0)),
14001
14001
  outputTail: String5,
14002
14002
  fileIds: optionalKey2(ArraySchema(String5)),
14003
+ failedTests: optionalKey2(ArraySchema(String5)),
14003
14004
  skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
14004
14005
  newNotRun: optionalKey2(ArraySchema(String5)),
14005
14006
  recordedAt: Timestamp
@@ -19034,6 +19035,7 @@ var EvidenceCheck = Struct({
19034
19035
  durationMs: Finite,
19035
19036
  evidenceId: String5,
19036
19037
  outputTail: optionalKey2(String5),
19038
+ failedTests: optionalKey2(ArraySchema(String5)),
19037
19039
  suggested: optionalKey2(Boolean3),
19038
19040
  skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
19039
19041
  newNotRun: optionalKey2(ArraySchema(String5))
@@ -19047,9 +19049,15 @@ var VerifyResult = Struct({
19047
19049
  });
19048
19050
  var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
19049
19051
  var missing2 = (side) => `No verification evidence for the ${side}`;
19050
- var failsOn = (side, name, tree) => `${name} fails on the ${side} tree ${tree}`;
19051
19052
  var shownTests = 10;
19052
19053
  var testList = (tests) => [...tests.slice(0, shownTests), ...tests.length > shownTests ? [`and ${tests.length - shownTests} more`] : []].join("; ");
19054
+ var codeSpan = (name) => {
19055
+ const line = name.replaceAll(/\s+/gu, " ");
19056
+ const longestRun = Math.max(0, ...[...line.matchAll(/`+/gu)].map(([run]) => run.length));
19057
+ const fence = "`".repeat(longestRun + 1);
19058
+ return longestRun === 0 ? `${fence}${line}${fence}` : `${fence} ${line} ${fence}`;
19059
+ };
19060
+ var failsOn = (side, check, tree) => `${check.name} fails on the ${side} tree ${tree}${check.failedTests === undefined || check.failedTests.length === 0 ? "" : `: ${testList(check.failedTests.map(codeSpan))}`}`;
19053
19061
  var testsNotRunReasons = (result) => result.checks.flatMap((check) => [
19054
19062
  ...check.newNotRun === undefined || check.newNotRun.length === 0 ? [] : [
19055
19063
  `${check.name} skipped ${check.newNotRun.length} new test${check.newNotRun.length === 1 ? "" : "s"} on the tree ${result.tree}, so verify never ran them: ${testList(check.newNotRun)}`
@@ -19063,7 +19071,7 @@ var allPass = (side, result) => {
19063
19071
  return [missing2(side)];
19064
19072
  if (result.checks.length === 0)
19065
19073
  return [`No approved verification ran on the ${side} tree ${result.tree}`];
19066
- return result.checks.filter((check) => check.status === "failed" && !check.preExisting).map((check) => failsOn(side, check.name, result.tree));
19074
+ return result.checks.filter((check) => check.status === "failed" && !check.preExisting).map((check) => failsOn(side, check, result.tree));
19067
19075
  };
19068
19076
  var checkOn = (side, result, name) => {
19069
19077
  if (result === undefined)
@@ -19077,14 +19085,14 @@ var passesOnHead = (head, name) => {
19077
19085
  const { found, reason } = checkOn("head", head, name);
19078
19086
  if (found === undefined)
19079
19087
  return [reason];
19080
- return found.status === "passed" ? [] : [failsOn("head", found.name, head?.tree)];
19088
+ return found.status === "passed" ? [] : [failsOn("head", found, head?.tree)];
19081
19089
  };
19082
19090
  var bugReasons = (input) => {
19083
19091
  const base = checkOn("base", input.base, input.reproducing);
19084
19092
  const head = checkOn("head", input.head, input.reproducing);
19085
19093
  return [
19086
19094
  ...base.found === undefined ? [base.reason] : base.found.status === "failed" ? [] : [`${base.found.name} does not fail on the base tree ${input.base?.tree}, so the bug is not reproduced`],
19087
- ...head.found === undefined ? [head.reason] : head.found.status === "passed" ? [] : [failsOn("head", head.found.name, input.head?.tree)]
19095
+ ...head.found === undefined ? [head.reason] : head.found.status === "passed" ? [] : [failsOn("head", head.found, input.head?.tree)]
19088
19096
  ];
19089
19097
  };
19090
19098
  var conclusionReasons = (conclusion) => {
@@ -20118,13 +20126,16 @@ var NetworkHostQuery = Struct({
20118
20126
  var maxSkippedTests = 1e4;
20119
20127
  var maxRanDigests = 1e5;
20120
20128
  var TestId = String5.check(isMinLength(1), isMaxLength(1000));
20129
+ var maxFailedTests = 50;
20130
+ var maxFailedTestLength = 300;
20121
20131
  var CheckTests = Struct({
20122
20132
  reports: Int.check(isGreaterThanOrEqualTo2(0)),
20123
20133
  passed: Int.check(isGreaterThanOrEqualTo2(0)),
20124
20134
  failed: Int.check(isGreaterThanOrEqualTo2(0)),
20125
20135
  skipped: Int.check(isGreaterThanOrEqualTo2(0)),
20126
20136
  skippedTests: ArraySchema(TestId).check(isMaxLength(maxSkippedTests)),
20127
- ranDigests: ArraySchema(String5.check(isMaxLength(16))).check(isMaxLength(maxRanDigests))
20137
+ ranDigests: ArraySchema(String5.check(isMaxLength(16))).check(isMaxLength(maxRanDigests)),
20138
+ failedTests: optionalKey2(ArraySchema(String5.check(isMinLength(1), isMaxLength(maxFailedTestLength))).check(isMaxLength(maxFailedTests)))
20128
20139
  });
20129
20140
  var entities = new Map([
20130
20141
  ["amp", "&"],
@@ -20133,6 +20144,18 @@ var entities = new Map([
20133
20144
  ["quot", '"'],
20134
20145
  ["apos", "'"]
20135
20146
  ]);
20147
+ var failedFileStart = String.raw`FAIL +(?:\|[^|]+\| *)?(?! )(?!\S*:\/\/)`;
20148
+ var afterPath = String.raw` > | \[ `;
20149
+ var failedFilePaths = [
20150
+ String.raw`\S*\.[A-Za-z]\w*(?=[\s:]|$)`,
20151
+ String.raw`(?=\S*[A-Za-z])(?=\S*\/)\S+(?=${afterPath}|$)`,
20152
+ String.raw`(?:(?!${afterPath}).)*\.[A-Za-z]\w*(?=${afterPath})`,
20153
+ String.raw`(?=\S*\/)(?:(?!${afterPath}).)*\.[A-Za-z]\w*$`,
20154
+ String.raw`(?=.*(?:\.(?:test|spec)\.|\b__tests__\/))(?:(?!${afterPath}).)*\.[cm]?[jt]sx?$`
20155
+ ];
20156
+ var failedFileLine = new RegExp(`^${failedFileStart}((?:${failedFilePaths.join("|")}).*)$`, "su");
20157
+ var attempt = String.raw`(?:\d+ times in )?(?:initial run|\d+[a-z]{2} (?:retry(?: of \d+[a-z]{2} repeat)?|repeat))`;
20158
+ var vitestAttempts = new RegExp(String.raw` \(${attempt}(?:, ${attempt})*\)$`, "u");
20136
20159
 
20137
20160
  // ../../packages/core/src/work-unit.ts
20138
20161
  var WorkUnitLease = Struct({
@@ -21076,6 +21099,7 @@ var verifyHead = (name, revision) => verify(name, { revision }).pipe(map8((head)
21076
21099
  notRun: nothingToVerify(failed.reason) ? [] : [`Kitman could not verify the head, so none of its tests count as run: ${failed.reason}`]
21077
21100
  })));
21078
21101
  var isCheckFinding = (id) => id.startsWith("check: ");
21102
+ var failedTestLines = (tests = []) => tests.length === 0 ? [] : ["Failing tests:", ...tests.map((test) => `- ${test}`)];
21079
21103
  var checkFindings = (head) => brokenChecks(head).map((check) => ({
21080
21104
  id: `check: ${check.name}`,
21081
21105
  severity: "blocker",
@@ -21083,6 +21107,7 @@ var checkFindings = (head) => brokenChecks(head).map((check) => ({
21083
21107
  line: 0,
21084
21108
  detail: [
21085
21109
  `\`${check.command}\` fails on the head and passes on the base.`,
21110
+ ...failedTestLines(check.failedTests),
21086
21111
  ...check.outputTail === undefined ? [] : ["It printed:", "```", check.outputTail, "```"]
21087
21112
  ].join(`
21088
21113
  `),
@@ -23401,7 +23426,8 @@ var fixPrompt = (settled) => {
23401
23426
  return [
23402
23427
  ...checks.length === 0 ? [] : [
23403
23428
  "These checks fail on your head and pass on the base. Only the check passing closes one. If you are sure the change did not cause it, such as a flaky test, rebut it with your reason: the ChangeRequest reports that as your claim and the check stays open. A check does not run again on an unchanged tree, so if you change nothing and only these are open, the rally ends.",
23404
- ...checks.map(findingLine)
23429
+ ...checks.map(findingLine),
23430
+ "Read the full output of a failed check with the Kitman tool check_output, by its name."
23405
23431
  ],
23406
23432
  ...findings.length === 0 ? [] : [
23407
23433
  "The review found these. Fix each, or rebut it with your reason if it is wrong; reviewers judge the rebuttals next round.",
@@ -23597,7 +23623,7 @@ var build2 = defineLoop({
23597
23623
  const unsettled = [
23598
23624
  ...new Set([
23599
23625
  ...verdict.settled ? [] : verdict.reasons,
23600
- ...brokenChecks(last.head).map((check) => failsOn("head", check.name, last.head.tree)),
23626
+ ...brokenChecks(last.head).map((check) => failsOn("head", check, last.head.tree)),
23601
23627
  ...unsettledItems(last.settled, last.decision),
23602
23628
  ...last.conflicts,
23603
23629
  ...criteria.flatMap((answer) => answer.status === "not_met" ? [`Criterion not met: ${answer.criterion} (${answer.detail})`] : [])
@@ -31787,4 +31813,4 @@ var runKit = (config, identity, packages) => {
31787
31813
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31788
31814
  };
31789
31815
  // .kitman-build-entry.ts
31790
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.11" }, []);
31816
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.12" }, []);
@@ -5891,7 +5891,7 @@
5891
5891
  "carried": [
5892
5892
  {
5893
5893
  "name": "@kitman-sh/software-engineering",
5894
- "version": "0.13.11",
5894
+ "version": "0.13.12",
5895
5895
  "setup": "2a237548a69b0cd53ec3be7f687cfa8c2128335b3a655d34e185f2abce6a3c37",
5896
5896
  "loops": [
5897
5897
  "build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/software-engineering",
3
- "version": "0.13.11",
3
+ "version": "0.13.12",
4
4
  "description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -17,12 +17,12 @@
17
17
  "tsconfig.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@kitman-sh/sdk": "0.13.11",
20
+ "@kitman-sh/sdk": "0.13.12",
21
21
  "effect": "^4.1.2"
22
22
  },
23
23
  "kitman": {
24
24
  "bundle": "dist/bundle.js",
25
- "digest": "1f532dc2edd412015985a3b11e94a10faed0feb5b6ea3a2c2bad6fc389ca9655",
25
+ "digest": "bd954b3c033458d0913ae037186b92f145fbf55b6d05757c5e2347cf12455ad5",
26
26
  "protocolVersion": 5,
27
27
  "declarations": "dist/declarations.json",
28
28
  "setup": {
package/src/build.ts CHANGED
@@ -263,7 +263,8 @@ const fixPrompt = (settled: SettledRound) => {
263
263
  ? []
264
264
  : [
265
265
  'These checks fail on your head and pass on the base. Only the check passing closes one. If you are sure the change did not cause it, such as a flaky test, rebut it with your reason: the ChangeRequest reports that as your claim and the check stays open. A check does not run again on an unchanged tree, so if you change nothing and only these are open, the rally ends.',
266
- ...checks.map(findingLine)
266
+ ...checks.map(findingLine),
267
+ 'Read the full output of a failed check with the Kitman tool check_output, by its name.'
267
268
  ]),
268
269
  ...(findings.length === 0
269
270
  ? []
@@ -581,7 +582,7 @@ const build = defineLoop({
581
582
  const unsettled = [
582
583
  ...new Set([
583
584
  ...(verdict.settled ? [] : verdict.reasons),
584
- ...brokenChecks(last.head).map(check => failsOn('head', check.name, last.head.tree)),
585
+ ...brokenChecks(last.head).map(check => failsOn('head', check, last.head.tree)),
585
586
  ...unsettledItems(last.settled, last.decision),
586
587
  ...last.conflicts,
587
588
  ...criteria.flatMap(answer =>
@@ -47,7 +47,10 @@ export const verifyHead = (name: string, revision: string) =>
47
47
 
48
48
  export const isCheckFinding = (id: string) => id.startsWith('check: ')
49
49
 
50
- /** Each check the change broke, as a blocker with its output, which only the check passing closes. */
50
+ const failedTestLines = (tests: readonly string[] = []) =>
51
+ tests.length === 0 ? [] : ['Failing tests:', ...tests.map(test => `- ${test}`)]
52
+
53
+ /** Each check the change broke, as a blocker with its failing tests and output, which only the check passing closes. */
51
54
  export const checkFindings = (head: VerifyResult): readonly MergedFinding[] =>
52
55
  brokenChecks(head).map(check => ({
53
56
  id: `check: ${check.name}`,
@@ -56,6 +59,7 @@ export const checkFindings = (head: VerifyResult): readonly MergedFinding[] =>
56
59
  line: 0,
57
60
  detail: [
58
61
  `\`${check.command}\` fails on the head and passes on the base.`,
62
+ ...failedTestLines(check.failedTests),
59
63
  ...(check.outputTail === undefined ? [] : ['It printed:', '```', check.outputTail, '```'])
60
64
  ].join('\n'),
61
65
  seats: ['verify']