@kitman-sh/software-engineering 0.13.11 → 0.13.13

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
@@ -13985,7 +13985,8 @@ var RunWaiting = Union2([
13985
13985
  position: Int.check(isGreaterThanOrEqualTo2(1)),
13986
13986
  reason: String5,
13987
13987
  movesUpAt: optionalKey2(String5),
13988
- unrunnable: optionalKey2(String5)
13988
+ unrunnable: optionalKey2(String5),
13989
+ quotaUntil: optionalKey2(Timestamp)
13989
13990
  })
13990
13991
  ]);
13991
13992
  var RunEvidence = Struct({
@@ -14000,6 +14001,7 @@ var RunEvidence = Struct({
14000
14001
  durationMs: Int.check(isGreaterThanOrEqualTo2(0)),
14001
14002
  outputTail: String5,
14002
14003
  fileIds: optionalKey2(ArraySchema(String5)),
14004
+ failedTests: optionalKey2(ArraySchema(String5)),
14003
14005
  skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
14004
14006
  newNotRun: optionalKey2(ArraySchema(String5)),
14005
14007
  recordedAt: Timestamp
@@ -19034,6 +19036,7 @@ var EvidenceCheck = Struct({
19034
19036
  durationMs: Finite,
19035
19037
  evidenceId: String5,
19036
19038
  outputTail: optionalKey2(String5),
19039
+ failedTests: optionalKey2(ArraySchema(String5)),
19037
19040
  suggested: optionalKey2(Boolean3),
19038
19041
  skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
19039
19042
  newNotRun: optionalKey2(ArraySchema(String5))
@@ -19047,9 +19050,15 @@ var VerifyResult = Struct({
19047
19050
  });
19048
19051
  var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
19049
19052
  var missing2 = (side) => `No verification evidence for the ${side}`;
19050
- var failsOn = (side, name, tree) => `${name} fails on the ${side} tree ${tree}`;
19051
19053
  var shownTests = 10;
19052
19054
  var testList = (tests) => [...tests.slice(0, shownTests), ...tests.length > shownTests ? [`and ${tests.length - shownTests} more`] : []].join("; ");
19055
+ var codeSpan = (name) => {
19056
+ const line = name.replaceAll(/\s+/gu, " ");
19057
+ const longestRun = Math.max(0, ...[...line.matchAll(/`+/gu)].map(([run]) => run.length));
19058
+ const fence = "`".repeat(longestRun + 1);
19059
+ return longestRun === 0 ? `${fence}${line}${fence}` : `${fence} ${line} ${fence}`;
19060
+ };
19061
+ 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
19062
  var testsNotRunReasons = (result) => result.checks.flatMap((check) => [
19054
19063
  ...check.newNotRun === undefined || check.newNotRun.length === 0 ? [] : [
19055
19064
  `${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 +19072,7 @@ var allPass = (side, result) => {
19063
19072
  return [missing2(side)];
19064
19073
  if (result.checks.length === 0)
19065
19074
  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));
19075
+ return result.checks.filter((check) => check.status === "failed" && !check.preExisting).map((check) => failsOn(side, check, result.tree));
19067
19076
  };
19068
19077
  var checkOn = (side, result, name) => {
19069
19078
  if (result === undefined)
@@ -19077,14 +19086,14 @@ var passesOnHead = (head, name) => {
19077
19086
  const { found, reason } = checkOn("head", head, name);
19078
19087
  if (found === undefined)
19079
19088
  return [reason];
19080
- return found.status === "passed" ? [] : [failsOn("head", found.name, head?.tree)];
19089
+ return found.status === "passed" ? [] : [failsOn("head", found, head?.tree)];
19081
19090
  };
19082
19091
  var bugReasons = (input) => {
19083
19092
  const base = checkOn("base", input.base, input.reproducing);
19084
19093
  const head = checkOn("head", input.head, input.reproducing);
19085
19094
  return [
19086
19095
  ...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)]
19096
+ ...head.found === undefined ? [head.reason] : head.found.status === "passed" ? [] : [failsOn("head", head.found, input.head?.tree)]
19088
19097
  ];
19089
19098
  };
19090
19099
  var conclusionReasons = (conclusion) => {
@@ -20118,13 +20127,16 @@ var NetworkHostQuery = Struct({
20118
20127
  var maxSkippedTests = 1e4;
20119
20128
  var maxRanDigests = 1e5;
20120
20129
  var TestId = String5.check(isMinLength(1), isMaxLength(1000));
20130
+ var maxFailedTests = 50;
20131
+ var maxFailedTestLength = 300;
20121
20132
  var CheckTests = Struct({
20122
20133
  reports: Int.check(isGreaterThanOrEqualTo2(0)),
20123
20134
  passed: Int.check(isGreaterThanOrEqualTo2(0)),
20124
20135
  failed: Int.check(isGreaterThanOrEqualTo2(0)),
20125
20136
  skipped: Int.check(isGreaterThanOrEqualTo2(0)),
20126
20137
  skippedTests: ArraySchema(TestId).check(isMaxLength(maxSkippedTests)),
20127
- ranDigests: ArraySchema(String5.check(isMaxLength(16))).check(isMaxLength(maxRanDigests))
20138
+ ranDigests: ArraySchema(String5.check(isMaxLength(16))).check(isMaxLength(maxRanDigests)),
20139
+ failedTests: optionalKey2(ArraySchema(String5.check(isMinLength(1), isMaxLength(maxFailedTestLength))).check(isMaxLength(maxFailedTests)))
20128
20140
  });
20129
20141
  var entities = new Map([
20130
20142
  ["amp", "&"],
@@ -20133,6 +20145,18 @@ var entities = new Map([
20133
20145
  ["quot", '"'],
20134
20146
  ["apos", "'"]
20135
20147
  ]);
20148
+ var failedFileStart = String.raw`FAIL +(?:\|[^|]+\| *)?(?! )(?!\S*:\/\/)`;
20149
+ var afterPath = String.raw` > | \[ `;
20150
+ var failedFilePaths = [
20151
+ String.raw`\S*\.[A-Za-z]\w*(?=[\s:]|$)`,
20152
+ String.raw`(?=\S*[A-Za-z])(?=\S*\/)\S+(?=${afterPath}|$)`,
20153
+ String.raw`(?:(?!${afterPath}).)*\.[A-Za-z]\w*(?=${afterPath})`,
20154
+ String.raw`(?=\S*\/)(?:(?!${afterPath}).)*\.[A-Za-z]\w*$`,
20155
+ String.raw`(?=.*(?:\.(?:test|spec)\.|\b__tests__\/))(?:(?!${afterPath}).)*\.[cm]?[jt]sx?$`
20156
+ ];
20157
+ var failedFileLine = new RegExp(`^${failedFileStart}((?:${failedFilePaths.join("|")}).*)$`, "su");
20158
+ var attempt = String.raw`(?:\d+ times in )?(?:initial run|\d+[a-z]{2} (?:retry(?: of \d+[a-z]{2} repeat)?|repeat))`;
20159
+ var vitestAttempts = new RegExp(String.raw` \(${attempt}(?:, ${attempt})*\)$`, "u");
20136
20160
 
20137
20161
  // ../../packages/core/src/work-unit.ts
20138
20162
  var WorkUnitLease = Struct({
@@ -21076,6 +21100,7 @@ var verifyHead = (name, revision) => verify(name, { revision }).pipe(map8((head)
21076
21100
  notRun: nothingToVerify(failed.reason) ? [] : [`Kitman could not verify the head, so none of its tests count as run: ${failed.reason}`]
21077
21101
  })));
21078
21102
  var isCheckFinding = (id) => id.startsWith("check: ");
21103
+ var failedTestLines = (tests = []) => tests.length === 0 ? [] : ["Failing tests:", ...tests.map((test) => `- ${test}`)];
21079
21104
  var checkFindings = (head) => brokenChecks(head).map((check) => ({
21080
21105
  id: `check: ${check.name}`,
21081
21106
  severity: "blocker",
@@ -21083,6 +21108,7 @@ var checkFindings = (head) => brokenChecks(head).map((check) => ({
21083
21108
  line: 0,
21084
21109
  detail: [
21085
21110
  `\`${check.command}\` fails on the head and passes on the base.`,
21111
+ ...failedTestLines(check.failedTests),
21086
21112
  ...check.outputTail === undefined ? [] : ["It printed:", "```", check.outputTail, "```"]
21087
21113
  ].join(`
21088
21114
  `),
@@ -23401,7 +23427,8 @@ var fixPrompt = (settled) => {
23401
23427
  return [
23402
23428
  ...checks.length === 0 ? [] : [
23403
23429
  "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)
23430
+ ...checks.map(findingLine),
23431
+ "Read the full output of a failed check with the Kitman tool check_output, by its name."
23405
23432
  ],
23406
23433
  ...findings.length === 0 ? [] : [
23407
23434
  "The review found these. Fix each, or rebut it with your reason if it is wrong; reviewers judge the rebuttals next round.",
@@ -23597,7 +23624,7 @@ var build2 = defineLoop({
23597
23624
  const unsettled = [
23598
23625
  ...new Set([
23599
23626
  ...verdict.settled ? [] : verdict.reasons,
23600
- ...brokenChecks(last.head).map((check) => failsOn("head", check.name, last.head.tree)),
23627
+ ...brokenChecks(last.head).map((check) => failsOn("head", check, last.head.tree)),
23601
23628
  ...unsettledItems(last.settled, last.decision),
23602
23629
  ...last.conflicts,
23603
23630
  ...criteria.flatMap((answer) => answer.status === "not_met" ? [`Criterion not met: ${answer.criterion} (${answer.detail})`] : [])
@@ -31787,4 +31814,4 @@ var runKit = (config, identity, packages) => {
31787
31814
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
31788
31815
  };
31789
31816
  // .kitman-build-entry.ts
31790
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.11" }, []);
31817
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.13" }, []);
@@ -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.13",
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.13",
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.13",
21
21
  "effect": "^4.1.2"
22
22
  },
23
23
  "kitman": {
24
24
  "bundle": "dist/bundle.js",
25
- "digest": "1f532dc2edd412015985a3b11e94a10faed0feb5b6ea3a2c2bad6fc389ca9655",
25
+ "digest": "66309735a624916d402564cf8c681ec78c5a52defeeeb834385cf7a61f188e5a",
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']