@attalabs/vinaya 0.44.1 → 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 +233 -195
- package/dist/checks/bin/check-branch-topology.js +70 -23
- package/dist/checks/bin/check-brief-shape.js +233 -195
- 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 +128 -34
- package/dist/checks/bin/check-coherence.js +336 -245
- package/dist/checks/bin/check-dispatch-readiness.js +3623 -463
- package/dist/checks/bin/check-doc-claims.js +233 -195
- package/dist/checks/bin/check-doc-coverage-push.js +243 -196
- package/dist/checks/bin/check-doc-coverage.js +243 -196
- package/dist/checks/bin/check-doctrine-no-procedures.js +233 -195
- package/dist/checks/bin/check-doctrine-portability.js +233 -195
- package/dist/checks/bin/check-evidence-fresh.js +9983 -1995
- package/dist/checks/bin/check-exec-bits.js +3 -0
- package/dist/checks/bin/check-first-push-dispatch.js +301 -224
- package/dist/checks/bin/check-issue-milestone-attach.js +65 -10
- package/dist/checks/bin/check-issue-objectives-numbering.js +233 -195
- package/dist/checks/bin/check-issue-parts-coverage.js +65 -10
- package/dist/checks/bin/check-issue-surface-globs.js +1032 -236
- package/dist/checks/bin/check-issue-title-grammar.js +5 -1
- package/dist/checks/bin/check-no-disk-state.js +5 -1
- package/dist/checks/bin/check-pr-premise-reassert.js +10 -1
- package/dist/checks/bin/check-pr-report-density.js +5 -1
- package/dist/checks/bin/check-principal-test-plan-wait.js +253 -201
- package/dist/checks/bin/check-quoted-command.js +233 -195
- package/dist/checks/bin/check-reader-resolvable-prose.js +233 -195
- package/dist/checks/bin/check-registry-gates.js +131 -34
- package/dist/checks/bin/check-retired-vocabulary.js +233 -195
- package/dist/checks/bin/check-review-gate.js +233 -195
- package/dist/checks/bin/check-single-plan-pr.js +5 -1
- package/dist/checks/bin/check-surface-scope.js +107 -32
- package/dist/checks/bin/check-test-plan.js +253 -201
- 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 +16617 -7187
- package/dist/lib/pre-push-cache-test-run.js +4487 -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 +15612 -7634
- 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 +9476 -1820
- package/dist/programs/pr-snapshot.js +8916 -1515
- package/dist/programs/pr-verify-evidence.js +9481 -1825
- package/dist/programs/pr.js +11709 -4033
- package/dist/programs/review-post.js +11140 -3496
- package/dist/programs/review-status.js +8996 -1533
- package/dist/programs/run-engine.js +22031 -18759
- package/dist/programs/sync.js +9030 -1629
- package/dist/programs/task-brief.js +10185 -1821
- package/dist/programs/task-sweep.js +9266 -1621
- package/dist/programs/task-tools-serve.js +77118 -16678
- 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 +3 -3
- package/dist/types/harness/processes/vinaya-strict/tools/task-contract/objectives.d.ts +5 -6
- 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 +4 -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 +2 -1
- 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 +29 -8
- 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/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/.next/static/{3URbt6IPajL5OOhijN1-x → bJrgAp9Kl4JsCUYkeAYez}/_ssgManifest.js +0 -0
|
@@ -1,10 +1,498 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __esm = (fn, res, err) => () => {
|
|
3
|
+
if (fn)
|
|
4
|
+
try {
|
|
5
|
+
res = fn(fn = 0);
|
|
6
|
+
} catch (e) {
|
|
7
|
+
err = [e];
|
|
8
|
+
}
|
|
9
|
+
if (err)
|
|
10
|
+
throw err[0];
|
|
11
|
+
return res;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// ../../harness/kernel/log/schema.ts
|
|
15
|
+
import {
|
|
16
|
+
CODE_TOKEN_PATTERN,
|
|
17
|
+
CONFIDENCE_REASON_MAX_LENGTH,
|
|
18
|
+
CustomEventSchema,
|
|
19
|
+
DevReviewLoopEventSchema,
|
|
20
|
+
DispatchEventSchema,
|
|
21
|
+
EffectEventSchema,
|
|
22
|
+
FlowSchema,
|
|
23
|
+
ForgeOpSchema,
|
|
24
|
+
ForgeWriteEventSchema,
|
|
25
|
+
GateEventSchema,
|
|
26
|
+
GateOutcomeSchema,
|
|
27
|
+
HandoffEventSchema,
|
|
28
|
+
HeaderMetaSchema,
|
|
29
|
+
HeaderMetaV1Schema,
|
|
30
|
+
HeaderMetaV2Schema,
|
|
31
|
+
HeaderMetaV3Schema,
|
|
32
|
+
HeaderMetaV4Schema,
|
|
33
|
+
HeaderSchema,
|
|
34
|
+
HOST_VALUES,
|
|
35
|
+
HostSchema,
|
|
36
|
+
InputVersionsSchema,
|
|
37
|
+
LineageSchema,
|
|
38
|
+
LogEventSchema,
|
|
39
|
+
OperationEventSchema,
|
|
40
|
+
OperationResultSchema,
|
|
41
|
+
ProvenanceSchema,
|
|
42
|
+
processAndRunnerOf,
|
|
43
|
+
REVIEW_FINDING_DESCRIPTION_MAX_LENGTH,
|
|
44
|
+
ROLE_NAME_PATTERN,
|
|
45
|
+
RoleAttemptEventSchema,
|
|
46
|
+
RoleAttemptOutcomeSchema,
|
|
47
|
+
RoleSchema,
|
|
48
|
+
UsageEventSchema,
|
|
49
|
+
WorkSchema
|
|
50
|
+
} from "@attalabs/vinaya-log-sdk";
|
|
51
|
+
var init_schema = () => {};
|
|
52
|
+
|
|
53
|
+
// ../../harness/kernel/connectors/checkpoint/control-store/records.ts
|
|
54
|
+
import { z } from "zod";
|
|
55
|
+
var isoTimestamp, taskId, epochNumber, RunRecordSchema, InputRecordSchema, OwnershipRecordSchema, TransitionRecordSchema, ManifestRecordSchema, roundHeadIdentity, LoopBudgetsSchema, LoopStateRecordSchema, EffectRecordSchema, EscalationRecordSchema, ResolutionRecordSchema, ExecutionRoundMirrorRecordSchema;
|
|
56
|
+
var init_records = __esm(() => {
|
|
57
|
+
isoTimestamp = z.string().min(1);
|
|
58
|
+
taskId = z.number().int().positive();
|
|
59
|
+
epochNumber = z.number().int().nonnegative();
|
|
60
|
+
RunRecordSchema = z.object({
|
|
61
|
+
version: z.literal(1),
|
|
62
|
+
kind: z.literal("run"),
|
|
63
|
+
task: taskId,
|
|
64
|
+
runId: z.string().min(1),
|
|
65
|
+
pid: z.number().int().positive(),
|
|
66
|
+
host: z.string().min(1),
|
|
67
|
+
startedAt: isoTimestamp,
|
|
68
|
+
childStartedAt: z.string().min(1).nullable().optional(),
|
|
69
|
+
childCommand: z.string().min(1).nullable().optional()
|
|
70
|
+
}).strict();
|
|
71
|
+
InputRecordSchema = z.object({
|
|
72
|
+
version: z.literal(1),
|
|
73
|
+
kind: z.literal("input"),
|
|
74
|
+
task: taskId,
|
|
75
|
+
runId: z.string().min(1),
|
|
76
|
+
source: z.union([z.literal("fresh"), z.literal("resume")]),
|
|
77
|
+
pr: z.number().int().positive().nullable(),
|
|
78
|
+
round: z.number().int().nonnegative(),
|
|
79
|
+
recordedAt: isoTimestamp
|
|
80
|
+
}).strict();
|
|
81
|
+
OwnershipRecordSchema = z.object({
|
|
82
|
+
version: z.literal(1),
|
|
83
|
+
kind: z.literal("ownership"),
|
|
84
|
+
task: taskId,
|
|
85
|
+
epoch: epochNumber,
|
|
86
|
+
ownerId: z.string().min(1),
|
|
87
|
+
pid: z.number().int().positive(),
|
|
88
|
+
host: z.string().min(1),
|
|
89
|
+
acquiredAt: isoTimestamp
|
|
90
|
+
}).strict();
|
|
91
|
+
TransitionRecordSchema = z.object({
|
|
92
|
+
version: z.literal(1),
|
|
93
|
+
kind: z.literal("transition"),
|
|
94
|
+
task: taskId,
|
|
95
|
+
epoch: epochNumber,
|
|
96
|
+
seq: z.number().int().nonnegative(),
|
|
97
|
+
from: z.string().min(1),
|
|
98
|
+
to: z.string().min(1),
|
|
99
|
+
detail: z.string().optional(),
|
|
100
|
+
at: isoTimestamp
|
|
101
|
+
}).strict();
|
|
102
|
+
ManifestRecordSchema = z.object({
|
|
103
|
+
version: z.literal(1),
|
|
104
|
+
kind: z.literal("manifest"),
|
|
105
|
+
task: taskId,
|
|
106
|
+
round: epochNumber,
|
|
107
|
+
repository: z.string().min(1),
|
|
108
|
+
pr: z.number().int().positive(),
|
|
109
|
+
branch: z.string().min(1),
|
|
110
|
+
baseSha: z.string().min(1).nullable(),
|
|
111
|
+
headSha: z.string().min(1),
|
|
112
|
+
briefHash: z.string().min(1).nullable(),
|
|
113
|
+
objectivesVersion: z.string().min(1).nullable(),
|
|
114
|
+
rulingOrdinal: epochNumber,
|
|
115
|
+
manifestVersion: z.literal(2).optional(),
|
|
116
|
+
pauseBoundRuling: z.object({
|
|
117
|
+
rulingId: z.string().min(1),
|
|
118
|
+
pauseId: z.string().min(1),
|
|
119
|
+
contentDigest: z.string().min(1)
|
|
120
|
+
}).strict().nullable().optional(),
|
|
121
|
+
policyDigest: z.string().min(1),
|
|
122
|
+
recordedAt: isoTimestamp
|
|
123
|
+
}).strict();
|
|
124
|
+
roundHeadIdentity = z.object({ round: z.number().int().positive(), head: z.string().min(1) }).strict();
|
|
125
|
+
LoopBudgetsSchema = z.object({
|
|
126
|
+
mechanicalRetries: z.number().int().nonnegative(),
|
|
127
|
+
reviewRounds: z.number().int().nonnegative(),
|
|
128
|
+
infrastructureRetries: z.number().int().nonnegative()
|
|
129
|
+
}).strict();
|
|
130
|
+
LoopStateRecordSchema = z.object({
|
|
131
|
+
version: z.literal(1),
|
|
132
|
+
kind: z.literal("loop_state"),
|
|
133
|
+
task: taskId,
|
|
134
|
+
round: z.number().int().positive(),
|
|
135
|
+
phase: z.string().min(1),
|
|
136
|
+
pauseReason: z.string().min(1).nullable(),
|
|
137
|
+
budgets: LoopBudgetsSchema,
|
|
138
|
+
heldResult: roundHeadIdentity.nullable(),
|
|
139
|
+
deliveredFindings: roundHeadIdentity.nullable(),
|
|
140
|
+
repeatMemory: z.object({
|
|
141
|
+
blockingFindings: z.array(z.string()),
|
|
142
|
+
lastFailure: z.object({ signature: z.string(), message: z.string(), developerAttemptedSince: z.boolean().optional() }).nullable()
|
|
143
|
+
}).strict().optional(),
|
|
144
|
+
developerHandoff: z.object({
|
|
145
|
+
findings: z.array(z.object({ id: z.string().min(1), description: z.string().min(1) }).strict()),
|
|
146
|
+
failingChecks: z.array(z.string().min(1))
|
|
147
|
+
}).strict().optional(),
|
|
148
|
+
publicationExpectedBase: z.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
149
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
150
|
+
phaseMs: z.record(z.string(), z.number().nonnegative()).optional(),
|
|
151
|
+
recordedAt: isoTimestamp
|
|
152
|
+
}).strict();
|
|
153
|
+
EffectRecordSchema = z.object({
|
|
154
|
+
version: z.literal(1),
|
|
155
|
+
kind: z.literal("effect"),
|
|
156
|
+
task: taskId,
|
|
157
|
+
key: z.string().min(1),
|
|
158
|
+
operation: z.string().min(1),
|
|
159
|
+
target: z.string().min(1),
|
|
160
|
+
inputVersion: z.number().int().nonnegative(),
|
|
161
|
+
payloadDigest: z.string().min(1),
|
|
162
|
+
status: z.union([z.literal("started"), z.literal("verified"), z.literal("uncertain")]),
|
|
163
|
+
url: z.string().optional(),
|
|
164
|
+
recordedAt: isoTimestamp
|
|
165
|
+
}).strict();
|
|
166
|
+
EscalationRecordSchema = z.object({
|
|
167
|
+
version: z.literal(1),
|
|
168
|
+
kind: z.literal("escalation"),
|
|
169
|
+
task: taskId,
|
|
170
|
+
escalationId: z.string().min(1),
|
|
171
|
+
round: epochNumber,
|
|
172
|
+
head: z.string().min(1),
|
|
173
|
+
branch: z.string().min(1),
|
|
174
|
+
pr: z.number().int().positive().nullable(),
|
|
175
|
+
runId: z.string().min(1),
|
|
176
|
+
pid: z.number().int().positive(),
|
|
177
|
+
host: z.string().min(1),
|
|
178
|
+
agent: z.string().min(1).optional(),
|
|
179
|
+
reason: z.string().min(1),
|
|
180
|
+
detail: z.string().optional(),
|
|
181
|
+
evidence: z.string().optional(),
|
|
182
|
+
attemptedRecovery: z.string().min(1),
|
|
183
|
+
requestedDecision: z.string().min(1),
|
|
184
|
+
recipient: z.string().min(1),
|
|
185
|
+
briefHash: z.string().min(1).nullable(),
|
|
186
|
+
objectivesVersion: z.string().min(1).nullable(),
|
|
187
|
+
rulingOrdinal: epochNumber,
|
|
188
|
+
policyDigest: z.string().min(1),
|
|
189
|
+
recordedAt: isoTimestamp
|
|
190
|
+
}).strict();
|
|
191
|
+
ResolutionRecordSchema = z.object({
|
|
192
|
+
version: z.literal(1),
|
|
193
|
+
kind: z.literal("resolution"),
|
|
194
|
+
task: taskId,
|
|
195
|
+
escalationId: z.string().min(1),
|
|
196
|
+
decision: z.union([z.literal("resume"), z.literal("cancel")]),
|
|
197
|
+
authenticatedBy: z.string().min(1),
|
|
198
|
+
authenticatedFrom: z.string().min(1),
|
|
199
|
+
consumedAt: isoTimestamp
|
|
200
|
+
}).strict();
|
|
201
|
+
ExecutionRoundMirrorRecordSchema = z.object({
|
|
202
|
+
version: z.literal(1),
|
|
203
|
+
kind: z.literal("execution_round"),
|
|
204
|
+
task: taskId,
|
|
205
|
+
repository: z.string().min(1),
|
|
206
|
+
threadId: z.string().min(1),
|
|
207
|
+
checkpointId: z.string().min(1),
|
|
208
|
+
round: z.number().int().positive(),
|
|
209
|
+
recordedAt: isoTimestamp
|
|
210
|
+
}).strict();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// ../../harness/kernel/connectors/checkpoint/control-store/local.ts
|
|
214
|
+
var init_local = __esm(() => {
|
|
215
|
+
init_records();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// ../../harness/kernel/connectors/checkpoint/control-store/migration.ts
|
|
219
|
+
var init_migration = __esm(() => {
|
|
220
|
+
init_local();
|
|
221
|
+
});
|
|
222
|
+
// ../../harness/kernel/connectors/checkpoint/control-store/index.ts
|
|
223
|
+
var init_control_store = __esm(() => {
|
|
224
|
+
init_records();
|
|
225
|
+
init_local();
|
|
226
|
+
init_migration();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// ../../harness/kernel/adapters/code-host/github/resolve-repo.ts
|
|
230
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
231
|
+
import { promisify as promisify4 } from "node:util";
|
|
232
|
+
async function resolveRepo2(exec = defaultExec2) {
|
|
233
|
+
if (cached2 !== undefined)
|
|
234
|
+
return cached2;
|
|
235
|
+
const fromEnv = process.env.VINAYA_REPO;
|
|
236
|
+
if (fromEnv) {
|
|
237
|
+
const parsed = parseOwnerRepo2(fromEnv);
|
|
238
|
+
if (parsed) {
|
|
239
|
+
cached2 = parsed;
|
|
240
|
+
return cached2;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (inflight2)
|
|
244
|
+
return inflight2;
|
|
245
|
+
inflight2 = (async () => {
|
|
246
|
+
try {
|
|
247
|
+
const { stdout } = await exec();
|
|
248
|
+
cached2 = parseGitRemoteUrl2(stdout.trim());
|
|
249
|
+
return cached2;
|
|
250
|
+
} catch (err) {
|
|
251
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
252
|
+
console.warn(`[resolve-repo] resolveRepo: git remote lookup failed (will retry): ${message}`);
|
|
253
|
+
return null;
|
|
254
|
+
} finally {
|
|
255
|
+
inflight2 = undefined;
|
|
256
|
+
}
|
|
257
|
+
})();
|
|
258
|
+
return inflight2;
|
|
259
|
+
}
|
|
260
|
+
function parseGitRemoteUrl2(url) {
|
|
261
|
+
const ssh = url.match(/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/);
|
|
262
|
+
if (ssh?.[1] && ssh[2])
|
|
263
|
+
return { owner: ssh[1], repo: ssh[2] };
|
|
264
|
+
const https = url.match(/^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
265
|
+
if (https?.[1] && https[2])
|
|
266
|
+
return { owner: https[1], repo: https[2] };
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
function parseOwnerRepo2(value) {
|
|
270
|
+
const match = value.match(/^([^/]+)\/(.+)$/);
|
|
271
|
+
if (!match?.[1] || !match[2])
|
|
272
|
+
return null;
|
|
273
|
+
return { owner: match[1], repo: match[2] };
|
|
274
|
+
}
|
|
275
|
+
var execFileAsync4, systemEnv4, defaultExec2 = () => execFileAsync4("git", ["remote", "get-url", "origin"], { env: systemEnv4, timeout: 5000 }), cached2, inflight2;
|
|
276
|
+
var init_resolve_repo = __esm(() => {
|
|
277
|
+
execFileAsync4 = promisify4(execFile4);
|
|
278
|
+
systemEnv4 = {
|
|
279
|
+
...process.env,
|
|
280
|
+
PATH: [process.env.PATH, "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"].filter(Boolean).join(":")
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
// ../../harness/kernel/log/roles.ts
|
|
285
|
+
var roles, titles;
|
|
286
|
+
var init_roles = __esm(() => {
|
|
287
|
+
roles = new Map;
|
|
288
|
+
titles = new Map;
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// ../../harness/kernel/log/envelope.ts
|
|
292
|
+
var init_envelope = __esm(() => {
|
|
293
|
+
init_roles();
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// ../../harness/kernel/log/store.ts
|
|
297
|
+
import {
|
|
298
|
+
classifyStoredLine,
|
|
299
|
+
createFixtureStore,
|
|
300
|
+
KNOWN_SCHEMA_VERSIONS,
|
|
301
|
+
readPageFrom,
|
|
302
|
+
recordIdentity
|
|
303
|
+
} from "@attalabs/vinaya-log-sdk";
|
|
304
|
+
var init_store = () => {};
|
|
305
|
+
|
|
306
|
+
// ../../harness/kernel/log/redact.ts
|
|
307
|
+
import { redact } from "@attalabs/vinaya-log-sdk";
|
|
308
|
+
var init_redact = () => {};
|
|
309
|
+
|
|
310
|
+
// ../../harness/kernel/log/deferred-sink-factory.ts
|
|
311
|
+
function loadDeferredLogSinkFactory() {
|
|
312
|
+
return deferred?.();
|
|
313
|
+
}
|
|
314
|
+
var deferred;
|
|
315
|
+
|
|
316
|
+
// ../../harness/kernel/config/loader/config-provider.ts
|
|
317
|
+
function configProvider() {
|
|
318
|
+
if (!installed)
|
|
319
|
+
throw new Error(NO_CONFIG_PROVIDER_MESSAGE);
|
|
320
|
+
return installed;
|
|
321
|
+
}
|
|
322
|
+
var installed = null, NO_CONFIG_PROVIDER_MESSAGE = "no configuration provider is installed — a composition root must call installConfigProvider() before any configuration read";
|
|
323
|
+
|
|
324
|
+
// ../../harness/kernel/config/schema/config-schema.ts
|
|
325
|
+
import { z as z2 } from "zod";
|
|
326
|
+
function isSafeRepoRelPath(p) {
|
|
327
|
+
if (p.length === 0)
|
|
328
|
+
return false;
|
|
329
|
+
if (p.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(p))
|
|
330
|
+
return false;
|
|
331
|
+
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
332
|
+
}
|
|
333
|
+
var EnvEntrySchema, KERNEL_CHECK_ENTRY_FIELDS, SafeRepoRelPath;
|
|
334
|
+
var init_config_schema = __esm(() => {
|
|
335
|
+
EnvEntrySchema = z2.union([
|
|
336
|
+
z2.literal(true),
|
|
337
|
+
z2.object({ optional: z2.literal(true) }),
|
|
338
|
+
z2.object({ anyOf: z2.array(z2.string()).min(2) }),
|
|
339
|
+
z2.string()
|
|
340
|
+
]);
|
|
341
|
+
KERNEL_CHECK_ENTRY_FIELDS = {
|
|
342
|
+
run: z2.string(),
|
|
343
|
+
scope: z2.enum(["diff", "full"]),
|
|
344
|
+
include: z2.array(z2.string()).optional(),
|
|
345
|
+
args: z2.array(z2.string()).optional(),
|
|
346
|
+
timeoutMs: z2.number().optional(),
|
|
347
|
+
env: z2.record(z2.string(), EnvEntrySchema).optional(),
|
|
348
|
+
requiresOpenPr: z2.boolean().optional(),
|
|
349
|
+
ownWorkflow: z2.boolean().optional(),
|
|
350
|
+
validates: z2.enum(["body", "issue"]).optional(),
|
|
351
|
+
advisory: z2.literal(true).optional()
|
|
352
|
+
};
|
|
353
|
+
SafeRepoRelPath = z2.string().refine(isSafeRepoRelPath, {
|
|
354
|
+
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// ../../harness/kernel/run-paths.ts
|
|
359
|
+
var init_run_paths = __esm(() => {
|
|
360
|
+
init_control_store();
|
|
361
|
+
init_config_schema();
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
// ../../harness/kernel/log/local-copy-writer.ts
|
|
365
|
+
import {
|
|
366
|
+
DEFAULT_KEEP_DAYS,
|
|
367
|
+
defaultRuntimeDir as sdkDefaultRuntimeDir,
|
|
368
|
+
resolveSettings as sdkResolveSettings,
|
|
369
|
+
sendLocalCopy
|
|
370
|
+
} from "@attalabs/vinaya-log-sdk";
|
|
371
|
+
var folderSends;
|
|
372
|
+
var init_local_copy_writer = __esm(() => {
|
|
373
|
+
init_run_paths();
|
|
374
|
+
folderSends = new Map;
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// ../../harness/kernel/log/log-sink.ts
|
|
378
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
379
|
+
import { randomUUID } from "node:crypto";
|
|
380
|
+
import {
|
|
381
|
+
appendFileSync,
|
|
382
|
+
closeSync,
|
|
383
|
+
constants as fsConstants,
|
|
384
|
+
fstatSync,
|
|
385
|
+
mkdirSync,
|
|
386
|
+
lstatSync,
|
|
387
|
+
openSync,
|
|
388
|
+
readFileSync,
|
|
389
|
+
renameSync,
|
|
390
|
+
writeFileSync,
|
|
391
|
+
writeSync
|
|
392
|
+
} from "node:fs";
|
|
393
|
+
import { promisify as promisify5 } from "node:util";
|
|
394
|
+
function withDeadline(work, ms, fallback) {
|
|
395
|
+
return new Promise((resolve) => {
|
|
396
|
+
let graceTimer;
|
|
397
|
+
const timer = setTimeout(() => {
|
|
398
|
+
graceTimer = setTimeout(() => resolve(fallback), WITH_DEADLINE_GRACE_MS);
|
|
399
|
+
graceTimer.unref?.();
|
|
400
|
+
}, ms);
|
|
401
|
+
timer.unref?.();
|
|
402
|
+
const settle = (answer) => {
|
|
403
|
+
clearTimeout(timer);
|
|
404
|
+
if (graceTimer !== undefined)
|
|
405
|
+
clearTimeout(graceTimer);
|
|
406
|
+
resolve(answer);
|
|
407
|
+
};
|
|
408
|
+
work.then((value) => settle(value), () => settle(fallback));
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
async function safeLoadTrustAnchorConfig() {
|
|
412
|
+
return withDeadline(configProvider().loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
413
|
+
}
|
|
414
|
+
function createTrustAnchorCache(read, now = Date.now, bounds = {
|
|
415
|
+
retryIntervalMs: LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS,
|
|
416
|
+
maxRetries: LOG_DESTINATION_ANCHOR_MAX_RETRIES
|
|
417
|
+
}) {
|
|
418
|
+
const slots = new Map;
|
|
419
|
+
const start = (repoRoot, retries) => {
|
|
420
|
+
const slot = {
|
|
421
|
+
reading: Promise.resolve().then(read).catch(() => null),
|
|
422
|
+
retries,
|
|
423
|
+
missedAt: null
|
|
424
|
+
};
|
|
425
|
+
slots.set(repoRoot, slot);
|
|
426
|
+
slot.reading.then((config) => {
|
|
427
|
+
if (config === null)
|
|
428
|
+
slot.missedAt = now();
|
|
429
|
+
});
|
|
430
|
+
return slot.reading;
|
|
431
|
+
};
|
|
432
|
+
return {
|
|
433
|
+
get: (repoRoot) => {
|
|
434
|
+
const slot = slots.get(repoRoot);
|
|
435
|
+
if (slot === undefined)
|
|
436
|
+
return start(repoRoot, 0);
|
|
437
|
+
if (slot.missedAt === null)
|
|
438
|
+
return slot.reading;
|
|
439
|
+
if (slot.retries >= bounds.maxRetries || now() - slot.missedAt < bounds.retryIntervalMs)
|
|
440
|
+
return slot.reading;
|
|
441
|
+
return start(repoRoot, slot.retries + 1);
|
|
442
|
+
},
|
|
443
|
+
clear: () => slots.clear()
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
function createDefaultLogSinkSlot(runId) {
|
|
447
|
+
let factory;
|
|
448
|
+
let sink;
|
|
449
|
+
return {
|
|
450
|
+
install: (next) => {
|
|
451
|
+
factory = next;
|
|
452
|
+
},
|
|
453
|
+
sink: () => {
|
|
454
|
+
if (sink !== undefined)
|
|
455
|
+
return sink;
|
|
456
|
+
if (factory === undefined)
|
|
457
|
+
factory = loadDeferredLogSinkFactory();
|
|
458
|
+
if (factory === undefined) {
|
|
459
|
+
throw new Error("vinaya log: no default log sink factory is installed — the entry point calls installDefaultLogSinkFactory before anything logs");
|
|
460
|
+
}
|
|
461
|
+
sink = factory({ runId });
|
|
462
|
+
return sink;
|
|
463
|
+
},
|
|
464
|
+
built: () => sink,
|
|
465
|
+
runId
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
var OUTBOX_MAX_BYTES, LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000, WITH_DEADLINE_GRACE_MS = 100, LOG_DESTINATION_ANCHOR_RETRY_INTERVAL_MS = 30000, LOG_DESTINATION_ANCHOR_MAX_RETRIES = 5, processTrustAnchorByRepo, defaultBranchSettingsByRepo, branchIssueByCwd, branchIssueSettledByCwd, headShaByCwd, headShaSettledByCwd, execFileAsync5, APPEND_OPEN_FLAGS, defaultSinkSlot, extraDrains;
|
|
469
|
+
var init_log_sink = __esm(() => {
|
|
470
|
+
init_resolve_repo();
|
|
471
|
+
init_envelope();
|
|
472
|
+
init_schema();
|
|
473
|
+
init_store();
|
|
474
|
+
init_redact();
|
|
475
|
+
init_local_copy_writer();
|
|
476
|
+
init_config_schema();
|
|
477
|
+
init_run_paths();
|
|
478
|
+
OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
479
|
+
processTrustAnchorByRepo = createTrustAnchorCache(safeLoadTrustAnchorConfig);
|
|
480
|
+
defaultBranchSettingsByRepo = new Map;
|
|
481
|
+
branchIssueByCwd = new Map;
|
|
482
|
+
branchIssueSettledByCwd = new Map;
|
|
483
|
+
headShaByCwd = new Map;
|
|
484
|
+
headShaSettledByCwd = new Map;
|
|
485
|
+
execFileAsync5 = promisify5(execFile5);
|
|
486
|
+
APPEND_OPEN_FLAGS = fsConstants.O_WRONLY | fsConstants.O_APPEND | fsConstants.O_CREAT | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK;
|
|
487
|
+
defaultSinkSlot = createDefaultLogSinkSlot(process.env.VINAYA_RUN_ID || randomUUID());
|
|
488
|
+
extraDrains = new Set;
|
|
489
|
+
});
|
|
2
490
|
|
|
3
491
|
// ../../harness/processes/vinaya-strict/checks/standalone/verify-dispatch.ts
|
|
4
|
-
import { execFile as
|
|
5
|
-
import { existsSync, readFileSync as
|
|
492
|
+
import { execFile as execFile6, execFileSync as execFileSync3, spawnSync } from "child_process";
|
|
493
|
+
import { existsSync, readFileSync as readFileSync3 } from "fs";
|
|
6
494
|
import { join as join2 } from "path";
|
|
7
|
-
import { promisify as
|
|
495
|
+
import { promisify as promisify6 } from "util";
|
|
8
496
|
|
|
9
497
|
// ../../harness/processes/vinaya-strict/tools/task-contract/forge/parse-rationale-deps.ts
|
|
10
498
|
var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
|
|
@@ -145,6 +633,31 @@ async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
|
145
633
|
}
|
|
146
634
|
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
147
635
|
}
|
|
636
|
+
var LABEL_ISSUE_COUNTS_QUERY = `query($owner: String!, $name: String!, $endCursor: String) {
|
|
637
|
+
repository(owner: $owner, name: $name) {
|
|
638
|
+
labels(first: 100, after: $endCursor, query: $labelQuery) {
|
|
639
|
+
pageInfo { hasNextPage endCursor }
|
|
640
|
+
nodes { name open: issues(states: OPEN) { totalCount } all: issues { totalCount } }
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}`;
|
|
644
|
+
async function ghLabelIssueCountsAsync(owner, repo, labelQuery) {
|
|
645
|
+
const stdout = await runAsync([
|
|
646
|
+
"api",
|
|
647
|
+
"graphql",
|
|
648
|
+
"--paginate",
|
|
649
|
+
"-f",
|
|
650
|
+
`query=${LABEL_ISSUE_COUNTS_QUERY.replace("$labelQuery", JSON.stringify(labelQuery))}`,
|
|
651
|
+
"-f",
|
|
652
|
+
`owner=${owner}`,
|
|
653
|
+
"-f",
|
|
654
|
+
`name=${repo}`,
|
|
655
|
+
"--jq",
|
|
656
|
+
".data.repository.labels.nodes[] | {name, open: .open.totalCount, total: .all.totalCount}"
|
|
657
|
+
]);
|
|
658
|
+
return stdout.split(`
|
|
659
|
+
`).filter((line) => line.trim() !== "").map((line) => JSON.parse(line));
|
|
660
|
+
}
|
|
148
661
|
function issueListByLabelArgs(owner, repo, label) {
|
|
149
662
|
return [
|
|
150
663
|
"issue",
|
|
@@ -714,6 +1227,33 @@ function tasksFromIssues(issues) {
|
|
|
714
1227
|
}
|
|
715
1228
|
return tasks.sort((a, b) => compareTaskIds(a.id, b.id));
|
|
716
1229
|
}
|
|
1230
|
+
function resolveDuplicateTasks(tasks, isOpen) {
|
|
1231
|
+
const byId = new Map;
|
|
1232
|
+
for (const t of tasks)
|
|
1233
|
+
byId.set(t.id, [...byId.get(t.id) ?? [], t]);
|
|
1234
|
+
const resolved = [];
|
|
1235
|
+
const conflicts = [];
|
|
1236
|
+
for (const [id, group] of byId) {
|
|
1237
|
+
const first = group[0];
|
|
1238
|
+
if (!first)
|
|
1239
|
+
continue;
|
|
1240
|
+
if (group.length === 1) {
|
|
1241
|
+
resolved.push(first);
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
const number = (t) => t.issue ?? 0;
|
|
1245
|
+
const open = group.filter((t) => t.issue !== null && isOpen(t.issue)).sort((a, b) => number(a) - number(b));
|
|
1246
|
+
if (open.length > 1) {
|
|
1247
|
+
conflicts.push({ id, issues: open.map(number) });
|
|
1248
|
+
resolved.push(open[0]);
|
|
1249
|
+
} else if (open.length === 1) {
|
|
1250
|
+
resolved.push(open[0]);
|
|
1251
|
+
} else {
|
|
1252
|
+
resolved.push([...group].sort((a, b) => number(b) - number(a))[0]);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
return { tasks: resolved.sort((a, b) => compareTaskIds(a.id, b.id)), conflicts };
|
|
1256
|
+
}
|
|
717
1257
|
async function fetchTrancheIssuesAsync(owner, repo, slug) {
|
|
718
1258
|
return ghIssueListByAnyLabelAsync(owner, repo, [trancheLabel(slug)]);
|
|
719
1259
|
}
|
|
@@ -782,6 +1322,19 @@ function lifecycleFromIssues(issues) {
|
|
|
782
1322
|
return "planned";
|
|
783
1323
|
return issues.some((i) => i.state === "OPEN") ? "active" : "complete";
|
|
784
1324
|
}
|
|
1325
|
+
function lifecycleFromCounts(open, total) {
|
|
1326
|
+
if (total === 0)
|
|
1327
|
+
return "planned";
|
|
1328
|
+
return open > 0 ? "active" : "complete";
|
|
1329
|
+
}
|
|
1330
|
+
function resolveLegacyFactsFromCounts(milestone, open, total) {
|
|
1331
|
+
if (milestone.state === "closed" && total > 0) {
|
|
1332
|
+
return { goal: milestone.description ?? "", lifecycle: lifecycleFromCounts(open, total) };
|
|
1333
|
+
}
|
|
1334
|
+
return factsFromLegacyMilestone(milestone);
|
|
1335
|
+
}
|
|
1336
|
+
var TRANCHE_LABEL_QUERY = "vinaya/tranche:";
|
|
1337
|
+
var ACTIVE_ISSUE_READ_CONCURRENCY = 4;
|
|
785
1338
|
function goalFromMilestones(milestones, slug) {
|
|
786
1339
|
for (const m of milestones) {
|
|
787
1340
|
const goal = intentGoalForSlug(m.description ?? "", slug);
|
|
@@ -809,10 +1362,20 @@ function trancheSlugsFromLabels(labels) {
|
|
|
809
1362
|
}
|
|
810
1363
|
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
811
1364
|
const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
|
|
812
|
-
const [milestones, labels] = await Promise.all([
|
|
1365
|
+
const [milestones, labels, counts] = await Promise.all([
|
|
813
1366
|
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
814
|
-
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
1367
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)),
|
|
1368
|
+
read(() => ghLabelIssueCountsAsync(owner, repo, TRANCHE_LABEL_QUERY))
|
|
815
1369
|
]);
|
|
1370
|
+
const countsByLabel = new Map(counts.map((c) => [c.name, c]));
|
|
1371
|
+
const uncounted = trancheSlugsFromLabels(labels).map((slug) => trancheLabel(slug)).filter((label) => !countsByLabel.has(label));
|
|
1372
|
+
if (uncounted.length > 0) {
|
|
1373
|
+
throw new Error(`the label Issue-count query returned no count for ${uncounted.join(", ")}`);
|
|
1374
|
+
}
|
|
1375
|
+
const lifecycleOf = (slug) => {
|
|
1376
|
+
const c = countsByLabel.get(trancheLabel(slug));
|
|
1377
|
+
return lifecycleFromCounts(c?.open ?? 0, c?.total ?? 0);
|
|
1378
|
+
};
|
|
816
1379
|
const active = [];
|
|
817
1380
|
const archived = [];
|
|
818
1381
|
const facts = new Map;
|
|
@@ -820,33 +1383,21 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
|
820
1383
|
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
821
1384
|
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
822
1385
|
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
823
|
-
const
|
|
824
|
-
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
825
|
-
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
826
|
-
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
827
|
-
]);
|
|
828
|
-
const issuesBySlug = new Map;
|
|
829
|
-
uniqueLegacySlugs.forEach((slug, i) => {
|
|
830
|
-
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
831
|
-
});
|
|
832
|
-
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
833
|
-
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
834
|
-
});
|
|
835
|
-
uniqueLegacySlugs.forEach((slug, i) => {
|
|
1386
|
+
for (const slug of legacySlugs) {
|
|
836
1387
|
const m = legacyMilestoneBySlug.get(slug);
|
|
837
1388
|
if (!m)
|
|
838
|
-
|
|
1389
|
+
continue;
|
|
839
1390
|
const ref = { slug, goal: m.description ?? "" };
|
|
840
|
-
const
|
|
1391
|
+
const c = countsByLabel.get(trancheLabel(slug));
|
|
1392
|
+
const f = resolveLegacyFactsFromCounts(m, c?.open ?? 0, c?.total ?? 0);
|
|
841
1393
|
if (f.lifecycle === "complete")
|
|
842
1394
|
archived.push(ref);
|
|
843
1395
|
else if (f.lifecycle === "active")
|
|
844
1396
|
active.push(ref);
|
|
845
1397
|
facts.set(slug, f);
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
const lifecycle = lifecycleFromIssues(issues);
|
|
1398
|
+
}
|
|
1399
|
+
for (const slug of uniqueNewPathSlugs) {
|
|
1400
|
+
const lifecycle = lifecycleOf(slug);
|
|
850
1401
|
const goal = goalFromMilestones(milestones, slug);
|
|
851
1402
|
const f = { goal, lifecycle };
|
|
852
1403
|
facts.set(slug, f);
|
|
@@ -854,7 +1405,16 @@ async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
|
854
1405
|
active.push({ slug, goal });
|
|
855
1406
|
else if (lifecycle === "complete")
|
|
856
1407
|
archived.push({ slug, goal });
|
|
857
|
-
}
|
|
1408
|
+
}
|
|
1409
|
+
const issuesBySlug = new Map;
|
|
1410
|
+
const activeSlugs = active.map((r) => r.slug);
|
|
1411
|
+
for (let i = 0;i < activeSlugs.length; i += ACTIVE_ISSUE_READ_CONCURRENCY) {
|
|
1412
|
+
const batch = activeSlugs.slice(i, i + ACTIVE_ISSUE_READ_CONCURRENCY);
|
|
1413
|
+
const lists = await Promise.all(batch.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))));
|
|
1414
|
+
batch.forEach((slug, j) => {
|
|
1415
|
+
issuesBySlug.set(slug, lists[j] ?? []);
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
858
1418
|
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
859
1419
|
}
|
|
860
1420
|
async function retryOnce(fetch) {
|
|
@@ -1550,6 +2110,7 @@ var LOOP_PAUSED_MARKER = commentMarkerFamily("loop:paused");
|
|
|
1550
2110
|
var LOOP_UNPUSHED_WORK_RESUME_MARKER = commentMarkerFamily("loop:unpushed-work-resume");
|
|
1551
2111
|
var PRINCIPAL_RULING_MARKER = commentMarkerFamily("principal:ruling");
|
|
1552
2112
|
var OBJECTIVES_VERSION_MARKER = commentMarkerFamily("objectives");
|
|
2113
|
+
var DOCUMENTATION_EDIT_MARKER = commentMarkerFamily("documentation");
|
|
1553
2114
|
var DEFERRED_FINDINGS_MARKER = commentMarkerFamily("deferred-findings");
|
|
1554
2115
|
var COMMENT_MARKER_PREFIX_CURRENT = COMMENT_MARKER_PREFIX.current;
|
|
1555
2116
|
var COMMENT_MARKER_PREFIXES = [COMMENT_MARKER_PREFIX.current, COMMENT_MARKER_PREFIX.old];
|
|
@@ -2230,6 +2791,7 @@ var DOCTRINE_MAP = [
|
|
|
2230
2791
|
{ key: "roles/developer.md", source: "executing/developer/doctrine.md", role: "developer", ships: true },
|
|
2231
2792
|
{ key: "roles/developer/reference.md", source: "executing/developer/reference.md", ships: true },
|
|
2232
2793
|
{ key: "roles/operator.md", source: "executing/operator/doctrine.md", role: "operator", ships: true },
|
|
2794
|
+
{ key: "roles/plan-reviewer.md", source: "thinking/plan-reviewer/doctrine.md", role: "plan-reviewer", ships: true },
|
|
2233
2795
|
{ key: "roles/planner.md", source: "thinking/planner/doctrine.md", role: "planner", ships: true },
|
|
2234
2796
|
{ key: "roles/planner/reference.md", source: "thinking/planner/reference.md", ships: true },
|
|
2235
2797
|
{ key: "roles/principal.md", source: "doctrine/roles/principal.md", role: "principal", ships: true },
|
|
@@ -2921,7 +3483,8 @@ function isMechanicallyNeutralDiff(diffText, path) {
|
|
|
2921
3483
|
}
|
|
2922
3484
|
return sawChange;
|
|
2923
3485
|
}
|
|
2924
|
-
|
|
3486
|
+
var DOC_NEUTRAL_OWED_PREFIX = "C5 doc-neutral-owed:";
|
|
3487
|
+
function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive, getDiff, bodyGiven = true) {
|
|
2925
3488
|
const out = { errors: [], notes: [] };
|
|
2926
3489
|
if (docOwnersContent === null)
|
|
2927
3490
|
return out;
|
|
@@ -2961,19 +3524,23 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2961
3524
|
}
|
|
2962
3525
|
if (changed.includes(pointerPath))
|
|
2963
3526
|
continue;
|
|
3527
|
+
const evidenced = () => getDiff !== undefined && matchedFiles.every((f) => {
|
|
3528
|
+
const diff = getDiff(f);
|
|
3529
|
+
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
3530
|
+
});
|
|
2964
3531
|
const declared = neutrals.find((n) => n.surface === b.pointer);
|
|
2965
3532
|
if (declared) {
|
|
2966
|
-
|
|
2967
|
-
const diff = getDiff(f);
|
|
2968
|
-
return diff !== null && isMechanicallyNeutralDiff(diff, f);
|
|
2969
|
-
});
|
|
2970
|
-
if (evidenced) {
|
|
3533
|
+
if (evidenced()) {
|
|
2971
3534
|
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.`);
|
|
2972
3535
|
continue;
|
|
2973
3536
|
}
|
|
2974
3537
|
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.`);
|
|
2975
3538
|
continue;
|
|
2976
3539
|
}
|
|
3540
|
+
if (!bodyGiven && evidenced()) {
|
|
3541
|
+
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>\`.`);
|
|
3542
|
+
continue;
|
|
3543
|
+
}
|
|
2977
3544
|
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.`);
|
|
2978
3545
|
}
|
|
2979
3546
|
return out;
|
|
@@ -3024,6 +3591,11 @@ var PROTECTED_ADMIN_PATHS = [
|
|
|
3024
3591
|
...DOCTRINE_REPO_PATHS
|
|
3025
3592
|
];
|
|
3026
3593
|
|
|
3594
|
+
// ../../harness/processes/vinaya-strict/tools/task-contract/test-plan-proof.ts
|
|
3595
|
+
var ID_LIST = String.raw`O\d+(?:\s*,\s*O\d+)*`;
|
|
3596
|
+
var LINE_IDS_RE = new RegExp(String.raw`\(\s*(${ID_LIST})\s*\)\s*$`);
|
|
3597
|
+
var ITEM_IDS_SPAN_RE = new RegExp(String.raw`(?<!\`)(\`+)\s*\(?\s*(${ID_LIST})\s*\)?\s*\1(?!\`)`, "g");
|
|
3598
|
+
|
|
3027
3599
|
// ../../harness/processes/vinaya-strict/tools/task-contract/issue-validation.ts
|
|
3028
3600
|
function hasRationaleField(body, labelPattern) {
|
|
3029
3601
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -3260,6 +3832,234 @@ function compareToBaseline(current, baseline) {
|
|
|
3260
3832
|
};
|
|
3261
3833
|
}
|
|
3262
3834
|
|
|
3835
|
+
// ../../harness/processes/vinaya-strict/tools/task-issue-read.ts
|
|
3836
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
3837
|
+
|
|
3838
|
+
// ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/round-assess.ts
|
|
3839
|
+
init_schema();
|
|
3840
|
+
init_control_store();
|
|
3841
|
+
|
|
3842
|
+
// ../../harness/kernel/effects/effects.ts
|
|
3843
|
+
init_control_store();
|
|
3844
|
+
|
|
3845
|
+
// ../../harness/kernel/log/run-recorder.ts
|
|
3846
|
+
init_log_sink();
|
|
3847
|
+
import {
|
|
3848
|
+
connect,
|
|
3849
|
+
EVENT_NAMES,
|
|
3850
|
+
SPAN_NAMES
|
|
3851
|
+
} from "@attalabs/vinaya-log-sdk";
|
|
3852
|
+
|
|
3853
|
+
// ../../harness/kernel/effects/effects.ts
|
|
3854
|
+
init_run_paths();
|
|
3855
|
+
|
|
3856
|
+
// ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/turn-result.ts
|
|
3857
|
+
init_schema();
|
|
3858
|
+
|
|
3859
|
+
// ../../harness/processes/vinaya-strict/executing/developer/developer-turn-result.ts
|
|
3860
|
+
init_schema();
|
|
3861
|
+
import { z as z3 } from "zod/v4";
|
|
3862
|
+
var DEVELOPER_TURN_RESULT_SCHEMA_VERSION = 1;
|
|
3863
|
+
var BLOCKER_KINDS = [
|
|
3864
|
+
"dependency_unmerged",
|
|
3865
|
+
"conflict_open",
|
|
3866
|
+
"preflight_failed",
|
|
3867
|
+
"premise_stale",
|
|
3868
|
+
"brief_contradicts_code",
|
|
3869
|
+
"test_failure",
|
|
3870
|
+
"destructive_unauthorized",
|
|
3871
|
+
"tooling_unavailable"
|
|
3872
|
+
];
|
|
3873
|
+
var schemaVersion = z3.literal(DEVELOPER_TURN_RESULT_SCHEMA_VERSION);
|
|
3874
|
+
var summary = z3.string().min(1);
|
|
3875
|
+
var SourceUseSchema = z3.object({
|
|
3876
|
+
source: z3.string().min(1),
|
|
3877
|
+
use: z3.string().min(1)
|
|
3878
|
+
}).strict();
|
|
3879
|
+
var ReportedCheckSchema = z3.object({
|
|
3880
|
+
command: z3.string().min(1),
|
|
3881
|
+
outcome: z3.enum(["pass", "fail"])
|
|
3882
|
+
}).strict();
|
|
3883
|
+
var DeveloperTurnResultSchema = z3.discriminatedUnion("status", [
|
|
3884
|
+
z3.object({
|
|
3885
|
+
schemaVersion,
|
|
3886
|
+
status: z3.literal("completed"),
|
|
3887
|
+
summary,
|
|
3888
|
+
confidence: z3.number().int().min(0).max(100),
|
|
3889
|
+
confidenceExplanation: z3.string().min(1).max(CONFIDENCE_REASON_MAX_LENGTH),
|
|
3890
|
+
addressedFindingIds: z3.array(z3.string().min(1)),
|
|
3891
|
+
sourceUses: z3.array(SourceUseSchema).nullable(),
|
|
3892
|
+
reportedChecks: z3.array(ReportedCheckSchema).nullable()
|
|
3893
|
+
}).strict(),
|
|
3894
|
+
z3.object({
|
|
3895
|
+
schemaVersion,
|
|
3896
|
+
status: z3.literal("blocked"),
|
|
3897
|
+
summary,
|
|
3898
|
+
blocker: z3.object({ kind: z3.enum(BLOCKER_KINDS), detail: z3.string().min(1) }).strict(),
|
|
3899
|
+
sourceUses: z3.array(SourceUseSchema).nullable()
|
|
3900
|
+
}).strict(),
|
|
3901
|
+
z3.object({
|
|
3902
|
+
schemaVersion,
|
|
3903
|
+
status: z3.literal("needs_ruling"),
|
|
3904
|
+
summary,
|
|
3905
|
+
rulingRequest: z3.object({ question: z3.string().min(1), decisions: z3.array(z3.string().min(1)) }).strict(),
|
|
3906
|
+
sourceUses: z3.array(SourceUseSchema).nullable()
|
|
3907
|
+
}).strict()
|
|
3908
|
+
]);
|
|
3909
|
+
var DeveloperTurnOutputSchema = z3.object({ turnResult: DeveloperTurnResultSchema }).strict();
|
|
3910
|
+
|
|
3911
|
+
// ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/turn-result.ts
|
|
3912
|
+
init_run_paths();
|
|
3913
|
+
|
|
3914
|
+
// ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/stop-decision.ts
|
|
3915
|
+
var CI_PARENT_WAIT_MAX_MS = 90 * 60000;
|
|
3916
|
+
|
|
3917
|
+
// ../../harness/processes/vinaya-strict/loops/dev-review/standalone/dev-review-loop/round-assess.ts
|
|
3918
|
+
var NO_RESPONSE_CODES = new Set([
|
|
3919
|
+
"ENOTFOUND",
|
|
3920
|
+
"EAI_AGAIN",
|
|
3921
|
+
"ECONNREFUSED",
|
|
3922
|
+
"ECONNRESET",
|
|
3923
|
+
"ECONNABORTED",
|
|
3924
|
+
"ETIMEDOUT",
|
|
3925
|
+
"ENETUNREACH",
|
|
3926
|
+
"ENETDOWN",
|
|
3927
|
+
"EHOSTUNREACH",
|
|
3928
|
+
"EHOSTDOWN",
|
|
3929
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
3930
|
+
"UND_ERR_SOCKET",
|
|
3931
|
+
"ConnectionRefused",
|
|
3932
|
+
"ConnectionClosed",
|
|
3933
|
+
"FailedToOpenSocket"
|
|
3934
|
+
]);
|
|
3935
|
+
var NO_RESPONSE_CAUSE = /dial tcp|i\/o timeout|connection refused|connection reset|no such host|network is unreachable|TLS handshake timeout|Client\.Timeout exceeded|server misbehaving|^EOF$|could not resolve host|failed to connect|couldn't connect to server|connection timed out|no route to host|operation timed out|resolving timed out/i;
|
|
3936
|
+
var GITHUB_HOST = /github/i;
|
|
3937
|
+
function unreachedHostOfLine(line) {
|
|
3938
|
+
const ghDns = /^error connecting to (\S+)$/.exec(line);
|
|
3939
|
+
if (ghDns)
|
|
3940
|
+
return ghDns[1];
|
|
3941
|
+
const sshDns = /^ssh: Could not resolve hostname ([^:\s]+):/.exec(line);
|
|
3942
|
+
if (sshDns)
|
|
3943
|
+
return sshDns[1];
|
|
3944
|
+
const sshConnect = /^ssh: connect to host (\S+) port \d+: (.+)$/.exec(line);
|
|
3945
|
+
if (sshConnect)
|
|
3946
|
+
return NO_RESPONSE_CAUSE.test(sshConnect[2].trim()) ? sshConnect[1] : null;
|
|
3947
|
+
const urlError = /^(?:Get|Post|Put|Patch|Delete|Head) "(https?:\/\/[^"]+)": (.+)$/.exec(line) ?? /^fatal: unable to access '(https?:\/\/[^']+)': (.+)$/.exec(line);
|
|
3948
|
+
if (!urlError || !NO_RESPONSE_CAUSE.test(urlError[2].trim()))
|
|
3949
|
+
return null;
|
|
3950
|
+
try {
|
|
3951
|
+
return new URL(urlError[1]).hostname;
|
|
3952
|
+
} catch {
|
|
3953
|
+
return null;
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
|
|
3957
|
+
class GitHubKeptAnswering extends Error {
|
|
3958
|
+
constructor(original) {
|
|
3959
|
+
super(`GitHub answered the reachability check, but this step's request kept failing: ${original instanceof Error ? original.message : String(original)}`);
|
|
3960
|
+
this.name = "GitHubKeptAnswering";
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
function isGitHubConnectionFailure(err) {
|
|
3964
|
+
let current = err;
|
|
3965
|
+
for (let depth = 0;depth < 5 && current instanceof Error; depth += 1) {
|
|
3966
|
+
if (current instanceof GitHubKeptAnswering)
|
|
3967
|
+
return false;
|
|
3968
|
+
const fields = current;
|
|
3969
|
+
if (typeof fields.code === "string" && NO_RESPONSE_CODES.has(fields.code)) {
|
|
3970
|
+
const where = [fields.hostname, fields.host, fields.path, fields.url].find((v) => typeof v === "string");
|
|
3971
|
+
if (typeof where === "string" && GITHUB_HOST.test(where))
|
|
3972
|
+
return true;
|
|
3973
|
+
}
|
|
3974
|
+
const stderr = fields.stderr === undefined ? "" : String(fields.stderr);
|
|
3975
|
+
for (const line of `${stderr}
|
|
3976
|
+
${current.message}`.split(`
|
|
3977
|
+
`)) {
|
|
3978
|
+
const host = unreachedHostOfLine(line.trim());
|
|
3979
|
+
if (host !== null && GITHUB_HOST.test(host))
|
|
3980
|
+
return true;
|
|
3981
|
+
}
|
|
3982
|
+
current = current.cause;
|
|
3983
|
+
}
|
|
3984
|
+
return false;
|
|
3985
|
+
}
|
|
3986
|
+
var RATE_LIMIT_FALLBACK_WAIT_MS = 5 * 60 * 1000;
|
|
3987
|
+
var RUN_LIFECYCLE_EVENTS = new Set([
|
|
3988
|
+
"loop_started",
|
|
3989
|
+
"journal_finalized",
|
|
3990
|
+
"paused",
|
|
3991
|
+
"resumed",
|
|
3992
|
+
"cancelled",
|
|
3993
|
+
"infrastructure_retry",
|
|
3994
|
+
"stop_condition_met",
|
|
3995
|
+
"driver_exited"
|
|
3996
|
+
]);
|
|
3997
|
+
var ROUND_AND_CHANGE_EVENTS = new Set([
|
|
3998
|
+
"round_started",
|
|
3999
|
+
"round_ended",
|
|
4000
|
+
"phase_time",
|
|
4001
|
+
"verdicts_read",
|
|
4002
|
+
"findings_compared",
|
|
4003
|
+
"gate_result_read",
|
|
4004
|
+
"storage_push",
|
|
4005
|
+
"ready_push",
|
|
4006
|
+
"local_checks_run",
|
|
4007
|
+
"failed_tests_rerun",
|
|
4008
|
+
"ci_result_read",
|
|
4009
|
+
"pr_opened",
|
|
4010
|
+
"conflict_reentry",
|
|
4011
|
+
"unpushed_work_resume"
|
|
4012
|
+
]);
|
|
4013
|
+
var MAX_USAGE_LIMIT_AUTO_WAIT_MS = 6 * 60 * 60 * 1000;
|
|
4014
|
+
|
|
4015
|
+
// ../../harness/processes/vinaya-strict/tools/task-issue-read.ts
|
|
4016
|
+
var RETRY_WAITS_MS = [1e4, 30000, 60000];
|
|
4017
|
+
var ISSUE_NOT_FOUND = /could not resolve to an issue/i;
|
|
4018
|
+
var processCache = new Map;
|
|
4019
|
+
var runGh = (args) => {
|
|
4020
|
+
try {
|
|
4021
|
+
return execFileSync2("gh", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
4022
|
+
} catch (err) {
|
|
4023
|
+
const stderr = err.stderr;
|
|
4024
|
+
const text = stderr === undefined || stderr === null ? "" : String(stderr);
|
|
4025
|
+
throw new Error(text !== "" ? text : err instanceof Error ? err.message : String(err));
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4028
|
+
var blockingSleep = (ms) => {
|
|
4029
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
4030
|
+
};
|
|
4031
|
+
function readTaskIssue(args, deps = {}) {
|
|
4032
|
+
const run = deps.run ?? runGh;
|
|
4033
|
+
const sleep = deps.sleep ?? blockingSleep;
|
|
4034
|
+
const cache = deps.cache ?? processCache;
|
|
4035
|
+
const key = args.join("\x00");
|
|
4036
|
+
if (cache.has(key))
|
|
4037
|
+
return { outcome: "read", issue: cache.get(key) };
|
|
4038
|
+
const waits = deps.retry === false ? [] : RETRY_WAITS_MS;
|
|
4039
|
+
for (let attempt = 0;; attempt += 1) {
|
|
4040
|
+
let text;
|
|
4041
|
+
try {
|
|
4042
|
+
const out = run(args);
|
|
4043
|
+
let parsed;
|
|
4044
|
+
try {
|
|
4045
|
+
parsed = JSON.parse(out);
|
|
4046
|
+
} catch {
|
|
4047
|
+
return { outcome: "failed", error: `gh printed output that is not JSON: ${out}` };
|
|
4048
|
+
}
|
|
4049
|
+
cache.set(key, parsed);
|
|
4050
|
+
return { outcome: "read", issue: parsed };
|
|
4051
|
+
} catch (err) {
|
|
4052
|
+
text = err instanceof Error ? err.message : String(err);
|
|
4053
|
+
}
|
|
4054
|
+
if (ISSUE_NOT_FOUND.test(text))
|
|
4055
|
+
return { outcome: "missing" };
|
|
4056
|
+
const wait = waits[attempt];
|
|
4057
|
+
if (wait === undefined || !isGitHubConnectionFailure(new Error(text)))
|
|
4058
|
+
return { outcome: "failed", error: text };
|
|
4059
|
+
sleep(wait);
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
|
|
3263
4063
|
// ../../harness/processes/vinaya-strict/tools/task-contract/issue-validation.ts
|
|
3264
4064
|
function hasRationaleField2(body, labelPattern) {
|
|
3265
4065
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -3609,6 +4409,9 @@ var CI_SHARD_PROBE2 = `${CI_SHARD_DIR2}/shard-1.txt`;
|
|
|
3609
4409
|
function isHandClosedByRecognizedPrincipal(dep, principalAllowlist) {
|
|
3610
4410
|
return dep.issueState === "closed" && dep.stateReason === "completed" && isPrincipal(dep.closedByActor ?? null, principalAllowlist);
|
|
3611
4411
|
}
|
|
4412
|
+
function issueReadFailedMessage(prefix, issueNumber, error) {
|
|
4413
|
+
return `${prefix} issue-read-failed: the forge could not be read for Issue #${issueNumber}, so whether it exists is unknown — this is not a claim that the Issue is missing. gh reported: ${error}`;
|
|
4414
|
+
}
|
|
3612
4415
|
function isSelfDependency(dep, task, issue) {
|
|
3613
4416
|
if (dep.issue !== null && issue !== null && dep.issue === issue.number)
|
|
3614
4417
|
return true;
|
|
@@ -3625,6 +4428,8 @@ function checkDispatchReadiness(input) {
|
|
|
3625
4428
|
};
|
|
3626
4429
|
if (task.issue === null) {
|
|
3627
4430
|
push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} has no Issue (#TBD or blank) in the topology — not dispatchable until the Planner cuts the Issue.`);
|
|
4431
|
+
} else if (input.issueReadFailed !== undefined) {
|
|
4432
|
+
push("issue-read-failed", issueReadFailedMessage("dispatch-gate", task.issue, input.issueReadFailed));
|
|
3628
4433
|
} else if (input.issue === null) {
|
|
3629
4434
|
push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} names Issue #${task.issue}, but it does not resolve to a real GitHub Issue (phantom reference).`);
|
|
3630
4435
|
}
|
|
@@ -3715,14 +4520,14 @@ function isEntryPoint(moduleUrl, scriptName, startedOn = process.argv[1]) {
|
|
|
3715
4520
|
}
|
|
3716
4521
|
|
|
3717
4522
|
// ../../harness/processes/vinaya-strict/tools/task-contract/principals-config.ts
|
|
3718
|
-
import { readFileSync } from "node:fs";
|
|
4523
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
3719
4524
|
import { join } from "node:path";
|
|
3720
4525
|
var PRINCIPALS_CONFIG_FIX = 'add "principals": [...] to vinaya.config.json';
|
|
3721
4526
|
function readConfigPrincipals(repoRoot = ".") {
|
|
3722
4527
|
const path = join(repoRoot, "vinaya.config.json");
|
|
3723
4528
|
let raw;
|
|
3724
4529
|
try {
|
|
3725
|
-
raw = JSON.parse(
|
|
4530
|
+
raw = JSON.parse(readFileSync2(path, "utf8"));
|
|
3726
4531
|
} catch (err) {
|
|
3727
4532
|
const why = err instanceof Error ? err.message : String(err);
|
|
3728
4533
|
return { ok: false, reason: `cannot read ${path} as JSON (${why}) — ${PRINCIPALS_CONFIG_FIX}` };
|
|
@@ -3742,7 +4547,7 @@ function readConfigPrincipals(repoRoot = ".") {
|
|
|
3742
4547
|
|
|
3743
4548
|
// ../../harness/processes/vinaya-strict/checks/standalone/verify-dispatch.ts
|
|
3744
4549
|
var DISPATCH_INVOCATION_CWD = process.cwd();
|
|
3745
|
-
function resolveTargetRoot(cwd = process.cwd(), exec =
|
|
4550
|
+
function resolveTargetRoot(cwd = process.cwd(), exec = execFileSync3) {
|
|
3746
4551
|
const gitRoot = (candidate) => {
|
|
3747
4552
|
try {
|
|
3748
4553
|
const root = exec("git", ["-C", candidate, "rev-parse", "--show-toplevel"], {
|
|
@@ -3758,7 +4563,7 @@ function resolveTargetRoot(cwd = process.cwd(), exec = execFileSync2) {
|
|
|
3758
4563
|
}
|
|
3759
4564
|
var REPO_ROOT = resolveTargetRoot(DISPATCH_INVOCATION_CWD);
|
|
3760
4565
|
process.chdir(REPO_ROOT);
|
|
3761
|
-
async function resolveTargetRepository(repoRoot = REPO_ROOT, exec =
|
|
4566
|
+
async function resolveTargetRepository(repoRoot = REPO_ROOT, exec = execFileSync3) {
|
|
3762
4567
|
return resolveRepo(async () => ({
|
|
3763
4568
|
stdout: String(exec("git", ["-C", repoRoot, "remote", "get-url", "origin"], {
|
|
3764
4569
|
encoding: "utf8",
|
|
@@ -3768,7 +4573,7 @@ async function resolveTargetRepository(repoRoot = REPO_ROOT, exec = execFileSync
|
|
|
3768
4573
|
}
|
|
3769
4574
|
function sh(cmd, args) {
|
|
3770
4575
|
try {
|
|
3771
|
-
return
|
|
4576
|
+
return execFileSync3(cmd, args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
3772
4577
|
} catch {
|
|
3773
4578
|
return "";
|
|
3774
4579
|
}
|
|
@@ -3783,30 +4588,21 @@ function shJson(cmd, args) {
|
|
|
3783
4588
|
return null;
|
|
3784
4589
|
}
|
|
3785
4590
|
}
|
|
3786
|
-
var
|
|
4591
|
+
var execFileAsync6 = promisify6(execFile6);
|
|
3787
4592
|
async function shJsonAsync(cmd, args) {
|
|
3788
4593
|
try {
|
|
3789
|
-
const { stdout } = await
|
|
4594
|
+
const { stdout } = await execFileAsync6(cmd, args, { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
|
|
3790
4595
|
return JSON.parse(stdout);
|
|
3791
4596
|
} catch {
|
|
3792
4597
|
return null;
|
|
3793
4598
|
}
|
|
3794
4599
|
}
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
const
|
|
3800
|
-
|
|
3801
|
-
"view",
|
|
3802
|
-
String(num),
|
|
3803
|
-
"-R",
|
|
3804
|
-
`${repo.owner}/${repo.repo}`,
|
|
3805
|
-
"--json",
|
|
3806
|
-
"number,state,body,labels,milestone"
|
|
3807
|
-
]);
|
|
3808
|
-
issueCache.set(num, result);
|
|
3809
|
-
return result;
|
|
4600
|
+
function ghIssueRead(num, repo, retry = true) {
|
|
4601
|
+
return readTaskIssue(["issue", "view", String(num), "-R", `${repo.owner}/${repo.repo}`, "--json", "number,state,body,labels,milestone"], { retry });
|
|
4602
|
+
}
|
|
4603
|
+
function ghIssueView(num, repo, retry = true) {
|
|
4604
|
+
const read = ghIssueRead(num, repo, retry);
|
|
4605
|
+
return read.outcome === "read" ? read.issue : null;
|
|
3810
4606
|
}
|
|
3811
4607
|
async function checkBareEdgeQualification(dependsOnIds, conflictsWithIds, milestone, repo) {
|
|
3812
4608
|
if (!milestone)
|
|
@@ -4106,7 +4902,7 @@ function resolvePriorTask(tranche, taskId, branchPrs, provenanceByIssue, repo) {
|
|
|
4106
4902
|
return null;
|
|
4107
4903
|
const prior = tranche.tasks[idx - 1];
|
|
4108
4904
|
const pr = branchPrs.get(prior.id);
|
|
4109
|
-
const issueJson = prior.issue !== null ? ghIssueView(prior.issue, repo) : null;
|
|
4905
|
+
const issueJson = prior.issue !== null ? ghIssueView(prior.issue, repo, false) : null;
|
|
4110
4906
|
return {
|
|
4111
4907
|
id: prior.id,
|
|
4112
4908
|
issue: prior.issue,
|
|
@@ -4266,7 +5062,7 @@ async function runPremiseModeFromIssue(trancheSlug, taskId) {
|
|
|
4266
5062
|
console.log("verify-dispatch --premise: no `Premise:` assertions found in the dispatched brief \u2014 nothing to re-assert.");
|
|
4267
5063
|
process.exit(0);
|
|
4268
5064
|
}
|
|
4269
|
-
const result = checkPremises2(assertions, (p) => existsSync(p) ?
|
|
5065
|
+
const result = checkPremises2(assertions, (p) => existsSync(p) ? readFileSync3(p, "utf8") : null);
|
|
4270
5066
|
if (!result.pass) {
|
|
4271
5067
|
console.error(`
|
|
4272
5068
|
verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no longer hold:
|
|
@@ -4279,13 +5075,13 @@ verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no
|
|
|
4279
5075
|
process.exit(0);
|
|
4280
5076
|
}
|
|
4281
5077
|
function runPremiseMode(bodyFile) {
|
|
4282
|
-
const body =
|
|
5078
|
+
const body = readFileSync3(bodyFile, "utf8");
|
|
4283
5079
|
const assertions = parsePremiseBlock2(body);
|
|
4284
5080
|
if (assertions.length === 0) {
|
|
4285
5081
|
console.log("verify-dispatch --premise: no `Premise:` assertions found in the body file \u2014 nothing to re-assert.");
|
|
4286
5082
|
process.exit(0);
|
|
4287
5083
|
}
|
|
4288
|
-
const result = checkPremises2(assertions, (p) => existsSync(p) ?
|
|
5084
|
+
const result = checkPremises2(assertions, (p) => existsSync(p) ? readFileSync3(p, "utf8") : null);
|
|
4289
5085
|
if (!result.pass) {
|
|
4290
5086
|
console.error(`
|
|
4291
5087
|
verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no longer hold:
|
|
@@ -4299,14 +5095,14 @@ verify-dispatch --premise FAILED \u2014 ${result.failures.length} premise(s) no
|
|
|
4299
5095
|
}
|
|
4300
5096
|
function runSimulateMode(trancheSlug, taskId, bodyFile) {
|
|
4301
5097
|
const branch = `task/${trancheSlug}/${taskId}`;
|
|
4302
|
-
const body =
|
|
5098
|
+
const body = readFileSync3(bodyFile, "utf8");
|
|
4303
5099
|
const assertions = parsePremiseBlock2(body);
|
|
4304
5100
|
console.log(assertions.length > 0 ? `verify-dispatch --simulate: Premise: block present (${assertions.length} assertion(s)).` : "verify-dispatch --simulate: WARNING \u2014 no `Premise:` block found in the body file (checkPremiseCoverage will fail at PR time if this task has a code surface).");
|
|
4305
5101
|
let failed = false;
|
|
4306
5102
|
const gates = [
|
|
4307
5103
|
[
|
|
4308
5104
|
"verify-brief",
|
|
4309
|
-
() =>
|
|
5105
|
+
() => execFileSync3("bun", [siblingTool("verify-brief")], {
|
|
4310
5106
|
cwd: REPO_ROOT,
|
|
4311
5107
|
env: { ...process.env, BRANCH: branch, PR_BODY: body },
|
|
4312
5108
|
stdio: "inherit"
|
|
@@ -4314,7 +5110,7 @@ function runSimulateMode(trancheSlug, taskId, bodyFile) {
|
|
|
4314
5110
|
],
|
|
4315
5111
|
[
|
|
4316
5112
|
"verify-docs --pr",
|
|
4317
|
-
() =>
|
|
5113
|
+
() => execFileSync3("bun", [siblingTool("verify-docs"), "--pr"], {
|
|
4318
5114
|
cwd: REPO_ROOT,
|
|
4319
5115
|
env: { ...process.env, PR_BODY: body },
|
|
4320
5116
|
stdio: "inherit"
|
|
@@ -4322,7 +5118,7 @@ function runSimulateMode(trancheSlug, taskId, bodyFile) {
|
|
|
4322
5118
|
],
|
|
4323
5119
|
[
|
|
4324
5120
|
"verify-docs --push (C5, via PR_BODY_FILE)",
|
|
4325
|
-
() =>
|
|
5121
|
+
() => execFileSync3("bun", [siblingTool("verify-docs"), "--push"], {
|
|
4326
5122
|
cwd: REPO_ROOT,
|
|
4327
5123
|
env: { ...process.env, PR_BODY_FILE: bodyFile },
|
|
4328
5124
|
stdio: "inherit"
|
|
@@ -4346,7 +5142,7 @@ function runSurfacesMode(surfacesArg) {
|
|
|
4346
5142
|
console.log("verify-dispatch --surfaces: no surface globs given \u2014 nothing to check.");
|
|
4347
5143
|
process.exit(0);
|
|
4348
5144
|
}
|
|
4349
|
-
const docOwnersContent = existsSync(DOC_OWNERS_PATH2) ?
|
|
5145
|
+
const docOwnersContent = existsSync(DOC_OWNERS_PATH2) ? readFileSync3(DOC_OWNERS_PATH2, "utf8") : null;
|
|
4350
5146
|
const manifestState = classifyDocOwnersManifest(docOwnersContent);
|
|
4351
5147
|
if (manifestState === "absent") {
|
|
4352
5148
|
console.log(`verify-dispatch --surfaces: no doc-ownership manifest at ${DOC_OWNERS_PATH2} \u2014 dormant, no bindings to check.`);
|
|
@@ -4375,7 +5171,7 @@ function runSurfacesMode(surfacesArg) {
|
|
|
4375
5171
|
process.exit(0);
|
|
4376
5172
|
}
|
|
4377
5173
|
function runCheckBaselineMode(baselineFile) {
|
|
4378
|
-
const baseline = JSON.parse(
|
|
5174
|
+
const baseline = JSON.parse(readFileSync3(baselineFile, "utf8"));
|
|
4379
5175
|
const current = currentFindingCounts();
|
|
4380
5176
|
const unavailable = current.filter((c) => c.unavailable);
|
|
4381
5177
|
if (unavailable.length > 0) {
|
|
@@ -4420,7 +5216,9 @@ async function runGateMode(trancheSlug, taskId) {
|
|
|
4420
5216
|
console.error(`verify-dispatch row-existence: task "${taskId}" is not present in tranche \`${trancheSlug}\`'s forge-derived task list (no \`${trancheLabel2(trancheSlug)}\`-labeled Issue with this task id yet) \u2014 the plan/Issue for this task hasn't merged/opened. Not dispatchable until it does.`);
|
|
4421
5217
|
process.exit(1);
|
|
4422
5218
|
}
|
|
4423
|
-
const
|
|
5219
|
+
const issueRead = task.issue !== null ? ghIssueRead(task.issue, repo) : null;
|
|
5220
|
+
const issueJson = issueRead?.outcome === "read" ? issueRead.issue : null;
|
|
5221
|
+
const issueReadFailed = issueRead?.outcome === "failed" ? issueRead.error : undefined;
|
|
4424
5222
|
const issueRationalePass = issueJson ? checkIssueRationale(issueJson.body).status === "pass" : true;
|
|
4425
5223
|
const branchPrs = fetchTrancheBranchPrs(trancheSlug, repo);
|
|
4426
5224
|
const dependsOn = await resolveDependsOn(task.dependsOn, tranche, branchPrs, repo);
|
|
@@ -4436,6 +5234,7 @@ async function runGateMode(trancheSlug, taskId) {
|
|
|
4436
5234
|
trancheSlug,
|
|
4437
5235
|
task,
|
|
4438
5236
|
issue: task.issue !== null && issueJson ? { number: task.issue, state: issueJson.state === "OPEN" ? "open" : "closed" } : null,
|
|
5237
|
+
...issueReadFailed !== undefined ? { issueReadFailed } : {},
|
|
4439
5238
|
issueRationalePass,
|
|
4440
5239
|
dependsOn,
|
|
4441
5240
|
conflictsWith,
|
|
@@ -4485,11 +5284,16 @@ async function runGateModeForIssue(issueNumber) {
|
|
|
4485
5284
|
console.error("verify-dispatch severity:infra \u2014 could not resolve a GitHub repo/token (set VINAYA_REPO / GITHUB_TOKEN, or `gh auth login`). Cannot evaluate forge-dependent predicates.");
|
|
4486
5285
|
process.exit(1);
|
|
4487
5286
|
}
|
|
4488
|
-
const
|
|
4489
|
-
if (
|
|
5287
|
+
const issueRead = ghIssueRead(issueNumber, repo);
|
|
5288
|
+
if (issueRead.outcome === "failed") {
|
|
5289
|
+
console.error(issueReadFailedMessage("verify-dispatch", issueNumber, issueRead.error));
|
|
5290
|
+
process.exit(1);
|
|
5291
|
+
}
|
|
5292
|
+
if (issueRead.outcome === "missing") {
|
|
4490
5293
|
console.error(`verify-dispatch issue-existence: Issue #${issueNumber} does not resolve on the forge.`);
|
|
4491
5294
|
process.exit(1);
|
|
4492
5295
|
}
|
|
5296
|
+
const issueJson = issueRead.issue;
|
|
4493
5297
|
if (issueJson.labels.some((l) => l.name.startsWith("vinaya/tranche:"))) {
|
|
4494
5298
|
console.error(`verify-dispatch: Issue #${issueNumber} carries a vinaya/tranche:* label \u2014 it belongs to a tranche; use \`verify-dispatch <tranche> <n>\` instead of --issue.`);
|
|
4495
5299
|
process.exit(1);
|