@attalabs/vinaya 0.44.0 → 0.47.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 +6 -4
- package/dist/checks/bin/check-body-bare-digits.js +262 -201
- package/dist/checks/bin/check-branch-topology.js +70 -23
- package/dist/checks/bin/check-brief-shape.js +262 -201
- package/dist/checks/bin/check-changeset-coverage.js +94 -16
- package/dist/checks/bin/check-ci-shard-coverage.js +3 -0
- package/dist/checks/bin/check-closes-n.js +157 -40
- package/dist/checks/bin/check-coherence.js +365 -251
- package/dist/checks/bin/check-dispatch-readiness.js +3654 -469
- package/dist/checks/bin/check-doc-claims.js +262 -201
- package/dist/checks/bin/check-doc-coverage-push.js +272 -202
- package/dist/checks/bin/check-doc-coverage.js +272 -202
- package/dist/checks/bin/check-doctrine-no-procedures.js +262 -201
- package/dist/checks/bin/check-doctrine-portability.js +262 -201
- package/dist/checks/bin/check-evidence-fresh.js +10138 -2126
- package/dist/checks/bin/check-exec-bits.js +3 -0
- package/dist/checks/bin/check-first-push-dispatch.js +330 -230
- package/dist/checks/bin/check-issue-milestone-attach.js +94 -16
- package/dist/checks/bin/check-issue-objectives-numbering.js +262 -201
- package/dist/checks/bin/check-issue-parts-coverage.js +94 -16
- package/dist/checks/bin/check-issue-surface-globs.js +1062 -242
- package/dist/checks/bin/check-issue-title-grammar.js +21 -5
- package/dist/checks/bin/check-no-disk-state.js +5 -1
- package/dist/checks/bin/check-pr-premise-reassert.js +22 -2
- package/dist/checks/bin/check-pr-report-density.js +5 -1
- package/dist/checks/bin/check-principal-test-plan-wait.js +282 -207
- package/dist/checks/bin/check-quoted-command.js +262 -201
- package/dist/checks/bin/check-reader-resolvable-prose.js +262 -201
- package/dist/checks/bin/check-registry-gates.js +131 -34
- package/dist/checks/bin/check-retired-vocabulary.js +262 -201
- package/dist/checks/bin/check-review-gate.js +262 -201
- package/dist/checks/bin/check-single-plan-pr.js +5 -1
- package/dist/checks/bin/check-surface-scope.js +136 -38
- package/dist/checks/bin/check-test-plan.js +282 -207
- package/dist/checks/bin/check-token-collection-wired.js +3 -0
- package/dist/checks/bin/check-workspace-escape.js +3 -0
- package/dist/checks/bin/verify-coherence.js +237 -148
- package/dist/checks/bin/verify-dispatch.js +870 -66
- package/dist/checks/bin/verify-docs.js +13 -6
- package/dist/harness.js +57 -10
- package/dist/index.js +16670 -7196
- package/dist/lib/pre-push-cache-test-run.js +4488 -2170
- package/dist/lib/pre-push-changed-files.js +251 -12
- package/dist/lib/pre-push-mode.js +69 -19
- package/dist/lib/pre-push-progress-dir.js +10265 -2853
- package/dist/lib/pre-push-record-tests.js +67 -19
- package/dist/lib/pre-push-select-tests.js +520 -222
- package/dist/lib/push-progress-observer.js +9176 -1757
- package/dist/process.js +2 -0
- package/dist/programs/archive.js +8948 -1547
- package/dist/programs/audit.js +9176 -1772
- package/dist/programs/check.js +9248 -1845
- package/dist/programs/commit-msg.js +8984 -1583
- package/dist/programs/dev-review-loop.js +15621 -7626
- package/dist/programs/dispatch.js +9977 -2726
- package/dist/programs/log-emit.js +9011 -1660
- package/dist/programs/log-selftest.js +8908 -1507
- package/dist/programs/log-send.js +9081 -1594
- package/dist/programs/pr-report.js +9477 -1820
- package/dist/programs/pr-snapshot.js +8916 -1515
- package/dist/programs/pr-verify-evidence.js +9482 -1825
- package/dist/programs/pr.js +11773 -4082
- package/dist/programs/review-post.js +11141 -3496
- package/dist/programs/review-status.js +8997 -1533
- package/dist/programs/run-engine.js +22149 -18798
- package/dist/programs/sync.js +9030 -1629
- package/dist/programs/task-brief.js +10234 -1827
- package/dist/programs/task-sweep.js +9267 -1621
- package/dist/programs/task-tools-serve.js +77141 -16659
- package/dist/programs/tokens.js +8966 -1565
- package/dist/programs/waiver.js +8983 -1582
- package/dist/types/harness/kernel/dev-process-socket/loader/load-process.d.ts +1 -1
- package/dist/types/harness/processes/vinaya-strict/tools/legacy-markers.d.ts +8 -0
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/brief-validation.d.ts +17 -10
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/premise-check.d.ts +14 -0
- package/dist/vinaya-strict/checks/registry.ts +2 -2
- package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +8 -0
- package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +1 -1
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +2 -2
- package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +30 -20
- package/dist/vinaya-strict/executing/developer/reference.md +5 -3
- package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +29 -7
- package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +4 -4
- package/dist/vinaya-strict/integration/process/process-integration.ts +5 -1
- package/dist/vinaya-strict/process.yaml +6 -1
- package/dist/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
- package/dist/vinaya-strict/thinking/plan-reviewer/grants.yaml +19 -0
- package/dist/vinaya-strict/thinking/plan-reviewer/output.schema.json +388 -0
- package/dist/vinaya-strict/thinking/planner/doctrine.md +4 -1
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +10 -2
- package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +5 -1
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +198 -34
- package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +120 -193
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +629 -15
- package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +726 -62
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +505 -5
- package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +636 -21
- package/package.json +3 -2
- package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/milestones/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/chunks/209.js +2 -2
- package/studio-standalone/apps/vinaya-studio/.next/server/chunks/951.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/server/preview-props.json +3 -3
- package/studio-standalone/apps/vinaya-studio/.next/server/server-reference-manifest.json +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-c365f0ef8268ad13.js +1 -0
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/19-aa314f13784dcc58.js +4 -0
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{layout-dfa2186095e797bd.js → layout-f038e8deecb2bf5f.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/milestones/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/{page-6ae258f663623b2a.js → page-7a06aa3cdd046fa8.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/app/tasks/{page-2fffb49104860a15.js → page-12314f4deb06a414.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/css/8eb5ed5b65b9692e.css +1 -0
- package/studio-standalone/apps/vinaya-studio/log-follow.mjs +708 -93
- package/studio-standalone/apps/vinaya-studio/log-sync-folder-source.mjs +699 -84
- package/studio-standalone/apps/vinaya-studio/studio-server.mjs +4692 -3116
- package/vinaya-strict/artifacts/templates/brief-template.md +6 -0
- package/vinaya-strict/artifacts/templates/issue-rationale-template.md +7 -3
- package/vinaya-strict/artifacts/templates/pr-report-template.md +1 -1
- package/vinaya-strict/doctrine/contracts/planner-developer.md +4 -3
- package/vinaya-strict/doctrine/enforcement.md +4 -4
- package/vinaya-strict/doctrine/roles/principal.md +1 -1
- package/vinaya-strict/doctrine/state-machine.md +7 -2
- package/vinaya-strict/executing/developer/reference.md +5 -3
- package/vinaya-strict/thinking/plan-reviewer/doctrine.md +68 -0
- package/vinaya-strict/thinking/planner/doctrine.md +4 -1
- package/vinaya-strict/thinking/planner/reference.md +30 -9
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/151-23bea4cac9687151.js +0 -1
- package/studio-standalone/apps/vinaya-studio/.next/static/chunks/853-1d5548ff3a55a75f.js +0 -4
- package/studio-standalone/apps/vinaya-studio/.next/static/css/fb16828fc3128d4c.css +0 -1
- /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/.next/static/{_r9iZDxlkoek85d_3oaxL → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -23,6 +24,7 @@ var __toCommonJS = (from) => {
|
|
|
23
24
|
return entry;
|
|
24
25
|
};
|
|
25
26
|
var __moduleCache;
|
|
27
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
28
|
var __returnValue = (v) => v;
|
|
27
29
|
function __exportSetter(name, newValue) {
|
|
28
30
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -47,6 +49,7 @@ var __esm = (fn, res, err) => () => {
|
|
|
47
49
|
throw err[0];
|
|
48
50
|
return res;
|
|
49
51
|
};
|
|
52
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
50
53
|
|
|
51
54
|
// ../../harness/kernel/adapters/code-host/github/gh.ts
|
|
52
55
|
import { execFile, execFileSync } from "node:child_process";
|
|
@@ -82,6 +85,23 @@ async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
|
82
85
|
}
|
|
83
86
|
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
84
87
|
}
|
|
88
|
+
async function ghLabelIssueCountsAsync(owner, repo, labelQuery) {
|
|
89
|
+
const stdout = await runAsync([
|
|
90
|
+
"api",
|
|
91
|
+
"graphql",
|
|
92
|
+
"--paginate",
|
|
93
|
+
"-f",
|
|
94
|
+
`query=${LABEL_ISSUE_COUNTS_QUERY.replace("$labelQuery", JSON.stringify(labelQuery))}`,
|
|
95
|
+
"-f",
|
|
96
|
+
`owner=${owner}`,
|
|
97
|
+
"-f",
|
|
98
|
+
`name=${repo}`,
|
|
99
|
+
"--jq",
|
|
100
|
+
".data.repository.labels.nodes[] | {name, open: .open.totalCount, total: .all.totalCount}"
|
|
101
|
+
]);
|
|
102
|
+
return stdout.split(`
|
|
103
|
+
`).filter((line) => line.trim() !== "").map((line) => JSON.parse(line));
|
|
104
|
+
}
|
|
85
105
|
function issueListByLabelArgs(owner, repo, label) {
|
|
86
106
|
return [
|
|
87
107
|
"issue",
|
|
@@ -115,7 +135,14 @@ async function ghIssueListByAnyLabelAsync(owner, repo, labels) {
|
|
|
115
135
|
const perLabel = await Promise.all(labels.map((l) => ghIssueListByLabelAsync(owner, repo, l)));
|
|
116
136
|
return dedupeByNumber(perLabel.flat());
|
|
117
137
|
}
|
|
118
|
-
var execFileAsync, systemEnv, MAX_PER_PAGE = 100, MAX_PAGES = 100
|
|
138
|
+
var execFileAsync, systemEnv, MAX_PER_PAGE = 100, MAX_PAGES = 100, LABEL_ISSUE_COUNTS_QUERY = `query($owner: String!, $name: String!, $endCursor: String) {
|
|
139
|
+
repository(owner: $owner, name: $name) {
|
|
140
|
+
labels(first: 100, after: $endCursor, query: $labelQuery) {
|
|
141
|
+
pageInfo { hasNextPage endCursor }
|
|
142
|
+
nodes { name open: issues(states: OPEN) { totalCount } all: issues { totalCount } }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}`;
|
|
119
146
|
var init_gh = __esm(() => {
|
|
120
147
|
execFileAsync = promisify(execFile);
|
|
121
148
|
systemEnv = {
|
|
@@ -725,7 +752,7 @@ function commentMarkerFamily(name) {
|
|
|
725
752
|
function anchorAlternation(spellings) {
|
|
726
753
|
return `(?:${spellings.map((spelling) => spelling.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`;
|
|
727
754
|
}
|
|
728
|
-
var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
|
|
755
|
+
var REGION_PREFIX, PROVENANCE_HEADING, CLAIM_ANCHOR, QUOTES_FILE_ANCHOR, VENDOR_EXAMPLE_ANCHOR, COMMENT_MARKER_PREFIX, FROZEN_BRIEF_MARKER, DEVELOPER_ROUND_MARKER, DEVELOPER_STOP_MARKER, LOOP_PUBLISHED_MARKER, LOOP_PAUSED_MARKER, LOOP_UNPUSHED_WORK_RESUME_MARKER, PRINCIPAL_RULING_MARKER, OBJECTIVES_VERSION_MARKER, DOCUMENTATION_EDIT_MARKER, DEFERRED_FINDINGS_MARKER, COMMENT_MARKER_PREFIX_CURRENT, COMMENT_MARKER_PREFIXES, COMMENT_MARKER_PREFIX_PATTERN, REGION_PREFIX_CURRENT, REGION_PREFIXES, PROVENANCE_HEADINGS, CLAIM_ANCHORS, QUOTES_FILE_ANCHORS, VENDOR_EXAMPLE_ANCHORS;
|
|
729
756
|
var init_legacy_markers = __esm(() => {
|
|
730
757
|
REGION_PREFIX = { old: "AEG", current: "VINAYA" };
|
|
731
758
|
PROVENANCE_HEADING = {
|
|
@@ -747,6 +774,7 @@ var init_legacy_markers = __esm(() => {
|
|
|
747
774
|
LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
|
|
748
775
|
PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
|
|
749
776
|
OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
|
|
777
|
+
DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
|
|
750
778
|
DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
|
|
751
779
|
COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
|
|
752
780
|
COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
|
|
@@ -949,6 +977,15 @@ function parsePremiseBlock(prBody) {
|
|
|
949
977
|
}
|
|
950
978
|
return assertions;
|
|
951
979
|
}
|
|
980
|
+
function declaresNewFilesOnly(prBody) {
|
|
981
|
+
const searchIn = anchoredRegion(prBody, "PREMISE", REGION_PREFIXES) ?? prBody;
|
|
982
|
+
const lines = searchIn.split(/\r?\n/).map((l) => l.trim());
|
|
983
|
+
const header = lines.findIndex(isPremiseHeader);
|
|
984
|
+
if (header === -1)
|
|
985
|
+
return false;
|
|
986
|
+
const first = lines.slice(header + 1).find((l) => l !== "");
|
|
987
|
+
return first === NEW_FILES_ONLY_PREMISE && parsePremiseBlock(prBody).length === 0;
|
|
988
|
+
}
|
|
952
989
|
function premiseBlockText(prBody) {
|
|
953
990
|
const searchIn = anchoredRegion(prBody, "PREMISE", REGION_PREFIXES) ?? prBody;
|
|
954
991
|
const lines = searchIn.split(/\r?\n/);
|
|
@@ -996,7 +1033,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
996
1033
|
}
|
|
997
1034
|
return { pass: failures.length === 0, failures };
|
|
998
1035
|
}
|
|
999
|
-
var ASSERTION_KINDS, PREMISE_LINE;
|
|
1036
|
+
var ASSERTION_KINDS, NEW_FILES_ONLY_PREMISE = "- (no pin — every file this task names is new, so no existing content can be pinned)", PREMISE_LINE;
|
|
1000
1037
|
var init_premise_check = __esm(() => {
|
|
1001
1038
|
init_anchored_region();
|
|
1002
1039
|
init_legacy_markers();
|
|
@@ -1138,13 +1175,16 @@ function checkSurfaceMap(prBody) {
|
|
|
1138
1175
|
function checkDocUpdateList(prBody) {
|
|
1139
1176
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
1140
1177
|
}
|
|
1141
|
-
function checkWorktreeStep0(
|
|
1142
|
-
|
|
1178
|
+
function checkWorktreeStep0(body) {
|
|
1179
|
+
const prBody = body.replaceAll(`\r
|
|
1180
|
+
`, `
|
|
1181
|
+
`);
|
|
1182
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody) || /\*\*Step 0 \(mandatory, verbatim\):\*\*\n\n```\n(?:npm ci|pnpm install --frozen-lockfile|yarn install --frozen-lockfile)\n```/.test(prBody))
|
|
1143
1183
|
return { status: "pass", errors: [] };
|
|
1144
1184
|
return {
|
|
1145
1185
|
status: "fail",
|
|
1146
1186
|
errors: [
|
|
1147
|
-
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile`
|
|
1187
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or frozen-lockfile install (`bun install --frozen-lockfile`, `npm ci`, `pnpm install --frozen-lockfile`, `yarn install --frozen-lockfile`) found in the PR body."
|
|
1148
1188
|
]
|
|
1149
1189
|
};
|
|
1150
1190
|
}
|
|
@@ -1586,6 +1626,7 @@ var init_doctrine_map = __esm(() => {
|
|
|
1586
1626
|
{ key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
|
|
1587
1627
|
{ key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
|
|
1588
1628
|
{ key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
|
|
1629
|
+
{ key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
|
|
1589
1630
|
{ key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
|
|
1590
1631
|
{ key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
|
|
1591
1632
|
{ key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
|
|
@@ -2708,7 +2749,13 @@ function isMechanicallyNeutralDiff(diffText, path) {
|
|
|
2708
2749
|
}
|
|
2709
2750
|
return sawChange;
|
|
2710
2751
|
}
|
|
2711
|
-
function
|
|
2752
|
+
function prBodyGiven(env = process.env) {
|
|
2753
|
+
return env.PR_BODY !== undefined || env.PR_BODY_FILE !== undefined;
|
|
2754
|
+
}
|
|
2755
|
+
function owedNeutralNotes(result) {
|
|
2756
|
+
return result.notes.filter((n) => n.startsWith(DOC_NEUTRAL_OWED_PREFIX));
|
|
2757
|
+
}
|
|
2758
|
+
function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff, bodyGiven = true) {
|
|
2712
2759
|
const out = { errors: [], notes: [] };
|
|
2713
2760
|
if (docOwnersContent === null)
|
|
2714
2761
|
return out;
|
|
@@ -2748,24 +2795,28 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2748
2795
|
}
|
|
2749
2796
|
if (changed.includes(pointerPath))
|
|
2750
2797
|
continue;
|
|
2798
|
+
const evidenced = () => getDiff !== undefined && matchedFiles.every((f) => {
|
|
2799
|
+
const diff = getDiff(f);
|
|
2800
|
+
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
2801
|
+
});
|
|
2751
2802
|
const declared = neutrals.find((n) => n.surface === b.pointer);
|
|
2752
2803
|
if (declared) {
|
|
2753
|
-
|
|
2754
|
-
const diff = getDiff(f);
|
|
2755
|
-
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
2756
|
-
});
|
|
2757
|
-
if (evidenced) {
|
|
2804
|
+
if (evidenced()) {
|
|
2758
2805
|
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.`);
|
|
2759
2806
|
continue;
|
|
2760
2807
|
}
|
|
2761
2808
|
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.`);
|
|
2762
2809
|
continue;
|
|
2763
2810
|
}
|
|
2811
|
+
if (!bodyGiven && evidenced()) {
|
|
2812
|
+
out.notes.push(`${DOC_NEUTRAL_OWED_PREFIX} ${b.pointer} not required in this run for ${DOC_OWNERS_PATH}:${b.lineNum} (glob \`${b.glob}\`) — no pull request body was given, and the diff of ${matchedFiles.join(", ")} is comment/whitespace-only. The pull request body owes \`Doc-neutral: ${b.pointer} — <why>\`.`);
|
|
2813
|
+
continue;
|
|
2814
|
+
}
|
|
2764
2815
|
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.`);
|
|
2765
2816
|
}
|
|
2766
2817
|
return out;
|
|
2767
2818
|
}
|
|
2768
|
-
var DOC_OWNERS_PATH = ".vinaya/doc-owners", SEPARATOR, LANGUAGE_COMMENT_PREFIXES;
|
|
2819
|
+
var DOC_OWNERS_PATH = ".vinaya/doc-owners", SEPARATOR, LANGUAGE_COMMENT_PREFIXES, DOC_NEUTRAL_OWED_PREFIX = "C5 doc-neutral-owed:";
|
|
2769
2820
|
var init_doc_owners = __esm(() => {
|
|
2770
2821
|
init_file_classify();
|
|
2771
2822
|
init_waiver_label();
|
|
@@ -2820,6 +2871,20 @@ var init_protected_paths = __esm(() => {
|
|
|
2820
2871
|
];
|
|
2821
2872
|
});
|
|
2822
2873
|
|
|
2874
|
+
// ../../harness/processes/vinaya-strict/tools/task-contract/test-plan-proof.ts
|
|
2875
|
+
function stripObjectiveIdSpans(text) {
|
|
2876
|
+
return text.replace(ITEM_IDS_SPAN_RE, "").trim();
|
|
2877
|
+
}
|
|
2878
|
+
var ID_LIST, LINE_IDS_RE, ITEM_IDS_SPAN_RE;
|
|
2879
|
+
var init_test_plan_proof = __esm(() => {
|
|
2880
|
+
init_brief_validation();
|
|
2881
|
+
init_objectives();
|
|
2882
|
+
init_test_plan_section();
|
|
2883
|
+
ID_LIST = String.raw`O\d+(?:\s*,\s*O\d+)*`;
|
|
2884
|
+
LINE_IDS_RE = new RegExp(String.raw`\(\s*(${ID_LIST})\s*\)\s*$`);
|
|
2885
|
+
ITEM_IDS_SPAN_RE = new RegExp(String.raw`(?<!\`)(\`+)\s*\(?\s*(${ID_LIST})\s*\)?\s*\1(?!\`)`, "g");
|
|
2886
|
+
});
|
|
2887
|
+
|
|
2823
2888
|
// ../../harness/processes/vinaya-strict/tools/task-contract/issue-validation.ts
|
|
2824
2889
|
function hasRationaleField(body, labelPattern) {
|
|
2825
2890
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -3018,7 +3083,7 @@ function checkPartsCiteDefinedObjectives(body) {
|
|
|
3018
3083
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3019
3084
|
}
|
|
3020
3085
|
function liveCommand(text) {
|
|
3021
|
-
const trimmed = text
|
|
3086
|
+
const trimmed = stripObjectiveIdSpans(text);
|
|
3022
3087
|
const span = /^(`+)(.+)\1$/.exec(trimmed);
|
|
3023
3088
|
return span ? span[2].trim() : trimmed;
|
|
3024
3089
|
}
|
|
@@ -3127,9 +3192,19 @@ function namedPathsIn(text) {
|
|
|
3127
3192
|
function boundaryPinnedFiles(body) {
|
|
3128
3193
|
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
3129
3194
|
const excluded = new Set(namedPathsIn(boundaryOutText(body)));
|
|
3130
|
-
|
|
3195
|
+
const named = [...namedPathsIn(boundary), ...rootFilesPinnedIn(boundary)];
|
|
3196
|
+
return [...new Set(named)].filter((p) => looksLikeFilePath(p) && !excluded.has(p));
|
|
3131
3197
|
}
|
|
3132
|
-
|
|
3198
|
+
function rootFilesPinnedIn(boundary) {
|
|
3199
|
+
const start = boundary.search(/\bPinned files\s*:/i);
|
|
3200
|
+
if (start === -1)
|
|
3201
|
+
return [];
|
|
3202
|
+
const clause = boundary.slice(start);
|
|
3203
|
+
const out = BOUNDARY_OUT_RE.exec(clause);
|
|
3204
|
+
const pinned = out ? clause.slice(0, out.index) : clause;
|
|
3205
|
+
return [...pinned.matchAll(ROOT_FILE_RE_GLOBAL)].map((m) => m[1]);
|
|
3206
|
+
}
|
|
3207
|
+
var RATIONALE_FIELDS, DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale", SINGLE_FIX_OPTIONAL_FIELDS, OBJECTIVES_SINCE_ISSUE = 404, PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3, ISSUE_PART_LINE_RE, ISSUE_LIVE_LINE_RE, TYPE_LABEL_IDS, PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" }), MESSAGE_VALUE_COUNT_MAX = 5, MESSAGE_VALUE_MAX = 64, DOC_PATH_RE, DOC_PATH_RE_GLOBAL, RATIONALE_PATH_RE_GLOBAL, DEFAULT_COLLISION_THRESHOLD = 3, BOUNDARY_OUT_RE, FILE_EXTENSIONS, ROOT_FILE_RE_GLOBAL, CI_SHARD_DIR = "apps/cli/tests/ci-shards", CI_SHARD_PROBE;
|
|
3133
3208
|
var init_issue_validation = __esm(() => {
|
|
3134
3209
|
init_parse_rationale_deps();
|
|
3135
3210
|
init_labels();
|
|
@@ -3143,11 +3218,13 @@ var init_issue_validation = __esm(() => {
|
|
|
3143
3218
|
init_derive_section7();
|
|
3144
3219
|
init_doctrine_map();
|
|
3145
3220
|
init_objectives();
|
|
3221
|
+
init_waiver_label();
|
|
3146
3222
|
init_issue_documentation();
|
|
3147
3223
|
init_touched_path();
|
|
3148
3224
|
init_protected_paths();
|
|
3149
3225
|
init_quoted_command();
|
|
3150
3226
|
init_test_plan_section();
|
|
3227
|
+
init_test_plan_proof();
|
|
3151
3228
|
RATIONALE_FIELDS = [
|
|
3152
3229
|
{ name: "Boundary", pattern: "Boundary" },
|
|
3153
3230
|
{ name: "Sizing", pattern: "Sizing" },
|
|
@@ -3191,6 +3268,7 @@ var init_issue_validation = __esm(() => {
|
|
|
3191
3268
|
"html",
|
|
3192
3269
|
"css"
|
|
3193
3270
|
]);
|
|
3271
|
+
ROOT_FILE_RE_GLOBAL = /`([\w.@-]+\.(?:md|mdx|txt|json|jsonc|ts|tsx|js|jsx|mjs|cjs|mts|cts|yml|yaml|toml|lock|html|css|scss|sh|py|rb|go|rs|xml|ini|cfg|conf))`/g;
|
|
3194
3272
|
CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
3195
3273
|
});
|
|
3196
3274
|
|
|
@@ -3202,59 +3280,22 @@ function emitCheckError(error) {
|
|
|
3202
3280
|
var CHECK_SCHEMA_VERSION = 1;
|
|
3203
3281
|
|
|
3204
3282
|
// ../../harness/kernel/log/custom.ts
|
|
3205
|
-
import {
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
CUSTOM_EVENT_NAME_PATTERN
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
});
|
|
3222
|
-
};
|
|
3223
|
-
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
3224
|
-
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
3225
|
-
}
|
|
3226
|
-
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
3227
|
-
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
3228
|
-
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
3229
|
-
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
3230
|
-
}
|
|
3231
|
-
const fieldEntries = Object.entries(declaration.fields);
|
|
3232
|
-
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
3233
|
-
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
3234
|
-
}
|
|
3235
|
-
for (const [field, type] of fieldEntries) {
|
|
3236
|
-
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
3237
|
-
refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
|
|
3238
|
-
}
|
|
3239
|
-
if (typeof type === "string")
|
|
3240
|
-
continue;
|
|
3241
|
-
if (type.length === 0) {
|
|
3242
|
-
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
3243
|
-
}
|
|
3244
|
-
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
3245
|
-
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
3246
|
-
}
|
|
3247
|
-
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
3248
|
-
if (bad.length > 0) {
|
|
3249
|
-
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
3250
|
-
}
|
|
3251
|
-
if (new Set(type).size !== type.length) {
|
|
3252
|
-
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
});
|
|
3257
|
-
});
|
|
3283
|
+
import {
|
|
3284
|
+
CUSTOM_EVENT_MAX_FIELDS,
|
|
3285
|
+
CUSTOM_EVENT_NAME_MAX_LENGTH,
|
|
3286
|
+
CUSTOM_EVENT_NAME_PATTERN,
|
|
3287
|
+
CUSTOM_EVENT_RESERVED_NAMESPACE,
|
|
3288
|
+
CUSTOM_FIELD_MAX_WORDS,
|
|
3289
|
+
CUSTOM_FIELD_NAME_MAX_LENGTH,
|
|
3290
|
+
CUSTOM_FIELD_NAME_PATTERN,
|
|
3291
|
+
CUSTOM_TEXT_MAX_LENGTH,
|
|
3292
|
+
CUSTOM_WORD_MAX_LENGTH,
|
|
3293
|
+
CUSTOM_WORD_PATTERN,
|
|
3294
|
+
CustomEventDeclarationsSchema,
|
|
3295
|
+
checkCustomEvent,
|
|
3296
|
+
UNRECORDABLE_FIELD_NAME
|
|
3297
|
+
} from "@attalabs/vinaya-log-sdk";
|
|
3298
|
+
var init_custom = () => {};
|
|
3258
3299
|
|
|
3259
3300
|
// ../../harness/kernel/adapters/agents/agent-vendors.ts
|
|
3260
3301
|
var AGENT_VENDORS;
|
|
@@ -3594,14 +3635,15 @@ ${detail}`;
|
|
|
3594
3635
|
return null;
|
|
3595
3636
|
}
|
|
3596
3637
|
}
|
|
3597
|
-
function loadTrustAnchorConfig(fetcher = fetchTrustAnchorConfig) {
|
|
3638
|
+
function loadTrustAnchorConfig(fetcher = fetchTrustAnchorConfig, loadOptions = {}) {
|
|
3639
|
+
const warn = loadOptions.quiet ? () => {} : warnTrustAnchorFallback;
|
|
3598
3640
|
let base64;
|
|
3599
3641
|
try {
|
|
3600
3642
|
base64 = fetcher();
|
|
3601
3643
|
} catch (err) {
|
|
3602
|
-
return trustAnchorFetchFailed(err);
|
|
3644
|
+
return trustAnchorFetchFailed(err, warn);
|
|
3603
3645
|
}
|
|
3604
|
-
return parseTrustAnchorContent(base64);
|
|
3646
|
+
return parseTrustAnchorContent(base64, warn);
|
|
3605
3647
|
}
|
|
3606
3648
|
function loadTrustAnchorConfigOrThrow(fetcher = fetchTrustAnchorConfig) {
|
|
3607
3649
|
let base64;
|
|
@@ -3660,9 +3702,9 @@ var installed = null, NO_CONFIG_PROVIDER_MESSAGE = "no configuration provider is
|
|
|
3660
3702
|
|
|
3661
3703
|
// ../../harness/kernel/config/schema/config-schema.ts
|
|
3662
3704
|
import { isAbsolute } from "node:path";
|
|
3663
|
-
import { z
|
|
3705
|
+
import { z } from "zod";
|
|
3664
3706
|
function checkEntrySchema(fields) {
|
|
3665
|
-
return
|
|
3707
|
+
return z.object(fields).superRefine((entry, ctx) => {
|
|
3666
3708
|
const env = entry.env;
|
|
3667
3709
|
if (!env)
|
|
3668
3710
|
return;
|
|
@@ -3672,14 +3714,14 @@ function checkEntrySchema(fields) {
|
|
|
3672
3714
|
const members = value.anyOf;
|
|
3673
3715
|
if (new Set(members).size !== members.length) {
|
|
3674
3716
|
ctx.addIssue({
|
|
3675
|
-
code:
|
|
3717
|
+
code: z.ZodIssueCode.custom,
|
|
3676
3718
|
message: `env.${key}.anyOf has duplicate members`,
|
|
3677
3719
|
path: ["env", key, "anyOf"]
|
|
3678
3720
|
});
|
|
3679
3721
|
}
|
|
3680
3722
|
if (!members.includes(key)) {
|
|
3681
3723
|
ctx.addIssue({
|
|
3682
|
-
code:
|
|
3724
|
+
code: z.ZodIssueCode.custom,
|
|
3683
3725
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
3684
3726
|
path: ["env", key, "anyOf"]
|
|
3685
3727
|
});
|
|
@@ -3702,26 +3744,31 @@ function hookBlockPathRule(prefixes) {
|
|
|
3702
3744
|
return { isCanonical, schema };
|
|
3703
3745
|
}
|
|
3704
3746
|
function managedManifestSchemas(agentVendors, hookBlockPrefixes) {
|
|
3705
|
-
const block =
|
|
3747
|
+
const block = z.object({
|
|
3706
3748
|
path: hookBlockPathRule(hookBlockPrefixes).schema,
|
|
3707
|
-
marker:
|
|
3708
|
-
comment:
|
|
3749
|
+
marker: z.string(),
|
|
3750
|
+
comment: z.enum(["hash", "html"])
|
|
3709
3751
|
});
|
|
3710
|
-
const manifest =
|
|
3711
|
-
version:
|
|
3712
|
-
files:
|
|
3713
|
-
blocks:
|
|
3714
|
-
labels:
|
|
3715
|
-
agents:
|
|
3752
|
+
const manifest = z.object({
|
|
3753
|
+
version: z.number().int().positive(),
|
|
3754
|
+
files: z.array(SafeRepoRelPath),
|
|
3755
|
+
blocks: z.array(block),
|
|
3756
|
+
labels: z.array(z.string()),
|
|
3757
|
+
agents: z.array(z.enum(agentVendors)).optional()
|
|
3716
3758
|
});
|
|
3717
3759
|
return { block, manifest };
|
|
3718
3760
|
}
|
|
3719
3761
|
function logsSchema(events) {
|
|
3720
|
-
return
|
|
3721
|
-
folder:
|
|
3722
|
-
url:
|
|
3723
|
-
|
|
3724
|
-
|
|
3762
|
+
return z.object({
|
|
3763
|
+
folder: z.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
3764
|
+
url: z.string().url().optional(),
|
|
3765
|
+
otlp: z.object({
|
|
3766
|
+
url: z.string().url().regex(/^https?:\/\//i),
|
|
3767
|
+
headers: z.record(z.string()).optional()
|
|
3768
|
+
}).strict().optional(),
|
|
3769
|
+
headers: z.record(z.string()).optional(),
|
|
3770
|
+
readHeaders: z.record(z.string()).optional(),
|
|
3771
|
+
keepDays: z.number({ invalid_type_error: "must be a whole number of days" }).int({ message: "must be a whole number of days" }).min(1, { message: "must be at least 1" }).optional(),
|
|
3725
3772
|
events: events.optional()
|
|
3726
3773
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
3727
3774
|
message: "logs: set at most one of folder/url"
|
|
@@ -3729,22 +3776,22 @@ function logsSchema(events) {
|
|
|
3729
3776
|
message: "logs: headers requires url"
|
|
3730
3777
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
3731
3778
|
message: "logs: readHeaders requires url"
|
|
3732
|
-
}).or(
|
|
3779
|
+
}).or(z.literal(false)).optional();
|
|
3733
3780
|
}
|
|
3734
3781
|
function kernelConfigFragment(leaves) {
|
|
3735
3782
|
return {
|
|
3736
|
-
rings:
|
|
3737
|
-
ring1_forgeWriteInterception:
|
|
3738
|
-
ring2_asyncAudits:
|
|
3783
|
+
rings: z.object({
|
|
3784
|
+
ring1_forgeWriteInterception: z.boolean(),
|
|
3785
|
+
ring2_asyncAudits: z.boolean()
|
|
3739
3786
|
}).optional(),
|
|
3740
|
-
checks:
|
|
3787
|
+
checks: z.record(z.string(), checkEntrySchema(leaves.checkEntryFields)).optional(),
|
|
3741
3788
|
managed: managedManifestSchemas(leaves.agentVendors, leaves.hookBlockPrefixes).manifest.optional(),
|
|
3742
|
-
ci:
|
|
3743
|
-
logPublish:
|
|
3789
|
+
ci: z.object({ setup: z.string().min(1) }).optional(),
|
|
3790
|
+
logPublish: z.unknown().refine((v) => v === undefined, {
|
|
3744
3791
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
3745
3792
|
}),
|
|
3746
|
-
runtimeDir:
|
|
3747
|
-
runner:
|
|
3793
|
+
runtimeDir: z.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
3794
|
+
runner: z.enum(["standalone", "atta-engine"]).optional(),
|
|
3748
3795
|
logs: logsSchema(leaves.logEvents)
|
|
3749
3796
|
};
|
|
3750
3797
|
}
|
|
@@ -3784,25 +3831,25 @@ function resolveLogsHeaderValues(headers, env) {
|
|
|
3784
3831
|
}
|
|
3785
3832
|
var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath, KERNEL_CONFIG_REFINEMENTS;
|
|
3786
3833
|
var init_config_schema = __esm(() => {
|
|
3787
|
-
EnvEntrySchema =
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3834
|
+
EnvEntrySchema = z.union([
|
|
3835
|
+
z.literal(true),
|
|
3836
|
+
z.object({ optional: z.literal(true) }),
|
|
3837
|
+
z.object({ anyOf: z.array(z.string()).min(2) }),
|
|
3838
|
+
z.string()
|
|
3792
3839
|
]);
|
|
3793
3840
|
KERNEL_CHECK_ENTRY_FIELDS = {
|
|
3794
|
-
run:
|
|
3795
|
-
scope:
|
|
3796
|
-
include:
|
|
3797
|
-
args:
|
|
3798
|
-
timeoutMs:
|
|
3799
|
-
env:
|
|
3800
|
-
requiresOpenPr:
|
|
3801
|
-
ownWorkflow:
|
|
3802
|
-
validates:
|
|
3803
|
-
advisory:
|
|
3841
|
+
run: z.string(),
|
|
3842
|
+
scope: z.enum(["diff", "full"]),
|
|
3843
|
+
include: z.array(z.string()).optional(),
|
|
3844
|
+
args: z.array(z.string()).optional(),
|
|
3845
|
+
timeoutMs: z.number().optional(),
|
|
3846
|
+
env: z.record(z.string(), EnvEntrySchema).optional(),
|
|
3847
|
+
requiresOpenPr: z.boolean().optional(),
|
|
3848
|
+
ownWorkflow: z.boolean().optional(),
|
|
3849
|
+
validates: z.enum(["body", "issue"]).optional(),
|
|
3850
|
+
advisory: z.literal(true).optional()
|
|
3804
3851
|
};
|
|
3805
|
-
SafeRepoRelPath =
|
|
3852
|
+
SafeRepoRelPath = z.string().refine(isSafeRepoRelPath, {
|
|
3806
3853
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
3807
3854
|
});
|
|
3808
3855
|
KERNEL_CONFIG_REFINEMENTS = [];
|
|
@@ -4370,7 +4417,7 @@ var init_review_gate = __esm(() => {
|
|
|
4370
4417
|
|
|
4371
4418
|
// ../../harness/processes/vinaya-strict/tools/prose-rules-config.ts
|
|
4372
4419
|
import safeRegex from "safe-regex2";
|
|
4373
|
-
import { z as
|
|
4420
|
+
import { z as z2 } from "zod";
|
|
4374
4421
|
function isPlainObject3(value) {
|
|
4375
4422
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4376
4423
|
}
|
|
@@ -4640,18 +4687,18 @@ var init_prose_rules_config = __esm(() => {
|
|
|
4640
4687
|
FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
|
|
4641
4688
|
CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
|
|
4642
4689
|
DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
|
|
4643
|
-
RepoRelativePathSchema =
|
|
4690
|
+
RepoRelativePathSchema = z2.string().min(1).superRefine((entry, ctx) => {
|
|
4644
4691
|
const reason = outsideRepositoryReason(entry);
|
|
4645
4692
|
if (reason)
|
|
4646
|
-
ctx.addIssue({ code:
|
|
4693
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, message: reason });
|
|
4647
4694
|
});
|
|
4648
|
-
ProseRulesSchema =
|
|
4695
|
+
ProseRulesSchema = z2.unknown().superRefine((value, ctx) => {
|
|
4649
4696
|
for (const issue of proseRulesIssues(value)) {
|
|
4650
|
-
ctx.addIssue({ code:
|
|
4697
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: issue.path, message: issue.message });
|
|
4651
4698
|
}
|
|
4652
4699
|
}).transform((value) => value);
|
|
4653
|
-
PublishedProseSchema =
|
|
4654
|
-
allow:
|
|
4700
|
+
PublishedProseSchema = z2.object({
|
|
4701
|
+
allow: z2.array(z2.string().min(1)).optional()
|
|
4655
4702
|
}).strict();
|
|
4656
4703
|
});
|
|
4657
4704
|
|
|
@@ -4666,10 +4713,13 @@ var exports_vinaya_config_section = {};
|
|
|
4666
4713
|
__export(exports_vinaya_config_section, {
|
|
4667
4714
|
BRIEF_BUILTINS: () => BRIEF_BUILTINS,
|
|
4668
4715
|
CANONICAL_HOOK_BLOCK_PREFIXES: () => CANONICAL_HOOK_BLOCK_PREFIXES,
|
|
4716
|
+
DEFAULT_REVIEW_AGENT: () => DEFAULT_REVIEW_AGENT,
|
|
4717
|
+
DEFAULT_REVIEW_ROUND_LIMIT: () => DEFAULT_REVIEW_ROUND_LIMIT,
|
|
4669
4718
|
LOCAL_OVERRIDABLE_KEYS: () => LOCAL_OVERRIDABLE_KEYS,
|
|
4670
4719
|
LOCAL_OVERRIDE_FILENAME: () => LOCAL_OVERRIDE_FILENAME,
|
|
4671
4720
|
PRINCIPALS_FIX: () => PRINCIPALS_FIX,
|
|
4672
4721
|
PrincipalsUnresolvedError: () => PrincipalsUnresolvedError,
|
|
4722
|
+
REVIEW_AGENT_SETTINGS: () => REVIEW_AGENT_SETTINGS,
|
|
4673
4723
|
VINAYA_CHECK_ENTRY_FIELDS: () => VINAYA_CHECK_ENTRY_FIELDS,
|
|
4674
4724
|
VINAYA_CONFIG_FILENAME: () => VINAYA_CONFIG_FILENAME,
|
|
4675
4725
|
VINAYA_CONFIG_FRAGMENT: () => VINAYA_CONFIG_FRAGMENT,
|
|
@@ -4691,7 +4741,9 @@ __export(exports_vinaya_config_section, {
|
|
|
4691
4741
|
resolveGateCutovers: () => resolveGateCutovers,
|
|
4692
4742
|
resolveLocalPacingOverride: () => resolveLocalPacingOverride,
|
|
4693
4743
|
resolveReleaseActor: () => resolveReleaseActor,
|
|
4744
|
+
resolveReviewAgent: () => resolveReviewAgent,
|
|
4694
4745
|
resolveReviewPolicy: () => resolveReviewPolicy,
|
|
4746
|
+
resolveReviewRoundLimit: () => resolveReviewRoundLimit,
|
|
4695
4747
|
resolveSecurityScanCommand: () => resolveSecurityScanCommand,
|
|
4696
4748
|
tokensCollectTrustKey: () => tokensCollectTrustKey,
|
|
4697
4749
|
trustAnchorFallbackWarning: () => trustAnchorFallbackWarning,
|
|
@@ -4702,7 +4754,7 @@ import { execFileSync as execFileSync3 } from "node:child_process";
|
|
|
4702
4754
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4703
4755
|
import { homedir } from "node:os";
|
|
4704
4756
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
4705
|
-
import { z as
|
|
4757
|
+
import { z as z3 } from "zod";
|
|
4706
4758
|
function isDefaultedAgentVendorPath(path, manifest) {
|
|
4707
4759
|
if (manifest.agents !== undefined)
|
|
4708
4760
|
return false;
|
|
@@ -4736,7 +4788,7 @@ function decisionRecordsOutsideDoctrine(config, ctx) {
|
|
|
4736
4788
|
return;
|
|
4737
4789
|
const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
|
|
4738
4790
|
if (issue)
|
|
4739
|
-
ctx.addIssue({ code:
|
|
4791
|
+
ctx.addIssue({ code: z3.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
|
|
4740
4792
|
}
|
|
4741
4793
|
function globalPrincipalsIgnoredWarning(path) {
|
|
4742
4794
|
return `${path}: "principals" in the global config is ignored — principals may only be declared from a repo-local vinaya.config.json.`;
|
|
@@ -4840,6 +4892,12 @@ function resolveGateCutovers(config) {
|
|
|
4840
4892
|
function resolveCollisionThreshold(config) {
|
|
4841
4893
|
return config?.planning?.collisionThreshold ?? DEFAULT_COLLISION_THRESHOLD;
|
|
4842
4894
|
}
|
|
4895
|
+
function resolveReviewRoundLimit(config) {
|
|
4896
|
+
return config?.planning?.reviewRoundLimit ?? DEFAULT_REVIEW_ROUND_LIMIT;
|
|
4897
|
+
}
|
|
4898
|
+
function resolveReviewAgent(config) {
|
|
4899
|
+
return config?.planning?.reviewAgent ?? DEFAULT_REVIEW_AGENT;
|
|
4900
|
+
}
|
|
4843
4901
|
function principalsNotConfigured(why) {
|
|
4844
4902
|
return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
|
|
4845
4903
|
}
|
|
@@ -4854,7 +4912,7 @@ function createTrustedPrincipalsResolver(reads) {
|
|
|
4854
4912
|
}
|
|
4855
4913
|
if (isMissingFileError(err))
|
|
4856
4914
|
throw principalsNotConfigured("the default branch has no vinaya.config.json");
|
|
4857
|
-
throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}
|
|
4915
|
+
throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`, { cause: err });
|
|
4858
4916
|
}
|
|
4859
4917
|
const unusable = { why: "" };
|
|
4860
4918
|
const config = reads.parse(content, (why) => {
|
|
@@ -4914,7 +4972,7 @@ function trustTokensCollectCommand(repoGitCommonDir, interpreter, script, script
|
|
|
4914
4972
|
store[key] = { interpreter, script, scriptBlobHash, trustedAt: new Date().toISOString() };
|
|
4915
4973
|
writeTokensCollectTrustStore(storePath, store);
|
|
4916
4974
|
}
|
|
4917
|
-
var VINAYA_HOME, VINAYA_GLOBAL_CONFIG_FILENAME = "config.json", VINAYA_CONFIG_FILENAME = "vinaya.config.json", CANONICAL_HOOK_BLOCK_PREFIXES, VINAYA_CHECK_ENTRY_FIELDS, AGENTS_SKILLS_PREFIX = ".agents/skills/", CLAUDE_SKILLS_PREFIX = ".claude/skills/vinaya-", RoleEntrySchema, MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000, BRIEF_BUILTINS, BriefSectionSchema, BriefSchemaSchema, ProjectEntrySchema, VINAYA_CONFIG_FRAGMENT, LOCAL_OVERRIDE_FILENAME = "vinaya.config.local.json", LOCAL_OVERRIDABLE_KEYS, PrincipalsUnresolvedError, PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch', TOKENS_COLLECT_TRUST_PATH, VINAYA_GLOBAL_ONLY_KEYS, VINAYA_CONFIG_SECTION;
|
|
4975
|
+
var VINAYA_HOME, VINAYA_GLOBAL_CONFIG_FILENAME = "config.json", VINAYA_CONFIG_FILENAME = "vinaya.config.json", CANONICAL_HOOK_BLOCK_PREFIXES, VINAYA_CHECK_ENTRY_FIELDS, AGENTS_SKILLS_PREFIX = ".agents/skills/", CLAUDE_SKILLS_PREFIX = ".claude/skills/vinaya-", RoleEntrySchema, MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000, BRIEF_BUILTINS, BriefSectionSchema, BriefSchemaSchema, ProjectEntrySchema, VINAYA_CONFIG_FRAGMENT, LOCAL_OVERRIDE_FILENAME = "vinaya.config.local.json", LOCAL_OVERRIDABLE_KEYS, DEFAULT_REVIEW_ROUND_LIMIT = 2, REVIEW_AGENT_SETTINGS, DEFAULT_REVIEW_AGENT = "same", PrincipalsUnresolvedError, PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch', TOKENS_COLLECT_TRUST_PATH, VINAYA_GLOBAL_ONLY_KEYS, VINAYA_CONFIG_SECTION;
|
|
4918
4976
|
var init_vinaya_config_section = __esm(() => {
|
|
4919
4977
|
init_review_policy();
|
|
4920
4978
|
init_issue_validation();
|
|
@@ -4928,10 +4986,10 @@ var init_vinaya_config_section = __esm(() => {
|
|
|
4928
4986
|
VINAYA_HOME = join2(homedir(), ".vinaya");
|
|
4929
4987
|
CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
4930
4988
|
VINAYA_CHECK_ENTRY_FIELDS = {
|
|
4931
|
-
principalOwed:
|
|
4989
|
+
principalOwed: z3.literal(true).optional()
|
|
4932
4990
|
};
|
|
4933
|
-
RoleEntrySchema =
|
|
4934
|
-
contract:
|
|
4991
|
+
RoleEntrySchema = z3.object({
|
|
4992
|
+
contract: z3.string().refine((p) => p.includes("/"), {
|
|
4935
4993
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
4936
4994
|
})
|
|
4937
4995
|
});
|
|
@@ -4954,102 +5012,104 @@ var init_vinaya_config_section = __esm(() => {
|
|
|
4954
5012
|
"briefSections",
|
|
4955
5013
|
"milestoneShape"
|
|
4956
5014
|
];
|
|
4957
|
-
BriefSectionSchema =
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
5015
|
+
BriefSectionSchema = z3.union([
|
|
5016
|
+
z3.object({ builtin: z3.enum(BRIEF_BUILTINS) }),
|
|
5017
|
+
z3.object({ heading: z3.string().min(1), name: z3.string().optional() }),
|
|
5018
|
+
z3.object({ field: z3.string().min(1), name: z3.string().optional() }),
|
|
5019
|
+
z3.object({ phrase: z3.string().min(1), name: z3.string().optional() })
|
|
4962
5020
|
]);
|
|
4963
|
-
BriefSchemaSchema =
|
|
4964
|
-
pr:
|
|
4965
|
-
issue:
|
|
4966
|
-
milestone:
|
|
4967
|
-
ack:
|
|
5021
|
+
BriefSchemaSchema = z3.object({
|
|
5022
|
+
pr: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
|
|
5023
|
+
issue: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
|
|
5024
|
+
milestone: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
|
|
5025
|
+
ack: z3.array(z3.enum(BRIEF_BUILTINS)).optional()
|
|
4968
5026
|
});
|
|
4969
|
-
ProjectEntrySchema =
|
|
4970
|
-
name:
|
|
4971
|
-
description:
|
|
4972
|
-
path:
|
|
5027
|
+
ProjectEntrySchema = z3.object({
|
|
5028
|
+
name: z3.string().min(1),
|
|
5029
|
+
description: z3.string().min(1).optional(),
|
|
5030
|
+
path: z3.string().min(1).optional()
|
|
4973
5031
|
});
|
|
4974
5032
|
VINAYA_CONFIG_FRAGMENT = {
|
|
4975
|
-
roles:
|
|
5033
|
+
roles: z3.record(z3.string(), RoleEntrySchema).optional(),
|
|
4976
5034
|
briefSchema: BriefSchemaSchema.optional(),
|
|
4977
|
-
principals:
|
|
4978
|
-
releaseActor:
|
|
4979
|
-
tokens:
|
|
4980
|
-
collect:
|
|
5035
|
+
principals: z3.array(z3.string()).min(1).optional(),
|
|
5036
|
+
releaseActor: z3.string().min(1).optional(),
|
|
5037
|
+
tokens: z3.object({
|
|
5038
|
+
collect: z3.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
4981
5039
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
4982
5040
|
})
|
|
4983
5041
|
}).optional(),
|
|
4984
|
-
blastRadius:
|
|
4985
|
-
proseGates:
|
|
4986
|
-
doctrineRoot:
|
|
4987
|
-
readerFacingPrefix:
|
|
4988
|
-
readerFacingSuffix:
|
|
4989
|
-
legacySlugDir:
|
|
4990
|
-
sourceComments:
|
|
4991
|
-
globs:
|
|
4992
|
-
allowlist:
|
|
4993
|
-
severity:
|
|
5042
|
+
blastRadius: z3.object({ extraDomains: z3.array(z3.string()).optional() }).optional(),
|
|
5043
|
+
proseGates: z3.object({
|
|
5044
|
+
doctrineRoot: z3.string().min(1).optional(),
|
|
5045
|
+
readerFacingPrefix: z3.string().min(1).optional(),
|
|
5046
|
+
readerFacingSuffix: z3.string().min(1).optional(),
|
|
5047
|
+
legacySlugDir: z3.string().min(1).optional(),
|
|
5048
|
+
sourceComments: z3.object({
|
|
5049
|
+
globs: z3.array(z3.string().min(1)).optional(),
|
|
5050
|
+
allowlist: z3.array(z3.string().min(1)).optional(),
|
|
5051
|
+
severity: z3.enum(["warning", "error"]).optional()
|
|
4994
5052
|
}).optional(),
|
|
4995
|
-
specGrandfather:
|
|
4996
|
-
specPaths:
|
|
4997
|
-
productPaths:
|
|
5053
|
+
specGrandfather: z3.union([z3.array(z3.string().min(1)), z3.record(z3.string().min(1), z3.number().int().min(0))]).optional(),
|
|
5054
|
+
specPaths: z3.array(RepoRelativePathSchema).optional(),
|
|
5055
|
+
productPaths: z3.array(RepoRelativePathSchema).optional(),
|
|
4998
5056
|
published: PublishedProseSchema.optional(),
|
|
4999
5057
|
rules: ProseRulesSchema.optional()
|
|
5000
5058
|
}).optional(),
|
|
5001
|
-
projects:
|
|
5002
|
-
dispatch:
|
|
5003
|
-
timeoutMs:
|
|
5004
|
-
reviewerTimeoutMs:
|
|
5005
|
-
killGraceMs:
|
|
5006
|
-
agent:
|
|
5059
|
+
projects: z3.array(ProjectEntrySchema).optional(),
|
|
5060
|
+
dispatch: z3.object({
|
|
5061
|
+
timeoutMs: z3.number().int().positive().optional(),
|
|
5062
|
+
reviewerTimeoutMs: z3.number().int().positive().optional(),
|
|
5063
|
+
killGraceMs: z3.number().int().positive().optional(),
|
|
5064
|
+
agent: z3.enum(["claude", "codex"]).optional()
|
|
5007
5065
|
}).optional(),
|
|
5008
|
-
reviewPolicy:
|
|
5009
|
-
codeReviewThreshold:
|
|
5010
|
-
securityThreshold:
|
|
5011
|
-
maxRounds:
|
|
5012
|
-
maxTaskMinutes:
|
|
5013
|
-
readyPushTimeoutMinutes:
|
|
5066
|
+
reviewPolicy: z3.object({
|
|
5067
|
+
codeReviewThreshold: z3.string().min(1).optional(),
|
|
5068
|
+
securityThreshold: z3.string().min(1).optional(),
|
|
5069
|
+
maxRounds: z3.number().optional(),
|
|
5070
|
+
maxTaskMinutes: z3.number().optional(),
|
|
5071
|
+
readyPushTimeoutMinutes: z3.number().optional()
|
|
5014
5072
|
}).optional(),
|
|
5015
|
-
securityScan:
|
|
5016
|
-
command:
|
|
5073
|
+
securityScan: z3.object({
|
|
5074
|
+
command: z3.array(z3.string().min(1)).min(1)
|
|
5017
5075
|
}).optional(),
|
|
5018
|
-
gateCutovers:
|
|
5019
|
-
objectivesSinceIssue:
|
|
5020
|
-
briefSectionsSinceIssue:
|
|
5021
|
-
documentationSinceIssue:
|
|
5022
|
-
briefRulesSincePr:
|
|
5023
|
-
agentBoxesRefusedSincePr:
|
|
5076
|
+
gateCutovers: z3.object({
|
|
5077
|
+
objectivesSinceIssue: z3.number().int().nonnegative().optional(),
|
|
5078
|
+
briefSectionsSinceIssue: z3.number().int().nonnegative().optional(),
|
|
5079
|
+
documentationSinceIssue: z3.number().int().nonnegative().optional(),
|
|
5080
|
+
briefRulesSincePr: z3.number().int().nonnegative().optional(),
|
|
5081
|
+
agentBoxesRefusedSincePr: z3.number().int().nonnegative().optional()
|
|
5024
5082
|
}).optional(),
|
|
5025
|
-
planning:
|
|
5026
|
-
collisionThreshold:
|
|
5083
|
+
planning: z3.object({
|
|
5084
|
+
collisionThreshold: z3.number().int().nonnegative().optional(),
|
|
5085
|
+
reviewRoundLimit: z3.number().int().positive().optional(),
|
|
5086
|
+
reviewAgent: z3.enum(["same", "different"]).optional()
|
|
5027
5087
|
}).optional(),
|
|
5028
|
-
prePush:
|
|
5029
|
-
alwaysRun:
|
|
5030
|
-
readyTests:
|
|
5031
|
-
mode:
|
|
5032
|
-
workflow:
|
|
5033
|
-
check:
|
|
5088
|
+
prePush: z3.object({
|
|
5089
|
+
alwaysRun: z3.array(z3.string()).optional(),
|
|
5090
|
+
readyTests: z3.object({
|
|
5091
|
+
mode: z3.literal("ci"),
|
|
5092
|
+
workflow: z3.literal(".github/workflows/ci.yml"),
|
|
5093
|
+
check: z3.literal("Vinaya CI")
|
|
5034
5094
|
}).strict().optional(),
|
|
5035
|
-
requiredCi:
|
|
5036
|
-
workflow:
|
|
5037
|
-
check:
|
|
5095
|
+
requiredCi: z3.object({
|
|
5096
|
+
workflow: z3.literal(".github/workflows/ci.yml"),
|
|
5097
|
+
check: z3.literal("Vinaya CI")
|
|
5038
5098
|
}).strict().optional()
|
|
5039
5099
|
}).optional(),
|
|
5040
|
-
report:
|
|
5041
|
-
commandTimeoutMs:
|
|
5100
|
+
report: z3.object({
|
|
5101
|
+
commandTimeoutMs: z3.number().int().positive().optional()
|
|
5042
5102
|
}).superRefine((report, ctx) => {
|
|
5043
5103
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
5044
5104
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
5045
5105
|
ctx.addIssue({
|
|
5046
|
-
code:
|
|
5106
|
+
code: z3.ZodIssueCode.custom,
|
|
5047
5107
|
path: ["commandTimeoutMs"],
|
|
5048
5108
|
message: "must be at most 3600000 (1 hour)"
|
|
5049
5109
|
});
|
|
5050
5110
|
}
|
|
5051
5111
|
}).optional(),
|
|
5052
|
-
decisionRecords:
|
|
5112
|
+
decisionRecords: z3.object({
|
|
5053
5113
|
path: RepoRelativePathSchema
|
|
5054
5114
|
}).strict().optional()
|
|
5055
5115
|
};
|
|
@@ -5058,10 +5118,11 @@ var init_vinaya_config_section = __esm(() => {
|
|
|
5058
5118
|
"reviewPolicy.maxTaskMinutes",
|
|
5059
5119
|
"reviewPolicy.readyPushTimeoutMinutes"
|
|
5060
5120
|
];
|
|
5121
|
+
REVIEW_AGENT_SETTINGS = ["same", "different"];
|
|
5061
5122
|
PrincipalsUnresolvedError = class PrincipalsUnresolvedError extends Error {
|
|
5062
5123
|
kind;
|
|
5063
|
-
constructor(kind, message) {
|
|
5064
|
-
super(message);
|
|
5124
|
+
constructor(kind, message, options) {
|
|
5125
|
+
super(message, options);
|
|
5065
5126
|
this.name = "PrincipalsUnresolvedError";
|
|
5066
5127
|
this.kind = kind;
|
|
5067
5128
|
}
|
|
@@ -5105,7 +5166,7 @@ var init_vinaya_config_section = __esm(() => {
|
|
|
5105
5166
|
});
|
|
5106
5167
|
|
|
5107
5168
|
// ../../harness/processes/vinaya-strict/integration/config/compose.ts
|
|
5108
|
-
import { z as
|
|
5169
|
+
import { z as z4 } from "zod";
|
|
5109
5170
|
function globalChecksIgnoredWarning(path) {
|
|
5110
5171
|
return `${path}: "checks" registration in the global config is ignored — checks may only be registered from a repo-local vinaya.config.json.`;
|
|
5111
5172
|
}
|
|
@@ -5177,7 +5238,7 @@ var init_compose = __esm(() => {
|
|
|
5177
5238
|
"logs",
|
|
5178
5239
|
"decisionRecords"
|
|
5179
5240
|
];
|
|
5180
|
-
VinayaConfigObjectSchema =
|
|
5241
|
+
VinayaConfigObjectSchema = z4.object(orderedShape(CONFIG_KEY_ORDER, KERNEL_FRAGMENT, VINAYA_CONFIG_SECTION.fragment));
|
|
5181
5242
|
VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
|
|
5182
5243
|
for (const refine of KERNEL_CONFIG_REFINEMENTS)
|
|
5183
5244
|
refine(config, ctx);
|
|
@@ -5228,7 +5289,7 @@ var init_compose = __esm(() => {
|
|
|
5228
5289
|
vinayaConfigProvider = {
|
|
5229
5290
|
homeDir: VINAYA_HOME,
|
|
5230
5291
|
loadConfig: () => loadConfig(),
|
|
5231
|
-
loadTrustAnchorConfig: () => loadTrustAnchorConfig(),
|
|
5292
|
+
loadTrustAnchorConfig: (options) => loadTrustAnchorConfig(undefined, options),
|
|
5232
5293
|
loadTrustAnchorConfigAsync: (fetcher, options) => loadTrustAnchorConfigAsync(fetcher, options)
|
|
5233
5294
|
};
|
|
5234
5295
|
installVinayaConfigProvider();
|
|
@@ -5305,6 +5366,19 @@ function lifecycleFromIssues(issues) {
|
|
|
5305
5366
|
return "planned";
|
|
5306
5367
|
return issues.some((i) => i.state === "OPEN") ? "active" : "complete";
|
|
5307
5368
|
}
|
|
5369
|
+
function lifecycleFromCounts(open, total) {
|
|
5370
|
+
if (total === 0)
|
|
5371
|
+
return "planned";
|
|
5372
|
+
return open > 0 ? "active" : "complete";
|
|
5373
|
+
}
|
|
5374
|
+
function resolveLegacyFactsFromCounts(milestone, open, total) {
|
|
5375
|
+
if (milestone.state === "closed" && total > 0) {
|
|
5376
|
+
return { goal: milestone.description ?? "", lifecycle: lifecycleFromCounts(open, total) };
|
|
5377
|
+
}
|
|
5378
|
+
return factsFromLegacyMilestone(milestone);
|
|
5379
|
+
}
|
|
5380
|
+
var TRANCHE_LABEL_QUERY = "vinaya/tranche:";
|
|
5381
|
+
var ACTIVE_ISSUE_READ_CONCURRENCY = 4;
|
|
5308
5382
|
function goalFromMilestones(milestones, slug) {
|
|
5309
5383
|
for (const m of milestones) {
|
|
5310
5384
|
const goal = intentGoalForSlug(m.description ?? "", slug);
|
|
@@ -5332,10 +5406,20 @@ function trancheSlugsFromLabels(labels) {
|
|
|
5332
5406
|
}
|
|
5333
5407
|
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
5334
5408
|
const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
|
|
5335
|
-
const [milestones, labels] = await Promise.all([
|
|
5409
|
+
const [milestones, labels, counts] = await Promise.all([
|
|
5336
5410
|
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
5337
|
-
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
5411
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)),
|
|
5412
|
+
read(() => ghLabelIssueCountsAsync(owner, repo, TRANCHE_LABEL_QUERY))
|
|
5338
5413
|
]);
|
|
5414
|
+
const countsByLabel = new Map(counts.map((c) => [c.name, c]));
|
|
5415
|
+
const uncounted = trancheSlugsFromLabels(labels).map((slug) => trancheLabel(slug)).filter((label) => !countsByLabel.has(label));
|
|
5416
|
+
if (uncounted.length > 0) {
|
|
5417
|
+
throw new Error(`the label Issue-count query returned no count for ${uncounted.join(", ")}`);
|
|
5418
|
+
}
|
|
5419
|
+
const lifecycleOf = (slug) => {
|
|
5420
|
+
const c = countsByLabel.get(trancheLabel(slug));
|
|
5421
|
+
return lifecycleFromCounts(c?.open ?? 0, c?.total ?? 0);
|
|
5422
|
+
};
|
|
5339
5423
|
const active = [];
|
|
5340
5424
|
const archived = [];
|
|
5341
5425
|
const facts = new Map;
|
|
@@ -5343,33 +5427,21 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
|
5343
5427
|
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
5344
5428
|
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
5345
5429
|
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
5346
|
-
const
|
|
5347
|
-
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
5348
|
-
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
5349
|
-
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
5350
|
-
]);
|
|
5351
|
-
const issuesBySlug = new Map;
|
|
5352
|
-
uniqueLegacySlugs.forEach((slug, i) => {
|
|
5353
|
-
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
5354
|
-
});
|
|
5355
|
-
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
5356
|
-
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
5357
|
-
});
|
|
5358
|
-
uniqueLegacySlugs.forEach((slug, i) => {
|
|
5430
|
+
for (const slug of legacySlugs) {
|
|
5359
5431
|
const m = legacyMilestoneBySlug.get(slug);
|
|
5360
5432
|
if (!m)
|
|
5361
|
-
|
|
5433
|
+
continue;
|
|
5362
5434
|
const ref = { slug, goal: m.description ?? "" };
|
|
5363
|
-
const
|
|
5435
|
+
const c = countsByLabel.get(trancheLabel(slug));
|
|
5436
|
+
const f = resolveLegacyFactsFromCounts(m, c?.open ?? 0, c?.total ?? 0);
|
|
5364
5437
|
if (f.lifecycle === "complete")
|
|
5365
5438
|
archived.push(ref);
|
|
5366
5439
|
else if (f.lifecycle === "active")
|
|
5367
5440
|
active.push(ref);
|
|
5368
5441
|
facts.set(slug, f);
|
|
5369
|
-
}
|
|
5370
|
-
|
|
5371
|
-
const
|
|
5372
|
-
const lifecycle = lifecycleFromIssues(issues);
|
|
5442
|
+
}
|
|
5443
|
+
for (const slug of uniqueNewPathSlugs) {
|
|
5444
|
+
const lifecycle = lifecycleOf(slug);
|
|
5373
5445
|
const goal = goalFromMilestones(milestones, slug);
|
|
5374
5446
|
const f = { goal, lifecycle };
|
|
5375
5447
|
facts.set(slug, f);
|
|
@@ -5377,7 +5449,16 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
|
5377
5449
|
active.push({ slug, goal });
|
|
5378
5450
|
else if (lifecycle === "complete")
|
|
5379
5451
|
archived.push({ slug, goal });
|
|
5380
|
-
}
|
|
5452
|
+
}
|
|
5453
|
+
const issuesBySlug = new Map;
|
|
5454
|
+
const activeSlugs = active.map((r) => r.slug);
|
|
5455
|
+
for (let i = 0;i < activeSlugs.length; i += ACTIVE_ISSUE_READ_CONCURRENCY) {
|
|
5456
|
+
const batch = activeSlugs.slice(i, i + ACTIVE_ISSUE_READ_CONCURRENCY);
|
|
5457
|
+
const lists = await Promise.all(batch.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))));
|
|
5458
|
+
batch.forEach((slug, j) => {
|
|
5459
|
+
issuesBySlug.set(slug, lists[j] ?? []);
|
|
5460
|
+
});
|
|
5461
|
+
}
|
|
5381
5462
|
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
5382
5463
|
}
|
|
5383
5464
|
async function retryOnce(fetch) {
|
|
@@ -6455,10 +6536,23 @@ function describeError(err) {
|
|
|
6455
6536
|
|
|
6456
6537
|
// ../../harness/processes/vinaya-strict/tools/task-contract/forge/fetch-open-issues.ts
|
|
6457
6538
|
init_labels();
|
|
6458
|
-
|
|
6539
|
+
function failureReason(err, token) {
|
|
6540
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
6541
|
+
if (token.length > 0 && message.includes(token))
|
|
6542
|
+
return null;
|
|
6543
|
+
return message;
|
|
6544
|
+
}
|
|
6545
|
+
async function fetchOpenIssuesByLabel(slugs, owner, repo, token, onFailedRead) {
|
|
6546
|
+
const read = await readOpenIssuesByLabel(slugs, owner, repo, token);
|
|
6547
|
+
if (read.ok)
|
|
6548
|
+
return read.issues;
|
|
6549
|
+
onFailedRead?.(read.reason);
|
|
6550
|
+
return new Map;
|
|
6551
|
+
}
|
|
6552
|
+
async function readOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
6459
6553
|
const result = new Map;
|
|
6460
6554
|
if (slugs.length === 0)
|
|
6461
|
-
return result;
|
|
6555
|
+
return { ok: true, issues: result };
|
|
6462
6556
|
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
6463
6557
|
const toAlias = (slug) => `tranche_${slug.replace(/-/g, "_")}`;
|
|
6464
6558
|
const perSlug = slugs.map((slug) => `
|
|
@@ -6472,11 +6566,12 @@ async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
|
6472
6566
|
let response;
|
|
6473
6567
|
try {
|
|
6474
6568
|
response = await client(query, { owner, repo });
|
|
6475
|
-
} catch {
|
|
6476
|
-
return
|
|
6569
|
+
} catch (err) {
|
|
6570
|
+
return { ok: false, reason: failureReason(err, token) };
|
|
6571
|
+
}
|
|
6572
|
+
if (!response.repository) {
|
|
6573
|
+
return { ok: false, reason: `the repository ${owner}/${repo} is not visible to the token` };
|
|
6477
6574
|
}
|
|
6478
|
-
if (!response.repository)
|
|
6479
|
-
return result;
|
|
6480
6575
|
for (const slug of slugs) {
|
|
6481
6576
|
const conn = response.repository[toAlias(slug)];
|
|
6482
6577
|
const issues = (conn?.nodes ?? []).map((n) => ({
|
|
@@ -6486,7 +6581,7 @@ async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
|
6486
6581
|
}));
|
|
6487
6582
|
result.set(slug, issues);
|
|
6488
6583
|
}
|
|
6489
|
-
return result;
|
|
6584
|
+
return { ok: true, issues: result };
|
|
6490
6585
|
}
|
|
6491
6586
|
|
|
6492
6587
|
// ../../harness/processes/vinaya-strict/tools/task-contract/parse-registry.ts
|
|
@@ -6564,6 +6659,7 @@ function splitTableRow(row) {
|
|
|
6564
6659
|
// ../../harness/processes/vinaya-strict/checks/coherence-checks.ts
|
|
6565
6660
|
init_parse_rationale_deps();
|
|
6566
6661
|
init_labels();
|
|
6662
|
+
init_list_tasks();
|
|
6567
6663
|
init_anchored_region();
|
|
6568
6664
|
init_legacy_markers();
|
|
6569
6665
|
init_issue_validation();
|
|
@@ -6590,6 +6686,21 @@ function isGrandfathered(isoDate) {
|
|
|
6590
6686
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
6591
6687
|
}
|
|
6592
6688
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
6689
|
+
function buildIssueEntries(trancheSlug, archived, tasks, factsByIssue) {
|
|
6690
|
+
return tasks.map((task) => ({
|
|
6691
|
+
trancheSlug,
|
|
6692
|
+
archived,
|
|
6693
|
+
task,
|
|
6694
|
+
facts: task.issue === null ? undefined : factsByIssue?.get(task.issue)
|
|
6695
|
+
}));
|
|
6696
|
+
}
|
|
6697
|
+
function buildTaskEntries(trancheSlug, archived, tasks, factsByIssue) {
|
|
6698
|
+
const { tasks: standing } = resolveDuplicateTasks(tasks, (n) => factsByIssue?.get(n)?.issueState === "open");
|
|
6699
|
+
return buildIssueEntries(trancheSlug, archived, standing, factsByIssue);
|
|
6700
|
+
}
|
|
6701
|
+
function provenanceKey(issue) {
|
|
6702
|
+
return String(issue);
|
|
6703
|
+
}
|
|
6593
6704
|
function checkA1(entries, principalAllowlist) {
|
|
6594
6705
|
const failures = [];
|
|
6595
6706
|
for (const e of entries) {
|
|
@@ -6625,10 +6736,13 @@ function checkA2(entries, hasProvenanceByKey) {
|
|
|
6625
6736
|
for (const e of entries) {
|
|
6626
6737
|
if (!e.facts)
|
|
6627
6738
|
continue;
|
|
6739
|
+
if (e.task.issue === null)
|
|
6740
|
+
continue;
|
|
6741
|
+
if (e.facts.stateReason === "not_planned")
|
|
6742
|
+
continue;
|
|
6628
6743
|
if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
|
|
6629
6744
|
continue;
|
|
6630
|
-
const
|
|
6631
|
-
const hasProvenance = hasProvenanceByKey.get(key);
|
|
6745
|
+
const hasProvenance = hasProvenanceByKey.get(provenanceKey(e.task.issue));
|
|
6632
6746
|
if (hasProvenance === undefined)
|
|
6633
6747
|
continue;
|
|
6634
6748
|
if (!hasProvenance) {
|
|
@@ -7206,8 +7320,11 @@ function emitAdvisories(results) {
|
|
|
7206
7320
|
}
|
|
7207
7321
|
}
|
|
7208
7322
|
}
|
|
7323
|
+
function topologyIssueNumbers(tasks) {
|
|
7324
|
+
return new Set(tasks.map((t) => t.issue).filter((n) => n !== null));
|
|
7325
|
+
}
|
|
7209
7326
|
async function evaluateA2(slug, entries, token, readProvenance) {
|
|
7210
|
-
const candidates = entries.filter((e) => e.facts?.issueState === "closed" && e.facts.prState === "merged" && e.task.issue !== null);
|
|
7327
|
+
const candidates = entries.filter((e) => e.facts?.issueState === "closed" && e.facts.prState === "merged" && e.facts.stateReason !== "not_planned" && e.task.issue !== null);
|
|
7211
7328
|
if (candidates.length === 0)
|
|
7212
7329
|
return checkA2(entries, new Map);
|
|
7213
7330
|
const unread = (reason, issues) => ({
|
|
@@ -7228,7 +7345,7 @@ async function evaluateA2(slug, entries, token, readProvenance) {
|
|
|
7228
7345
|
if (has === undefined)
|
|
7229
7346
|
missing.push(issue);
|
|
7230
7347
|
else
|
|
7231
|
-
provenanceByKey.set(
|
|
7348
|
+
provenanceByKey.set(provenanceKey(issue), has);
|
|
7232
7349
|
}
|
|
7233
7350
|
if (missing.length > 0) {
|
|
7234
7351
|
return unread(`severity:infra — the provenance read returned no answer for #${missing.join(", #")}, so A2 did not evaluate it`, missing);
|
|
@@ -7359,14 +7476,13 @@ async function main() {
|
|
|
7359
7476
|
const otherTranchesL5 = sweepOtherTranchesL5(index, (s) => fetchTrancheIssuesAsync(repo.owner, repo.repo, s));
|
|
7360
7477
|
const tranche = await deriveTrancheFromForge(repo.owner, repo.repo, slug, index.facts.get(slug) ?? { goal: "", lifecycle: "planned" });
|
|
7361
7478
|
const file = { slug, archived: false, tranche };
|
|
7362
|
-
const baseEntries = tranche.tasks.map((t) => ({
|
|
7363
|
-
trancheSlug: slug,
|
|
7364
|
-
archived: false,
|
|
7365
|
-
task: t,
|
|
7366
|
-
facts: undefined
|
|
7367
|
-
}));
|
|
7368
7479
|
const taskRefs = tranche.tasks.filter((t) => t.issue !== null).map((t) => ({ id: t.id, issue: t.issue }));
|
|
7369
|
-
const snapshot = await
|
|
7480
|
+
const snapshot = await fetchForgeFactsByIssue({
|
|
7481
|
+
owner: repo.owner,
|
|
7482
|
+
repo: repo.repo,
|
|
7483
|
+
tranche: slug,
|
|
7484
|
+
tasks: taskRefs
|
|
7485
|
+
});
|
|
7370
7486
|
const results = [checkL3([file])];
|
|
7371
7487
|
if (snapshot.unavailable) {
|
|
7372
7488
|
emitCheckError({
|
|
@@ -7378,19 +7494,16 @@ async function main() {
|
|
|
7378
7494
|
});
|
|
7379
7495
|
process.exit(1);
|
|
7380
7496
|
}
|
|
7381
|
-
const enrichedEntries = tranche.tasks.
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
task: t,
|
|
7385
|
-
facts: snapshot.facts.get(t.id)
|
|
7386
|
-
}));
|
|
7497
|
+
const enrichedEntries = buildTaskEntries(slug, false, tranche.tasks, snapshot.facts);
|
|
7498
|
+
const issueEntries = buildIssueEntries(slug, false, tranche.tasks, snapshot.facts);
|
|
7499
|
+
const baseEntries = enrichedEntries.map((e) => ({ ...e, facts: undefined }));
|
|
7387
7500
|
const token = await resolveToken() ?? "";
|
|
7388
7501
|
if (a1Principals !== null)
|
|
7389
7502
|
results.push(checkA1(enrichedEntries, a1Principals));
|
|
7390
|
-
results.push(await evaluateA2(slug,
|
|
7503
|
+
results.push(await evaluateA2(slug, issueEntries, token, (nums) => fetchProvenance(nums, repo.owner, repo.repo, token)));
|
|
7391
7504
|
results.push(checkA3(enrichedEntries));
|
|
7392
7505
|
results.push(checkT1(enrichedEntries));
|
|
7393
|
-
results.push(checkD1(enrichedEntries, issueToEntry(
|
|
7506
|
+
results.push(checkD1(enrichedEntries, issueToEntry(issueEntries), taskToEntry(enrichedEntries, slug)));
|
|
7394
7507
|
results.push(checkT3(baseEntries, slug, enrichedEntries, new Set));
|
|
7395
7508
|
results.push(checkL1([file], new Map([[slug, enrichedEntries]])));
|
|
7396
7509
|
results.push(evaluateBranchL5(slug, index, enrichedEntries));
|
|
@@ -7407,7 +7520,7 @@ async function main() {
|
|
|
7407
7520
|
emitAdvisories(evaluateLifecycleAdvisories(slug, tranche, enrichedEntries, index, slugIssues));
|
|
7408
7521
|
emitOtherTrancheL5(await otherTranchesL5);
|
|
7409
7522
|
const openIssuesBySlug = await fetchOpenIssuesByLabel([slug], repo.owner, repo.repo, token);
|
|
7410
|
-
const topologyIssues =
|
|
7523
|
+
const topologyIssues = topologyIssueNumbers(tranche.tasks);
|
|
7411
7524
|
const openNums = (openIssuesBySlug.get(slug) ?? []).map((i) => i.number);
|
|
7412
7525
|
results.push(scopeT2ToPlanPr(checkT2(new Map([[slug, openNums]]), new Map([[slug, topologyIssues]]), slug), false));
|
|
7413
7526
|
const registeredNames = readRegisteredProjectNames();
|
|
@@ -7448,5 +7561,6 @@ export {
|
|
|
7448
7561
|
evaluateLifecycleAdvisories,
|
|
7449
7562
|
l4Applies,
|
|
7450
7563
|
recoveryPromptFor,
|
|
7451
|
-
sweepOtherTranchesL5
|
|
7564
|
+
sweepOtherTranchesL5,
|
|
7565
|
+
topologyIssueNumbers
|
|
7452
7566
|
};
|