@attalabs/vinaya 0.34.0 → 0.35.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/LICENSE +104 -201
- package/README.md +1 -1
- package/aeg-root/roles/planner/reference.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +5 -2
- package/dist/checks/bin/check-branch-topology.js +13 -0
- package/dist/checks/bin/check-brief-shape.js +5 -2
- package/dist/checks/bin/check-changeset-coverage.js +38 -5
- package/dist/checks/bin/check-closes-n.js +13 -0
- package/dist/checks/bin/check-coherence.js +16 -2
- package/dist/checks/bin/check-dead-branch-push.js +2 -0
- package/dist/checks/bin/check-dispatch-readiness.js +16 -2
- package/dist/checks/bin/check-doc-coverage-push.js +38 -5
- package/dist/checks/bin/check-doc-coverage.js +38 -5
- package/dist/checks/bin/check-doctrine-no-procedures.js +5 -2
- package/dist/checks/bin/check-doctrine-portability.js +38 -5
- package/dist/checks/bin/check-evidence-fresh.js +38 -5
- package/dist/checks/bin/check-exec-bits.js +38 -5
- package/dist/checks/bin/check-first-push-dispatch.js +16 -2
- package/dist/checks/bin/check-issue-assignment.js +13 -0
- package/dist/checks/bin/check-issue-milestone-attach.js +2 -0
- package/dist/checks/bin/check-issue-objectives-numbering.js +5 -2
- package/dist/checks/bin/check-issue-parts-coverage.js +2 -0
- package/dist/checks/bin/check-issue-surface-globs.js +16 -2
- package/dist/checks/bin/check-issue-title-grammar.js +2 -0
- package/dist/checks/bin/check-issue-tranche-label.js +2 -0
- package/dist/checks/bin/check-main-branch-refusal.js +2 -0
- package/dist/checks/bin/check-no-disk-state.js +2 -0
- package/dist/checks/bin/check-pr-premise-reassert.js +5 -2
- package/dist/checks/bin/check-pr-report-density.js +2 -0
- package/dist/checks/bin/check-principal-test-plan-wait.js +2 -0
- package/dist/checks/bin/check-quoted-command.js +38 -5
- package/dist/checks/bin/check-reader-resolvable-prose.js +38 -5
- package/dist/checks/bin/check-registry-gates.js +2 -0
- package/dist/checks/bin/check-retired-vocabulary.js +38 -5
- package/dist/checks/bin/check-review-gate.js +5 -2
- package/dist/checks/bin/check-single-plan-pr.js +2 -0
- package/dist/checks/bin/check-surface-scope.js +13 -0
- package/dist/checks/bin/check-test-plan.js +2 -0
- package/dist/checks/bin/check-token-collection-wired.js +2 -0
- package/dist/checks/bin/check-token-report.js +2 -0
- package/dist/checks/bin/check-workspace-escape.js +38 -5
- package/dist/index.js +308 -113
- package/dist/lib/pre-push-cache-test-run.js +36 -5
- package/dist/lib/pre-push-select-tests.js +3 -2
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +153 -37
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +87 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +9 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +7 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +28 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-cutovers.ts +49 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +12 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +138 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +26 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives-cutover-config.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +15 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +122 -23
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +38 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__07uhu5z._.js → [root-of-the-server]__0zc_0gx._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2174nz5he_oc4.js → 3goaig_rysc6p.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0q9p7c6vn-x2w.js → 3ip5z3cf43bgo.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xnma0-359j17.js → 3u9emqjwpd0t9.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{HmoeqXdX1E4drt7GReFOO → ca66rAHI_w9D7S7ceXDvR}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{HmoeqXdX1E4drt7GReFOO → ca66rAHI_w9D7S7ceXDvR}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{HmoeqXdX1E4drt7GReFOO → ca66rAHI_w9D7S7ceXDvR}/_ssgManifest.js +0 -0
|
@@ -2482,7 +2482,8 @@ async function trustAnchorRepoAsync() {
|
|
|
2482
2482
|
try {
|
|
2483
2483
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
2484
2484
|
encoding: "utf-8",
|
|
2485
|
-
timeout: 1e4
|
|
2485
|
+
timeout: 1e4,
|
|
2486
|
+
killSignal: "SIGKILL"
|
|
2486
2487
|
});
|
|
2487
2488
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
2488
2489
|
} catch {
|
|
@@ -2543,7 +2544,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
2543
2544
|
const repo = await trustAnchorRepoAsync();
|
|
2544
2545
|
if (!repo)
|
|
2545
2546
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
2546
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
2547
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
2547
2548
|
return stdout;
|
|
2548
2549
|
}
|
|
2549
2550
|
function firstLine(err) {
|
|
@@ -3134,7 +3135,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
3134
3135
|
|
|
3135
3136
|
// src/lib/log-sink.ts
|
|
3136
3137
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
3138
|
+
function describeFolderFallback(reason) {
|
|
3139
|
+
if (reason.kind === "anchor-unreadable") {
|
|
3140
|
+
return `not delivering to the configured log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json could not be read to confirm it (the trust-anchor read via `gh` was offline, " + "unauthenticated, or slower than its deadline); events are written to the local folder and can be " + "delivered later with `vinaya log send`";
|
|
3141
|
+
}
|
|
3142
|
+
return `not delivering to the working-tree log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json does not declare it, so an unattended run does not honour it (a pull request cannot " + "redirect telemetry); events are written to the local folder";
|
|
3143
|
+
}
|
|
3137
3144
|
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
3145
|
+
var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
|
|
3138
3146
|
function withDeadline(work, ms, fallback) {
|
|
3139
3147
|
return new Promise((resolve) => {
|
|
3140
3148
|
const timer = setTimeout(() => resolve(fallback), ms);
|
|
@@ -3149,7 +3157,7 @@ function withDeadline(work, ms, fallback) {
|
|
|
3149
3157
|
});
|
|
3150
3158
|
}
|
|
3151
3159
|
async function safeLoadTrustAnchorConfig() {
|
|
3152
|
-
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
3160
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
3153
3161
|
}
|
|
3154
3162
|
function logsCredentialMissing(headers, env) {
|
|
3155
3163
|
if (!headers)
|
|
@@ -3166,8 +3174,16 @@ function logsCredentialMissing(headers, env) {
|
|
|
3166
3174
|
function resolveLogDestinationFrom(input) {
|
|
3167
3175
|
const local = resolveLogsSetting(input.localConfig);
|
|
3168
3176
|
let effective = null;
|
|
3177
|
+
let fallbackReason;
|
|
3169
3178
|
if (input.unattended) {
|
|
3170
|
-
|
|
3179
|
+
if (local) {
|
|
3180
|
+
effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
|
|
3181
|
+
if (effective === null && "url" in local) {
|
|
3182
|
+
fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
|
|
3183
|
+
}
|
|
3184
|
+
} else {
|
|
3185
|
+
effective = resolveLogsSetting(input.trustAnchorConfig);
|
|
3186
|
+
}
|
|
3171
3187
|
} else {
|
|
3172
3188
|
effective = local;
|
|
3173
3189
|
}
|
|
@@ -3193,7 +3209,7 @@ function resolveLogDestinationFrom(input) {
|
|
|
3193
3209
|
effective = null;
|
|
3194
3210
|
}
|
|
3195
3211
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
3196
|
-
return { kind: "folder", folder };
|
|
3212
|
+
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
3197
3213
|
}
|
|
3198
3214
|
var processTrustAnchorOnce;
|
|
3199
3215
|
function processTrustAnchor() {
|
|
@@ -3572,6 +3588,10 @@ function createLogSink(overrides = {}) {
|
|
|
3572
3588
|
`);
|
|
3573
3589
|
return;
|
|
3574
3590
|
}
|
|
3591
|
+
if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
|
|
3592
|
+
warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
|
|
3593
|
+
`);
|
|
3594
|
+
}
|
|
3575
3595
|
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
3576
3596
|
const header = buildHeader({
|
|
3577
3597
|
now,
|
|
@@ -4340,6 +4360,17 @@ var COMMANDS = [
|
|
|
4340
4360
|
"issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
|
|
4341
4361
|
],
|
|
4342
4362
|
status: "shipped"
|
|
4363
|
+
},
|
|
4364
|
+
{
|
|
4365
|
+
name: "log send",
|
|
4366
|
+
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
4367
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
4368
|
+
details: [
|
|
4369
|
+
"For a run whose events ended up on local disk instead of the configured server — an unattended run that fell back to the local folder because the trust-anchor read could not confirm its `logs.url` (a developer machine slower than the read deadline, or genuinely offline), or a retry queue holding a backlog or a `.draining.ndjson` a dead drain left behind. It moves the local folder's events into the retry queue and drains every queue for this repository through the SAME webhook delivery a live event uses.",
|
|
4370
|
+
"It resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — never a URL passed on the command line. A repository whose destination is a folder (or none) has nothing to send to a server and the command says so.",
|
|
4371
|
+
"Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
|
|
4372
|
+
],
|
|
4373
|
+
status: "shipped"
|
|
4343
4374
|
}
|
|
4344
4375
|
];
|
|
4345
4376
|
// ../../packages/sources/src/select-source.ts
|
|
@@ -1975,7 +1975,8 @@ async function trustAnchorRepoAsync() {
|
|
|
1975
1975
|
try {
|
|
1976
1976
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
1977
1977
|
encoding: "utf-8",
|
|
1978
|
-
timeout: 1e4
|
|
1978
|
+
timeout: 1e4,
|
|
1979
|
+
killSignal: "SIGKILL"
|
|
1979
1980
|
});
|
|
1980
1981
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
1981
1982
|
} catch {
|
|
@@ -2036,7 +2037,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
2036
2037
|
const repo = await trustAnchorRepoAsync();
|
|
2037
2038
|
if (!repo)
|
|
2038
2039
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
2039
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
2040
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
2040
2041
|
return stdout;
|
|
2041
2042
|
}
|
|
2042
2043
|
function firstLine(err) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attalabs/vinaya",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Vinaya — Agentic Engineering Harness. Deterministic checks every AI coding agent must satisfy before merge.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "FSL-1.1-ALv2",
|
|
7
7
|
"author": "Daniel Estevez",
|
|
8
8
|
"bin": {
|
|
9
9
|
"vinaya": "./dist/index.js",
|
|
@@ -21,15 +21,13 @@
|
|
|
21
21
|
|
|
22
22
|
import { packagesNamedIn } from './brief-validation'
|
|
23
23
|
import { deriveSection7 } from './derive-section7'
|
|
24
|
+
import type { GateCutovers } from './gate-cutovers'
|
|
24
25
|
import {
|
|
25
|
-
BRIEF_SECTIONS_SINCE_ISSUE,
|
|
26
|
-
DOCUMENTATION_SINCE_ISSUE,
|
|
27
26
|
globCoversPath,
|
|
28
27
|
type IssueDocumentation,
|
|
29
28
|
type IssuePart,
|
|
30
29
|
type IssueSurface,
|
|
31
|
-
type IssueTestPlan
|
|
32
|
-
OBJECTIVES_SINCE_ISSUE
|
|
30
|
+
type IssueTestPlan
|
|
33
31
|
} from './issue-validation'
|
|
34
32
|
import { type Objective, renderObjectives } from './objectives'
|
|
35
33
|
import { applyTierFloor, deriveTierFromDiff, readTierFromPrBody } from './pr-tier'
|
|
@@ -252,6 +250,16 @@ export type BriefFacts = {
|
|
|
252
250
|
* legitimate explicit opt-out and is rendered, never treated as absent.
|
|
253
251
|
*/
|
|
254
252
|
documentation: IssueDocumentation
|
|
253
|
+
/**
|
|
254
|
+
* The resolved gate cutovers (`resolveGateCutovers`, `apps/cli/src/lib/config.ts`).
|
|
255
|
+
* The renderer's missing-fact refusal for a missing `## Objectives`/
|
|
256
|
+
* `## Documentation` section grandfathers exactly the same class the Issue
|
|
257
|
+
* gate itself does — an Issue below the cutover legitimately has no such
|
|
258
|
+
* section — so the two never disagree. A `null` field means NO cutover: the
|
|
259
|
+
* section is expected on every Issue, from 1 (a repository that declares no
|
|
260
|
+
* `gateCutovers`, O1).
|
|
261
|
+
*/
|
|
262
|
+
cutovers: GateCutovers
|
|
255
263
|
dispatchReady: boolean
|
|
256
264
|
dispatchBlockers: string[]
|
|
257
265
|
surfaceFiles: SurfaceFileFact[]
|
|
@@ -271,6 +279,43 @@ export type BriefFacts = {
|
|
|
271
279
|
* for the review loop's reviewer-prompt facts.
|
|
272
280
|
*/
|
|
273
281
|
sourceRevision: string
|
|
282
|
+
/**
|
|
283
|
+
* How the repository this brief is rendered for invokes the Vinaya CLI —
|
|
284
|
+
* `npx --yes @attalabs/vinaya@<version>` for a repository that installs it
|
|
285
|
+
* from the registry, `bun <dir>/src/index.ts` for one that vendors it.
|
|
286
|
+
* Every command this renderer tells the Developer to run is written through
|
|
287
|
+
* it, so no brief ever names a path that exists only in the authoring
|
|
288
|
+
* repository.
|
|
289
|
+
*
|
|
290
|
+
* Passed in as a fact, never detected here: this module reads no
|
|
291
|
+
* environment and no filesystem, and the decision already has one owner —
|
|
292
|
+
* `apps/cli`'s `briefCliInvocation`, over the same vendored-CLI detection
|
|
293
|
+
* the generated hooks and workflows use. Empty refuses the render, the same
|
|
294
|
+
* as `sourceRevision`: a brief whose commands nobody can run is worse than
|
|
295
|
+
* no brief.
|
|
296
|
+
*/
|
|
297
|
+
cliInvocation: string
|
|
298
|
+
/**
|
|
299
|
+
* Commands the rendered-for repository ships itself that run an unabridged
|
|
300
|
+
* version of a CLI check this brief names — the CLI's own check being the
|
|
301
|
+
* portable form every reader has, and these being the fuller derivation the
|
|
302
|
+
* authoring repository additionally carries (`dispatch-readiness`'s shipped
|
|
303
|
+
* predicate reports prior-tranche-archival empty; `doc-coverage` evaluates
|
|
304
|
+
* C5 alone, not C1/C3). Each is the program alone, with no arguments — this
|
|
305
|
+
* renderer holds the task's own facts and appends them.
|
|
306
|
+
*
|
|
307
|
+
* `null` for a repository that has only the CLI's own checks, which is every
|
|
308
|
+
* adopter — the brief then names the CLI check and nothing else.
|
|
309
|
+
*/
|
|
310
|
+
localGateCommands: LocalGateCommands
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** See `BriefFacts.localGateCommands`. */
|
|
314
|
+
export type LocalGateCommands = {
|
|
315
|
+
/** e.g. `bun packages/aeg-core/bin/verify-dispatch.ts`, or `null`. */
|
|
316
|
+
dispatchReadiness: string | null
|
|
317
|
+
/** e.g. `bun packages/aeg-core/bin/verify-docs.ts`, or `null`. */
|
|
318
|
+
docCoverage: string | null
|
|
274
319
|
}
|
|
275
320
|
|
|
276
321
|
export type RenderResult = { ok: true; brief: string } | { ok: false; missing: string[] }
|
|
@@ -311,14 +356,37 @@ function isTestFile(path: string): boolean {
|
|
|
311
356
|
return /\.test\.[jt]sx?$/i.test(path)
|
|
312
357
|
}
|
|
313
358
|
|
|
359
|
+
/**
|
|
360
|
+
* A command the template (or this module) writes as a bare `vinaya <args>`,
|
|
361
|
+
* rewritten to the way the rendered-for repository actually invokes the CLI.
|
|
362
|
+
*
|
|
363
|
+
* Scoped to an inline code span's own opening backtick, deliberately: the word
|
|
364
|
+
* `vinaya` also occurs in ordinary prose the Planner wrote (`.vinaya/`, "the
|
|
365
|
+
* Vinaya Log", a Boundary quoting a command by name), and none of that is a
|
|
366
|
+
* command this brief is telling anyone to run.
|
|
367
|
+
*/
|
|
368
|
+
function withCliInvocation(text: string, invocation: string): string {
|
|
369
|
+
// The replacement is a REPLACER FUNCTION, never a string: in a string
|
|
370
|
+
// replacement `$&`, `` $` ``, `$'` and `$<name>` are substitution patterns,
|
|
371
|
+
// so an invocation carrying any of them would be expanded rather than
|
|
372
|
+
// copied. `cliInvocation` is an unconstrained `string` on the exported
|
|
373
|
+
// `BriefFacts` — the guards that keep it clean today (`self-host.ts`'s
|
|
374
|
+
// `SAFE_PATH`, `ownVersion`'s semver) live in another package, and this
|
|
375
|
+
// module must not depend on them holding.
|
|
376
|
+
return text.replaceAll('`vinaya ', () => `\`${invocation} `)
|
|
377
|
+
}
|
|
378
|
+
|
|
314
379
|
function renderHeader(facts: BriefFacts, template: string): string {
|
|
315
380
|
const introMatch = template.match(/^You are the AEG Developer\.[^\n]*$/m)
|
|
381
|
+
// Left as the template's own bare `vinaya`: `renderBrief` runs
|
|
382
|
+
// `withCliInvocation` over this whole section once every section is composed,
|
|
383
|
+
// so rewriting here too would be a second application point to keep in sync.
|
|
316
384
|
const intro = introMatch
|
|
317
385
|
? (introMatch[0] as string)
|
|
318
386
|
.replace(/\s*\[[^\]]*\]/g, '')
|
|
319
387
|
.replace(/\bBoth mandatory\.$/, 'Mandatory.')
|
|
320
388
|
.trim()
|
|
321
|
-
: 'You are the AEG Developer.
|
|
389
|
+
: 'You are the AEG Developer. Run `vinaya doctrine --role developer --print` and read its output first. Mandatory.'
|
|
322
390
|
|
|
323
391
|
const reason = facts.rationale.suggestedAgentClass ?? ''
|
|
324
392
|
// The declared tier is a floor, not a default: raised to the mechanical
|
|
@@ -354,8 +422,8 @@ function renderSection2(facts: BriefFacts): string {
|
|
|
354
422
|
const branch = developerBranchForFacts(facts)
|
|
355
423
|
const identityLine =
|
|
356
424
|
facts.trancheSlug !== null
|
|
357
|
-
? `- **Tranche:** \`${facts.trancheSlug}\`, task ${facts.taskId}, Issue #${facts.issue}. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`. Confirm
|
|
358
|
-
: `- **Backlog Issue:** #${facts.issue}, no tranche. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`. Confirm
|
|
425
|
+
? `- **Tranche:** \`${facts.trancheSlug}\`, task ${facts.taskId}, Issue #${facts.issue}. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`. Confirm dispatch readiness at your own Step 0, with the command §5 names.`
|
|
426
|
+
: `- **Backlog Issue:** #${facts.issue}, no tranche. Branch \`${branch}\`. \`Depends-on: ${depends}\`, \`Conflicts-with: ${conflicts}\`. Confirm dispatch readiness at your own Step 0, with the command §5 names.`
|
|
359
427
|
const lines = [
|
|
360
428
|
'## 2. Context — read before doing anything',
|
|
361
429
|
'',
|
|
@@ -554,10 +622,20 @@ function renderSection4(facts: BriefFacts): string {
|
|
|
554
622
|
|
|
555
623
|
function renderSection5(facts: BriefFacts): string {
|
|
556
624
|
const branch = developerBranchForFacts(facts)
|
|
625
|
+
// The portable form first — `dispatch-readiness` is a shipped check every
|
|
626
|
+
// reader of this brief can run. The authoring repository's own fuller
|
|
627
|
+
// derivation follows only when `facts` says that repository has one, and
|
|
628
|
+
// takes the task arguments from this render rather than from a placeholder.
|
|
629
|
+
const unabridgedTarget =
|
|
630
|
+
facts.trancheSlug !== null ? `${facts.trancheSlug} ${facts.taskId}` : `--issue ${facts.issue}`
|
|
631
|
+
const unabridged =
|
|
632
|
+
facts.localGateCommands.dispatchReadiness !== null
|
|
633
|
+
? ` This repository also ships the unabridged derivation — \`${facts.localGateCommands.dispatchReadiness} ${unabridgedTarget}\` → \`READY TO DISPATCH\`.`
|
|
634
|
+
: ''
|
|
557
635
|
const verifyLine =
|
|
558
|
-
facts.
|
|
559
|
-
|
|
560
|
-
|
|
636
|
+
`2. \`${facts.cliInvocation} check dispatch-readiness\` → pass (re-derived at render time: it was ready).` +
|
|
637
|
+
' Known gap: its prior-tranche-archival predicate always reports empty — confirm that predicate yourself.' +
|
|
638
|
+
unabridged
|
|
561
639
|
const lines = [
|
|
562
640
|
'## 5. Pre-flight checks',
|
|
563
641
|
'',
|
|
@@ -664,7 +742,20 @@ function renderSection7(section7Pointers: string[]): string {
|
|
|
664
742
|
return lines.join('\n')
|
|
665
743
|
}
|
|
666
744
|
|
|
667
|
-
|
|
745
|
+
/**
|
|
746
|
+
* The pre-open documentation gate, as one command the reader can run — cited
|
|
747
|
+
* by both §8 and §12, so it is written once. `check doc-coverage` is the
|
|
748
|
+
* portable form; the authoring repository's fuller `--pr` derivation is
|
|
749
|
+
* appended only when `facts` says that repository ships one.
|
|
750
|
+
*/
|
|
751
|
+
function docGateCommand(facts: BriefFacts): string {
|
|
752
|
+
const portable = `\`PR_BODY="$(cat <body-file>)" ${facts.cliInvocation} check doc-coverage\` green`
|
|
753
|
+
return facts.localGateCommands.docCoverage !== null
|
|
754
|
+
? `${portable} (this repository also ships \`PR_BODY="$(cat <body-file>)" ${facts.localGateCommands.docCoverage} --pr\`, which additionally evaluates the spec-status and code-requires-docs contracts)`
|
|
755
|
+
: portable
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function renderSection8(facts: BriefFacts): string {
|
|
668
759
|
return [
|
|
669
760
|
'## 8. Verification before claiming done',
|
|
670
761
|
'',
|
|
@@ -673,10 +764,10 @@ function renderSection8(): string {
|
|
|
673
764
|
// never a command a check or `pr report` executes — `evidence-fresh`
|
|
674
765
|
// re-running it under the twenty-six sibling checks CI had just built
|
|
675
766
|
// deleted their own `dist` out from under them.
|
|
676
|
-
|
|
767
|
+
`- The pre-push hook already ran the affected suite on your one push and refused it on failure — do not additionally run it yourself; \`${facts.cliInvocation} pr report --write\`/\`--push\` separately re-runs it with \`--force\` to attest the command and its output in the Evidence block.`,
|
|
677
768
|
"- The full `bun run test` suite is CI's to run, on the one push — never run it locally.",
|
|
678
769
|
'- Every blast-radius consumer named in §4, re-verified by name.',
|
|
679
|
-
|
|
770
|
+
`- The tier checklist in \`${facts.cliInvocation} doctrine --role developer --print\` genuinely satisfied, and ${docGateCommand(facts)}.`
|
|
680
771
|
].join('\n')
|
|
681
772
|
}
|
|
682
773
|
|
|
@@ -767,11 +858,9 @@ function renderSection12(facts: BriefFacts): string {
|
|
|
767
858
|
'## 12. Deliverable',
|
|
768
859
|
'',
|
|
769
860
|
`- PR title (exact): \`${prTitle}\``,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
'` at the top of the header block.',
|
|
774
|
-
'- Pre-open gate: tier checklist satisfied, and `PR_BODY="$(cat <body-file>)" bun packages/aeg-core/bin/verify-docs.ts --pr` green.',
|
|
861
|
+
`- Open the PR only via \`${facts.cliInvocation} pr create --body-file <path> --title "<title above>"\`.`,
|
|
862
|
+
`- PR body = the Developer's PR report (print it with \`${facts.cliInvocation} doctrine --template pr-report --print\`), with this entire brief pasted as the reference copy inside a collapsed \`<details>\` block, and \`Closes #${facts.issue}\` at the top of the header block.`,
|
|
863
|
+
`- Pre-open gate: tier checklist satisfied, and ${docGateCommand(facts)}.`,
|
|
775
864
|
'- Include `git diff main --stat` and a token report (if unavailable, state so).',
|
|
776
865
|
'- Then STOP. Review and Verification are separate invocations.'
|
|
777
866
|
].join('\n')
|
|
@@ -788,6 +877,11 @@ function renderSection12(facts: BriefFacts): string {
|
|
|
788
877
|
* is absent: never a default, per this rule that a brief states no
|
|
789
878
|
* fact it did not actually derive.
|
|
790
879
|
*/
|
|
880
|
+
/** Whether an Issue is at or above a resolved cutover — `true` for a `null` cutover (no grandfathering: every Issue is at or above "no cutover", O1). */
|
|
881
|
+
function atOrAboveCutover(issue: number, cutover: number | null): boolean {
|
|
882
|
+
return cutover === null || issue >= cutover
|
|
883
|
+
}
|
|
884
|
+
|
|
791
885
|
export function renderBrief(facts: BriefFacts, template: string): RenderResult {
|
|
792
886
|
const missing: string[] = []
|
|
793
887
|
|
|
@@ -797,11 +891,17 @@ export function renderBrief(facts: BriefFacts, template: string): RenderResult {
|
|
|
797
891
|
'Revision (no source revision resolved — the caller must refuse before render, never render with an empty one)'
|
|
798
892
|
)
|
|
799
893
|
}
|
|
894
|
+
if (!facts.cliInvocation) {
|
|
895
|
+
missing.push(
|
|
896
|
+
'CLI invocation (the caller must state how this repository invokes the CLI — every command this brief names is written through it)'
|
|
897
|
+
)
|
|
898
|
+
}
|
|
800
899
|
// Grandfathered the same as the Issue gate itself (`checkIssueObjectives`):
|
|
801
|
-
// an Issue below
|
|
802
|
-
// section, and the renderer must not newly refuse a class of
|
|
803
|
-
// other consumer in this task already exempts.
|
|
804
|
-
|
|
900
|
+
// an Issue below the resolved Objectives cutover legitimately has no
|
|
901
|
+
// `## Objectives` section, and the renderer must not newly refuse a class of
|
|
902
|
+
// Issue every other consumer in this task already exempts. A `null` cutover
|
|
903
|
+
// means no grandfathering — every Issue is expected to carry the section (O1).
|
|
904
|
+
if (facts.objectives.length === 0 && atOrAboveCutover(facts.issue, facts.cutovers.objectivesSinceIssue)) {
|
|
805
905
|
missing.push('Objectives (Issue has no `## Objectives` section)')
|
|
806
906
|
}
|
|
807
907
|
// Same grandfather posture as Objectives, not the four judgment sections
|
|
@@ -812,7 +912,7 @@ export function renderBrief(facts: BriefFacts, template: string): RenderResult {
|
|
|
812
912
|
if (
|
|
813
913
|
facts.documentation.kind === 'sources' &&
|
|
814
914
|
facts.documentation.sources.length === 0 &&
|
|
815
|
-
facts.issue
|
|
915
|
+
atOrAboveCutover(facts.issue, facts.cutovers.documentationSinceIssue)
|
|
816
916
|
) {
|
|
817
917
|
missing.push('Documentation (Issue has no `## Documentation` section)')
|
|
818
918
|
}
|
|
@@ -824,7 +924,10 @@ export function renderBrief(facts: BriefFacts, template: string): RenderResult {
|
|
|
824
924
|
// ISSUE CREATION gate starts requiring the section, not whether a brief
|
|
825
925
|
// can be rendered without one. The message names the cutover so a
|
|
826
926
|
// pre-cutover Issue reads this as "add the section", not as a gate bug.
|
|
827
|
-
const cutoverNote =
|
|
927
|
+
const cutoverNote =
|
|
928
|
+
facts.cutovers.briefSectionsSinceIssue !== null
|
|
929
|
+
? `the Issue predates the \`## Surface\`/\`## Parts\`/\`## Test plan\`/\`## Stop conditions\` gate cutover at #${facts.cutovers.briefSectionsSinceIssue}, but a brief still needs it to render`
|
|
930
|
+
: 'a brief still needs the `## Surface`/`## Parts`/`## Test plan`/`## Stop conditions` section to render'
|
|
828
931
|
if (facts.surface.in.length === 0) {
|
|
829
932
|
missing.push(`Surface (Issue has no \`## Surface\` section with a non-empty \`in:\` list — ${cutoverNote})`)
|
|
830
933
|
}
|
|
@@ -882,34 +985,47 @@ export function renderBrief(facts: BriefFacts, template: string): RenderResult {
|
|
|
882
985
|
)
|
|
883
986
|
: []
|
|
884
987
|
|
|
988
|
+
// `withCliInvocation` over every section the renderer composes, not only the
|
|
989
|
+
// ones whose commands it writes itself: a Planner's own prose (a Traps line,
|
|
990
|
+
// a Boundary, a Test plan entry) names `vinaya` commands too, and those were
|
|
991
|
+
// copied into an adopter's brief unrewritten — the same defect on the
|
|
992
|
+
// caller-supplied side, found by review.
|
|
993
|
+
//
|
|
994
|
+
// `## Objectives` is the one section held out, and the reason is a gate:
|
|
995
|
+
// `checkObjectivesCopy` refuses a brief whose Objectives do not match the
|
|
996
|
+
// Issue's word for word. An objective naming a command keeps the Issue's own
|
|
997
|
+
// spelling; §6's Parts cite it by id, so nothing there depends on the
|
|
998
|
+
// command form.
|
|
999
|
+
const withCli = (section: string): string => withCliInvocation(section, facts.cliInvocation)
|
|
1000
|
+
|
|
885
1001
|
const brief = [
|
|
886
|
-
renderHeader(scopedFacts, template),
|
|
1002
|
+
withCli(renderHeader(scopedFacts, template)),
|
|
887
1003
|
'',
|
|
888
1004
|
...(facts.objectives.length > 0 ? [renderObjectives(facts.objectives), ''] : []),
|
|
889
1005
|
...(facts.documentation.kind === 'none' || facts.documentation.sources.length > 0
|
|
890
|
-
? [renderDocumentation(facts.documentation), '']
|
|
1006
|
+
? [withCli(renderDocumentation(facts.documentation)), '']
|
|
891
1007
|
: []),
|
|
892
|
-
renderSection2(facts),
|
|
1008
|
+
withCli(renderSection2(facts)),
|
|
893
1009
|
'',
|
|
894
|
-
renderSection3(facts),
|
|
1010
|
+
withCli(renderSection3(facts)),
|
|
895
1011
|
'',
|
|
896
|
-
renderSection4(scopedFacts),
|
|
1012
|
+
withCli(renderSection4(scopedFacts)),
|
|
897
1013
|
'',
|
|
898
|
-
renderSection5(facts),
|
|
1014
|
+
withCli(renderSection5(facts)),
|
|
899
1015
|
'',
|
|
900
|
-
renderSection6(scopedFacts),
|
|
1016
|
+
withCli(renderSection6(scopedFacts)),
|
|
901
1017
|
'',
|
|
902
|
-
renderSection7(section7Pointers),
|
|
1018
|
+
withCli(renderSection7(section7Pointers)),
|
|
903
1019
|
'',
|
|
904
|
-
renderSection8(),
|
|
1020
|
+
withCli(renderSection8(facts)),
|
|
905
1021
|
'',
|
|
906
|
-
renderSection9(facts),
|
|
1022
|
+
withCli(renderSection9(facts)),
|
|
907
1023
|
'',
|
|
908
|
-
renderSection10(facts),
|
|
1024
|
+
withCli(renderSection10(facts)),
|
|
909
1025
|
'',
|
|
910
|
-
renderSection11(template, facts),
|
|
1026
|
+
withCli(renderSection11(template, facts)),
|
|
911
1027
|
'',
|
|
912
|
-
renderSection12(facts)
|
|
1028
|
+
withCli(renderSection12(facts))
|
|
913
1029
|
].join('\n')
|
|
914
1030
|
|
|
915
1031
|
return { ok: true, brief }
|
|
@@ -391,8 +391,22 @@ export const COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join('|')})(\\([a-
|
|
|
391
391
|
* (husky/commitlint parity, applied at the wrapper).
|
|
392
392
|
*/
|
|
393
393
|
export function checkForgeTitle(title: string): BriefSectionResult {
|
|
394
|
-
const taskStyle = /^\[[a-z0-9._-]+\] \
|
|
394
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/
|
|
395
395
|
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title)) return { status: 'pass', errors: [] }
|
|
396
|
+
// A title that is task-shaped except for a non-numeric id (`[slug] 7a — …`)
|
|
397
|
+
// gets the specific rule, not the generic "matches neither grammar": task ids
|
|
398
|
+
// are whole numbers, the same shape `vinaya task run`/`task dispatch` and the
|
|
399
|
+
// edge grammar (`parse-rationale-deps.ts`) accept — a lettered id names a task
|
|
400
|
+
// nothing downstream can start.
|
|
401
|
+
const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title)
|
|
402
|
+
if (letteredTaskId) {
|
|
403
|
+
return {
|
|
404
|
+
status: 'fail',
|
|
405
|
+
errors: [
|
|
406
|
+
`brief-validation title: "${title}" names task id \`${letteredTaskId[1]}\` — task ids are whole numbers (\`1\`, \`2\`), never lettered (\`2a\`). \`vinaya task run\` and \`task dispatch\` refuse a non-numeric id, so a plan titled this way names a task that cannot be started.`
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
}
|
|
396
410
|
return {
|
|
397
411
|
status: 'fail',
|
|
398
412
|
errors: [
|
|
@@ -518,6 +532,12 @@ export const COMMAND_WORDS = ['export', 'bun', 'gh', 'git', 'grep', 'sed', 'cat'
|
|
|
518
532
|
* pre-dispatch) has no PR number and applies all four unconditionally —
|
|
519
533
|
* grandfathering is a CI-only rollout concern, not a grammar relaxation
|
|
520
534
|
* (round-2 ruling addendum 1).
|
|
535
|
+
*
|
|
536
|
+
* Now this repository's own historical value, exported as the DEFAULT for
|
|
537
|
+
* `partitionBriefErrorsByRollout`'s `cutovers`, not the value the gate reads:
|
|
538
|
+
* the cutover is `vinaya.config.json`'s optional `gateCutovers.briefRulesSincePr`
|
|
539
|
+
* (absent → `null` → no grandfathering, block from PR 1, O1), restated as this
|
|
540
|
+
* repo's own value (O2).
|
|
521
541
|
*/
|
|
522
542
|
export const BRIEF_RULES_SINCE_PR = 394
|
|
523
543
|
|
|
@@ -532,6 +552,12 @@ export const BRIEF_RULES_SINCE_PR = 394
|
|
|
532
552
|
* (authoring time, pre-dispatch) has no PR number and applies the rule
|
|
533
553
|
* unconditionally, same grandfathering-is-CI-only posture as
|
|
534
554
|
* `BRIEF_RULES_SINCE_PR`.
|
|
555
|
+
*
|
|
556
|
+
* Now this repository's own historical value, exported as a DEFAULT for
|
|
557
|
+
* `partitionBriefErrorsByRollout`'s `cutovers`, not the value the gate reads:
|
|
558
|
+
* the cutover is `vinaya.config.json`'s optional
|
|
559
|
+
* `gateCutovers.agentBoxesRefusedSincePr` (absent → `null` → no grandfathering,
|
|
560
|
+
* block from PR 1, O1), restated as this repo's own value (O2).
|
|
535
561
|
*/
|
|
536
562
|
export const AGENT_BOXES_REFUSED_SINCE_PR = 396
|
|
537
563
|
|
|
@@ -555,36 +581,68 @@ export function checkNoAgentBoxes(prBody: string): BriefSectionResult {
|
|
|
555
581
|
}
|
|
556
582
|
}
|
|
557
583
|
|
|
584
|
+
/** Which rollout rule an error message belongs to (by its distinct prefix), or `null` for an always-blocking message no rollout covers. */
|
|
585
|
+
type BriefRolloutRule = 'briefRules' | 'agentBoxes'
|
|
586
|
+
|
|
587
|
+
function rolloutRuleFor(message: string): BriefRolloutRule | null {
|
|
588
|
+
if (
|
|
589
|
+
message.startsWith('brief-validation unpinned code claim:') ||
|
|
590
|
+
message.startsWith('brief-validation commands carry output:') ||
|
|
591
|
+
message.startsWith('brief-validation consumer tests:') ||
|
|
592
|
+
message.startsWith('brief-validation defeat cases:')
|
|
593
|
+
) {
|
|
594
|
+
return 'briefRules'
|
|
595
|
+
}
|
|
596
|
+
if (message.startsWith('brief-validation no agent boxes:')) return 'agentBoxes'
|
|
597
|
+
return null
|
|
598
|
+
}
|
|
599
|
+
|
|
558
600
|
/**
|
|
559
601
|
* True for an error message produced by one of the five grandfatherable
|
|
560
602
|
* rules below (the original four, plus `checkNoAgentBoxes`) — classified by
|
|
561
603
|
* each rule's own distinct message prefix, since `checkBriefSections`
|
|
562
|
-
* aggregates every sub-check's errors into one flat `string[]
|
|
563
|
-
*
|
|
604
|
+
* aggregates every sub-check's errors into one flat `string[]`. A pure
|
|
605
|
+
* classification of the message, independent of any actual cutover value.
|
|
564
606
|
*/
|
|
565
607
|
export function isGrandfatherableBriefRuleError(message: string): boolean {
|
|
566
|
-
return
|
|
608
|
+
return rolloutRuleFor(message) !== null
|
|
567
609
|
}
|
|
568
610
|
|
|
569
611
|
/**
|
|
570
|
-
* The rollout
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
* `
|
|
574
|
-
*
|
|
575
|
-
* can be added here without touching either existing one's grandfather
|
|
576
|
-
* window.
|
|
612
|
+
* The two PR rollout cutovers, `null` meaning NO cutover for that rule (its
|
|
613
|
+
* findings block on every PR, from PR 1 — a repository that declares no
|
|
614
|
+
* `gateCutovers`, O1). Resolved from `vinaya.config.json`'s optional
|
|
615
|
+
* `gateCutovers` key by `resolveGateCutovers` (`apps/cli/src/lib/config.ts`)
|
|
616
|
+
* and passed into `partitionBriefErrorsByRollout`; this module reads no config.
|
|
577
617
|
*/
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
618
|
+
export type BriefRolloutCutovers = {
|
|
619
|
+
briefRulesSincePr: number | null
|
|
620
|
+
agentBoxesRefusedSincePr: number | null
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* This repository's own historical rollout cutovers — the DEFAULT for a caller
|
|
625
|
+
* that does not resolve config (a test). Every enforcement path
|
|
626
|
+
* (`check-brief-shape.ts`) passes the resolved values, which are `null` when
|
|
627
|
+
* the key is absent.
|
|
628
|
+
*/
|
|
629
|
+
const DEFAULT_BRIEF_ROLLOUT_CUTOVERS: BriefRolloutCutovers = {
|
|
630
|
+
briefRulesSincePr: BRIEF_RULES_SINCE_PR,
|
|
631
|
+
agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* The rollout cutover a given error message is grandfathered against, or
|
|
636
|
+
* `null` — either because the message belongs to no rollout rule (always
|
|
637
|
+
* blocking), or because that rule's own cutover is `null` (no cutover
|
|
638
|
+
* configured, so nothing below it is grandfathered). A message is matched to
|
|
639
|
+
* whichever rule produced it, never a single global cutover, so a later third
|
|
640
|
+
* threshold can be added without touching either existing one's window.
|
|
641
|
+
*/
|
|
642
|
+
function rolloutThresholdFor(message: string, cutovers: BriefRolloutCutovers): number | null {
|
|
643
|
+
const rule = rolloutRuleFor(message)
|
|
644
|
+
if (rule === 'briefRules') return cutovers.briefRulesSincePr
|
|
645
|
+
if (rule === 'agentBoxes') return cutovers.agentBoxesRefusedSincePr
|
|
588
646
|
return null
|
|
589
647
|
}
|
|
590
648
|
|
|
@@ -592,7 +650,11 @@ function rolloutThresholdFor(message: string): number | null {
|
|
|
592
650
|
* Splits `checkBriefSections`'s flat error list into `blocking` (fails the
|
|
593
651
|
* check) and `info` (printed, never a failure) — the CI shim
|
|
594
652
|
* (`check-brief-shape.ts`) is the only caller, but the split is a pure
|
|
595
|
-
* function of `(errors, prNumber)` so it is unit-testable directly.
|
|
653
|
+
* function of `(errors, prNumber, cutovers)` so it is unit-testable directly.
|
|
654
|
+
*
|
|
655
|
+
* `cutovers` is the resolved rollout cutovers; a `null` field means that
|
|
656
|
+
* rule's findings are never grandfathered (block from PR 1, O1). Defaults to
|
|
657
|
+
* this repo's historical constants for a caller that does not resolve config.
|
|
596
658
|
*
|
|
597
659
|
* `prNumber === null` (no `PR_NUMBER`, or an unparseable one) is NOT
|
|
598
660
|
* grandfathered — only a real, parsed number below a message's own
|
|
@@ -602,12 +664,13 @@ function rolloutThresholdFor(message: string): number | null {
|
|
|
602
664
|
*/
|
|
603
665
|
export function partitionBriefErrorsByRollout(
|
|
604
666
|
errors: string[],
|
|
605
|
-
prNumber: number | null
|
|
667
|
+
prNumber: number | null,
|
|
668
|
+
cutovers: BriefRolloutCutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS
|
|
606
669
|
): { blocking: string[]; info: string[] } {
|
|
607
670
|
const blocking: string[] = []
|
|
608
671
|
const info: string[] = []
|
|
609
672
|
for (const e of errors) {
|
|
610
|
-
const threshold = rolloutThresholdFor(e)
|
|
673
|
+
const threshold = rolloutThresholdFor(e, cutovers)
|
|
611
674
|
const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold
|
|
612
675
|
;(grandfathered ? info : blocking).push(e)
|
|
613
676
|
}
|
|
@@ -511,11 +511,18 @@ export type { ForgeIssue }
|
|
|
511
511
|
* (aeg-core is pure). Defaults to `[]`, which leaves the registry half
|
|
512
512
|
* dormant — so a caller that has no registry to hand keeps R1's prior
|
|
513
513
|
* behaviour exactly.
|
|
514
|
+
* `objectivesSinceIssue`: the resolved Objectives cutover
|
|
515
|
+
* (`gateCutovers.objectivesSinceIssue`, resolved by the caller from
|
|
516
|
+
* `vinaya.config.json` — aeg-core is pure), threaded into `checkIssueObjectives`.
|
|
517
|
+
* `null` means NO cutover (grade every open Issue from 1, O1); `undefined`
|
|
518
|
+
* (an omitting caller, e.g. a test) falls through to `checkIssueObjectives`'s
|
|
519
|
+
* own default (this repo's historical cutover).
|
|
514
520
|
*/
|
|
515
521
|
export function checkR1(
|
|
516
522
|
issuesBySlug: Map<string, ForgeIssue[]>,
|
|
517
523
|
grandfatheredIssues: ReadonlySet<number>,
|
|
518
|
-
registeredNames: string[] = []
|
|
524
|
+
registeredNames: string[] = [],
|
|
525
|
+
objectivesSinceIssue?: number | null
|
|
519
526
|
): CheckResult {
|
|
520
527
|
const failures: CheckFailure[] = []
|
|
521
528
|
for (const [slug, issues] of issuesBySlug) {
|
|
@@ -524,7 +531,7 @@ export function checkR1(
|
|
|
524
531
|
const errors = [
|
|
525
532
|
...checkIssueRationale(issue.body).errors,
|
|
526
533
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
527
|
-
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
534
|
+
...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
|
|
528
535
|
// task 17, O2 — Parts coverage joins the sweep here: same
|
|
529
536
|
// dormant-when-absent posture as the other two, zero new inputs.
|
|
530
537
|
...checkPartsCiteDefinedObjectives(issue.body).errors
|