@attalabs/vinaya 0.31.0 → 0.32.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 (46) hide show
  1. package/README.md +1 -2
  2. package/aeg-root/roles/developer/reference.md +3 -3
  3. package/aeg-root/templates/pr-report-template.md +7 -2
  4. package/dist/checks/bin/check-body-bare-digits.js +229 -86
  5. package/dist/checks/bin/check-branch-topology.js +101 -89
  6. package/dist/checks/bin/check-brief-shape.js +222 -79
  7. package/dist/checks/bin/check-changeset-coverage.js +739 -232
  8. package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
  9. package/dist/checks/bin/check-closes-n.js +101 -89
  10. package/dist/checks/bin/check-coherence.js +233 -129
  11. package/dist/checks/bin/check-dead-branch-push.js +97 -44
  12. package/dist/checks/bin/check-dispatch-readiness.js +238 -134
  13. package/dist/checks/bin/check-doc-coverage-push.js +722 -215
  14. package/dist/checks/bin/check-doc-coverage.js +726 -219
  15. package/dist/checks/bin/check-doctrine-no-procedures.js +222 -79
  16. package/dist/checks/bin/check-doctrine-portability.js +724 -217
  17. package/dist/checks/bin/check-evidence-fresh.js +720 -206
  18. package/dist/checks/bin/check-exec-bits.js +720 -213
  19. package/dist/checks/bin/check-first-push-dispatch.js +231 -129
  20. package/dist/checks/bin/check-issue-assignment.js +103 -91
  21. package/dist/checks/bin/check-issue-milestone-attach.js +94 -41
  22. package/dist/checks/bin/check-issue-objectives-numbering.js +94 -41
  23. package/dist/checks/bin/check-issue-parts-coverage.js +94 -41
  24. package/dist/checks/bin/check-issue-surface-globs.js +251 -127
  25. package/dist/checks/bin/check-issue-title-grammar.js +94 -41
  26. package/dist/checks/bin/check-issue-tranche-label.js +94 -41
  27. package/dist/checks/bin/check-main-branch-refusal.js +94 -41
  28. package/dist/checks/bin/check-no-disk-state.js +94 -41
  29. package/dist/checks/bin/check-pr-premise-reassert.js +222 -77
  30. package/dist/checks/bin/check-pr-report-density.js +94 -41
  31. package/dist/checks/bin/check-principal-test-plan-wait.js +94 -39
  32. package/dist/checks/bin/check-quoted-command.js +710 -201
  33. package/dist/checks/bin/check-reader-resolvable-prose.js +722 -213
  34. package/dist/checks/bin/check-registry-gates.js +104 -41
  35. package/dist/checks/bin/check-retired-vocabulary.js +708 -199
  36. package/dist/checks/bin/check-review-gate.js +224 -79
  37. package/dist/checks/bin/check-single-plan-pr.js +94 -41
  38. package/dist/checks/bin/check-surface-scope.js +101 -89
  39. package/dist/checks/bin/check-test-plan.js +94 -39
  40. package/dist/checks/bin/check-token-collection-wired.js +100 -42
  41. package/dist/checks/bin/check-token-report.js +96 -43
  42. package/dist/checks/bin/check-workspace-escape.js +722 -213
  43. package/dist/index.js +3725 -3148
  44. package/dist/lib/pre-push-cache-test-run.js +4175 -0
  45. package/dist/lib/pre-push-select-tests.js +709 -101
  46. package/package.json +3 -2
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
2
  // ../../packages/aeg-core/src/gate-audience.ts
5
3
  var GATE_AUDIENCE = {
6
4
  "check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
@@ -1034,7 +1032,7 @@ function withDefaults(oldDefaults, newDefaults) {
1034
1032
  var endpoint = withDefaults(null, DEFAULTS);
1035
1033
 
1036
1034
  // ../../node_modules/fast-content-type-parse/index.js
1037
- var NullObject = function NullObject2() {};
1035
+ var NullObject = function NullObject() {};
1038
1036
  NullObject.prototype = Object.create(null);
1039
1037
  var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
1040
1038
  var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
@@ -1778,27 +1776,27 @@ function splitTableRow(row) {
1778
1776
  return parts.map((p) => p.split(PLACEHOLDER).join("|"));
1779
1777
  }
1780
1778
  // ../../packages/aeg-core/src/blast-radius-domains.ts
1781
- function resolveWorkspaceEntry(entry2, listDirs) {
1782
- if (entry2.endsWith("/*")) {
1783
- const baseDir = entry2.slice(0, -2);
1779
+ function resolveWorkspaceEntry(entry, listDirs) {
1780
+ if (entry.endsWith("/*")) {
1781
+ const baseDir = entry.slice(0, -2);
1784
1782
  return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
1785
1783
  }
1786
- if (entry2.includes("*"))
1784
+ if (entry.includes("*"))
1787
1785
  return [];
1788
- return [entry2];
1786
+ return [entry];
1789
1787
  }
1790
1788
  // ../../packages/aeg-core/src/consumer-enumeration.ts
1791
1789
  function deriveWorkspaceMemberDirs(workspaces, listDirs) {
1792
- const positive = workspaces.filter((entry2) => !entry2.startsWith("!"));
1793
- const negative = workspaces.filter((entry2) => entry2.startsWith("!")).map((entry2) => entry2.slice(1));
1790
+ const positive = workspaces.filter((entry) => !entry.startsWith("!"));
1791
+ const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
1794
1792
  const excluded = new Set;
1795
- for (const entry2 of negative) {
1796
- for (const member of resolveWorkspaceEntry(entry2, listDirs))
1793
+ for (const entry of negative) {
1794
+ for (const member of resolveWorkspaceEntry(entry, listDirs))
1797
1795
  excluded.add(member);
1798
1796
  }
1799
1797
  const members = new Set;
1800
- for (const entry2 of positive) {
1801
- for (const member of resolveWorkspaceEntry(entry2, listDirs)) {
1798
+ for (const entry of positive) {
1799
+ for (const member of resolveWorkspaceEntry(entry, listDirs)) {
1802
1800
  if (!excluded.has(member))
1803
1801
  members.add(member);
1804
1802
  }
@@ -2122,15 +2120,15 @@ function summarizeTranscript(jsonl) {
2122
2120
  const line = rawLine.trim();
2123
2121
  if (!line)
2124
2122
  continue;
2125
- let entry2;
2123
+ let entry;
2126
2124
  try {
2127
- entry2 = JSON.parse(line);
2125
+ entry = JSON.parse(line);
2128
2126
  } catch {
2129
2127
  continue;
2130
2128
  }
2131
- if (!entry2 || typeof entry2 !== "object")
2129
+ if (!entry || typeof entry !== "object")
2132
2130
  continue;
2133
- const obj = entry2;
2131
+ const obj = entry;
2134
2132
  if (obj.type !== "assistant")
2135
2133
  continue;
2136
2134
  const message = obj.message;
@@ -2978,7 +2976,7 @@ function isStep0Block(content) {
2978
2976
  }
2979
2977
  function checkCommandsCarryOutput(prBody) {
2980
2978
  const errors = [];
2981
- for (const [label2, num] of [
2979
+ for (const [label, num] of [
2982
2980
  ["5", 5],
2983
2981
  ["6", 6]
2984
2982
  ]) {
@@ -2992,7 +2990,7 @@ function checkCommandsCarryOutput(prBody) {
2992
2990
  continue;
2993
2991
  const next = blocks[i + 1];
2994
2992
  if (!next || isCommandBlock(next.content)) {
2995
- errors.push(`brief-validation commands carry output: §${label2} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2993
+ errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2996
2994
  }
2997
2995
  }
2998
2996
  }
@@ -3429,8 +3427,8 @@ function stripPartBackticks(text) {
3429
3427
  function partWordCount(text) {
3430
3428
  return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3431
3429
  }
3432
- function looksLikeFilePath(entry2) {
3433
- const stripped = entry2.replace(/\/\*\*?$/, "");
3430
+ function looksLikeFilePath(entry) {
3431
+ const stripped = entry.replace(/\/\*\*?$/, "");
3434
3432
  const lastSegment = stripped.split("/").pop() ?? stripped;
3435
3433
  const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3436
3434
  return extMatch !== null && extMatch.index > 0;
@@ -3916,14 +3914,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3916
3914
  const referenced = extractClosesReferences(prBody);
3917
3915
  if (taskIssueRefs) {
3918
3916
  for (const n of referenced) {
3919
- const ref2 = taskIssueRefs.get(n);
3920
- if (!ref2)
3917
+ const ref = taskIssueRefs.get(n);
3918
+ if (!ref)
3921
3919
  continue;
3922
- const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
3920
+ const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
3923
3921
  if (branch !== expectedBranch) {
3924
3922
  return {
3925
3923
  ok: false,
3926
- message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref2.taskId} of tranche "${ref2.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3924
+ message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3927
3925
  };
3928
3926
  }
3929
3927
  }
@@ -3932,15 +3930,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3932
3930
  if (!ref)
3933
3931
  return { ok: true };
3934
3932
  if (ref.kind === "issue") {
3935
- const expectedIssue2 = ref.issueNumber;
3936
- if (!referenced.has(expectedIssue2)) {
3933
+ const expectedIssue = ref.issueNumber;
3934
+ if (!referenced.has(expectedIssue)) {
3937
3935
  return {
3938
3936
  ok: false,
3939
- expectedIssue: expectedIssue2,
3940
- message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3937
+ expectedIssue,
3938
+ message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3941
3939
  };
3942
3940
  }
3943
- return { ok: true, expectedIssue: expectedIssue2 };
3941
+ return { ok: true, expectedIssue };
3944
3942
  }
3945
3943
  const trancheSlug = ref.tranche;
3946
3944
  const taskId = ref.taskId;
@@ -3986,8 +3984,8 @@ function extractIssue(body) {
3986
3984
  const anchorNums = closesRefs(anchored);
3987
3985
  if (anchorNums.length === 0)
3988
3986
  return { issue: null, extraIssues: bodyNums, outsideHeader: false };
3989
- const issue2 = anchorNums[0];
3990
- return { issue: issue2, extraIssues: bodyNums.filter((n) => n !== issue2), outsideHeader: false };
3987
+ const issue = anchorNums[0];
3988
+ return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
3991
3989
  }
3992
3990
  const headerNums = closesRefs(headerRegion(stripped));
3993
3991
  if (bodyNums.length === 0)
@@ -4056,15 +4054,15 @@ function compareManifest(echoed, current, patchIdOf) {
4056
4054
  const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
4057
4055
  const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
4058
4056
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4059
- const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
4057
+ const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4060
4058
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
4061
4059
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4062
4060
  return {
4063
- bound: head && base && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
4061
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
4064
4062
  head,
4065
4063
  base,
4066
4064
  briefHash: briefHashBound,
4067
- objectivesVersion: objectivesVersion2,
4065
+ objectivesVersion,
4068
4066
  rulingOrdinal,
4069
4067
  policyDigest: policyDigestBound
4070
4068
  };
@@ -5496,6 +5494,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5496
5494
  }
5497
5495
  return findings;
5498
5496
  }
5497
+ // ../../packages/aeg-core/src/dev-review-loop/types.ts
5498
+ var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5499
+ // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5500
+ var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5499
5501
  // ../../packages/aeg-core/src/log/envelope.ts
5500
5502
  import { createHash as createHash5 } from "node:crypto";
5501
5503
 
@@ -6034,6 +6036,7 @@ function redact(value, home) {
6034
6036
  return value;
6035
6037
  }
6036
6038
  // ../../packages/aeg-core/src/log/store.ts
6039
+ var KNOWN_SCHEMA_VERSIONS = [1, 2];
6037
6040
  function metaOf(obj) {
6038
6041
  if (obj === null || typeof obj !== "object")
6039
6042
  return null;
@@ -6056,11 +6059,61 @@ function recordIdentity(obj) {
6056
6059
  }
6057
6060
  return null;
6058
6061
  }
6059
-
6060
- // ../../packages/aeg-core/src/log/artifact.ts
6061
- var TASK_LOG_ARTIFACT_MAX_BYTES = 8 * 1024 * 1024;
6062
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
6063
- var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
6062
+ function schemaVersionOf(obj) {
6063
+ const meta = metaOf(obj);
6064
+ const schema = meta?.schema;
6065
+ return typeof schema === "number" ? schema : null;
6066
+ }
6067
+ function isKnownSchema(version) {
6068
+ return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
6069
+ }
6070
+ function classifyStoredLine(raw, home) {
6071
+ let obj;
6072
+ try {
6073
+ obj = JSON.parse(raw);
6074
+ } catch {
6075
+ return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
6076
+ }
6077
+ const version = schemaVersionOf(obj);
6078
+ if (version === null) {
6079
+ return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
6080
+ }
6081
+ if (!isKnownSchema(version)) {
6082
+ return {
6083
+ status: "unknown_version",
6084
+ identity: recordIdentity(obj),
6085
+ schema: version,
6086
+ raw,
6087
+ reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
6088
+ };
6089
+ }
6090
+ const result = LogEventSchema.safeParse(obj);
6091
+ if (!result.success) {
6092
+ return {
6093
+ status: "invalid",
6094
+ identity: recordIdentity(obj),
6095
+ raw,
6096
+ reason: result.error.issues[0]?.message ?? "schema violation"
6097
+ };
6098
+ }
6099
+ const event = result.data;
6100
+ const identity = recordIdentity(event);
6101
+ if (identity === null) {
6102
+ return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6103
+ }
6104
+ const redacted = redact(event, home);
6105
+ const provenance = version === 2 ? event.meta.provenance ?? null : null;
6106
+ return {
6107
+ status: "ok",
6108
+ identity,
6109
+ runId: event.meta.run_id,
6110
+ seq: event.meta.seq,
6111
+ schema: version,
6112
+ provenance,
6113
+ event,
6114
+ postLine: JSON.stringify(redacted)
6115
+ };
6116
+ }
6064
6117
  // ../../packages/aeg-core/src/control-store/records.ts
6065
6118
  import { z as z3 } from "zod";
6066
6119
  var isoTimestamp = z3.string().min(1);
@@ -1034,7 +1034,7 @@ function withDefaults(oldDefaults, newDefaults) {
1034
1034
  var endpoint = withDefaults(null, DEFAULTS);
1035
1035
 
1036
1036
  // ../../node_modules/fast-content-type-parse/index.js
1037
- var NullObject = function NullObject2() {};
1037
+ var NullObject = function NullObject() {};
1038
1038
  NullObject.prototype = Object.create(null);
1039
1039
  var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
1040
1040
  var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
@@ -1778,27 +1778,27 @@ function splitTableRow(row) {
1778
1778
  return parts.map((p) => p.split(PLACEHOLDER).join("|"));
1779
1779
  }
1780
1780
  // ../../packages/aeg-core/src/blast-radius-domains.ts
1781
- function resolveWorkspaceEntry(entry2, listDirs) {
1782
- if (entry2.endsWith("/*")) {
1783
- const baseDir = entry2.slice(0, -2);
1781
+ function resolveWorkspaceEntry(entry, listDirs) {
1782
+ if (entry.endsWith("/*")) {
1783
+ const baseDir = entry.slice(0, -2);
1784
1784
  return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
1785
1785
  }
1786
- if (entry2.includes("*"))
1786
+ if (entry.includes("*"))
1787
1787
  return [];
1788
- return [entry2];
1788
+ return [entry];
1789
1789
  }
1790
1790
  // ../../packages/aeg-core/src/consumer-enumeration.ts
1791
1791
  function deriveWorkspaceMemberDirs(workspaces, listDirs) {
1792
- const positive = workspaces.filter((entry2) => !entry2.startsWith("!"));
1793
- const negative = workspaces.filter((entry2) => entry2.startsWith("!")).map((entry2) => entry2.slice(1));
1792
+ const positive = workspaces.filter((entry) => !entry.startsWith("!"));
1793
+ const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
1794
1794
  const excluded = new Set;
1795
- for (const entry2 of negative) {
1796
- for (const member of resolveWorkspaceEntry(entry2, listDirs))
1795
+ for (const entry of negative) {
1796
+ for (const member of resolveWorkspaceEntry(entry, listDirs))
1797
1797
  excluded.add(member);
1798
1798
  }
1799
1799
  const members = new Set;
1800
- for (const entry2 of positive) {
1801
- for (const member of resolveWorkspaceEntry(entry2, listDirs)) {
1800
+ for (const entry of positive) {
1801
+ for (const member of resolveWorkspaceEntry(entry, listDirs)) {
1802
1802
  if (!excluded.has(member))
1803
1803
  members.add(member);
1804
1804
  }
@@ -2122,15 +2122,15 @@ function summarizeTranscript(jsonl) {
2122
2122
  const line = rawLine.trim();
2123
2123
  if (!line)
2124
2124
  continue;
2125
- let entry2;
2125
+ let entry;
2126
2126
  try {
2127
- entry2 = JSON.parse(line);
2127
+ entry = JSON.parse(line);
2128
2128
  } catch {
2129
2129
  continue;
2130
2130
  }
2131
- if (!entry2 || typeof entry2 !== "object")
2131
+ if (!entry || typeof entry !== "object")
2132
2132
  continue;
2133
- const obj = entry2;
2133
+ const obj = entry;
2134
2134
  if (obj.type !== "assistant")
2135
2135
  continue;
2136
2136
  const message = obj.message;
@@ -2978,7 +2978,7 @@ function isStep0Block(content) {
2978
2978
  }
2979
2979
  function checkCommandsCarryOutput(prBody) {
2980
2980
  const errors = [];
2981
- for (const [label2, num] of [
2981
+ for (const [label, num] of [
2982
2982
  ["5", 5],
2983
2983
  ["6", 6]
2984
2984
  ]) {
@@ -2992,7 +2992,7 @@ function checkCommandsCarryOutput(prBody) {
2992
2992
  continue;
2993
2993
  const next = blocks[i + 1];
2994
2994
  if (!next || isCommandBlock(next.content)) {
2995
- errors.push(`brief-validation commands carry output: §${label2} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2995
+ errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2996
2996
  }
2997
2997
  }
2998
2998
  }
@@ -3429,8 +3429,8 @@ function stripPartBackticks(text) {
3429
3429
  function partWordCount(text) {
3430
3430
  return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3431
3431
  }
3432
- function looksLikeFilePath(entry2) {
3433
- const stripped = entry2.replace(/\/\*\*?$/, "");
3432
+ function looksLikeFilePath(entry) {
3433
+ const stripped = entry.replace(/\/\*\*?$/, "");
3434
3434
  const lastSegment = stripped.split("/").pop() ?? stripped;
3435
3435
  const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3436
3436
  return extMatch !== null && extMatch.index > 0;
@@ -3916,14 +3916,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3916
3916
  const referenced = extractClosesReferences(prBody);
3917
3917
  if (taskIssueRefs) {
3918
3918
  for (const n of referenced) {
3919
- const ref2 = taskIssueRefs.get(n);
3920
- if (!ref2)
3919
+ const ref = taskIssueRefs.get(n);
3920
+ if (!ref)
3921
3921
  continue;
3922
- const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
3922
+ const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
3923
3923
  if (branch !== expectedBranch) {
3924
3924
  return {
3925
3925
  ok: false,
3926
- message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref2.taskId} of tranche "${ref2.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3926
+ message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3927
3927
  };
3928
3928
  }
3929
3929
  }
@@ -3932,15 +3932,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3932
3932
  if (!ref)
3933
3933
  return { ok: true };
3934
3934
  if (ref.kind === "issue") {
3935
- const expectedIssue2 = ref.issueNumber;
3936
- if (!referenced.has(expectedIssue2)) {
3935
+ const expectedIssue = ref.issueNumber;
3936
+ if (!referenced.has(expectedIssue)) {
3937
3937
  return {
3938
3938
  ok: false,
3939
- expectedIssue: expectedIssue2,
3940
- message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3939
+ expectedIssue,
3940
+ message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3941
3941
  };
3942
3942
  }
3943
- return { ok: true, expectedIssue: expectedIssue2 };
3943
+ return { ok: true, expectedIssue };
3944
3944
  }
3945
3945
  const trancheSlug = ref.tranche;
3946
3946
  const taskId = ref.taskId;
@@ -3986,8 +3986,8 @@ function extractIssue(body) {
3986
3986
  const anchorNums = closesRefs(anchored);
3987
3987
  if (anchorNums.length === 0)
3988
3988
  return { issue: null, extraIssues: bodyNums, outsideHeader: false };
3989
- const issue2 = anchorNums[0];
3990
- return { issue: issue2, extraIssues: bodyNums.filter((n) => n !== issue2), outsideHeader: false };
3989
+ const issue = anchorNums[0];
3990
+ return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
3991
3991
  }
3992
3992
  const headerNums = closesRefs(headerRegion(stripped));
3993
3993
  if (bodyNums.length === 0)
@@ -4056,15 +4056,15 @@ function compareManifest(echoed, current, patchIdOf) {
4056
4056
  const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
4057
4057
  const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
4058
4058
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4059
- const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
4059
+ const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4060
4060
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
4061
4061
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4062
4062
  return {
4063
- bound: head && base && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
4063
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
4064
4064
  head,
4065
4065
  base,
4066
4066
  briefHash: briefHashBound,
4067
- objectivesVersion: objectivesVersion2,
4067
+ objectivesVersion,
4068
4068
  rulingOrdinal,
4069
4069
  policyDigest: policyDigestBound
4070
4070
  };
@@ -5496,6 +5496,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5496
5496
  }
5497
5497
  return findings;
5498
5498
  }
5499
+ // ../../packages/aeg-core/src/dev-review-loop/types.ts
5500
+ var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5501
+ // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5502
+ var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5499
5503
  // ../../packages/aeg-core/src/log/envelope.ts
5500
5504
  import { createHash as createHash5 } from "node:crypto";
5501
5505
 
@@ -6034,6 +6038,7 @@ function redact(value, home) {
6034
6038
  return value;
6035
6039
  }
6036
6040
  // ../../packages/aeg-core/src/log/store.ts
6041
+ var KNOWN_SCHEMA_VERSIONS = [1, 2];
6037
6042
  function metaOf(obj) {
6038
6043
  if (obj === null || typeof obj !== "object")
6039
6044
  return null;
@@ -6056,11 +6061,61 @@ function recordIdentity(obj) {
6056
6061
  }
6057
6062
  return null;
6058
6063
  }
6059
-
6060
- // ../../packages/aeg-core/src/log/artifact.ts
6061
- var TASK_LOG_ARTIFACT_MAX_BYTES = 8 * 1024 * 1024;
6062
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
6063
- var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
6064
+ function schemaVersionOf(obj) {
6065
+ const meta = metaOf(obj);
6066
+ const schema = meta?.schema;
6067
+ return typeof schema === "number" ? schema : null;
6068
+ }
6069
+ function isKnownSchema(version) {
6070
+ return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
6071
+ }
6072
+ function classifyStoredLine(raw, home) {
6073
+ let obj;
6074
+ try {
6075
+ obj = JSON.parse(raw);
6076
+ } catch {
6077
+ return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
6078
+ }
6079
+ const version = schemaVersionOf(obj);
6080
+ if (version === null) {
6081
+ return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
6082
+ }
6083
+ if (!isKnownSchema(version)) {
6084
+ return {
6085
+ status: "unknown_version",
6086
+ identity: recordIdentity(obj),
6087
+ schema: version,
6088
+ raw,
6089
+ reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
6090
+ };
6091
+ }
6092
+ const result = LogEventSchema.safeParse(obj);
6093
+ if (!result.success) {
6094
+ return {
6095
+ status: "invalid",
6096
+ identity: recordIdentity(obj),
6097
+ raw,
6098
+ reason: result.error.issues[0]?.message ?? "schema violation"
6099
+ };
6100
+ }
6101
+ const event = result.data;
6102
+ const identity = recordIdentity(event);
6103
+ if (identity === null) {
6104
+ return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6105
+ }
6106
+ const redacted = redact(event, home);
6107
+ const provenance = version === 2 ? event.meta.provenance ?? null : null;
6108
+ return {
6109
+ status: "ok",
6110
+ identity,
6111
+ runId: event.meta.run_id,
6112
+ seq: event.meta.seq,
6113
+ schema: version,
6114
+ provenance,
6115
+ event,
6116
+ postLine: JSON.stringify(redacted)
6117
+ };
6118
+ }
6064
6119
  // ../../packages/aeg-core/src/control-store/records.ts
6065
6120
  import { z as z3 } from "zod";
6066
6121
  var isoTimestamp = z3.string().min(1);