@kitman-sh/software-engineering 0.13.10 → 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
@@ -14330,6 +14331,8 @@ var RunStepSummary = Struct({
14330
14331
  failureSummary: optionalKey2(String5),
14331
14332
  output: optionalKey2(Unknown2),
14332
14333
  revision: optionalKey2(String5),
14334
+ harness: optionalKey2(String5),
14335
+ model: optionalKey2(String5),
14333
14336
  tokens: optionalKey2(AttemptTokens)
14334
14337
  })),
14335
14338
  tokens: optionalKey2(TokenUsage)
@@ -19032,6 +19035,7 @@ var EvidenceCheck = Struct({
19032
19035
  durationMs: Finite,
19033
19036
  evidenceId: String5,
19034
19037
  outputTail: optionalKey2(String5),
19038
+ failedTests: optionalKey2(ArraySchema(String5)),
19035
19039
  suggested: optionalKey2(Boolean3),
19036
19040
  skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
19037
19041
  newNotRun: optionalKey2(ArraySchema(String5))
@@ -19045,9 +19049,15 @@ var VerifyResult = Struct({
19045
19049
  });
19046
19050
  var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
19047
19051
  var missing2 = (side) => `No verification evidence for the ${side}`;
19048
- var failsOn = (side, name, tree) => `${name} fails on the ${side} tree ${tree}`;
19049
19052
  var shownTests = 10;
19050
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))}`}`;
19051
19061
  var testsNotRunReasons = (result) => result.checks.flatMap((check) => [
19052
19062
  ...check.newNotRun === undefined || check.newNotRun.length === 0 ? [] : [
19053
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)}`
@@ -19061,7 +19071,7 @@ var allPass = (side, result) => {
19061
19071
  return [missing2(side)];
19062
19072
  if (result.checks.length === 0)
19063
19073
  return [`No approved verification ran on the ${side} tree ${result.tree}`];
19064
- 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));
19065
19075
  };
19066
19076
  var checkOn = (side, result, name) => {
19067
19077
  if (result === undefined)
@@ -19075,14 +19085,14 @@ var passesOnHead = (head, name) => {
19075
19085
  const { found, reason } = checkOn("head", head, name);
19076
19086
  if (found === undefined)
19077
19087
  return [reason];
19078
- return found.status === "passed" ? [] : [failsOn("head", found.name, head?.tree)];
19088
+ return found.status === "passed" ? [] : [failsOn("head", found, head?.tree)];
19079
19089
  };
19080
19090
  var bugReasons = (input) => {
19081
19091
  const base = checkOn("base", input.base, input.reproducing);
19082
19092
  const head = checkOn("head", input.head, input.reproducing);
19083
19093
  return [
19084
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`],
19085
- ...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)]
19086
19096
  ];
19087
19097
  };
19088
19098
  var conclusionReasons = (conclusion) => {
@@ -20116,13 +20126,16 @@ var NetworkHostQuery = Struct({
20116
20126
  var maxSkippedTests = 1e4;
20117
20127
  var maxRanDigests = 1e5;
20118
20128
  var TestId = String5.check(isMinLength(1), isMaxLength(1000));
20129
+ var maxFailedTests = 50;
20130
+ var maxFailedTestLength = 300;
20119
20131
  var CheckTests = Struct({
20120
20132
  reports: Int.check(isGreaterThanOrEqualTo2(0)),
20121
20133
  passed: Int.check(isGreaterThanOrEqualTo2(0)),
20122
20134
  failed: Int.check(isGreaterThanOrEqualTo2(0)),
20123
20135
  skipped: Int.check(isGreaterThanOrEqualTo2(0)),
20124
20136
  skippedTests: ArraySchema(TestId).check(isMaxLength(maxSkippedTests)),
20125
- 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)))
20126
20139
  });
20127
20140
  var entities = new Map([
20128
20141
  ["amp", "&"],
@@ -20131,6 +20144,18 @@ var entities = new Map([
20131
20144
  ["quot", '"'],
20132
20145
  ["apos", "'"]
20133
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");
20134
20159
 
20135
20160
  // ../../packages/core/src/work-unit.ts
20136
20161
  var WorkUnitLease = Struct({
@@ -21074,6 +21099,7 @@ var verifyHead = (name, revision) => verify(name, { revision }).pipe(map8((head)
21074
21099
  notRun: nothingToVerify(failed.reason) ? [] : [`Kitman could not verify the head, so none of its tests count as run: ${failed.reason}`]
21075
21100
  })));
21076
21101
  var isCheckFinding = (id) => id.startsWith("check: ");
21102
+ var failedTestLines = (tests = []) => tests.length === 0 ? [] : ["Failing tests:", ...tests.map((test) => `- ${test}`)];
21077
21103
  var checkFindings = (head) => brokenChecks(head).map((check) => ({
21078
21104
  id: `check: ${check.name}`,
21079
21105
  severity: "blocker",
@@ -21081,6 +21107,7 @@ var checkFindings = (head) => brokenChecks(head).map((check) => ({
21081
21107
  line: 0,
21082
21108
  detail: [
21083
21109
  `\`${check.command}\` fails on the head and passes on the base.`,
21110
+ ...failedTestLines(check.failedTests),
21084
21111
  ...check.outputTail === undefined ? [] : ["It printed:", "```", check.outputTail, "```"]
21085
21112
  ].join(`
21086
21113
  `),
@@ -23399,7 +23426,8 @@ var fixPrompt = (settled) => {
23399
23426
  return [
23400
23427
  ...checks.length === 0 ? [] : [
23401
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.",
23402
- ...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."
23403
23431
  ],
23404
23432
  ...findings.length === 0 ? [] : [
23405
23433
  "The review found these. Fix each, or rebut it with your reason if it is wrong; reviewers judge the rebuttals next round.",
@@ -23595,7 +23623,7 @@ var build2 = defineLoop({
23595
23623
  const unsettled = [
23596
23624
  ...new Set([
23597
23625
  ...verdict.settled ? [] : verdict.reasons,
23598
- ...brokenChecks(last.head).map((check) => failsOn("head", check.name, last.head.tree)),
23626
+ ...brokenChecks(last.head).map((check) => failsOn("head", check, last.head.tree)),
23599
23627
  ...unsettledItems(last.settled, last.decision),
23600
23628
  ...last.conflicts,
23601
23629
  ...criteria.flatMap((answer) => answer.status === "not_met" ? [`Criterion not met: ${answer.criterion} (${answer.detail})`] : [])
@@ -31785,4 +31813,4 @@ var runKit = (config, identity, packages) => {
31785
31813
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31786
31814
  };
31787
31815
  // .kitman-build-entry.ts
31788
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.10" }, []);
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.10",
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.10",
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.10",
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": "3faba804520385bbca53011d02313670c85fe76668043252207913ce934c2703",
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']