@attalabs/vinaya 0.2.0 → 0.4.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.
- package/aeg-root/enforcement.md +5 -4
- package/aeg-root/glossary.md +4 -0
- package/aeg-root/roles/archivist.md +1 -1
- package/aeg-root/roles/developer.md +2 -2
- package/aeg-root/roles/reviewer.md +1 -1
- package/aeg-root/roles/security.md +1 -1
- package/aeg-root/state-machine.md +17 -3
- package/aeg-root/tranche-model.md +5 -3
- package/dist/checks/bin/check-branch-topology.js +76 -14
- package/dist/checks/bin/check-brief-shape.js +76 -14
- package/dist/checks/bin/check-closes-n.js +76 -14
- package/dist/checks/bin/check-coherence.js +76 -14
- package/dist/checks/bin/check-dead-branch-push.js +76 -14
- package/dist/checks/bin/check-dispatch-readiness.js +76 -14
- package/dist/checks/bin/check-doc-coverage-push.js +76 -14
- package/dist/checks/bin/check-doc-coverage.js +76 -14
- package/dist/checks/bin/check-first-push-dispatch.js +76 -14
- package/dist/checks/bin/check-issue-assignment.js +76 -14
- package/dist/checks/bin/check-no-disk-state.js +76 -14
- package/dist/checks/bin/check-reader-resolvable-prose.js +76 -14
- package/dist/checks/bin/check-registry-gates.js +76 -14
- package/dist/checks/bin/check-review-gate.js +81 -15
- package/dist/checks/bin/check-single-plan-pr.js +76 -14
- package/dist/checks/bin/check-test-plan.js +76 -14
- package/dist/index.js +427 -68
- package/package.json +1 -1
|
@@ -1513,15 +1513,58 @@ function pointerToPath(p) {
|
|
|
1513
1513
|
return idx === -1 ? p : p.slice(0, idx);
|
|
1514
1514
|
}
|
|
1515
1515
|
var SEPARATOR = /(?:[ \t]*[—–][ \t]*|[ \t]+-[ \t]+)/.source;
|
|
1516
|
-
function
|
|
1517
|
-
const
|
|
1518
|
-
const re = new RegExp(`^[ \\t]
|
|
1516
|
+
function readPointerNoteField(body, field) {
|
|
1517
|
+
const out = [];
|
|
1518
|
+
const re = new RegExp(`^[ \\t]*${field}[ \\t]*:[ \\t]*(.+?)${SEPARATOR}(.+?)[ \\t]*$`, "gim");
|
|
1519
1519
|
for (const m of body.matchAll(re)) {
|
|
1520
|
-
|
|
1520
|
+
out.push({ surface: (m[1] ?? "").trim(), note: (m[2] ?? "").trim() });
|
|
1521
|
+
}
|
|
1522
|
+
return out;
|
|
1523
|
+
}
|
|
1524
|
+
function readDocAcks(body) {
|
|
1525
|
+
return readPointerNoteField(body, "Doc-ack");
|
|
1526
|
+
}
|
|
1527
|
+
function readDocNeutrals(body) {
|
|
1528
|
+
return readPointerNoteField(body, "Doc-neutral");
|
|
1529
|
+
}
|
|
1530
|
+
var LANGUAGE_COMMENT_PREFIXES = [
|
|
1531
|
+
{ test: /\.(ts|tsx|js|jsx|mjs|cjs)$/, prefixes: ["//"] },
|
|
1532
|
+
{ test: /(^|\/)(pre-push|pre-commit|pre-merge-commit)$/, prefixes: ["#"] },
|
|
1533
|
+
{ test: /\.(sh|bash)$/, prefixes: ["#"] },
|
|
1534
|
+
{ test: /\.ya?ml$/, prefixes: ["#"] },
|
|
1535
|
+
{ test: /\.py$/, prefixes: ["#"] }
|
|
1536
|
+
];
|
|
1537
|
+
function commentPrefixesForPath(path) {
|
|
1538
|
+
for (const { test, prefixes } of LANGUAGE_COMMENT_PREFIXES) {
|
|
1539
|
+
if (test.test(path))
|
|
1540
|
+
return prefixes;
|
|
1521
1541
|
}
|
|
1522
|
-
return
|
|
1542
|
+
return [];
|
|
1523
1543
|
}
|
|
1524
|
-
function
|
|
1544
|
+
function isNeutralDiffContentLine(line, prefixes) {
|
|
1545
|
+
const t = line.trim();
|
|
1546
|
+
if (t === "")
|
|
1547
|
+
return true;
|
|
1548
|
+
if (t.startsWith("#!"))
|
|
1549
|
+
return false;
|
|
1550
|
+
return prefixes.some((p) => t.startsWith(p));
|
|
1551
|
+
}
|
|
1552
|
+
function isMechanicallyNeutralDiff(diffText, path) {
|
|
1553
|
+
const prefixes = commentPrefixesForPath(path);
|
|
1554
|
+
let sawChange = false;
|
|
1555
|
+
for (const raw of diffText.split(`
|
|
1556
|
+
`)) {
|
|
1557
|
+
if (raw.startsWith("+++ ") || raw.startsWith("--- ") || raw.startsWith("@@"))
|
|
1558
|
+
continue;
|
|
1559
|
+
if (raw.startsWith("+") || raw.startsWith("-")) {
|
|
1560
|
+
if (!isNeutralDiffContentLine(raw.slice(1), prefixes))
|
|
1561
|
+
return false;
|
|
1562
|
+
sawChange = true;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
return sawChange;
|
|
1566
|
+
}
|
|
1567
|
+
function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff) {
|
|
1525
1568
|
const out = { errors: [], notes: [] };
|
|
1526
1569
|
if (docOwnersContent === null)
|
|
1527
1570
|
return out;
|
|
@@ -1534,13 +1577,15 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive)
|
|
|
1534
1577
|
const fired = [];
|
|
1535
1578
|
for (const b of bindings) {
|
|
1536
1579
|
const re = globToRegex(b.glob);
|
|
1537
|
-
|
|
1538
|
-
|
|
1580
|
+
const matchedFiles = codeFiles.filter((f) => re.test(f));
|
|
1581
|
+
if (matchedFiles.length > 0)
|
|
1582
|
+
fired.push({ binding: b, matchedFiles });
|
|
1539
1583
|
}
|
|
1540
1584
|
if (fired.length === 0)
|
|
1541
1585
|
return out;
|
|
1542
1586
|
const acks = readDocAcks(prBody);
|
|
1543
|
-
|
|
1587
|
+
const neutrals = readDocNeutrals(prBody);
|
|
1588
|
+
for (const { binding: b, matchedFiles } of fired) {
|
|
1544
1589
|
if (waiverActive) {
|
|
1545
1590
|
out.notes.push(`C5 doc-waiver active for ${b.pointer} (binding ${DOC_OWNERS_PATH}:${b.lineNum})`);
|
|
1546
1591
|
continue;
|
|
@@ -1557,9 +1602,22 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive)
|
|
|
1557
1602
|
out.errors.push(`C5 doc-owners-dangling: ${DOC_OWNERS_PATH}:${b.lineNum} points to ${b.pointer}, which does not exist on disk. Fix the binding or add the doc.`);
|
|
1558
1603
|
continue;
|
|
1559
1604
|
}
|
|
1560
|
-
if (
|
|
1561
|
-
|
|
1605
|
+
if (changed.includes(pointerPath))
|
|
1606
|
+
continue;
|
|
1607
|
+
const declared = neutrals.find((n) => n.surface === b.pointer);
|
|
1608
|
+
if (declared) {
|
|
1609
|
+
const evidenced = getDiff !== undefined && matchedFiles.every((f) => {
|
|
1610
|
+
const diff = getDiff(f);
|
|
1611
|
+
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
1612
|
+
});
|
|
1613
|
+
if (evidenced) {
|
|
1614
|
+
out.notes.push(`C5 doc-neutral: ${b.pointer} not required for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — declared neutral ("${declared.note}"), diff of ${matchedFiles.join(", ")} confirmed comment/whitespace-only.`);
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
out.errors.push(`C5 doc-neutral-unverified: ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}) declared \`Doc-neutral: ${b.pointer} — ${declared.note}\`, but the diff of ${matchedFiles.join(", ")} contains changes beyond comments/whitespace. Update ${pointerPath}, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
|
|
1618
|
+
continue;
|
|
1562
1619
|
}
|
|
1620
|
+
out.errors.push(`C5 doc-coverage: code change matched ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}), but ${pointerPath} is not in the PR diff. Update it, declare \`Doc-neutral: ${b.pointer} — <why>\` if the change is genuinely mechanically-neutral, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
|
|
1563
1621
|
}
|
|
1564
1622
|
return out;
|
|
1565
1623
|
}
|
|
@@ -2112,8 +2170,11 @@ function checkReviewGate(input) {
|
|
|
2112
2170
|
waived: true
|
|
2113
2171
|
};
|
|
2114
2172
|
}
|
|
2115
|
-
const
|
|
2116
|
-
const
|
|
2173
|
+
const verified = input.comments.filter((c) => c.author !== null && PRINCIPAL_ALLOWLIST.includes(c.author));
|
|
2174
|
+
const ignoredCount = input.comments.filter((c) => (c.author === null || !PRINCIPAL_ALLOWLIST.includes(c.author)) && c.body.includes("VERDICT")).length;
|
|
2175
|
+
const verifiedBodies = verified.map((c) => c.body);
|
|
2176
|
+
const codeReview = extractCodeReviewVerdict(verifiedBodies);
|
|
2177
|
+
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
2117
2178
|
const codeReviewClean = codeReview.value === "APPROVE";
|
|
2118
2179
|
const securityClean = security.value === "PASS";
|
|
2119
2180
|
if (codeReviewClean && securityClean) {
|
|
@@ -2128,9 +2189,10 @@ function checkReviewGate(input) {
|
|
|
2128
2189
|
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
2129
2190
|
if (!securityClean)
|
|
2130
2191
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
2192
|
+
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
2131
2193
|
return {
|
|
2132
2194
|
verdict: "fail",
|
|
2133
|
-
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s)
|
|
2195
|
+
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}`,
|
|
2134
2196
|
waived: false
|
|
2135
2197
|
};
|
|
2136
2198
|
}
|
|
@@ -1510,15 +1510,58 @@ function pointerToPath(p) {
|
|
|
1510
1510
|
return idx === -1 ? p : p.slice(0, idx);
|
|
1511
1511
|
}
|
|
1512
1512
|
var SEPARATOR = /(?:[ \t]*[—–][ \t]*|[ \t]+-[ \t]+)/.source;
|
|
1513
|
-
function
|
|
1514
|
-
const
|
|
1515
|
-
const re = new RegExp(`^[ \\t]
|
|
1513
|
+
function readPointerNoteField(body, field) {
|
|
1514
|
+
const out = [];
|
|
1515
|
+
const re = new RegExp(`^[ \\t]*${field}[ \\t]*:[ \\t]*(.+?)${SEPARATOR}(.+?)[ \\t]*$`, "gim");
|
|
1516
1516
|
for (const m of body.matchAll(re)) {
|
|
1517
|
-
|
|
1517
|
+
out.push({ surface: (m[1] ?? "").trim(), note: (m[2] ?? "").trim() });
|
|
1518
|
+
}
|
|
1519
|
+
return out;
|
|
1520
|
+
}
|
|
1521
|
+
function readDocAcks(body) {
|
|
1522
|
+
return readPointerNoteField(body, "Doc-ack");
|
|
1523
|
+
}
|
|
1524
|
+
function readDocNeutrals(body) {
|
|
1525
|
+
return readPointerNoteField(body, "Doc-neutral");
|
|
1526
|
+
}
|
|
1527
|
+
var LANGUAGE_COMMENT_PREFIXES = [
|
|
1528
|
+
{ test: /\.(ts|tsx|js|jsx|mjs|cjs)$/, prefixes: ["//"] },
|
|
1529
|
+
{ test: /(^|\/)(pre-push|pre-commit|pre-merge-commit)$/, prefixes: ["#"] },
|
|
1530
|
+
{ test: /\.(sh|bash)$/, prefixes: ["#"] },
|
|
1531
|
+
{ test: /\.ya?ml$/, prefixes: ["#"] },
|
|
1532
|
+
{ test: /\.py$/, prefixes: ["#"] }
|
|
1533
|
+
];
|
|
1534
|
+
function commentPrefixesForPath(path) {
|
|
1535
|
+
for (const { test, prefixes } of LANGUAGE_COMMENT_PREFIXES) {
|
|
1536
|
+
if (test.test(path))
|
|
1537
|
+
return prefixes;
|
|
1518
1538
|
}
|
|
1519
|
-
return
|
|
1539
|
+
return [];
|
|
1520
1540
|
}
|
|
1521
|
-
function
|
|
1541
|
+
function isNeutralDiffContentLine(line, prefixes) {
|
|
1542
|
+
const t = line.trim();
|
|
1543
|
+
if (t === "")
|
|
1544
|
+
return true;
|
|
1545
|
+
if (t.startsWith("#!"))
|
|
1546
|
+
return false;
|
|
1547
|
+
return prefixes.some((p) => t.startsWith(p));
|
|
1548
|
+
}
|
|
1549
|
+
function isMechanicallyNeutralDiff(diffText, path) {
|
|
1550
|
+
const prefixes = commentPrefixesForPath(path);
|
|
1551
|
+
let sawChange = false;
|
|
1552
|
+
for (const raw of diffText.split(`
|
|
1553
|
+
`)) {
|
|
1554
|
+
if (raw.startsWith("+++ ") || raw.startsWith("--- ") || raw.startsWith("@@"))
|
|
1555
|
+
continue;
|
|
1556
|
+
if (raw.startsWith("+") || raw.startsWith("-")) {
|
|
1557
|
+
if (!isNeutralDiffContentLine(raw.slice(1), prefixes))
|
|
1558
|
+
return false;
|
|
1559
|
+
sawChange = true;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
return sawChange;
|
|
1563
|
+
}
|
|
1564
|
+
function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff) {
|
|
1522
1565
|
const out = { errors: [], notes: [] };
|
|
1523
1566
|
if (docOwnersContent === null)
|
|
1524
1567
|
return out;
|
|
@@ -1531,13 +1574,15 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive)
|
|
|
1531
1574
|
const fired = [];
|
|
1532
1575
|
for (const b of bindings) {
|
|
1533
1576
|
const re = globToRegex(b.glob);
|
|
1534
|
-
|
|
1535
|
-
|
|
1577
|
+
const matchedFiles = codeFiles.filter((f) => re.test(f));
|
|
1578
|
+
if (matchedFiles.length > 0)
|
|
1579
|
+
fired.push({ binding: b, matchedFiles });
|
|
1536
1580
|
}
|
|
1537
1581
|
if (fired.length === 0)
|
|
1538
1582
|
return out;
|
|
1539
1583
|
const acks = readDocAcks(prBody);
|
|
1540
|
-
|
|
1584
|
+
const neutrals = readDocNeutrals(prBody);
|
|
1585
|
+
for (const { binding: b, matchedFiles } of fired) {
|
|
1541
1586
|
if (waiverActive) {
|
|
1542
1587
|
out.notes.push(`C5 doc-waiver active for ${b.pointer} (binding ${DOC_OWNERS_PATH}:${b.lineNum})`);
|
|
1543
1588
|
continue;
|
|
@@ -1554,9 +1599,22 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive)
|
|
|
1554
1599
|
out.errors.push(`C5 doc-owners-dangling: ${DOC_OWNERS_PATH}:${b.lineNum} points to ${b.pointer}, which does not exist on disk. Fix the binding or add the doc.`);
|
|
1555
1600
|
continue;
|
|
1556
1601
|
}
|
|
1557
|
-
if (
|
|
1558
|
-
|
|
1602
|
+
if (changed.includes(pointerPath))
|
|
1603
|
+
continue;
|
|
1604
|
+
const declared = neutrals.find((n) => n.surface === b.pointer);
|
|
1605
|
+
if (declared) {
|
|
1606
|
+
const evidenced = getDiff !== undefined && matchedFiles.every((f) => {
|
|
1607
|
+
const diff = getDiff(f);
|
|
1608
|
+
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
1609
|
+
});
|
|
1610
|
+
if (evidenced) {
|
|
1611
|
+
out.notes.push(`C5 doc-neutral: ${b.pointer} not required for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — declared neutral ("${declared.note}"), diff of ${matchedFiles.join(", ")} confirmed comment/whitespace-only.`);
|
|
1612
|
+
continue;
|
|
1613
|
+
}
|
|
1614
|
+
out.errors.push(`C5 doc-neutral-unverified: ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}) declared \`Doc-neutral: ${b.pointer} — ${declared.note}\`, but the diff of ${matchedFiles.join(", ")} contains changes beyond comments/whitespace. Update ${pointerPath}, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
|
|
1615
|
+
continue;
|
|
1559
1616
|
}
|
|
1617
|
+
out.errors.push(`C5 doc-coverage: code change matched ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\` → ${b.pointer}), but ${pointerPath} is not in the PR diff. Update it, declare \`Doc-neutral: ${b.pointer} — <why>\` if the change is genuinely mechanically-neutral, or have a principal apply the \`${WAIVER_LABEL}\` label.`);
|
|
1560
1618
|
}
|
|
1561
1619
|
return out;
|
|
1562
1620
|
}
|
|
@@ -2109,8 +2167,11 @@ function checkReviewGate(input) {
|
|
|
2109
2167
|
waived: true
|
|
2110
2168
|
};
|
|
2111
2169
|
}
|
|
2112
|
-
const
|
|
2113
|
-
const
|
|
2170
|
+
const verified = input.comments.filter((c) => c.author !== null && PRINCIPAL_ALLOWLIST.includes(c.author));
|
|
2171
|
+
const ignoredCount = input.comments.filter((c) => (c.author === null || !PRINCIPAL_ALLOWLIST.includes(c.author)) && c.body.includes("VERDICT")).length;
|
|
2172
|
+
const verifiedBodies = verified.map((c) => c.body);
|
|
2173
|
+
const codeReview = extractCodeReviewVerdict(verifiedBodies);
|
|
2174
|
+
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
2114
2175
|
const codeReviewClean = codeReview.value === "APPROVE";
|
|
2115
2176
|
const securityClean = security.value === "PASS";
|
|
2116
2177
|
if (codeReviewClean && securityClean) {
|
|
@@ -2125,9 +2186,10 @@ function checkReviewGate(input) {
|
|
|
2125
2186
|
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
2126
2187
|
if (!securityClean)
|
|
2127
2188
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
2189
|
+
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
2128
2190
|
return {
|
|
2129
2191
|
verdict: "fail",
|
|
2130
|
-
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s)
|
|
2192
|
+
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}`,
|
|
2131
2193
|
waived: false
|
|
2132
2194
|
};
|
|
2133
2195
|
}
|