@jphutchins/code-review 0.1.0-alpha.56 → 0.1.0-alpha.57

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/index.js CHANGED
@@ -3393,7 +3393,7 @@ var post = async (input, ghApi = runGhApi, readArtifact = ghArtifactReader) => {
3393
3393
  noticeBody(
3394
3394
  `${DEFAULT_MARKER}
3395
3395
 
3396
- \u26A0\uFE0F **CI-fix pass completed with no findings** for \`${input.headSha.slice(0, 7)}\`${input.unverifiedNoLogs === true ? ' \u2014 **but no failing-job logs were available**, so it had only the diff to work from and "no findings" is not evidence of none' : ""} \u2014 the completed full review of \`${priorSha ? priorSha.slice(0, 7) : "an earlier commit"}\` is preserved below.${dropNote ? `
3396
+ \u26A0\uFE0F **CI-fix pass completed with no findings** for \`${input.headSha.slice(0, 7)}\`${input.unverifiedNoLogs === true ? ' \u2014 **but no failing-job logs were available**, so it worked from the diff and any local reproduction of the checks, and "no findings" is not evidence of none' : ""} \u2014 the completed full review of \`${priorSha ? priorSha.slice(0, 7) : "an earlier commit"}\` is preserved below.${dropNote ? `
3397
3397
 
3398
3398
  ${dropNote}` : ""}`,
3399
3399
  sticky.body
@@ -4234,8 +4234,14 @@ var IssueCommentCodec = t.intersection([
4234
4234
  author_association: t.union([t.string, t.null])
4235
4235
  })
4236
4236
  ]);
4237
- var JobCodec = t.type({ id: t.number, conclusion: t.union([t.string, t.null]) });
4238
- var JOBS_JQ = ".jobs[] | {id: .id, conclusion: .conclusion}";
4237
+ var JobCodec = t.type({
4238
+ id: t.number,
4239
+ // A null name (an API edge) degrades to a nameless entry rather than aborting the whole gather —
4240
+ // the identity the reproduction steer needs is best-effort, never load-bearing.
4241
+ name: t.union([t.string, t.null]),
4242
+ conclusion: t.union([t.string, t.null])
4243
+ });
4244
+ var JOBS_JQ = ".jobs[] | {id: .id, name: .name, conclusion: .conclusion}";
4239
4245
  var fetchPrMeta = async (repo, prNumber, ghApi) => {
4240
4246
  const stdout = await ghApi([
4241
4247
  `repos/${repo}/pulls/${String(prNumber)}`,
@@ -4396,6 +4402,13 @@ var downloadFailingJobLogs = async (repo, runId, outDir, ghApi) => {
4396
4402
  for (const job of selected) {
4397
4403
  try {
4398
4404
  const log = await ghApi([`repos/${repo}/actions/jobs/${String(job.id)}/logs`]);
4405
+ if (log.trim() === "no log available" || log.trim() === "") {
4406
+ process.stderr.write(
4407
+ `Warning: job ${String(job.id)} has no log available (placeholder body) \u2014 not staged
4408
+ `
4409
+ );
4410
+ continue;
4411
+ }
4399
4412
  writeFileSync(join(outDir, `job_${String(job.id)}.log`), log);
4400
4413
  staged += 1;
4401
4414
  } catch (err) {
@@ -4405,6 +4418,15 @@ var downloadFailingJobLogs = async (repo, runId, outDir, ghApi) => {
4405
4418
  );
4406
4419
  }
4407
4420
  }
4421
+ writeFileSync(
4422
+ join(outDir, "failed_jobs.json"),
4423
+ `${JSON.stringify(
4424
+ failing.map((j) => ({ name: j.name, conclusion: j.conclusion })),
4425
+ null,
4426
+ 2
4427
+ )}
4428
+ `
4429
+ );
4408
4430
  if (failing.length > selected.length) {
4409
4431
  process.stderr.write(
4410
4432
  `::warning::${annotationSafe(`${String(failing.length)} failing job(s) in run ${runId}; staged ${String(staged)} of the first ${String(selected.length)} log(s) \u2014 the review does not see the rest`)}
@@ -4412,8 +4434,11 @@ var downloadFailingJobLogs = async (repo, runId, outDir, ghApi) => {
4412
4434
  );
4413
4435
  }
4414
4436
  if (staged === 0) {
4437
+ const reported = failing.length > 0 ? `${String(failing.length)} failing job(s) reported` : "no job concluded 'failure' (timeouts or cancellations)";
4415
4438
  process.stderr.write(
4416
- `::warning::${annotationSafe(`No failing-job logs could be staged for run ${runId} (${String(failing.length)} failing job(s) reported) \u2014 the review has only the diff to work from`)}
4439
+ `::warning::${annotationSafe(
4440
+ `No failing-job logs could be staged for run ${runId} (${reported}) \u2014 the review must reproduce the failures itself${failing.length > 0 ? " (the failing jobs are listed in failed_jobs.json)" : ""}`
4441
+ )}
4417
4442
  `
4418
4443
  );
4419
4444
  }
@@ -6081,7 +6106,7 @@ var stopGateCmd = defineCommand({
6081
6106
  var gatherCmd = defineCommand({
6082
6107
  meta: {
6083
6108
  name: "gather",
6084
- description: "Resolve the PR from the CI head SHA and gather review inputs (diff with git-diff fallback, PR context, prior bot review, untrusted PR conversation to triage, failing-job logs) as files for the review agent"
6109
+ description: "Resolve the PR from the CI head SHA and gather review inputs (diff with git-diff fallback, PR context, prior bot review, untrusted PR conversation to triage, failing-job logs and the failing jobs' identities in failed_jobs.json) as files for the review agent"
6085
6110
  },
6086
6111
  args: {
6087
6112
  repo: { type: "string", description: "Repository (owner/name)", required: true },