tamperward 2.41.0 → 2.42.0

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +79 -7
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -11328,7 +11328,7 @@ var init_signoff = __esm({
11328
11328
  function machineOutput(payload) {
11329
11329
  return { ...payload, schema_version: MACHINE_SCHEMA_VERSION };
11330
11330
  }
11331
- var MACHINE_SCHEMA_VERSION, VERIFY_VERDICTS, RUN_VERDICTS;
11331
+ var MACHINE_SCHEMA_VERSION, VERIFY_VERDICTS, VERIFY_CANNOT_VERIFY_REASONS, RUN_VERDICTS;
11332
11332
  var init_machine_output = __esm({
11333
11333
  "src/machine-output.ts"() {
11334
11334
  "use strict";
@@ -11340,6 +11340,23 @@ var init_machine_output = __esm({
11340
11340
  "BUDGET_EXCEEDED",
11341
11341
  "CANNOT_VERIFY"
11342
11342
  ];
11343
+ VERIFY_CANNOT_VERIFY_REASONS = [
11344
+ "INVALID_ARGUMENTS",
11345
+ "POLICY_ERROR",
11346
+ "BASE_NOT_ANCESTOR",
11347
+ "NO_SUITE_COMMAND",
11348
+ "VERIFIER_BACKEND_UNAVAILABLE",
11349
+ "LOCAL_VERIFIER_UNSUPPORTED_PLATFORM",
11350
+ "DEPENDENCY_ENVIRONMENT_UNATTESTABLE",
11351
+ "BASE_UNRESOLVABLE",
11352
+ "DEPENDENCY_DRIFT",
11353
+ "MATERIALIZATION_FAILED",
11354
+ "VERIFIER_BACKEND_RUNTIME_FAILURE",
11355
+ "VERIFIER_RESOURCE_EXHAUSTED",
11356
+ "WORKTREE_CHANGED",
11357
+ "PRISTINE_INTEGRITY_CHANGED",
11358
+ "PATH_CASE_COLLISION"
11359
+ ];
11343
11360
  RUN_VERDICTS = [
11344
11361
  "VERIFIED",
11345
11362
  "AGENT_TIMEOUT",
@@ -25281,6 +25298,41 @@ var init_research = __esm({
25281
25298
  }
25282
25299
  });
25283
25300
 
25301
+ // src/cli/render/verify-github.ts
25302
+ function safeDetail(value) {
25303
+ const normalized = value.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").replace(/\s+/g, " ").trim();
25304
+ if (normalized.length <= DETAIL_LIMIT) return normalized;
25305
+ return normalized.slice(0, DETAIL_LIMIT - 1).trimEnd() + "\u2026";
25306
+ }
25307
+ function workflowData(value) {
25308
+ return value.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
25309
+ }
25310
+ function verifyWorkflowCommand(verdict2, exitCode, details = {}, env = process.env) {
25311
+ if (env.GITHUB_ACTIONS !== "true" || verdict2 === "VERIFIED") return void 0;
25312
+ if (verdict2 === "MASKED_FAILURE" && exitCode === 0) {
25313
+ return "::warning title=TamperWard verify::MASKED_FAILURE: a trusted out-of-band sign-off was accepted; this is not a VERIFIED result. Review the verification summary.";
25314
+ }
25315
+ const parts = [ERROR_MESSAGES[verdict2]];
25316
+ if (verdict2 === "CANNOT_VERIFY") {
25317
+ if (details.reason) parts.push(`Reason: ${details.reason}`);
25318
+ if (details.detail) parts.push(`Detail: ${safeDetail(details.detail)}`);
25319
+ }
25320
+ return `::error title=TamperWard verify::${workflowData(parts.join("\n"))}`;
25321
+ }
25322
+ var ERROR_MESSAGES, DETAIL_LIMIT;
25323
+ var init_verify_github = __esm({
25324
+ "src/cli/render/verify-github.ts"() {
25325
+ "use strict";
25326
+ ERROR_MESSAGES = {
25327
+ MASKED_FAILURE: "MASKED_FAILURE: the visible suite passed, but the suite restored from the trusted base failed. Review the test changes and verification summary.",
25328
+ SUITE_RED: "SUITE_RED: the visible suite failed. Fix the failing change before merging.",
25329
+ BUDGET_EXCEEDED: "BUDGET_EXCEEDED: verification exceeded its configured budget; CI could not establish a clean result.",
25330
+ CANNOT_VERIFY: "CANNOT_VERIFY: CI could not establish a trusted verification result."
25331
+ };
25332
+ DETAIL_LIMIT = 320;
25333
+ }
25334
+ });
25335
+
25284
25336
  // src/cli/receipt.ts
25285
25337
  import { appendFileSync as appendFileSync3, readFileSync as readFileSync26, writeFileSync as writeFileSync14 } from "node:fs";
25286
25338
  function parseReceipt(args) {
@@ -25413,12 +25465,17 @@ function ciAdjudicate(cwd, opts) {
25413
25465
  } catch (e) {
25414
25466
  return {
25415
25467
  ci: { verdict: "CANNOT_VERIFY", binding, binding_error: `unreadable CI verify result: ${e instanceof Error ? e.message : String(e)}` },
25416
- exit: 2
25468
+ exit: 2,
25469
+ annotation: { detail: "The CI verify result could not be read. Check the verify step output and artifact path." }
25417
25470
  };
25418
25471
  }
25419
25472
  const check2 = readCiVerify(doc, binding, cwd, opts);
25420
25473
  if (check2.reason !== void 0) {
25421
- return { ci: { verdict: "CANNOT_VERIFY", binding, binding_error: check2.reason }, exit: 2 };
25474
+ return {
25475
+ ci: { verdict: "CANNOT_VERIFY", binding, binding_error: check2.reason },
25476
+ exit: 2,
25477
+ annotation: { detail: check2.reason }
25478
+ };
25422
25479
  }
25423
25480
  const oob = oobFromEnv();
25424
25481
  const oobHead = oobHeadFromEnv();
@@ -25433,7 +25490,8 @@ function ciAdjudicate(cwd, opts) {
25433
25490
  ...check2.adjudicated_tree !== void 0 ? { adjudicated_tree: check2.adjudicated_tree } : {},
25434
25491
  ...bindingError ? { binding_error: bindingError } : {}
25435
25492
  },
25436
- exit: verdictExit(check2.verdict, signedOff)
25493
+ exit: verdictExit(check2.verdict, signedOff),
25494
+ annotation: { reason: check2.verifierReason, detail: check2.detail }
25437
25495
  };
25438
25496
  }
25439
25497
  const impl = opts.runVerifyImpl ?? runVerify;
@@ -25458,7 +25516,8 @@ function ciAdjudicate(cwd, opts) {
25458
25516
  ...binding ? { adjudicated_tree: binding.tree } : {},
25459
25517
  ...bindingError ? { binding_error: bindingError } : {}
25460
25518
  },
25461
- exit
25519
+ exit,
25520
+ annotation: { reason: summary?.reason, detail: summary?.detail }
25462
25521
  };
25463
25522
  }
25464
25523
  function isCommitId(v) {
@@ -25492,7 +25551,9 @@ function readCiVerify(doc, binding, cwd, opts) {
25492
25551
  }
25493
25552
  }
25494
25553
  const adjudicated_tree = typeof d.adjudicated_tree === "string" && d.adjudicated_tree.length > 0 ? d.adjudicated_tree : void 0;
25495
- return { verdict: d.verdict, adjudicated_tree };
25554
+ const verifierReason = isOneOf(VERIFY_CANNOT_VERIFY_REASONS, d.reason) ? d.reason : void 0;
25555
+ const detail = typeof d.detail === "string" ? d.detail : void 0;
25556
+ return { verdict: d.verdict, verifierReason, detail, adjudicated_tree };
25496
25557
  }
25497
25558
  function isRecordObject(v) {
25498
25559
  return typeof v === "object" && v !== null && !Array.isArray(v);
@@ -25571,7 +25632,7 @@ function runReceiptReconcile(opts = {}) {
25571
25632
  const cwd = opts.cwd ?? process.cwd();
25572
25633
  const guard = needRepo(cwd, "reconcile");
25573
25634
  if (guard !== null) return guard;
25574
- const { ci, exit } = ciAdjudicate(cwd, opts);
25635
+ const { ci, exit, annotation: annotationDetails } = ciAdjudicate(cwd, opts);
25575
25636
  const claimed = loadClaimedReceipt(opts.receipt);
25576
25637
  const r = reconcile(ci, claimed);
25577
25638
  const claimedReceipt = claimed.disposition === "PRESENT" ? claimed.receipt : null;
@@ -25581,6 +25642,16 @@ function runReceiptReconcile(opts = {}) {
25581
25642
  process.stdout.write(renderReconcile(r, claimedReceipt, ci.binding, ci.adjudicated_tree, colourEnabled(process.env, process.stdout)));
25582
25643
  }
25583
25644
  writeJobSummary(r, claimedReceipt, ci.binding, ci.adjudicated_tree);
25645
+ if (!opts.json) {
25646
+ const annotation = verifyWorkflowCommand(ci.verdict, exit, annotationDetails);
25647
+ if (annotation) process.stdout.write(`${annotation}
25648
+ `);
25649
+ }
25650
+ if (!opts.json) {
25651
+ const annotation = verifyWorkflowCommand(ci.verdict, exit);
25652
+ if (annotation) process.stdout.write(`${annotation}
25653
+ `);
25654
+ }
25584
25655
  return exit;
25585
25656
  }
25586
25657
  function writeJobSummary(r, receipt, ciBinding, adjudicatedTree) {
@@ -25621,6 +25692,7 @@ var init_receipt = __esm({
25621
25692
  init_verify();
25622
25693
  init_signoff();
25623
25694
  init_text();
25695
+ init_verify_github();
25624
25696
  init_status();
25625
25697
  RECEIPT_SUBCOMMANDS = ["export", "reconcile"];
25626
25698
  AGREEMENT_SEVERITY = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamperward",
3
- "version": "2.41.0",
3
+ "version": "2.42.0",
4
4
  "description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "hexrift",