@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.
- package/README.md +1 -2
- package/aeg-root/roles/developer/reference.md +3 -3
- package/aeg-root/templates/pr-report-template.md +7 -2
- package/dist/checks/bin/check-body-bare-digits.js +229 -86
- package/dist/checks/bin/check-branch-topology.js +101 -89
- package/dist/checks/bin/check-brief-shape.js +222 -79
- package/dist/checks/bin/check-changeset-coverage.js +739 -232
- package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
- package/dist/checks/bin/check-closes-n.js +101 -89
- package/dist/checks/bin/check-coherence.js +233 -129
- package/dist/checks/bin/check-dead-branch-push.js +97 -44
- package/dist/checks/bin/check-dispatch-readiness.js +238 -134
- package/dist/checks/bin/check-doc-coverage-push.js +722 -215
- package/dist/checks/bin/check-doc-coverage.js +726 -219
- package/dist/checks/bin/check-doctrine-no-procedures.js +222 -79
- package/dist/checks/bin/check-doctrine-portability.js +724 -217
- package/dist/checks/bin/check-evidence-fresh.js +720 -206
- package/dist/checks/bin/check-exec-bits.js +720 -213
- package/dist/checks/bin/check-first-push-dispatch.js +231 -129
- package/dist/checks/bin/check-issue-assignment.js +103 -91
- package/dist/checks/bin/check-issue-milestone-attach.js +94 -41
- package/dist/checks/bin/check-issue-objectives-numbering.js +94 -41
- package/dist/checks/bin/check-issue-parts-coverage.js +94 -41
- package/dist/checks/bin/check-issue-surface-globs.js +251 -127
- package/dist/checks/bin/check-issue-title-grammar.js +94 -41
- package/dist/checks/bin/check-issue-tranche-label.js +94 -41
- package/dist/checks/bin/check-main-branch-refusal.js +94 -41
- package/dist/checks/bin/check-no-disk-state.js +94 -41
- package/dist/checks/bin/check-pr-premise-reassert.js +222 -77
- package/dist/checks/bin/check-pr-report-density.js +94 -41
- package/dist/checks/bin/check-principal-test-plan-wait.js +94 -39
- package/dist/checks/bin/check-quoted-command.js +710 -201
- package/dist/checks/bin/check-reader-resolvable-prose.js +722 -213
- package/dist/checks/bin/check-registry-gates.js +104 -41
- package/dist/checks/bin/check-retired-vocabulary.js +708 -199
- package/dist/checks/bin/check-review-gate.js +224 -79
- package/dist/checks/bin/check-single-plan-pr.js +94 -41
- package/dist/checks/bin/check-surface-scope.js +101 -89
- package/dist/checks/bin/check-test-plan.js +94 -39
- package/dist/checks/bin/check-token-collection-wired.js +100 -42
- package/dist/checks/bin/check-token-report.js +96 -43
- package/dist/checks/bin/check-workspace-escape.js +722 -213
- package/dist/index.js +3725 -3148
- package/dist/lib/pre-push-cache-test-run.js +4175 -0
- package/dist/lib/pre-push-select-tests.js +709 -101
- package/package.json +3 -2
|
@@ -1037,7 +1037,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|
|
1037
1037
|
var endpoint = withDefaults(null, DEFAULTS);
|
|
1038
1038
|
|
|
1039
1039
|
// ../../node_modules/fast-content-type-parse/index.js
|
|
1040
|
-
var NullObject = function
|
|
1040
|
+
var NullObject = function NullObject() {};
|
|
1041
1041
|
NullObject.prototype = Object.create(null);
|
|
1042
1042
|
var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
|
|
1043
1043
|
var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
|
|
@@ -1781,27 +1781,27 @@ function splitTableRow(row) {
|
|
|
1781
1781
|
return parts.map((p) => p.split(PLACEHOLDER).join("|"));
|
|
1782
1782
|
}
|
|
1783
1783
|
// ../../packages/aeg-core/src/blast-radius-domains.ts
|
|
1784
|
-
function resolveWorkspaceEntry(
|
|
1785
|
-
if (
|
|
1786
|
-
const baseDir =
|
|
1784
|
+
function resolveWorkspaceEntry(entry, listDirs) {
|
|
1785
|
+
if (entry.endsWith("/*")) {
|
|
1786
|
+
const baseDir = entry.slice(0, -2);
|
|
1787
1787
|
return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
|
|
1788
1788
|
}
|
|
1789
|
-
if (
|
|
1789
|
+
if (entry.includes("*"))
|
|
1790
1790
|
return [];
|
|
1791
|
-
return [
|
|
1791
|
+
return [entry];
|
|
1792
1792
|
}
|
|
1793
1793
|
// ../../packages/aeg-core/src/consumer-enumeration.ts
|
|
1794
1794
|
function deriveWorkspaceMemberDirs(workspaces, listDirs) {
|
|
1795
|
-
const positive = workspaces.filter((
|
|
1796
|
-
const negative = workspaces.filter((
|
|
1795
|
+
const positive = workspaces.filter((entry) => !entry.startsWith("!"));
|
|
1796
|
+
const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
|
|
1797
1797
|
const excluded = new Set;
|
|
1798
|
-
for (const
|
|
1799
|
-
for (const member of resolveWorkspaceEntry(
|
|
1798
|
+
for (const entry of negative) {
|
|
1799
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs))
|
|
1800
1800
|
excluded.add(member);
|
|
1801
1801
|
}
|
|
1802
1802
|
const members = new Set;
|
|
1803
|
-
for (const
|
|
1804
|
-
for (const member of resolveWorkspaceEntry(
|
|
1803
|
+
for (const entry of positive) {
|
|
1804
|
+
for (const member of resolveWorkspaceEntry(entry, listDirs)) {
|
|
1805
1805
|
if (!excluded.has(member))
|
|
1806
1806
|
members.add(member);
|
|
1807
1807
|
}
|
|
@@ -2125,15 +2125,15 @@ function summarizeTranscript(jsonl) {
|
|
|
2125
2125
|
const line = rawLine.trim();
|
|
2126
2126
|
if (!line)
|
|
2127
2127
|
continue;
|
|
2128
|
-
let
|
|
2128
|
+
let entry;
|
|
2129
2129
|
try {
|
|
2130
|
-
|
|
2130
|
+
entry = JSON.parse(line);
|
|
2131
2131
|
} catch {
|
|
2132
2132
|
continue;
|
|
2133
2133
|
}
|
|
2134
|
-
if (!
|
|
2134
|
+
if (!entry || typeof entry !== "object")
|
|
2135
2135
|
continue;
|
|
2136
|
-
const obj =
|
|
2136
|
+
const obj = entry;
|
|
2137
2137
|
if (obj.type !== "assistant")
|
|
2138
2138
|
continue;
|
|
2139
2139
|
const message = obj.message;
|
|
@@ -2981,7 +2981,7 @@ function isStep0Block(content) {
|
|
|
2981
2981
|
}
|
|
2982
2982
|
function checkCommandsCarryOutput(prBody) {
|
|
2983
2983
|
const errors = [];
|
|
2984
|
-
for (const [
|
|
2984
|
+
for (const [label, num] of [
|
|
2985
2985
|
["5", 5],
|
|
2986
2986
|
["6", 6]
|
|
2987
2987
|
]) {
|
|
@@ -2995,7 +2995,7 @@ function checkCommandsCarryOutput(prBody) {
|
|
|
2995
2995
|
continue;
|
|
2996
2996
|
const next = blocks[i + 1];
|
|
2997
2997
|
if (!next || isCommandBlock(next.content)) {
|
|
2998
|
-
errors.push(`brief-validation commands carry output: §${
|
|
2998
|
+
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.`);
|
|
2999
2999
|
}
|
|
3000
3000
|
}
|
|
3001
3001
|
}
|
|
@@ -3432,8 +3432,8 @@ function stripPartBackticks(text) {
|
|
|
3432
3432
|
function partWordCount(text) {
|
|
3433
3433
|
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3434
3434
|
}
|
|
3435
|
-
function looksLikeFilePath(
|
|
3436
|
-
const stripped =
|
|
3435
|
+
function looksLikeFilePath(entry) {
|
|
3436
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3437
3437
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3438
3438
|
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3439
3439
|
return extMatch !== null && extMatch.index > 0;
|
|
@@ -3919,14 +3919,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3919
3919
|
const referenced = extractClosesReferences(prBody);
|
|
3920
3920
|
if (taskIssueRefs) {
|
|
3921
3921
|
for (const n of referenced) {
|
|
3922
|
-
const
|
|
3923
|
-
if (!
|
|
3922
|
+
const ref = taskIssueRefs.get(n);
|
|
3923
|
+
if (!ref)
|
|
3924
3924
|
continue;
|
|
3925
|
-
const expectedBranch = `task/${
|
|
3925
|
+
const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
|
|
3926
3926
|
if (branch !== expectedBranch) {
|
|
3927
3927
|
return {
|
|
3928
3928
|
ok: false,
|
|
3929
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3929
|
+
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.`
|
|
3930
3930
|
};
|
|
3931
3931
|
}
|
|
3932
3932
|
}
|
|
@@ -3935,15 +3935,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3935
3935
|
if (!ref)
|
|
3936
3936
|
return { ok: true };
|
|
3937
3937
|
if (ref.kind === "issue") {
|
|
3938
|
-
const
|
|
3939
|
-
if (!referenced.has(
|
|
3938
|
+
const expectedIssue = ref.issueNumber;
|
|
3939
|
+
if (!referenced.has(expectedIssue)) {
|
|
3940
3940
|
return {
|
|
3941
3941
|
ok: false,
|
|
3942
|
-
expectedIssue
|
|
3943
|
-
message: `closes-n: PR body does not contain \`Closes #${
|
|
3942
|
+
expectedIssue,
|
|
3943
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3944
3944
|
};
|
|
3945
3945
|
}
|
|
3946
|
-
return { ok: true, expectedIssue
|
|
3946
|
+
return { ok: true, expectedIssue };
|
|
3947
3947
|
}
|
|
3948
3948
|
const trancheSlug = ref.tranche;
|
|
3949
3949
|
const taskId = ref.taskId;
|
|
@@ -3989,8 +3989,8 @@ function extractIssue(body) {
|
|
|
3989
3989
|
const anchorNums = closesRefs(anchored);
|
|
3990
3990
|
if (anchorNums.length === 0)
|
|
3991
3991
|
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
3992
|
-
const
|
|
3993
|
-
return { issue
|
|
3992
|
+
const issue = anchorNums[0];
|
|
3993
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
|
|
3994
3994
|
}
|
|
3995
3995
|
const headerNums = closesRefs(headerRegion(stripped));
|
|
3996
3996
|
if (bodyNums.length === 0)
|
|
@@ -4059,15 +4059,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4059
4059
|
const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
|
|
4060
4060
|
const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
|
|
4061
4061
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4062
|
-
const
|
|
4062
|
+
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4063
4063
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4064
4064
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4065
4065
|
return {
|
|
4066
|
-
bound: head && base && briefHashBound &&
|
|
4066
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
4067
4067
|
head,
|
|
4068
4068
|
base,
|
|
4069
4069
|
briefHash: briefHashBound,
|
|
4070
|
-
objectivesVersion
|
|
4070
|
+
objectivesVersion,
|
|
4071
4071
|
rulingOrdinal,
|
|
4072
4072
|
policyDigest: policyDigestBound
|
|
4073
4073
|
};
|
|
@@ -5499,6 +5499,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
5499
5499
|
}
|
|
5500
5500
|
return findings;
|
|
5501
5501
|
}
|
|
5502
|
+
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5503
|
+
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5504
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5505
|
+
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5502
5506
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5503
5507
|
import { createHash as createHash5 } from "node:crypto";
|
|
5504
5508
|
|
|
@@ -6037,6 +6041,7 @@ function redact(value, home) {
|
|
|
6037
6041
|
return value;
|
|
6038
6042
|
}
|
|
6039
6043
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6044
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6040
6045
|
function metaOf(obj) {
|
|
6041
6046
|
if (obj === null || typeof obj !== "object")
|
|
6042
6047
|
return null;
|
|
@@ -6059,11 +6064,61 @@ function recordIdentity(obj) {
|
|
|
6059
6064
|
}
|
|
6060
6065
|
return null;
|
|
6061
6066
|
}
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
+
function schemaVersionOf(obj) {
|
|
6068
|
+
const meta = metaOf(obj);
|
|
6069
|
+
const schema = meta?.schema;
|
|
6070
|
+
return typeof schema === "number" ? schema : null;
|
|
6071
|
+
}
|
|
6072
|
+
function isKnownSchema(version) {
|
|
6073
|
+
return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
|
|
6074
|
+
}
|
|
6075
|
+
function classifyStoredLine(raw, home) {
|
|
6076
|
+
let obj;
|
|
6077
|
+
try {
|
|
6078
|
+
obj = JSON.parse(raw);
|
|
6079
|
+
} catch {
|
|
6080
|
+
return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
|
|
6081
|
+
}
|
|
6082
|
+
const version = schemaVersionOf(obj);
|
|
6083
|
+
if (version === null) {
|
|
6084
|
+
return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
|
|
6085
|
+
}
|
|
6086
|
+
if (!isKnownSchema(version)) {
|
|
6087
|
+
return {
|
|
6088
|
+
status: "unknown_version",
|
|
6089
|
+
identity: recordIdentity(obj),
|
|
6090
|
+
schema: version,
|
|
6091
|
+
raw,
|
|
6092
|
+
reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
|
|
6093
|
+
};
|
|
6094
|
+
}
|
|
6095
|
+
const result = LogEventSchema.safeParse(obj);
|
|
6096
|
+
if (!result.success) {
|
|
6097
|
+
return {
|
|
6098
|
+
status: "invalid",
|
|
6099
|
+
identity: recordIdentity(obj),
|
|
6100
|
+
raw,
|
|
6101
|
+
reason: result.error.issues[0]?.message ?? "schema violation"
|
|
6102
|
+
};
|
|
6103
|
+
}
|
|
6104
|
+
const event = result.data;
|
|
6105
|
+
const identity = recordIdentity(event);
|
|
6106
|
+
if (identity === null) {
|
|
6107
|
+
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6108
|
+
}
|
|
6109
|
+
const redacted = redact(event, home);
|
|
6110
|
+
const provenance = version === 2 ? event.meta.provenance ?? null : null;
|
|
6111
|
+
return {
|
|
6112
|
+
status: "ok",
|
|
6113
|
+
identity,
|
|
6114
|
+
runId: event.meta.run_id,
|
|
6115
|
+
seq: event.meta.seq,
|
|
6116
|
+
schema: version,
|
|
6117
|
+
provenance,
|
|
6118
|
+
event,
|
|
6119
|
+
postLine: JSON.stringify(redacted)
|
|
6120
|
+
};
|
|
6121
|
+
}
|
|
6067
6122
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6068
6123
|
import { z as z3 } from "zod";
|
|
6069
6124
|
var isoTimestamp = z3.string().min(1);
|
|
@@ -6201,7 +6256,8 @@ function emitCheckError(error) {
|
|
|
6201
6256
|
}
|
|
6202
6257
|
|
|
6203
6258
|
// src/lib/config.ts
|
|
6204
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
6259
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6260
|
+
import { promisify as promisify4 } from "node:util";
|
|
6205
6261
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6206
6262
|
import { homedir } from "node:os";
|
|
6207
6263
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -6228,10 +6284,10 @@ var CheckEntrySchema = z4.object({
|
|
|
6228
6284
|
ownWorkflow: z4.boolean().optional(),
|
|
6229
6285
|
principalOwed: z4.literal(true).optional(),
|
|
6230
6286
|
validates: z4.enum(["body", "issue"]).optional()
|
|
6231
|
-
}).superRefine((
|
|
6232
|
-
if (!
|
|
6287
|
+
}).superRefine((entry, ctx) => {
|
|
6288
|
+
if (!entry.env)
|
|
6233
6289
|
return;
|
|
6234
|
-
for (const [key, value] of Object.entries(
|
|
6290
|
+
for (const [key, value] of Object.entries(entry.env)) {
|
|
6235
6291
|
if (typeof value !== "object" || value === null || !("anyOf" in value))
|
|
6236
6292
|
continue;
|
|
6237
6293
|
const members = value.anyOf;
|
|
@@ -6388,18 +6444,19 @@ var VinayaConfigSchema = z4.object({
|
|
|
6388
6444
|
});
|
|
6389
6445
|
}
|
|
6390
6446
|
}).optional(),
|
|
6391
|
-
logPublish: z4.
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
}).refine((v) => v.
|
|
6400
|
-
message: "
|
|
6401
|
-
}).
|
|
6402
|
-
|
|
6447
|
+
logPublish: z4.unknown().refine((v) => v === undefined, {
|
|
6448
|
+
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6449
|
+
}),
|
|
6450
|
+
runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6451
|
+
logs: z4.object({
|
|
6452
|
+
folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6453
|
+
url: z4.string().url().optional(),
|
|
6454
|
+
headers: z4.record(z4.string()).optional()
|
|
6455
|
+
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6456
|
+
message: "logs: set at most one of folder/url"
|
|
6457
|
+
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6458
|
+
message: "logs: headers requires url"
|
|
6459
|
+
}).optional()
|
|
6403
6460
|
});
|
|
6404
6461
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
6405
6462
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
@@ -6444,32 +6501,39 @@ function globalTokensCollectIgnoredWarning(path) {
|
|
|
6444
6501
|
function globalRuntimeDirIgnoredWarning(path) {
|
|
6445
6502
|
return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
|
|
6446
6503
|
}
|
|
6504
|
+
var emittedGlobalKeyWarnings = new Set;
|
|
6505
|
+
function warnGlobalKeyIgnoredOnce(message) {
|
|
6506
|
+
if (emittedGlobalKeyWarnings.has(message))
|
|
6507
|
+
return;
|
|
6508
|
+
emittedGlobalKeyWarnings.add(message);
|
|
6509
|
+
console.error(`⚠ ${message}`);
|
|
6510
|
+
}
|
|
6447
6511
|
function stripGlobalOnlyKeys(config, path) {
|
|
6448
6512
|
if (path !== GLOBAL_CONFIG_PATH)
|
|
6449
6513
|
return config;
|
|
6450
6514
|
let result = config;
|
|
6451
6515
|
if (result.checks && Object.keys(result.checks).length > 0) {
|
|
6452
|
-
|
|
6516
|
+
warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
|
|
6453
6517
|
result = { ...result, checks: undefined };
|
|
6454
6518
|
}
|
|
6455
6519
|
if (result.roles && Object.keys(result.roles).length > 0) {
|
|
6456
|
-
|
|
6520
|
+
warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
|
|
6457
6521
|
result = { ...result, roles: undefined };
|
|
6458
6522
|
}
|
|
6459
6523
|
if (result.principals && result.principals.length > 0) {
|
|
6460
|
-
|
|
6524
|
+
warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
|
|
6461
6525
|
result = { ...result, principals: undefined };
|
|
6462
6526
|
}
|
|
6463
6527
|
if (result.releaseActor) {
|
|
6464
|
-
|
|
6528
|
+
warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
|
|
6465
6529
|
result = { ...result, releaseActor: undefined };
|
|
6466
6530
|
}
|
|
6467
6531
|
if (result.tokens) {
|
|
6468
|
-
|
|
6532
|
+
warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
|
|
6469
6533
|
result = { ...result, tokens: undefined };
|
|
6470
6534
|
}
|
|
6471
6535
|
if (result.runtimeDir) {
|
|
6472
|
-
|
|
6536
|
+
warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
|
|
6473
6537
|
result = { ...result, runtimeDir: undefined };
|
|
6474
6538
|
}
|
|
6475
6539
|
return result;
|
|
@@ -6502,25 +6566,80 @@ function resolveReviewPolicy(config) {
|
|
|
6502
6566
|
maxRounds
|
|
6503
6567
|
};
|
|
6504
6568
|
}
|
|
6505
|
-
function
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6569
|
+
function resolveRuntimeDirSetting(config) {
|
|
6570
|
+
return config?.runtimeDir ?? null;
|
|
6571
|
+
}
|
|
6572
|
+
function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
|
|
6573
|
+
const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
|
|
6574
|
+
return anchored !== null && anchored === localRuntimeDir ? anchored : null;
|
|
6575
|
+
}
|
|
6576
|
+
function resolveLogsSetting(config) {
|
|
6577
|
+
const raw = config?.logs;
|
|
6578
|
+
if (!raw)
|
|
6579
|
+
return null;
|
|
6580
|
+
if (raw.url !== undefined)
|
|
6581
|
+
return { url: raw.url, headers: raw.headers };
|
|
6582
|
+
if (raw.folder !== undefined)
|
|
6583
|
+
return { folder: raw.folder };
|
|
6584
|
+
return null;
|
|
6585
|
+
}
|
|
6586
|
+
function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
6587
|
+
const anchored = resolveLogsSetting(trustAnchorConfig);
|
|
6588
|
+
if (!anchored)
|
|
6589
|
+
return null;
|
|
6590
|
+
if ("url" in local)
|
|
6591
|
+
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6592
|
+
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6593
|
+
}
|
|
6594
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6595
|
+
if (!headers)
|
|
6596
|
+
return;
|
|
6597
|
+
const resolved = {};
|
|
6598
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
6599
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6512
6600
|
}
|
|
6601
|
+
return resolved;
|
|
6602
|
+
}
|
|
6603
|
+
function trustAnchorRepo() {
|
|
6604
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6605
|
+
if (fromRunner)
|
|
6606
|
+
return fromRunner;
|
|
6513
6607
|
try {
|
|
6514
6608
|
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6515
6609
|
encoding: "utf-8",
|
|
6516
6610
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6517
|
-
})
|
|
6518
|
-
|
|
6519
|
-
return m?.[1] && m[2] ? wellFormed(`${m[1]}/${m[2]}`) : null;
|
|
6611
|
+
});
|
|
6612
|
+
return trustAnchorRepoFromRemoteUrl(url);
|
|
6520
6613
|
} catch {
|
|
6521
6614
|
return null;
|
|
6522
6615
|
}
|
|
6523
6616
|
}
|
|
6617
|
+
async function trustAnchorRepoAsync() {
|
|
6618
|
+
const fromRunner = trustAnchorRepoFromRunner();
|
|
6619
|
+
if (fromRunner)
|
|
6620
|
+
return fromRunner;
|
|
6621
|
+
try {
|
|
6622
|
+
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
6623
|
+
encoding: "utf-8",
|
|
6624
|
+
timeout: 1e4
|
|
6625
|
+
});
|
|
6626
|
+
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
6627
|
+
} catch {
|
|
6628
|
+
return null;
|
|
6629
|
+
}
|
|
6630
|
+
}
|
|
6631
|
+
function wellFormedRepoSlug(slug) {
|
|
6632
|
+
return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
6633
|
+
}
|
|
6634
|
+
function trustAnchorRepoFromRunner() {
|
|
6635
|
+
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
6636
|
+
return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
|
|
6637
|
+
}
|
|
6638
|
+
function trustAnchorRepoFromRemoteUrl(url) {
|
|
6639
|
+
const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
6640
|
+
return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
|
|
6641
|
+
}
|
|
6642
|
+
var execFileAsync4 = promisify4(execFile4);
|
|
6524
6643
|
function ghFetchTrustAnchorConfig() {
|
|
6525
6644
|
const repo = trustAnchorRepo();
|
|
6526
6645
|
if (!repo)
|
|
@@ -6530,6 +6649,13 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6530
6649
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6531
6650
|
});
|
|
6532
6651
|
}
|
|
6652
|
+
async function ghFetchTrustAnchorConfigAsync() {
|
|
6653
|
+
const repo = await trustAnchorRepoAsync();
|
|
6654
|
+
if (!repo)
|
|
6655
|
+
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6656
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
6657
|
+
return stdout;
|
|
6658
|
+
}
|
|
6533
6659
|
function firstLine(err) {
|
|
6534
6660
|
return err?.message?.split(`
|
|
6535
6661
|
`)[0] ?? "unknown error";
|
|
@@ -6544,16 +6670,35 @@ function isMissingFileError(err) {
|
|
|
6544
6670
|
return /\b404\b|not found/i.test(haystack);
|
|
6545
6671
|
}
|
|
6546
6672
|
function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
6547
|
-
const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6548
|
-
`);
|
|
6549
6673
|
let base64;
|
|
6550
6674
|
try {
|
|
6551
|
-
base64 = fetcher()
|
|
6675
|
+
base64 = fetcher();
|
|
6552
6676
|
} catch (err) {
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6677
|
+
return trustAnchorFetchFailed(err);
|
|
6678
|
+
}
|
|
6679
|
+
return parseTrustAnchorContent(base64);
|
|
6680
|
+
}
|
|
6681
|
+
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
6682
|
+
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
6683
|
+
let base64;
|
|
6684
|
+
try {
|
|
6685
|
+
base64 = await fetcher();
|
|
6686
|
+
} catch (err) {
|
|
6687
|
+
return trustAnchorFetchFailed(err, warn);
|
|
6556
6688
|
}
|
|
6689
|
+
return parseTrustAnchorContent(base64, warn);
|
|
6690
|
+
}
|
|
6691
|
+
function warnTrustAnchorFallback(why) {
|
|
6692
|
+
process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
|
|
6693
|
+
`);
|
|
6694
|
+
}
|
|
6695
|
+
function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
|
|
6696
|
+
if (!isMissingFileError(err))
|
|
6697
|
+
warn(firstLine(err));
|
|
6698
|
+
return null;
|
|
6699
|
+
}
|
|
6700
|
+
function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
|
|
6701
|
+
const base64 = content.trim();
|
|
6557
6702
|
if (!base64)
|
|
6558
6703
|
return null;
|
|
6559
6704
|
try {
|
|
@@ -6753,14 +6898,14 @@ function resolveTrueHeadSha(pr) {
|
|
|
6753
6898
|
}
|
|
6754
6899
|
return trueSha;
|
|
6755
6900
|
}
|
|
6756
|
-
function fetchWaiverLabelActor(prNumber,
|
|
6901
|
+
function fetchWaiverLabelActor(prNumber, label) {
|
|
6757
6902
|
try {
|
|
6758
6903
|
const out = execFileSync4("gh", ["api", `repos/{owner}/{repo}/issues/${prNumber}/timeline`, "--paginate"], {
|
|
6759
6904
|
encoding: "utf8",
|
|
6760
6905
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6761
6906
|
});
|
|
6762
6907
|
const events = JSON.parse(out);
|
|
6763
|
-
const matches = events.filter((e) => e.event === "labeled" && e.label?.name ===
|
|
6908
|
+
const matches = events.filter((e) => e.event === "labeled" && e.label?.name === label);
|
|
6764
6909
|
const last = matches[matches.length - 1];
|
|
6765
6910
|
return last?.actor?.login ?? null;
|
|
6766
6911
|
} catch {
|