@elvis1513/auto-coding-skill 4.2.8 → 4.3.1
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 +110 -7
- package/cli/assets/managed-install.json +1 -1
- package/cli/assets/skill/SKILL.md +7 -7
- package/cli/assets/skill/data/policies/feedback-resolutions-v1.json +15 -0
- package/cli/assets/skill/data/policies/workflow-migrations-v1.json +2 -2
- package/cli/assets/skill/data/templates/ENGINEERING.md +17 -12
- package/cli/assets/skill/data/templates/bridges/AGENTS.md +14 -8
- package/cli/assets/skill/scripts/ap.py +3094 -641
- package/cli/assets/skill/scripts/core.py +363 -1
- package/cli/assets/skill/scripts/install_integrity.py +12 -10
- package/cli/assets/skill/scripts/scaffold_templates.py +146 -0
- package/cli/src/index.js +1188 -317
- package/cli/tests/ap_concurrency_test.py +1 -1
- package/cli/tests/ap_profiles_test.py +98 -33
- package/cli/tests/core_shell_test.py +261 -0
- package/cli/tests/index.test.js +1694 -180
- package/package.json +1 -1
package/cli/tests/index.test.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import crypto from "node:crypto";
|
|
4
5
|
import zlib from "node:zlib";
|
|
5
|
-
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
6
7
|
import { fileURLToPath } from "node:url";
|
|
7
8
|
|
|
8
9
|
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
9
10
|
const cli = path.join(repoRoot, "cli", "src", "index.js");
|
|
10
11
|
const assetAp = path.join(repoRoot, "cli", "assets", "skill", "scripts", "ap.py");
|
|
12
|
+
const projectConfigRelativePath = path.join("docs", "project", "auto-coding-skill.yaml");
|
|
13
|
+
const projectConfigSchema = "auto-coding-skill/project-config/v1";
|
|
11
14
|
// Frozen gzip/base64 fixture of the official v2.2.0 ENGINEERING body (frontmatter excluded).
|
|
12
15
|
const officialV220EngineeringBody = zlib.gunzipSync(Buffer.from(
|
|
13
16
|
"H4sIAAAAAAAAE51YwY7bOBK98ysKk8PuApaMnezuoTMYwNPuzfZObyboJDPHFk2WJMYUqWGR7mjQH78oUpLdQA6ZviRtWSSrXr33qmjxCm5cZxxiMK6D33w4ttY/CvGxNwStsQiGIPYIZFxnEQbpkrR2gkEaF6VxqOFxXgXKu9Z0KchovKvhZ8QRTATjxFsTa9hpDX7k76QFQsV/EXhnJ3js0eVjxuA/o4qATh4slqMDWhlRA6XQSoW1EK9ewc0XVIl34CUcKAnRLJHU87MrkCn6BggtqshnIfgWYh8QAduWYzjhusOVEE/wvnyAJ/g4jUZJm/ODJ3grIz+9tp5SQBi8RngST1BVFXzlX/EEzWBU8A08gfaKthEpUsX5buCEYQIapLVgyJf85nNUL12HmlfhqexDUTotg+atfNDGyTBBizJyINJp0Mi5LDssr19u0Zuur4KhI++x/2krU+y3o5wGdHGrcbR+2h6SsXquIvgAGpWVATXwYuDF8ARtshaeOAHTTvAkRFMwNnMp5Yy2DzV87L8CM78p7aOcaAFoc5HhRvhwGW0NO1g/AZmOyaOkcz7CAUH7R9cFqRk+E3uQcH13C62VOQEpFj6FZLGGnQP8MlqjTATnXcWRr2EFHK1USJkzfyGw/nHrfBikhYMktMZhfUExrv/VDEMD0pKHgL8nE2bWZpw6GZmv7+comvyZY6EGBjktCEMzytgTA6H8MEin89+k/IjNJldYulU7oplDbmq4niWH55U1H/LAxzfwVx/AYifVdPE9f/XALzV/g9YHcYaXk3sDEqzp+sgArkyaF4P2SMDYK59cBEkgn2X66hX8zzjDoD1zAyHuCziaj4QZV40ntH5kDl4JUcFzdJsraDSeGg6kmYF+9tICwxUUDm6+Sih4TijeYWZF7eSA/EBGsCgpZoNIxNaTE1rSfrMmg8CSLQZy+QatFiZgNTElmW8YlCFcZL1ZMS11zeDlQhNHltM0qjholKHD+IDu9DBTSzd50fPXPqM7Gkfnd4S4KzVfqnbEiYCS6rlgZyLkMhcmbKD5PRl1fGCT4k/z/9Jp0WRfaCAgmz5QGkcfIuoa7pODRnsWe5Pril+kijAY4nZRtQatBm1k5zxFo6gW4rcMU04MLrNgVyimz8BoDc05+7pHaWP/wDJ8SME2Jaz5KUunKd2lDd5FdHp7kOqITsOn+7vZljg6BgiJrRadHr1xEVSP6kglT+s747aEKmCEgC0GdOwH5w51kGQU+0PP4a7b1ZCz+m+pAxgSzzOZC9QUizKRsqFsP/tDDnADhyCd6jcgQzStVIshw4BRahnlRkQzoE9xA59ut7v3t5AIQwkbRkn06IOGk7SJww2A7mSCd6yri0Rq+OQSoRZr76XeJ6uXwsoD5QUy9hgg9tLxBGAXa83u2HurMVBR+h5bmWxcBwAh9s8E/fca7lFqiOswwfGyOcrSEaKkI6CLYarF94VOuUySPGsp+NT10CgribjZVFUWSmnqtXjN2yvOPA8o3EyRIkPTJvYWbhbsVfgGVEAW636/3e3vLwpqnGb+oa7FP2q4HUaLGTTe0KFCIu60RbqQmNSAXwxF/mNROcWQ1NqJAyZCyOSiWvyzJFWmGPL2hHrtN8Ux/7Um0exvfq2u7375cLNvNlm6Js4VTtTXQvxn9emstLmPXYpoxnw9UdpLc/6e2wXverHp6xp+LZ18pixc324XIudqZRVWl4ya5zDKmC3Bv999+MC+8e/d7d3sue939x9vd3cNy3LgkidpAU9GMxtrnjFzKXsfTJSZDz5oDDMdCW7evb19d3Nzf/vu7SZT5eD9cSuD6s0JabNUmKVrXMQcFIQcD20gYBeQyHi3PaTu/FzN89sSCO/DYpvFUt4SMbNj4cM80O59bn2DDEdIDvMEinr2ELZWBqFI48NKitFboyYh3qLDYNQFXZZ1zBx9MuTDBAeeCbKq8vQ05SkhIBtuURCZP3Aj2uSyhMvHIpoOv1TsK5rj9iFWB5+40Uzz1MQ+kzK1JzhYr45nHYhmjapG1/qgctpX5T3jujzeLZSz07kdchPA0ZOJPkyVy2UUuUQRz6JQfhiNxZBH4BV5iPLIUyEqLJ/9CQN0M05ODsZ1oscUTGkecJ+1tQqwRztiKDSVJ280uy1/kdxyZQhIo3dkDsaaaJBE9CBtQKknsMzsDCq9AV1KS6M1PNtohAED2gmiB5LRUDvluchhmXxqIT4RQrNMhmCciVBVj8FEhKpKo5YRq4JTM3efFadHo3ElwnzDqMVOKRxjHrcp+pDvHhoPPOda7zoCU3SdEcrpLafnfmd9V7h37WfY18uW9ipxQamIbmYYkJJt68vIH7PkMiNWuz6rrvjQIh0+Ca6zpQoaURlpzR+oz8ec73PZ4R2izkPxcCVE0zBovRin2Hv3er4aeW+J7yR+NGNJSY71OJ1DlKNZ4P2zS2efeOHqZ2R+4R4BTwYfX7qaRcO0fnH6q729cIdD6ujF8Fm7Lm2aRojnkpnn2Q5dRWkYZJiald/MGBPApzimSKBNQBXtVK6VZYIQZ4JekLOwNfqxsjyPwH5fZJ6tNrvifNtmVC3qDgO94blB8DBLVXlUzZ0Gqmq00jVwwDYrKz/mpXzkKtdpEd8weLdeC/4s38sw/Y0vf3Uw+sa1efav8hXmcjVUFdu8NO5bC700jiq3s5eEUkadigcS+OHj7sPPD7f7H6GqBurgu/XBFfwwM+TH774dzLWYObpvXMeoVPOYVkjLjLMyOcWTMfMn5HvP1/ZoQCNfuSP/DuAvfzsLyfEYz7+HNbXs2Ci3dDR23qBSnrtXlR9tSQUzRmrW1qQTd98iCxmXzWrxf3x8K0DDEwAA",
|
|
@@ -34,6 +37,8 @@ const exactDocs = [
|
|
|
34
37
|
"docs/project/repository-map.md",
|
|
35
38
|
"docs/project/runtime.md",
|
|
36
39
|
"docs/reviews/_TEMPLATE-REVIEW.md",
|
|
40
|
+
"docs/skill-feedback/README.md",
|
|
41
|
+
"docs/skill-feedback/_TEMPLATE-SKILL-FEEDBACK.md",
|
|
37
42
|
"docs/testing/regression-matrix.md",
|
|
38
43
|
"docs/tools/autopipeline/ap.py",
|
|
39
44
|
];
|
|
@@ -85,6 +90,30 @@ function writeFile(file, text) {
|
|
|
85
90
|
fs.writeFileSync(file, text);
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
function installTrustedEngineeringDefault(repo, content, version) {
|
|
94
|
+
const installedRelative = path.join(
|
|
95
|
+
".agents",
|
|
96
|
+
"skills",
|
|
97
|
+
"auto-coding-skill",
|
|
98
|
+
"data",
|
|
99
|
+
"templates",
|
|
100
|
+
"ENGINEERING.md",
|
|
101
|
+
);
|
|
102
|
+
writeFile(path.join(repo, installedRelative), content);
|
|
103
|
+
const manifestPath = path.join(repo, ".agents", "managed-install.json");
|
|
104
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
105
|
+
manifest.skill_version = version;
|
|
106
|
+
const entry = manifest.entries.find(item => item.path === installedRelative);
|
|
107
|
+
assert(entry, "installed manifest must contain the managed ENGINEERING source template");
|
|
108
|
+
Object.assign(entry, {
|
|
109
|
+
source: "skill/data/templates/ENGINEERING.md",
|
|
110
|
+
ownership: "exact",
|
|
111
|
+
sha256: crypto.createHash("sha256").update(content).digest("hex"),
|
|
112
|
+
version,
|
|
113
|
+
});
|
|
114
|
+
writeFile(manifestPath, `${JSON.stringify(manifest)}\n`);
|
|
115
|
+
}
|
|
116
|
+
|
|
88
117
|
function readEngineeringConfig(file) {
|
|
89
118
|
const script = [
|
|
90
119
|
"import json, pathlib, sys, yaml",
|
|
@@ -96,6 +125,42 @@ function readEngineeringConfig(file) {
|
|
|
96
125
|
return JSON.parse(run("python3", ["-c", script, file]).stdout);
|
|
97
126
|
}
|
|
98
127
|
|
|
128
|
+
function readYamlConfig(file) {
|
|
129
|
+
const script = [
|
|
130
|
+
"import json, pathlib, sys, yaml",
|
|
131
|
+
"value = yaml.safe_load(pathlib.Path(sys.argv[1]).read_text(encoding='utf-8'))",
|
|
132
|
+
"print(json.dumps(value, sort_keys=True))",
|
|
133
|
+
].join("; ");
|
|
134
|
+
return JSON.parse(run("python3", ["-c", script, file]).stdout);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function projectConfigPath(repo) {
|
|
138
|
+
return path.join(repo, projectConfigRelativePath);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function writeProjectConfig(repo, overrides) {
|
|
142
|
+
writeFile(projectConfigPath(repo), `${JSON.stringify({ schema: projectConfigSchema, overrides }, null, 2)}\n`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function renderYaml(value) {
|
|
146
|
+
const script = [
|
|
147
|
+
"import json, sys, yaml",
|
|
148
|
+
"print(yaml.safe_dump(json.loads(sys.argv[1]), allow_unicode=True, sort_keys=False), end='')",
|
|
149
|
+
].join("; ");
|
|
150
|
+
return run("python3", ["-c", script, JSON.stringify(value)]).stdout;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function readEffectiveConfig(repo) {
|
|
154
|
+
const script = [
|
|
155
|
+
"import json, pathlib, sys",
|
|
156
|
+
"repo = pathlib.Path(sys.argv[1]).resolve()",
|
|
157
|
+
"sys.path.insert(0, str(repo / '.agents' / 'skills' / 'auto-coding-skill' / 'scripts'))",
|
|
158
|
+
"import core",
|
|
159
|
+
"print(json.dumps(core.load_effective_config(repo), sort_keys=True))",
|
|
160
|
+
].join("; ");
|
|
161
|
+
return JSON.parse(run("python3", ["-c", script, repo]).stdout);
|
|
162
|
+
}
|
|
163
|
+
|
|
99
164
|
function canonicalJson(value) {
|
|
100
165
|
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
101
166
|
if (value && typeof value === "object") {
|
|
@@ -139,7 +204,7 @@ function listProjectFiles(root) {
|
|
|
139
204
|
return out;
|
|
140
205
|
}
|
|
141
206
|
|
|
142
|
-
function
|
|
207
|
+
function fillLegacyEngineeringAccess(repo, password = "local-dev-password") {
|
|
143
208
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
144
209
|
const text = fs.readFileSync(engineering, "utf8");
|
|
145
210
|
const block = [
|
|
@@ -189,6 +254,54 @@ function fillRequiredAccess(repo, password = "local-dev-password") {
|
|
|
189
254
|
fs.writeFileSync(engineering, updated);
|
|
190
255
|
}
|
|
191
256
|
|
|
257
|
+
function fillRequiredAccess(repo, password = "local-dev-password") {
|
|
258
|
+
const overlay = projectConfigPath(repo);
|
|
259
|
+
const existing = exists(overlay) ? (readYamlConfig(overlay).overrides ?? {}) : {};
|
|
260
|
+
const required = requiredProjectOverrides(existing.project?.name ?? path.basename(repo), password);
|
|
261
|
+
writeProjectConfig(repo, {
|
|
262
|
+
...existing,
|
|
263
|
+
project: { ...required.project, ...(existing.project ?? {}) },
|
|
264
|
+
access: required.access,
|
|
265
|
+
commands: { ...(existing.commands ?? {}), ...required.commands },
|
|
266
|
+
validation: { ...(existing.validation ?? {}), ...required.validation },
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function requiredProjectOverrides(projectName, password = "overlay-local-dev-password") {
|
|
271
|
+
return {
|
|
272
|
+
project: {
|
|
273
|
+
name: projectName,
|
|
274
|
+
},
|
|
275
|
+
access: {
|
|
276
|
+
project: {
|
|
277
|
+
frontend: { url: "http://project-frontend.local", username: "project-frontend-user", password },
|
|
278
|
+
backend: { url: "http://project-backend.local", username: "project-backend-user", password },
|
|
279
|
+
},
|
|
280
|
+
jenkins: {
|
|
281
|
+
frontend: { url: "http://jenkins-frontend.local", username: "jenkins-frontend-user", password },
|
|
282
|
+
backend: { url: "http://jenkins-backend.local", username: "jenkins-backend-user", password },
|
|
283
|
+
},
|
|
284
|
+
gitlab: { url: "http://gitlab.local", username: "gitlab-user", password },
|
|
285
|
+
nexus: {
|
|
286
|
+
frontend: { url: "http://nexus-frontend.local", username: "nexus-frontend-user", password },
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
commands: {
|
|
290
|
+
project_fast: "true",
|
|
291
|
+
},
|
|
292
|
+
validation: {
|
|
293
|
+
routes: [
|
|
294
|
+
{
|
|
295
|
+
name: "project-code",
|
|
296
|
+
paths: ["**"],
|
|
297
|
+
exclude: ["*.md", "docs/**"],
|
|
298
|
+
commands: ["project_fast"],
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
192
305
|
function assertStatusOk(repo) {
|
|
193
306
|
fillRequiredAccess(repo);
|
|
194
307
|
const result = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
@@ -199,7 +312,6 @@ function assertStatusOk(repo) {
|
|
|
199
312
|
function testInitFullyConvergesExistingProject() {
|
|
200
313
|
const repo = tmpdir("full-init");
|
|
201
314
|
run("node", [cli, "init"], { cwd: repo });
|
|
202
|
-
fillRequiredAccess(repo, "preserved-project-secret");
|
|
203
315
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
204
316
|
const structureStandard = path.join(repo, "docs", "architecture", "structure-standard.md");
|
|
205
317
|
assert(
|
|
@@ -242,54 +354,45 @@ function testInitFullyConvergesExistingProject() {
|
|
|
242
354
|
],
|
|
243
355
|
},
|
|
244
356
|
};
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
" - frontend/package.json",
|
|
252
|
-
" - frontend/extensions/**",
|
|
253
|
-
" profile: high-risk",
|
|
254
|
-
" review: required",
|
|
255
|
-
" design: required",
|
|
256
|
-
].join("\n");
|
|
257
|
-
const customStructureYaml = [
|
|
258
|
-
"structure:",
|
|
259
|
-
" enabled: false",
|
|
260
|
-
" enforcement: blocking",
|
|
261
|
-
" architecture_standard: xjmate-clean-architecture",
|
|
262
|
-
" exclude: [docs/**]",
|
|
263
|
-
" allow_large_files: [generated/**]",
|
|
264
|
-
" reusable_tool_dirs: [tools/**]",
|
|
265
|
-
" max_file_lines_warn: 701",
|
|
266
|
-
" max_file_lines_block: 1401",
|
|
267
|
-
" max_function_lines_warn: 101",
|
|
268
|
-
" max_added_lines_to_large_file: 41",
|
|
269
|
-
" require_reuse_search: false",
|
|
270
|
-
" block_new_responsibility_in_large_file: false",
|
|
271
|
-
" accepted_debt_paths: [legacy/accepted/**]",
|
|
272
|
-
" layer_rules:",
|
|
273
|
-
" enabled: false",
|
|
274
|
-
" block: true",
|
|
275
|
-
" rules:",
|
|
276
|
-
" - name: project-domain",
|
|
277
|
-
" paths: [src/domain/**]",
|
|
278
|
-
" forbidden_imports: [src/infrastructure/**]",
|
|
279
|
-
].join("\n");
|
|
357
|
+
writeProjectConfig(repo, {
|
|
358
|
+
...requiredProjectOverrides(path.basename(repo), "preserved-project-secret"),
|
|
359
|
+
risk: { rules: expectedRiskRules },
|
|
360
|
+
structure: expectedStructure,
|
|
361
|
+
});
|
|
362
|
+
const overlayBefore = fs.readFileSync(projectConfigPath(repo));
|
|
280
363
|
writeFile(engineering, fs.readFileSync(engineering, "utf8")
|
|
281
|
-
.replace("concurrency:\n", "legacy_extra:\n forbidden: true\n\nconcurrency:\n")
|
|
282
|
-
.replace(/^risk:\r?\n[\s\S]*?(?=^structure:)/m, `${customRiskYaml}\n`)
|
|
283
|
-
.replace(/^structure:\r?\n[\s\S]*?(?=^optimization:)/m, `${customStructureYaml}\n`)
|
|
284
364
|
.replace("# Project Facts", "# Obsolete workflow rules\n\nRun a full build every time.\n\n# Project Facts"));
|
|
285
365
|
writeFile(path.join(repo, "docs", "legacy", "old-taskbook.md"), "historical\n");
|
|
286
366
|
writeFile(path.join(repo, "docs", "architecture", "system-context.md"), "# System context\n\nKeep me.\n");
|
|
287
367
|
writeFile(path.join(repo, "docs", "architecture", "adr", "0042-project-choice.md"), "# ADR-0042\n\nKeep me.\n");
|
|
288
368
|
writeFile(path.join(repo, "docs", "interfaces", "event-contracts.md"), "# Events\n\nKeep me.\n");
|
|
369
|
+
writeFile(path.join(repo, "docs", "project", "operations.md"), "# Project operations\n\nKeep me.\n");
|
|
370
|
+
const projectAssets = new Map([
|
|
371
|
+
["docs/architecture/diagrams/system.svg", Buffer.from("<svg>architecture</svg>\n")],
|
|
372
|
+
["docs/bugs/attachments/trace.bin", Buffer.from([0, 1, 2, 255])],
|
|
373
|
+
["docs/deployment/assets/values.yaml", Buffer.from("replicas: 2\n")],
|
|
374
|
+
["docs/design/T0055-login-comparison.png", Buffer.from([137, 80, 78, 71, 0, 255])],
|
|
375
|
+
["docs/interfaces/schemas/event.json", Buffer.from('{"type":"object"}\n')],
|
|
376
|
+
["docs/project/assets/logo.bin", Buffer.from([10, 20, 30, 40])],
|
|
377
|
+
["docs/reviews/evidence/chart.svg", Buffer.from("<svg>review</svg>\n")],
|
|
378
|
+
["docs/testing/fixtures/sample.dat", Buffer.from("fixture\u0000bytes")],
|
|
379
|
+
]);
|
|
380
|
+
for (const [relative, bytes] of projectAssets) writeFile(path.join(repo, relative), bytes);
|
|
381
|
+
writeFile(path.join(repo, "docs", "legacy", "orphan.bin"), Buffer.from([7, 8, 9]));
|
|
382
|
+
const skillFeedback = path.join(repo, "docs", "skill-feedback", "reports", "2026-07-18-review-timeout-a13f82c1.md");
|
|
383
|
+
const skillFeedbackContent = "project-owned feedback bytes\n";
|
|
384
|
+
writeFile(skillFeedback, skillFeedbackContent);
|
|
289
385
|
writeFile(structureStandard, customStructureStandard);
|
|
290
386
|
writeFile(path.join(repo, ".agents", "agents", "custom.toml"), 'name = "custom"\n');
|
|
291
387
|
writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "obsolete.txt"), "obsolete\n");
|
|
292
388
|
|
|
389
|
+
const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
390
|
+
const dryActions = JSON.parse(dryRun.stdout).results[0].actions;
|
|
391
|
+
for (const [relative, bytes] of projectAssets) {
|
|
392
|
+
assert(!dryActions.some(item => item.path === relative && item.action === "would-delete"), `${relative}: dry-run must preserve project-owned assets`);
|
|
393
|
+
assert(fs.readFileSync(path.join(repo, relative)).equals(bytes), `${relative}: dry-run must preserve bytes`);
|
|
394
|
+
}
|
|
395
|
+
|
|
293
396
|
run("node", [cli, "init"], { cwd: repo });
|
|
294
397
|
const installedDocs = listProjectFiles(path.join(repo, "docs"))
|
|
295
398
|
.map(file => path.relative(repo, file).split(path.sep).join("/"))
|
|
@@ -299,12 +402,17 @@ function testInitFullyConvergesExistingProject() {
|
|
|
299
402
|
"docs/architecture/adr/0042-project-choice.md",
|
|
300
403
|
"docs/architecture/system-context.md",
|
|
301
404
|
"docs/interfaces/event-contracts.md",
|
|
405
|
+
"docs/project/auto-coding-skill.yaml",
|
|
406
|
+
"docs/project/operations.md",
|
|
407
|
+
"docs/skill-feedback/reports/2026-07-18-review-timeout-a13f82c1.md",
|
|
408
|
+
...projectAssets.keys(),
|
|
302
409
|
].sort();
|
|
303
410
|
assert(JSON.stringify(installedDocs) === JSON.stringify(expectedInstalledDocs), `docs framework must converge while preserving valid artifacts: ${installedDocs.join(", ")}`);
|
|
304
411
|
const converged = fs.readFileSync(engineering, "utf8");
|
|
305
|
-
const convergedConfig =
|
|
306
|
-
assert(
|
|
307
|
-
assert(!converged.includes("
|
|
412
|
+
const convergedConfig = readEffectiveConfig(repo);
|
|
413
|
+
assert(convergedConfig.access?.project?.frontend?.password === "preserved-project-secret", "project access values must survive init in the overlay");
|
|
414
|
+
assert(!converged.includes("preserved-project-secret"), "managed ENGINEERING must not retain project access values");
|
|
415
|
+
assert(!converged.includes("Run a full build every time"), "legacy workflow text must be removed");
|
|
308
416
|
assert(canonicalJson(convergedConfig.risk?.rules) === canonicalJson(expectedRiskRules), "project risk.rules must survive init path-for-path");
|
|
309
417
|
for (const [key, expected] of Object.entries(expectedStructure)) {
|
|
310
418
|
assert(
|
|
@@ -314,15 +422,27 @@ function testInitFullyConvergesExistingProject() {
|
|
|
314
422
|
}
|
|
315
423
|
assert(exists(path.join(repo, ".agents", "agents", "custom.toml")), "project-owned custom agents must survive init");
|
|
316
424
|
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "obsolete.txt")), "extra Skill files must be removed");
|
|
317
|
-
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.
|
|
425
|
+
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "legacy", "old-taskbook.md")), "removed docs must be archived outside active docs");
|
|
426
|
+
assert(exists(path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "legacy", "orphan.bin")), "unowned legacy binary assets must still be archived");
|
|
318
427
|
assert(fs.readFileSync(structureStandard, "utf8") === customStructureStandard, "init must preserve a project-owned structure standard");
|
|
319
428
|
assert(fs.readFileSync(path.join(repo, "docs", "architecture", "adr", "0042-project-choice.md"), "utf8").includes("Keep me"), "numbered ADR artifacts must survive init");
|
|
320
429
|
assert(fs.readFileSync(path.join(repo, "docs", "architecture", "system-context.md"), "utf8").includes("Keep me"), "architecture artifacts must survive init");
|
|
321
430
|
assert(fs.readFileSync(path.join(repo, "docs", "interfaces", "event-contracts.md"), "utf8").includes("Keep me"), "interface artifacts must survive init");
|
|
431
|
+
assert(fs.readFileSync(path.join(repo, "docs", "project", "operations.md"), "utf8").includes("Keep me"), "project fact documents promised by the manifest must survive init");
|
|
432
|
+
assert(fs.readFileSync(skillFeedback, "utf8") === skillFeedbackContent, "project Skill feedback must survive init byte-for-byte");
|
|
433
|
+
assert(fs.readFileSync(projectConfigPath(repo)).equals(overlayBefore), "init must preserve the project configuration overlay byte-for-byte");
|
|
434
|
+
for (const [relative, bytes] of projectAssets) {
|
|
435
|
+
assert(fs.readFileSync(path.join(repo, relative)).equals(bytes), `${relative}: init must preserve project-owned bytes`);
|
|
436
|
+
}
|
|
322
437
|
|
|
323
438
|
run("node", [cli, "init"], { cwd: repo });
|
|
324
439
|
assert(fs.readFileSync(engineering, "utf8") === converged, "repeated init must be byte-idempotent for ENGINEERING.md");
|
|
440
|
+
assert(fs.readFileSync(projectConfigPath(repo)).equals(overlayBefore), "repeated init must preserve the project configuration overlay byte-for-byte");
|
|
325
441
|
assert(fs.readFileSync(structureStandard, "utf8") === customStructureStandard, "repeated init must preserve the project structure standard byte-for-byte");
|
|
442
|
+
assert(fs.readFileSync(skillFeedback, "utf8") === skillFeedbackContent, "repeated init must preserve project Skill feedback byte-for-byte");
|
|
443
|
+
for (const [relative, bytes] of projectAssets) {
|
|
444
|
+
assert(fs.readFileSync(path.join(repo, relative)).equals(bytes), `${relative}: repeated init must preserve project-owned bytes`);
|
|
445
|
+
}
|
|
326
446
|
const secondDocs = listProjectFiles(path.join(repo, "docs"))
|
|
327
447
|
.map(file => path.relative(repo, file).split(path.sep).join("/"))
|
|
328
448
|
.sort();
|
|
@@ -340,32 +460,34 @@ function testStructureBlockWarningsDefaultsPreserveAndConverge() {
|
|
|
340
460
|
"new projects must default structure.block_warnings to false",
|
|
341
461
|
);
|
|
342
462
|
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
463
|
+
const initialOverrides = readYamlConfig(projectConfigPath(repo)).overrides;
|
|
464
|
+
writeProjectConfig(repo, {
|
|
465
|
+
...initialOverrides,
|
|
466
|
+
structure: { ...(initialOverrides.structure ?? {}), block_warnings: true },
|
|
467
|
+
});
|
|
468
|
+
const customized = fs.readFileSync(projectConfigPath(repo));
|
|
349
469
|
|
|
350
470
|
run("node", [cli, "init"], { cwd: repo });
|
|
351
471
|
const converged = fs.readFileSync(engineering, "utf8");
|
|
352
472
|
assert(
|
|
353
|
-
|
|
354
|
-
"init must
|
|
473
|
+
readEffectiveConfig(repo).structure?.block_warnings === true,
|
|
474
|
+
"init must apply an explicit true project structure.block_warnings override",
|
|
355
475
|
);
|
|
476
|
+
assert(fs.readFileSync(projectConfigPath(repo)).equals(customized), "init must preserve the block_warnings overlay byte-for-byte");
|
|
356
477
|
run("node", [cli, "init"], { cwd: repo });
|
|
357
478
|
assert(
|
|
358
479
|
fs.readFileSync(engineering, "utf8") === converged,
|
|
359
|
-
"repeated init must be byte-idempotent
|
|
480
|
+
"repeated init must be byte-idempotent for managed defaults",
|
|
360
481
|
);
|
|
361
482
|
|
|
362
483
|
run("node", [cli, "sync", "--projects", repo]);
|
|
363
484
|
const synced = fs.readFileSync(engineering, "utf8");
|
|
364
485
|
assert(
|
|
365
|
-
|
|
366
|
-
"sync must preserve an explicit true structure.block_warnings
|
|
486
|
+
readEffectiveConfig(repo).structure?.block_warnings === true,
|
|
487
|
+
"sync must preserve an explicit true project structure.block_warnings override",
|
|
367
488
|
);
|
|
368
489
|
assert(synced === converged, "sync must not rewrite a converged block_warnings=true config");
|
|
490
|
+
assert(fs.readFileSync(projectConfigPath(repo)).equals(customized), "sync must preserve the block_warnings overlay byte-for-byte");
|
|
369
491
|
run("node", [cli, "sync", "--projects", repo]);
|
|
370
492
|
assert(
|
|
371
493
|
fs.readFileSync(engineering, "utf8") === synced,
|
|
@@ -373,16 +495,55 @@ function testStructureBlockWarningsDefaultsPreserveAndConverge() {
|
|
|
373
495
|
);
|
|
374
496
|
}
|
|
375
497
|
|
|
498
|
+
function testProjectDocumentationSpecialFilesFailBeforeWrites() {
|
|
499
|
+
if (process.platform === "win32") return;
|
|
500
|
+
const repo = tmpdir("docs-special-files");
|
|
501
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
502
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
503
|
+
const sentinel = "stale-skill-must-survive-rejected-docs-preflight\n";
|
|
504
|
+
writeFile(skill, sentinel);
|
|
505
|
+
|
|
506
|
+
const externalFile = path.join(tmpdir("docs-special-target"), "external.png");
|
|
507
|
+
writeFile(externalFile, "external-target\n");
|
|
508
|
+
const linkedFile = path.join(repo, "docs", "design", "linked.png");
|
|
509
|
+
fs.symlinkSync(externalFile, linkedFile);
|
|
510
|
+
let rejected = run("node", [cli, "sync", "--projects", repo], { check: false });
|
|
511
|
+
assert(rejected.status !== 0 && rejected.stderr.includes("regular non-symlink files"), "project document file symlinks must fail before writes");
|
|
512
|
+
assert(fs.readFileSync(skill, "utf8") === sentinel && fs.readFileSync(externalFile, "utf8") === "external-target\n", "rejected file symlink must not mutate managed or external files");
|
|
513
|
+
fs.unlinkSync(linkedFile);
|
|
514
|
+
|
|
515
|
+
const externalDir = tmpdir("docs-special-directory-target");
|
|
516
|
+
const linkedDir = path.join(repo, "docs", "reviews", "linked-assets");
|
|
517
|
+
fs.symlinkSync(externalDir, linkedDir);
|
|
518
|
+
rejected = run("node", [cli, "sync", "--projects", repo], { check: false });
|
|
519
|
+
assert(rejected.status !== 0 && rejected.stderr.includes("regular non-symlink files"), "project document directory symlinks must fail before writes");
|
|
520
|
+
assert(fs.readFileSync(skill, "utf8") === sentinel && fs.readdirSync(externalDir).length === 0, "rejected directory symlink must preserve both roots");
|
|
521
|
+
fs.unlinkSync(linkedDir);
|
|
522
|
+
|
|
523
|
+
const fifo = path.join(repo, "docs", "testing", "fixture.pipe");
|
|
524
|
+
run("mkfifo", [fifo]);
|
|
525
|
+
rejected = run("node", [cli, "sync", "--projects", repo], { check: false });
|
|
526
|
+
assert(rejected.status !== 0 && rejected.stderr.includes("regular non-symlink files"), "project document FIFOs must fail before writes");
|
|
527
|
+
assert(fs.readFileSync(skill, "utf8") === sentinel, "rejected special files must preserve managed bytes");
|
|
528
|
+
fs.unlinkSync(fifo);
|
|
529
|
+
}
|
|
530
|
+
|
|
376
531
|
function testManagedPolicySummaryPreservesProjectConfiguration() {
|
|
377
532
|
const repo = tmpdir("managed-policy-summary");
|
|
378
533
|
run("node", [cli, "init"], { cwd: repo });
|
|
534
|
+
fs.unlinkSync(projectConfigPath(repo));
|
|
379
535
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
380
536
|
const current = fs.readFileSync(engineering, "utf8");
|
|
381
|
-
const neutralSummary = "- `structure` and `optimization`:
|
|
537
|
+
const neutralSummary = "- `structure` and `optimization`: managed defaults that the project overlay may\n replace explicitly.";
|
|
382
538
|
const legacySummary = "- `structure` and `optimization`: advisory architecture and no-new-debt policy.";
|
|
539
|
+
const installedOldDefault = current
|
|
540
|
+
.replace(/^ skill_version:.*$/m, " skill_version: 4.2.5")
|
|
541
|
+
.replace("managed-workflow:start version=4.3.1", "managed-workflow:start version=4.2.5")
|
|
542
|
+
.replace(neutralSummary, legacySummary);
|
|
543
|
+
installTrustedEngineeringDefault(repo, installedOldDefault, "4.2.5");
|
|
383
544
|
const customized = current
|
|
384
545
|
.replace(/^ skill_version:.*$/m, " skill_version: 4.2.5")
|
|
385
|
-
.replace("managed-workflow:start version=4.
|
|
546
|
+
.replace("managed-workflow:start version=4.3.1", "managed-workflow:start version=4.2.5")
|
|
386
547
|
.replace(neutralSummary, legacySummary)
|
|
387
548
|
.replace(/^ enforcement:.*$/m, " enforcement: blocking")
|
|
388
549
|
.replace(" block_warnings: false", " block_warnings: true")
|
|
@@ -399,15 +560,18 @@ function testManagedPolicySummaryPreservesProjectConfiguration() {
|
|
|
399
560
|
|
|
400
561
|
run("node", [cli, "init"], { cwd: repo });
|
|
401
562
|
const upgraded = fs.readFileSync(engineering, "utf8");
|
|
402
|
-
const
|
|
403
|
-
|
|
563
|
+
const managedAfterUpgrade = readEngineeringConfig(engineering);
|
|
564
|
+
const afterUpgrade = readEffectiveConfig(repo);
|
|
565
|
+
assert(managedAfterUpgrade.workflow?.skill_version === "4.3.1", "init must upgrade the managed workflow version");
|
|
404
566
|
assert(canonicalJson(afterUpgrade.structure) === canonicalJson(beforeUpgrade.structure), "init must preserve the complete project structure policy");
|
|
405
567
|
assert(canonicalJson(afterUpgrade.optimization) === canonicalJson(beforeUpgrade.optimization), "init must preserve the complete project optimization policy");
|
|
406
568
|
assert(upgraded.includes(neutralSummary), "upgraded managed text must defer to frontmatter policy");
|
|
407
569
|
assert(!upgraded.includes(legacySummary), "upgraded managed text must remove the hard-coded default policy description");
|
|
408
570
|
|
|
571
|
+
const migratedOverlay = fs.readFileSync(projectConfigPath(repo));
|
|
409
572
|
run("node", [cli, "init"], { cwd: repo });
|
|
410
573
|
assert(fs.readFileSync(engineering, "utf8") === upgraded, "repeated init must be byte-idempotent after the policy-summary upgrade");
|
|
574
|
+
assert(fs.readFileSync(projectConfigPath(repo)).equals(migratedOverlay), "repeated init must preserve the migrated project policy overlay byte-for-byte");
|
|
411
575
|
}
|
|
412
576
|
|
|
413
577
|
function testInitRejectsMissingPythonRuntimeBeforeWrites() {
|
|
@@ -475,18 +639,22 @@ function testMinimalInitConvergesWithinBudget() {
|
|
|
475
639
|
const lines = files.reduce((total, file) => total + fs.readFileSync(file, "utf8").split(/\r?\n/).length, 0);
|
|
476
640
|
assert(files.length <= 40, `minimal scaffold file budget exceeded: ${files.length}`);
|
|
477
641
|
// Integrity, staging, fail-closed classification, immutable Reviewer snapshots,
|
|
478
|
-
// bounded runtime supervision, failure-evidence binding, contract helpers,
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
|
|
642
|
+
// bounded runtime supervision, failure-evidence binding, contract helpers,
|
|
643
|
+
// effective-config overlay parsing/migration, release-aware metadata-only
|
|
644
|
+
// feedback lifecycle collection, and the language-aware structure scanner are executable
|
|
645
|
+
// support code, not prompt context. Keep a measured ceiling while leaving
|
|
646
|
+
// safety checks readable.
|
|
647
|
+
assert(lines <= 20500, `minimal scaffold line budget exceeded: ${lines}`);
|
|
482
648
|
const engineering = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"), "utf8");
|
|
483
|
-
|
|
484
|
-
assert(
|
|
485
|
-
assert(
|
|
486
|
-
assert(
|
|
487
|
-
assert(
|
|
488
|
-
assert(
|
|
489
|
-
assert(
|
|
649
|
+
const managedConfig = readEngineeringConfig(path.join(repo, "docs", "ENGINEERING.md"));
|
|
650
|
+
assert(managedConfig.workflow?.profile === "auto", "engineering should enable adaptive profiles");
|
|
651
|
+
assert(managedConfig.concurrency?.isolation === "adaptive", "engineering should default to adaptive clean-branch/worktree isolation");
|
|
652
|
+
assert(managedConfig.workflow?.completion === "push", "engineering should complete normal development at push");
|
|
653
|
+
assert(managedConfig.commands?.project_fast === "", "generic projects should expose an optional project-fast command");
|
|
654
|
+
assert(managedConfig.validation?.max_command_seconds === 120, "engineering should bound each final route command");
|
|
655
|
+
assert(managedConfig.validation?.max_total_seconds === 180, "engineering should bound the complete final gate");
|
|
656
|
+
assert(readYamlConfig(projectConfigPath(repo)).overrides?.project?.name === path.basename(repo), "project name should be initialized in the project-owned overlay");
|
|
657
|
+
assert(managedConfig.project?.name === "", "managed ENGINEERING must keep the neutral project-name default");
|
|
490
658
|
assert(!engineering.includes("## Design, review, and subagents"), "engineering must not duplicate the behavioral protocol");
|
|
491
659
|
const agentsProtocol = fs.readFileSync(path.join(repo, "AGENTS.md"), "utf8");
|
|
492
660
|
assert(agentsProtocol.includes("## Minimum mechanism budget"), "AGENTS should own the shared behavioral protocol");
|
|
@@ -530,17 +698,72 @@ function testMinimalInitConvergesWithinBudget() {
|
|
|
530
698
|
}
|
|
531
699
|
}
|
|
532
700
|
|
|
701
|
+
function testSkillFeedbackTemplatesAndReportsSurviveSync() {
|
|
702
|
+
const repo = tmpdir("skill-feedback-sync");
|
|
703
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
704
|
+
fillRequiredAccess(repo);
|
|
705
|
+
const feedbackReadme = path.join(repo, "docs", "skill-feedback", "README.md");
|
|
706
|
+
const feedbackTemplate = path.join(repo, "docs", "skill-feedback", "_TEMPLATE-SKILL-FEEDBACK.md");
|
|
707
|
+
const report = path.join(repo, "docs", "skill-feedback", "reports", "2026-07-18-installer-gap-a13f82c1.md");
|
|
708
|
+
const reportBytes = Buffer.from("project-owned\u0000feedback\n", "utf8");
|
|
709
|
+
fs.mkdirSync(path.dirname(report), { recursive: true });
|
|
710
|
+
fs.writeFileSync(report, reportBytes);
|
|
711
|
+
assert(exists(feedbackReadme) && exists(feedbackTemplate), "init must install managed Skill feedback guidance and template");
|
|
712
|
+
|
|
713
|
+
writeFile(feedbackReadme, "managed template drift\n");
|
|
714
|
+
const dry = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
715
|
+
const dryResult = JSON.parse(dry.stdout).results[0];
|
|
716
|
+
assert(
|
|
717
|
+
dryResult.actions.some(item => item.path === "docs/skill-feedback/README.md" && item.action === "would-replace"),
|
|
718
|
+
"sync dry-run must report managed feedback template drift",
|
|
719
|
+
);
|
|
720
|
+
assert(fs.readFileSync(feedbackReadme, "utf8") === "managed template drift\n", "sync dry-run must not write feedback templates");
|
|
721
|
+
assert(fs.readFileSync(report).equals(reportBytes), "sync dry-run must not touch project feedback reports");
|
|
722
|
+
|
|
723
|
+
run("node", [cli, "sync", "--projects", repo, "--json"]);
|
|
724
|
+
assert(fs.readFileSync(feedbackReadme, "utf8").includes("Auto Coding Skill Feedback"), "sync must restore the managed feedback README");
|
|
725
|
+
assert(fs.readFileSync(report).equals(reportBytes), "sync must preserve project feedback reports byte-for-byte");
|
|
726
|
+
assertStatusOk(repo);
|
|
727
|
+
|
|
728
|
+
if (process.platform !== "win32") {
|
|
729
|
+
const external = path.join(tmpdir("feedback-managed-symlink"), "external.md");
|
|
730
|
+
const installedSkill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
731
|
+
const skillBefore = fs.readFileSync(installedSkill);
|
|
732
|
+
writeFile(external, "external must not change\n");
|
|
733
|
+
fs.unlinkSync(feedbackReadme);
|
|
734
|
+
fs.symlinkSync(external, feedbackReadme);
|
|
735
|
+
const unsafeInit = run("node", [cli, "init"], { cwd: repo, check: false });
|
|
736
|
+
assert(unsafeInit.status !== 0 && unsafeInit.stderr.includes("non-symlink"), "init must reject a managed feedback template symlink before writes");
|
|
737
|
+
assert(fs.readFileSync(external, "utf8") === "external must not change\n", "init must never follow a managed feedback template symlink");
|
|
738
|
+
assert(fs.readFileSync(installedSkill).equals(skillBefore), "managed feedback symlink preflight must happen before install writes");
|
|
739
|
+
fs.unlinkSync(feedbackReadme);
|
|
740
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
741
|
+
assert(fs.readFileSync(report).equals(reportBytes), "feedback report must survive repair of a managed template symlink");
|
|
742
|
+
|
|
743
|
+
const parentLinkRepo = tmpdir("feedback-managed-parent-symlink");
|
|
744
|
+
const externalDir = tmpdir("feedback-managed-parent-external");
|
|
745
|
+
run("node", [cli, "init"], { cwd: parentLinkRepo });
|
|
746
|
+
const parentInstalledSkill = path.join(parentLinkRepo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
747
|
+
const parentSkillBefore = fs.readFileSync(parentInstalledSkill);
|
|
748
|
+
fs.rmSync(path.join(parentLinkRepo, "docs", "skill-feedback"), { recursive: true, force: true });
|
|
749
|
+
fs.symlinkSync(externalDir, path.join(parentLinkRepo, "docs", "skill-feedback"));
|
|
750
|
+
const unsafeParentInit = run("node", [cli, "init"], { cwd: parentLinkRepo, check: false });
|
|
751
|
+
assert(unsafeParentInit.status !== 0 && unsafeParentInit.stderr.includes("real directory"), "init must reject a symlink in the managed feedback parent chain");
|
|
752
|
+
assert(fs.readdirSync(externalDir).length === 0, "init must not write through a managed feedback parent symlink");
|
|
753
|
+
assert(fs.readFileSync(parentInstalledSkill).equals(parentSkillBefore), "parent symlink preflight must happen before install writes");
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
533
757
|
function testStatusRejectsLegacyIsolation() {
|
|
534
758
|
const repo = tmpdir("legacy-isolation-status");
|
|
535
759
|
run("node", [cli, "init"], { cwd: repo });
|
|
536
760
|
run("node", [cli, "sync", "--projects", repo]);
|
|
537
761
|
fillRequiredAccess(repo);
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
);
|
|
543
|
-
fs.writeFileSync(engineeringPath, engineering);
|
|
762
|
+
const overrides = readYamlConfig(projectConfigPath(repo)).overrides;
|
|
763
|
+
writeProjectConfig(repo, {
|
|
764
|
+
...overrides,
|
|
765
|
+
concurrency: { ...(overrides.concurrency ?? {}), isolation: "legacy" },
|
|
766
|
+
});
|
|
544
767
|
|
|
545
768
|
const result = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
546
769
|
assert(result.status !== 0, "status must reject legacy isolation");
|
|
@@ -556,17 +779,20 @@ function testStatusRejectsLegacyGateEscalation() {
|
|
|
556
779
|
const repo = tmpdir("legacy-gate-status");
|
|
557
780
|
run("node", [cli, "init"], { cwd: repo });
|
|
558
781
|
run("node", [cli, "sync", "--projects", repo]);
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
782
|
+
const overrides = readYamlConfig(projectConfigPath(repo)).overrides;
|
|
783
|
+
writeProjectConfig(repo, {
|
|
784
|
+
...overrides,
|
|
785
|
+
gate: {
|
|
786
|
+
full_on_unknown: "true",
|
|
787
|
+
full_on: ["prod_config"],
|
|
788
|
+
rules: [{ match: ["Jenkinsfile"], scope: "full", commands: ["gate_full"] }],
|
|
789
|
+
},
|
|
790
|
+
});
|
|
565
791
|
const status = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
566
792
|
assert(status.status === 2, "legacy automatic gate escalation must make status non-zero");
|
|
567
793
|
const invalid = JSON.parse(status.stdout).results[0].invalidConfigTokens;
|
|
568
|
-
for (const expected of ["gate.full_on", "gate.full_on_unknown", "gate.rules[].scope", "gate.rules[].commands"]) {
|
|
569
|
-
assert(invalid.some(item => item.includes(expected)), `status should report ${expected}`);
|
|
794
|
+
for (const expected of ["gate.full_on", "gate.full_on_unknown", "gate.rules[0].scope", "gate.rules[0].commands"]) {
|
|
795
|
+
assert(invalid.some(item => item.includes(expected)), `status should report ${expected}: ${status.stdout}`);
|
|
570
796
|
}
|
|
571
797
|
}
|
|
572
798
|
|
|
@@ -574,12 +800,11 @@ function testStatusAcceptsValidIndentlessYamlRoutes() {
|
|
|
574
800
|
const repo = tmpdir("indentless-routes");
|
|
575
801
|
run("node", [cli, "init"], { cwd: repo });
|
|
576
802
|
fillRequiredAccess(repo);
|
|
577
|
-
const
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
(
|
|
581
|
-
);
|
|
582
|
-
writeFile(engineering, text);
|
|
803
|
+
const overlay = projectConfigPath(repo);
|
|
804
|
+
const parsed = readYamlConfig(overlay);
|
|
805
|
+
const text = renderYaml(parsed);
|
|
806
|
+
assert(/^ routes:\r?\n - /m.test(text), "fixture must use a valid indentless YAML route sequence");
|
|
807
|
+
writeFile(overlay, text);
|
|
583
808
|
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
584
809
|
assert(JSON.parse(status.stdout).results[0].ok === true, "valid indentless YAML routes must not be reported as empty");
|
|
585
810
|
}
|
|
@@ -589,10 +814,10 @@ function testOrdinaryNodeTestIsNotPromotedToAutomaticGate() {
|
|
|
589
814
|
writeFile(path.join(repo, "package.json"), JSON.stringify({ scripts: { test: "node --test" } }, null, 2) + "\n");
|
|
590
815
|
run("node", [cli, "init"], { cwd: repo });
|
|
591
816
|
run("node", [cli, "sync", "--projects", repo]);
|
|
592
|
-
const
|
|
593
|
-
assert(
|
|
594
|
-
assert(
|
|
595
|
-
assert(
|
|
817
|
+
const effective = readEffectiveConfig(repo);
|
|
818
|
+
assert(effective.commands?.project_fast === "", "ordinary test must not be promoted to the project-fast command");
|
|
819
|
+
assert(effective.commands?.gate_standard === undefined, "ordinary test must not seed an automatic standard gate");
|
|
820
|
+
assert(effective.commands?.gate_full === undefined, "ordinary test must not seed an automatic full gate");
|
|
596
821
|
|
|
597
822
|
fillRequiredAccess(repo);
|
|
598
823
|
run("git", ["init", "-q"], { cwd: repo });
|
|
@@ -621,31 +846,1004 @@ function testAccessPasswordsAreRequiredButNeverPrintedByStatus() {
|
|
|
621
846
|
const healthy = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
622
847
|
assert(!healthy.stdout.includes(secret), "status JSON must not echo configured passwords");
|
|
623
848
|
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
)
|
|
849
|
+
const overlay = projectConfigPath(repo);
|
|
850
|
+
const missingPassword = readYamlConfig(overlay).overrides;
|
|
851
|
+
missingPassword.access.project.frontend.password = "";
|
|
852
|
+
missingPassword.access.project.frontend.password_env = "PROJECT_FRONTEND_PASSWORD";
|
|
853
|
+
writeProjectConfig(repo, missingPassword);
|
|
629
854
|
const missing = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
630
855
|
assert(missing.status !== 0, "an environment reference must not replace the required direct password");
|
|
631
856
|
assert(JSON.parse(missing.stdout).results[0].missingConfigTokens.includes("access.project.frontend.password"), "status should name the missing direct password field");
|
|
632
857
|
assert(!missing.stdout.includes(secret), "failed status JSON must not echo other configured passwords");
|
|
633
858
|
assert(!JSON.parse(missing.stdout).results[0].next.includes("upgrade"), "present but blank fields should not trigger a no-op upgrade recommendation");
|
|
634
859
|
|
|
860
|
+
fillRequiredAccess(repo);
|
|
861
|
+
const validOverlaySource = fs.readFileSync(overlay, "utf8");
|
|
635
862
|
for (const yamlValue of ["false", "[]", "{}", "2026-07-13", "0x10", "|"]) {
|
|
636
|
-
|
|
637
|
-
|
|
863
|
+
const invalid = validOverlaySource.replace('"password": "local-dev-password"', `"password": ${yamlValue}`);
|
|
864
|
+
assert(invalid !== validOverlaySource, `${yamlValue}: fixture must replace one overlay password`);
|
|
865
|
+
writeFile(overlay, invalid);
|
|
638
866
|
const nonString = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
639
|
-
assert(JSON.parse(nonString.stdout).results[0].missingConfigTokens.includes("access.project.frontend.password"), `YAML non-string ${yamlValue} must not count as a credential string`);
|
|
867
|
+
assert(JSON.parse(nonString.stdout).results[0].missingConfigTokens.includes("access.project.frontend.password"), `YAML non-string ${yamlValue} must not count as a credential string: ${nonString.stdout}`);
|
|
640
868
|
}
|
|
641
|
-
|
|
642
|
-
writeFile(engineering, fs.readFileSync(engineering, "utf8").replace(' password: "local-dev-password"', ' password: "TO\\u0044O"'));
|
|
869
|
+
writeFile(overlay, validOverlaySource.replace('"password": "local-dev-password"', '"password": "TO\\u0044O"'));
|
|
643
870
|
const escapedPlaceholder = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
644
871
|
assert(JSON.parse(escapedPlaceholder.stdout).results[0].missingConfigTokens.includes("access.project.frontend.password"), "escaped YAML placeholders must be decoded before validation");
|
|
645
872
|
|
|
646
|
-
|
|
873
|
+
const absentOverrides = readYamlConfig(overlay).overrides;
|
|
874
|
+
delete absentOverrides.access;
|
|
875
|
+
writeProjectConfig(repo, absentOverrides);
|
|
647
876
|
const absent = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
648
|
-
|
|
877
|
+
const absentStatus = JSON.parse(absent.stdout).results[0];
|
|
878
|
+
assert(absentStatus.unfilledConfigTokens.includes("access.project.frontend.password"), `status must retain its redacted required-field summary: ${absent.stdout}`);
|
|
879
|
+
assert(absentStatus.invalidConfigTokens.some(item => item.includes("access.project.frontend.password") && item.includes("explicitly filled string")), `status must consume the complete doctor contract: ${absent.stdout}`);
|
|
880
|
+
assert(absentStatus.next.includes("doctor"), `invalid effective configuration must direct the user through doctor: ${absent.stdout}`);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
function testProjectConfigOverlayMigratesLegacyEngineeringAndStaysByteStable() {
|
|
884
|
+
const repo = tmpdir("project-config-migration");
|
|
885
|
+
const secret = "legacy-overlay-secret-6e2f";
|
|
886
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
887
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
888
|
+
const overlay = projectConfigPath(repo);
|
|
889
|
+
assert(exists(overlay), "new project init must create the project-owned config overlay");
|
|
890
|
+
const initializedOverlay = readYamlConfig(overlay);
|
|
891
|
+
assert(initializedOverlay.schema === projectConfigSchema, "new project overlay must use the versioned schema");
|
|
892
|
+
assert(initializedOverlay.overrides?.project?.name === path.basename(repo), "new project overlay must own the inferred project name");
|
|
893
|
+
|
|
894
|
+
// Simulate the last pre-overlay release: project values lived directly in the
|
|
895
|
+
// otherwise managed ENGINEERING frontmatter and no overlay existed yet.
|
|
896
|
+
fs.unlinkSync(overlay);
|
|
897
|
+
fillLegacyEngineeringAccess(repo, secret);
|
|
898
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
899
|
+
const current = fs.readFileSync(engineering, "utf8");
|
|
900
|
+
const legacy = current
|
|
901
|
+
.replace(/^ name:.*$/m, ' name: "legacy-specialized-project"')
|
|
902
|
+
.replace(/^ stack:.*$/m, ' stack: "node-go-specialized"')
|
|
903
|
+
.replace(/^ target_branch:.*$/m, ' target_branch: "dev"')
|
|
904
|
+
.replace(/^ cleanup_merged: true$/m, " cleanup_merged: 1")
|
|
905
|
+
.replace(/^ max_command_seconds: 120$/m, " max_command_seconds: 120.0")
|
|
906
|
+
.replace(/^risk:\r?\n rules: \[\]$/m, [
|
|
907
|
+
"risk:",
|
|
908
|
+
" rules:",
|
|
909
|
+
" - name: project-device-credentials",
|
|
910
|
+
" paths: [src/device-credentials/**]",
|
|
911
|
+
" profile: high-risk",
|
|
912
|
+
" review: required",
|
|
913
|
+
].join("\n"))
|
|
914
|
+
.replace(/^structure:\r?\n enabled: true$/m, "structure:\n enabled: false")
|
|
915
|
+
.replace(/^ block_warnings: false$/m, " block_warnings: true")
|
|
916
|
+
.replace(/^ block: false$/m, " block: 0")
|
|
917
|
+
.replace(/^ api_docs_required: false$/m, " api_docs_required: true");
|
|
918
|
+
assert(legacy !== current, "legacy migration fixture must contain project-specific frontmatter changes");
|
|
919
|
+
writeFile(engineering, legacy);
|
|
920
|
+
|
|
921
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
922
|
+
const migrated = readYamlConfig(overlay);
|
|
923
|
+
assert(migrated.schema === projectConfigSchema, "migration must create the current project overlay schema");
|
|
924
|
+
assert(migrated.overrides?.project?.name === "legacy-specialized-project", "migration must extract project.name from legacy ENGINEERING");
|
|
925
|
+
assert(migrated.overrides?.project?.stack === "node-go-specialized", "migration must extract the project stack");
|
|
926
|
+
assert(migrated.overrides?.concurrency?.target_branch === "dev", "migration must extract the target branch");
|
|
927
|
+
assert(migrated.overrides?.concurrency?.cleanup_merged === 1, "migration must distinguish integer 1 from boolean true");
|
|
928
|
+
assert(migrated.overrides?.validation?.max_command_seconds === 120, "migration must retain the numeric timeout value");
|
|
929
|
+
assert(migrated.overrides?.access?.project?.frontend?.password === secret, "migration must extract project access without printing it");
|
|
930
|
+
assert(migrated.overrides?.risk?.rules?.[0]?.name === "project-device-credentials", "migration must extract project risk rules");
|
|
931
|
+
assert(migrated.overrides?.structure?.enabled === false && migrated.overrides?.structure?.block_warnings === true, "migration must extract explicit project structure policy");
|
|
932
|
+
assert(migrated.overrides?.structure?.layer_rules?.block === 0, "migration must distinguish integer 0 from boolean false");
|
|
933
|
+
assert(migrated.overrides?.docs?.api_docs_required === true, "migration must extract project documentation policy");
|
|
934
|
+
assert(migrated.overrides?.workflow?.skill_version === undefined, "migration must never copy the managed Skill version into project overrides");
|
|
935
|
+
const migratedOverlaySource = fs.readFileSync(overlay, "utf8");
|
|
936
|
+
assert(migratedOverlaySource.includes("max_command_seconds: 120.0"), "migration must distinguish float 120.0 from integer 120");
|
|
937
|
+
|
|
938
|
+
const managed = readEngineeringConfig(engineering);
|
|
939
|
+
assert(managed.project?.name === "" && managed.project?.stack === "generic", "ENGINEERING must converge to managed defaults after migration");
|
|
940
|
+
assert(managed.access?.project?.frontend?.password === "", "ENGINEERING must no longer retain project access after migration");
|
|
941
|
+
assert(managed.risk?.rules?.length === 0 && managed.structure?.enabled === true, "ENGINEERING policy defaults must remain release-owned");
|
|
942
|
+
const effective = readEffectiveConfig(repo);
|
|
943
|
+
assert(effective.project?.name === "legacy-specialized-project", "effective config must retain the migrated project identity");
|
|
944
|
+
assert(effective.concurrency?.cleanup_merged === 1, "effective config must preserve integer 1 instead of restoring boolean true");
|
|
945
|
+
assert(effective.structure?.layer_rules?.block === 0, "effective config must preserve integer 0 instead of restoring boolean false");
|
|
946
|
+
assert(effective.access?.project?.frontend?.password === secret, "effective config must retain migrated access values");
|
|
947
|
+
assert(effective.docs?.api_docs_required === true, "effective config must apply migrated project overrides");
|
|
948
|
+
assert(effective.docs?.api_change_log === "docs/interfaces/api-change-log.md", "fields absent from the legacy project config must inherit the new managed default");
|
|
949
|
+
|
|
950
|
+
const stableOverlay = fs.readFileSync(overlay);
|
|
951
|
+
const stableEngineering = fs.readFileSync(engineering);
|
|
952
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
953
|
+
assert(fs.readFileSync(overlay).equals(stableOverlay), "repeated init must preserve the project overlay byte-for-byte");
|
|
954
|
+
assert(fs.readFileSync(engineering).equals(stableEngineering), "repeated init must keep the managed default document stable");
|
|
955
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
956
|
+
assert(fs.readFileSync(overlay).equals(stableOverlay), "sync must preserve the project overlay byte-for-byte");
|
|
957
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
958
|
+
assert(fs.readFileSync(overlay).equals(stableOverlay), "repeated sync must preserve the project overlay byte-for-byte");
|
|
959
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
960
|
+
assert(fs.readFileSync(overlay).equals(stableOverlay), "transactional sync must preserve an existing project overlay byte-for-byte");
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
function testProjectConfigOverlayMergeKeepsExplicitFalseZeroEmptyAndList() {
|
|
964
|
+
const repo = tmpdir("project-config-merge");
|
|
965
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
966
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
967
|
+
const managedDefault = fs.readFileSync(engineering, "utf8");
|
|
968
|
+
const base = managedDefault
|
|
969
|
+
.replace(/^ target_branch: (?:(?:""|'')|null)$/m, ' target_branch: "release-default"')
|
|
970
|
+
.replace(/^risk:\r?\n rules: \[\]$/m, [
|
|
971
|
+
"risk:",
|
|
972
|
+
" rules:",
|
|
973
|
+
" - name: new-managed-default",
|
|
974
|
+
" paths: [managed-default/**]",
|
|
975
|
+
" profile: high-risk",
|
|
976
|
+
" review: required",
|
|
977
|
+
].join("\n"))
|
|
978
|
+
.replace(/^structure:\r?\n enabled: true$/m, "structure:\n enabled: true\n max_file_lines_warn: 777")
|
|
979
|
+
.replace(/^ api_docs_required: false$/m, " api_docs_required: true");
|
|
980
|
+
writeFile(engineering, base);
|
|
981
|
+
writeProjectConfig(repo, {
|
|
982
|
+
project: { name: "explicit-overlay-values" },
|
|
983
|
+
concurrency: { target_branch: "" },
|
|
984
|
+
risk: { rules: [] },
|
|
985
|
+
structure: { enabled: false, max_file_lines_warn: 0 },
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
const effective = readEffectiveConfig(repo);
|
|
989
|
+
assert(effective.project?.name === "explicit-overlay-values", "project scalar must override the managed default");
|
|
990
|
+
assert(effective.structure?.enabled === false, "explicit false must override a true managed default");
|
|
991
|
+
assert(effective.structure?.max_file_lines_warn === 0, "explicit zero must not fall back to a non-zero managed default");
|
|
992
|
+
assert(effective.concurrency?.target_branch === "", "explicit empty string must override a non-empty managed default");
|
|
993
|
+
assert(Array.isArray(effective.risk?.rules) && effective.risk.rules.length === 0, "explicit empty list must replace the managed list instead of merging it");
|
|
994
|
+
assert(effective.docs?.api_docs_required === true, "an unoverridden field must inherit a new managed default");
|
|
995
|
+
|
|
996
|
+
const overlay = projectConfigPath(repo);
|
|
997
|
+
const stableOverlay = fs.readFileSync(overlay);
|
|
998
|
+
writeFile(engineering, managedDefault);
|
|
999
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1000
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
1001
|
+
assert(fs.readFileSync(overlay).equals(stableOverlay), "managed convergence must never normalize or rewrite an existing valid overlay");
|
|
1002
|
+
const convergedEffective = readEffectiveConfig(repo);
|
|
1003
|
+
assert(convergedEffective.structure?.enabled === false && convergedEffective.structure?.max_file_lines_warn === 0, "project scalar overrides must survive managed convergence");
|
|
1004
|
+
assert(convergedEffective.concurrency?.target_branch === "" && convergedEffective.risk?.rules?.length === 0, "project empty values must survive managed convergence");
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
function testOversizedLegacyMigrationFailsBeforeCreatingAnInvalidOverlay() {
|
|
1008
|
+
const repo = tmpdir("project-config-oversized-migration");
|
|
1009
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
1010
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1011
|
+
const overlay = projectConfigPath(repo);
|
|
1012
|
+
fs.unlinkSync(overlay);
|
|
1013
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1014
|
+
const current = fs.readFileSync(engineering, "utf8");
|
|
1015
|
+
const oversized = current.replace(
|
|
1016
|
+
/^project:\r?\n/m,
|
|
1017
|
+
`project:\n oversized_legacy_value: ${JSON.stringify("x".repeat(140 * 1024))}\n`,
|
|
1018
|
+
);
|
|
1019
|
+
assert(oversized !== current, "oversized legacy migration fixture must modify managed frontmatter");
|
|
1020
|
+
writeFile(engineering, oversized);
|
|
1021
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1022
|
+
const manifest = path.join(repo, ".agents", "managed-install.json");
|
|
1023
|
+
const before = {
|
|
1024
|
+
engineering: fs.readFileSync(engineering),
|
|
1025
|
+
skill: fs.readFileSync(skill),
|
|
1026
|
+
manifest: fs.readFileSync(manifest),
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
const failed = run("node", [cli, "init"], { cwd: repo, check: false });
|
|
1030
|
+
const output = `${failed.stdout}\n${failed.stderr}`;
|
|
1031
|
+
assert(failed.status !== 0 && output.includes("exceeds its size limit"), `oversized migrated overlay must fail before writes: ${output}`);
|
|
1032
|
+
assert(!exists(overlay), "installer must not create an overlay that violates its own size contract");
|
|
1033
|
+
assert(fs.readFileSync(engineering).equals(before.engineering), "oversized migration failure must preserve legacy ENGINEERING bytes");
|
|
1034
|
+
assert(fs.readFileSync(skill).equals(before.skill), "oversized migration failure must not switch the installed Skill");
|
|
1035
|
+
assert(fs.readFileSync(manifest).equals(before.manifest), "oversized migration failure must not replace the install manifest");
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
function testInvalidProjectConfigOverlayFailsBeforeAnyWrites() {
|
|
1039
|
+
const invalidCases = [
|
|
1040
|
+
{
|
|
1041
|
+
name: "null",
|
|
1042
|
+
content: `${JSON.stringify({ schema: projectConfigSchema, overrides: { structure: { enabled: null } } }, null, 2)}\n`,
|
|
1043
|
+
hints: ["null"],
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
name: "duplicate",
|
|
1047
|
+
content: [
|
|
1048
|
+
`schema: ${projectConfigSchema}`,
|
|
1049
|
+
"overrides:",
|
|
1050
|
+
" project:",
|
|
1051
|
+
" name: duplicate-one",
|
|
1052
|
+
" name: duplicate-two",
|
|
1053
|
+
"",
|
|
1054
|
+
].join("\n"),
|
|
1055
|
+
hints: ["duplicate"],
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
name: "alias",
|
|
1059
|
+
content: [
|
|
1060
|
+
`schema: ${projectConfigSchema}`,
|
|
1061
|
+
"overrides:",
|
|
1062
|
+
" project: &shared_project",
|
|
1063
|
+
" name: alias-project",
|
|
1064
|
+
" docs: *shared_project",
|
|
1065
|
+
"",
|
|
1066
|
+
].join("\n"),
|
|
1067
|
+
hints: ["alias", "anchor"],
|
|
1068
|
+
},
|
|
1069
|
+
];
|
|
1070
|
+
for (const invalid of invalidCases) {
|
|
1071
|
+
const repo = tmpdir(`project-config-invalid-${invalid.name}`);
|
|
1072
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1073
|
+
const overlay = projectConfigPath(repo);
|
|
1074
|
+
writeFile(overlay, invalid.content);
|
|
1075
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1076
|
+
writeFile(skill, `must-stay-${invalid.name}\n`);
|
|
1077
|
+
const engineeringBefore = fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md"));
|
|
1078
|
+
const result = run("node", [cli, "init"], { cwd: repo, check: false });
|
|
1079
|
+
const output = `${result.stdout}\n${result.stderr}`.toLowerCase();
|
|
1080
|
+
assert(result.status !== 0, `${invalid.name}: invalid project overlay must reject init`);
|
|
1081
|
+
assert(invalid.hints.some(hint => output.includes(hint)), `${invalid.name}: failure must identify the unsafe YAML construct: ${output}`);
|
|
1082
|
+
assert(fs.readFileSync(skill, "utf8") === `must-stay-${invalid.name}\n`, `${invalid.name}: overlay validation must happen before managed Skill writes`);
|
|
1083
|
+
assert(fs.readFileSync(path.join(repo, "docs", "ENGINEERING.md")).equals(engineeringBefore), `${invalid.name}: overlay validation must happen before managed document writes`);
|
|
1084
|
+
assert(fs.readFileSync(overlay, "utf8") === invalid.content, `${invalid.name}: rejected init must not rewrite the project overlay`);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
const batchFirst = tmpdir("project-config-invalid-batch-first");
|
|
1088
|
+
const batchSecond = tmpdir("project-config-invalid-batch-second");
|
|
1089
|
+
run("node", [cli, "init"], { cwd: batchFirst });
|
|
1090
|
+
run("node", [cli, "init"], { cwd: batchSecond });
|
|
1091
|
+
const firstSkill = path.join(batchFirst, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1092
|
+
writeFile(firstSkill, "batch-must-stay\n");
|
|
1093
|
+
writeFile(projectConfigPath(batchSecond), invalidCases[0].content);
|
|
1094
|
+
const batch = run("node", [cli, "sync", "--projects", `${batchFirst},${batchSecond}`], { check: false });
|
|
1095
|
+
assert(batch.status !== 0, "one invalid overlay must reject the complete multi-project sync batch");
|
|
1096
|
+
assert(fs.readFileSync(firstSkill, "utf8") === "batch-must-stay\n", "multi-project overlay preflight must run before writing an earlier valid project");
|
|
1097
|
+
assert(fs.readFileSync(projectConfigPath(batchSecond), "utf8") === invalidCases[0].content, "multi-project rejection must not rewrite the invalid overlay");
|
|
1098
|
+
|
|
1099
|
+
if (process.platform !== "win32") {
|
|
1100
|
+
const repo = tmpdir("project-config-invalid-symlink");
|
|
1101
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1102
|
+
const overlay = projectConfigPath(repo);
|
|
1103
|
+
const external = path.join(tmpdir("project-config-external"), "outside.yaml");
|
|
1104
|
+
const externalBytes = `${JSON.stringify({ schema: projectConfigSchema, overrides: { project: { name: "outside" } } }, null, 2)}\n`;
|
|
1105
|
+
writeFile(external, externalBytes);
|
|
1106
|
+
fs.unlinkSync(overlay);
|
|
1107
|
+
fs.symlinkSync(external, overlay);
|
|
1108
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1109
|
+
writeFile(skill, "must-stay-symlink\n");
|
|
1110
|
+
const result = run("node", [cli, "sync", "--projects", repo], { check: false });
|
|
1111
|
+
const output = `${result.stdout}\n${result.stderr}`.toLowerCase();
|
|
1112
|
+
assert(result.status !== 0 && (output.includes("symlink") || output.includes("non-symlink")), "overlay symlink must reject sync before writes");
|
|
1113
|
+
assert(fs.readFileSync(skill, "utf8") === "must-stay-symlink\n", "overlay symlink preflight must happen before managed Skill writes");
|
|
1114
|
+
assert(fs.readFileSync(external, "utf8") === externalBytes, "overlay validation must never follow or rewrite a symlink target");
|
|
1115
|
+
assert(fs.lstatSync(overlay).isSymbolicLink(), "rejected sync must leave the project-owned symlink untouched");
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
function testStatusRejectsManagedAgentSymlinksWithoutLeakingExternalContent() {
|
|
1120
|
+
if (process.platform === "win32") return;
|
|
1121
|
+
for (const target of ["agents-directory", "agents-parent"]) {
|
|
1122
|
+
const repo = tmpdir(`status-agent-symlink-${target}`);
|
|
1123
|
+
const secret = `UNIQUE_STATUS_AGENT_SYMLINK_SECRET_${target}_7f42`;
|
|
1124
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1125
|
+
fillRequiredAccess(repo);
|
|
1126
|
+
const agentsRoot = path.join(repo, ".agents");
|
|
1127
|
+
const agentsDir = path.join(agentsRoot, "agents");
|
|
1128
|
+
|
|
1129
|
+
if (target === "agents-directory") {
|
|
1130
|
+
const external = path.join(tmpdir("status-external-agents-directory"), "agents");
|
|
1131
|
+
fs.mkdirSync(external);
|
|
1132
|
+
writeFile(path.join(external, "explorer.toml"), `description = ${JSON.stringify(secret)}\n`);
|
|
1133
|
+
fs.rmSync(agentsDir, { recursive: true });
|
|
1134
|
+
fs.symlinkSync(external, agentsDir);
|
|
1135
|
+
} else {
|
|
1136
|
+
const external = path.join(tmpdir("status-external-agents-parent"), "agents-root");
|
|
1137
|
+
fs.renameSync(agentsRoot, external);
|
|
1138
|
+
fs.appendFileSync(path.join(external, "agents", "explorer.toml"), `\n# ${secret}\n`);
|
|
1139
|
+
fs.symlinkSync(external, agentsRoot);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
const status = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
1143
|
+
const output = `${status.stdout}\n${status.stderr}`;
|
|
1144
|
+
assert(status.status !== 0, `${target}: status must reject a managed-agent path that escapes through a symlink`);
|
|
1145
|
+
assert(!output.includes(secret), `${target}: status must never echo content read from the external symlink target: ${output}`);
|
|
1146
|
+
assert(/symlink|junction|real directory|non-directory/i.test(output), `${target}: status must explain the unsafe managed target shape: ${output}`);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
function testMultiProjectSyncRejectsManagedTargetSymlinksBeforeAnyProjectWrite() {
|
|
1151
|
+
if (process.platform === "win32") return;
|
|
1152
|
+
for (const target of ["parent", "leaf"]) {
|
|
1153
|
+
const first = tmpdir(`managed-target-batch-first-${target}`);
|
|
1154
|
+
const second = tmpdir(`managed-target-batch-second-${target}`);
|
|
1155
|
+
run("node", [cli, "init"], { cwd: first });
|
|
1156
|
+
run("node", [cli, "init"], { cwd: second });
|
|
1157
|
+
|
|
1158
|
+
const firstProtected = [
|
|
1159
|
+
path.join(first, ".agents", "skills", "auto-coding-skill", "SKILL.md"),
|
|
1160
|
+
path.join(first, ".agents", "managed-install.json"),
|
|
1161
|
+
path.join(first, ".agents", "agents", "explorer.toml"),
|
|
1162
|
+
path.join(first, "docs", "ENGINEERING.md"),
|
|
1163
|
+
];
|
|
1164
|
+
writeFile(firstProtected[0], `first-project-zero-write-sentinel-${target}\n`);
|
|
1165
|
+
const before = new Map(firstProtected.map(file => [file, fs.readFileSync(file)]));
|
|
1166
|
+
const secret = `UNIQUE_BATCH_MANAGED_TARGET_SECRET_${target}_98d1`;
|
|
1167
|
+
const external = path.join(tmpdir(`managed-target-external-${target}`), "target");
|
|
1168
|
+
let linked;
|
|
1169
|
+
let externalFile;
|
|
1170
|
+
if (target === "parent") {
|
|
1171
|
+
fs.mkdirSync(external);
|
|
1172
|
+
externalFile = path.join(external, "explorer.toml");
|
|
1173
|
+
writeFile(externalFile, `description = ${JSON.stringify(secret)}\n`);
|
|
1174
|
+
linked = path.join(second, ".agents", "agents");
|
|
1175
|
+
fs.rmSync(linked, { recursive: true });
|
|
1176
|
+
fs.symlinkSync(external, linked);
|
|
1177
|
+
} else {
|
|
1178
|
+
externalFile = external;
|
|
1179
|
+
writeFile(external, `description = ${JSON.stringify(secret)}\n`);
|
|
1180
|
+
linked = path.join(second, ".agents", "agents", "explorer.toml");
|
|
1181
|
+
fs.unlinkSync(linked);
|
|
1182
|
+
fs.symlinkSync(external, linked);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
const sync = run("node", [cli, "sync", "--projects", `${first},${second}`], { check: false });
|
|
1186
|
+
const output = `${sync.stdout}\n${sync.stderr}`;
|
|
1187
|
+
assert(sync.status !== 0, `${target}: one unsafe managed target must reject multi-project sync`);
|
|
1188
|
+
assert(/symlink|junction|non-directory/i.test(output), `${target}: batch rejection must identify the unsafe target shape: ${output}`);
|
|
1189
|
+
assert(!output.includes(secret), `${target}: batch rejection must not echo the external managed-target content: ${output}`);
|
|
1190
|
+
for (const file of firstProtected) {
|
|
1191
|
+
assert(fs.readFileSync(file).equals(before.get(file)), `${target}: second-project preflight failure must leave first project untouched: ${path.relative(first, file)}`);
|
|
1192
|
+
}
|
|
1193
|
+
assert(fs.lstatSync(linked).isSymbolicLink(), `${target}: rejected batch must leave the unsafe second-project link untouched`);
|
|
1194
|
+
assert(fs.readFileSync(externalFile, "utf8").includes(secret), `${target}: rejected batch must leave the external target untouched`);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
function testTamperedInstalledDefaultRejectsInitAndSyncWithoutWrites() {
|
|
1199
|
+
const repo = tmpdir("project-config-tampered-old-default");
|
|
1200
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1201
|
+
const overlay = projectConfigPath(repo);
|
|
1202
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1203
|
+
const installedTemplate = path.join(
|
|
1204
|
+
repo,
|
|
1205
|
+
".agents",
|
|
1206
|
+
"skills",
|
|
1207
|
+
"auto-coding-skill",
|
|
1208
|
+
"data",
|
|
1209
|
+
"templates",
|
|
1210
|
+
"ENGINEERING.md",
|
|
1211
|
+
);
|
|
1212
|
+
const manifest = path.join(repo, ".agents", "managed-install.json");
|
|
1213
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1214
|
+
const oldDefault = fs.readFileSync(engineering, "utf8")
|
|
1215
|
+
.replace(/^ skill_version:.*$/m, ' skill_version: "4.2.7"')
|
|
1216
|
+
.replace("managed-workflow:start version=4.3.1", "managed-workflow:start version=4.2.7");
|
|
1217
|
+
installTrustedEngineeringDefault(repo, oldDefault, "4.2.7");
|
|
1218
|
+
writeFile(engineering, oldDefault);
|
|
1219
|
+
fs.unlinkSync(overlay);
|
|
1220
|
+
fillLegacyEngineeringAccess(repo, "tampered-old-default-secret");
|
|
1221
|
+
fs.appendFileSync(installedTemplate, "\n# untrusted template mutation\n");
|
|
1222
|
+
writeFile(skill, "tampered-template-zero-write-sentinel\n");
|
|
1223
|
+
|
|
1224
|
+
const protectedPaths = [engineering, installedTemplate, manifest, skill];
|
|
1225
|
+
for (const args of [["init"], ["sync", "--projects", repo]]) {
|
|
1226
|
+
const before = new Map(protectedPaths.map(file => [file, fs.readFileSync(file)]));
|
|
1227
|
+
const result = run("node", [cli, ...args], { cwd: repo, check: false });
|
|
1228
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
1229
|
+
assert(result.status !== 0, `${args[0]} must reject a tampered installed old default`);
|
|
1230
|
+
assert(output.includes("managed manifest identity check"), `${args[0]} must identify the untrusted installed template: ${output}`);
|
|
1231
|
+
for (const file of protectedPaths) {
|
|
1232
|
+
assert(fs.readFileSync(file).equals(before.get(file)), `${args[0]} must perform zero writes before rejecting ${path.relative(repo, file)}`);
|
|
1233
|
+
}
|
|
1234
|
+
assert(!exists(overlay), `${args[0]} must not create an overlay from an untrusted installed default`);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
function testExistingOverlayConflictRejectsInitAndSyncWithoutWrites() {
|
|
1239
|
+
const repo = tmpdir("project-config-existing-conflict");
|
|
1240
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1241
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1242
|
+
const overlay = projectConfigPath(repo);
|
|
1243
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1244
|
+
const conflicting = fs.readFileSync(engineering, "utf8")
|
|
1245
|
+
.replace(/^ name:.*$/m, ' name: "legacy-conflicting-name"');
|
|
1246
|
+
writeFile(engineering, conflicting);
|
|
1247
|
+
writeFile(skill, "overlay-conflict-zero-write-sentinel\n");
|
|
1248
|
+
|
|
1249
|
+
const protectedPaths = [engineering, overlay, skill, path.join(repo, ".agents", "managed-install.json")];
|
|
1250
|
+
for (const args of [["init"], ["sync", "--projects", repo]]) {
|
|
1251
|
+
const before = new Map(protectedPaths.map(file => [file, fs.readFileSync(file)]));
|
|
1252
|
+
const result = run("node", [cli, ...args], { cwd: repo, check: false });
|
|
1253
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
1254
|
+
assert(result.status !== 0, `${args[0]} must reject legacy values that conflict with an existing overlay`);
|
|
1255
|
+
assert(output.includes("overlay conflicts with legacy project configuration"), `${args[0]} must explain the conflicting ownership boundary: ${output}`);
|
|
1256
|
+
for (const file of protectedPaths) {
|
|
1257
|
+
assert(fs.readFileSync(file).equals(before.get(file)), `${args[0]} must perform zero writes before rejecting ${path.relative(repo, file)}`);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function testExistingOverlayLegacyDeletionRejectsInitAndSyncWithoutWrites() {
|
|
1263
|
+
const repo = tmpdir("project-config-existing-deletion");
|
|
1264
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1265
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1266
|
+
const overlay = projectConfigPath(repo);
|
|
1267
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1268
|
+
const current = fs.readFileSync(engineering, "utf8");
|
|
1269
|
+
const deletedDefault = current.replace(/^ api_change_log: "docs\/interfaces\/api-change-log\.md"\r?\n/m, "");
|
|
1270
|
+
assert(deletedDefault !== current, "legacy deletion fixture must remove one managed default key");
|
|
1271
|
+
writeFile(engineering, deletedDefault);
|
|
1272
|
+
writeFile(skill, "legacy-deletion-zero-write-sentinel\n");
|
|
1273
|
+
|
|
1274
|
+
const protectedPaths = [engineering, overlay, skill, path.join(repo, ".agents", "managed-install.json")];
|
|
1275
|
+
for (const args of [["init"], ["sync", "--projects", repo]]) {
|
|
1276
|
+
const before = new Map(protectedPaths.map(file => [file, fs.readFileSync(file)]));
|
|
1277
|
+
const result = run("node", [cli, ...args], { cwd: repo, check: false });
|
|
1278
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
1279
|
+
assert(result.status !== 0, `${args[0]} must reject a legacy deletion that additive overrides cannot represent`);
|
|
1280
|
+
assert(output.includes("cannot be represented as additive overrides"), `${args[0]} must explain the deleted-default ambiguity: ${output}`);
|
|
1281
|
+
for (const file of protectedPaths) {
|
|
1282
|
+
assert(fs.readFileSync(file).equals(before.get(file)), `${args[0]} must perform zero writes before rejecting ${path.relative(repo, file)}`);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
function testLiveInstallTransactionRejectsSecondInstallerWithoutWrites() {
|
|
1288
|
+
const repo = tmpdir("live-install-owner");
|
|
1289
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1290
|
+
const installedAp = path.join(repo, ".agents", "skills", "auto-coding-skill", "scripts", "ap.py");
|
|
1291
|
+
writeFile(installedAp, "live-owner-sentinel\n");
|
|
1292
|
+
|
|
1293
|
+
const first = spawn(
|
|
1294
|
+
process.execPath,
|
|
1295
|
+
[cli, "sync", "--projects", repo],
|
|
1296
|
+
{
|
|
1297
|
+
cwd: repo,
|
|
1298
|
+
env: {
|
|
1299
|
+
...process.env,
|
|
1300
|
+
AUTOCODING_TEST_HOLD_PHASE: "after-stage-copy",
|
|
1301
|
+
AUTOCODING_TEST_HOLD_MILLISECONDS: "5000",
|
|
1302
|
+
},
|
|
1303
|
+
stdio: "ignore",
|
|
1304
|
+
},
|
|
1305
|
+
);
|
|
1306
|
+
const transaction = path.join(repo, ".agents", ".auto-coding-skill-install-transaction");
|
|
1307
|
+
const statePath = path.join(transaction, "state.json");
|
|
1308
|
+
const sleep = new Int32Array(new SharedArrayBuffer(4));
|
|
1309
|
+
const stagedDeadline = Date.now() + 10000;
|
|
1310
|
+
while (!exists(statePath) && Date.now() < stagedDeadline) Atomics.wait(sleep, 0, 0, 5);
|
|
1311
|
+
assert(exists(statePath), "first installer must publish a durable state before the concurrency check");
|
|
1312
|
+
const owner = JSON.parse(fs.readFileSync(path.join(transaction, "owner.json"), "utf8"));
|
|
1313
|
+
assert(owner.pid === first.pid, "transaction owner lease must bind the live installer pid");
|
|
1314
|
+
|
|
1315
|
+
const protectedPaths = [
|
|
1316
|
+
installedAp,
|
|
1317
|
+
path.join(repo, ".agents", "managed-install.json"),
|
|
1318
|
+
path.join(repo, "docs", "ENGINEERING.md"),
|
|
1319
|
+
projectConfigPath(repo),
|
|
1320
|
+
];
|
|
1321
|
+
const beforeSecond = new Map(protectedPaths.map(file => [file, fs.readFileSync(file)]));
|
|
1322
|
+
const second = run("node", [cli, "sync", "--projects", repo], { cwd: repo, check: false });
|
|
1323
|
+
const secondOutput = `${second.stdout}\n${second.stderr}`;
|
|
1324
|
+
assert(second.status !== 0, "a second installer must reject a live install transaction");
|
|
1325
|
+
assert(secondOutput.includes("install transaction is active under owner pid"), `live-owner rejection must be explicit: ${secondOutput}`);
|
|
1326
|
+
assert(exists(transaction), "second installer must not remove the live transaction");
|
|
1327
|
+
for (const file of protectedPaths) {
|
|
1328
|
+
assert(fs.readFileSync(file).equals(beforeSecond.get(file)), `second installer must perform zero canonical writes: ${path.relative(repo, file)}`);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
const waitForCompletion = [
|
|
1332
|
+
"const fs = require('node:fs');",
|
|
1333
|
+
"const target = process.argv[1];",
|
|
1334
|
+
"const sleep = new Int32Array(new SharedArrayBuffer(4));",
|
|
1335
|
+
"const deadline = Date.now() + 15000;",
|
|
1336
|
+
"while (fs.existsSync(target) && Date.now() < deadline) Atomics.wait(sleep, 0, 0, 10);",
|
|
1337
|
+
"process.exit(fs.existsSync(target) ? 2 : 0);",
|
|
1338
|
+
].join("\n");
|
|
1339
|
+
const completed = run(process.execPath, ["-e", waitForCompletion, transaction], { check: false });
|
|
1340
|
+
first.kill();
|
|
1341
|
+
assert(completed.status === 0, "live owner must finish normally after the rejected second installer");
|
|
1342
|
+
assert(!fs.readFileSync(installedAp, "utf8").includes("live-owner-sentinel"), "the live owner must retain control and finish its own upgrade");
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
function testStagedRuntimeTamperingIsRejectedBeforeExecution() {
|
|
1346
|
+
const repo = tmpdir("staged-runtime-tamper");
|
|
1347
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1348
|
+
|
|
1349
|
+
// Keep beginInstallTransaction busy after it has hashed new-skill. The
|
|
1350
|
+
// watcher uses old-skill creation as the deterministic signal that this
|
|
1351
|
+
// binding has already happened, then changes the staged runtime.
|
|
1352
|
+
const installedSkill = path.join(repo, ".agents", "skills", "auto-coding-skill");
|
|
1353
|
+
fs.writeFileSync(path.join(installedSkill, "zzzz-staging-delay.bin"), Buffer.alloc(32 * 1024 * 1024, 0x61));
|
|
1354
|
+
const installedAp = path.join(installedSkill, "scripts", "ap.py");
|
|
1355
|
+
const installedBefore = fs.readFileSync(installedAp);
|
|
1356
|
+
const transaction = path.join(repo, ".agents", ".auto-coding-skill-install-transaction");
|
|
1357
|
+
const oldSkill = path.join(transaction, "old-skill");
|
|
1358
|
+
const stagedAp = path.join(transaction, "new-skill", "scripts", "ap.py");
|
|
1359
|
+
const ready = path.join(repo, "attacker-ready");
|
|
1360
|
+
const tampered = path.join(repo, "staged-runtime-tampered");
|
|
1361
|
+
const executed = path.join(repo, "tampered-runtime-executed");
|
|
1362
|
+
const malicious = [
|
|
1363
|
+
"from pathlib import Path",
|
|
1364
|
+
`Path(${JSON.stringify(executed)}).write_text('executed', encoding='utf-8')`,
|
|
1365
|
+
"print('{}')",
|
|
1366
|
+
"",
|
|
1367
|
+
].join("\n");
|
|
1368
|
+
const watcher = [
|
|
1369
|
+
"const fs = require('node:fs');",
|
|
1370
|
+
"const [oldSkill, stagedAp, ready, tampered, malicious] = process.argv.slice(1);",
|
|
1371
|
+
"fs.writeFileSync(ready, 'ready');",
|
|
1372
|
+
"const deadline = Date.now() + 15000;",
|
|
1373
|
+
"const sleep = new Int32Array(new SharedArrayBuffer(4));",
|
|
1374
|
+
"while (Date.now() < deadline) {",
|
|
1375
|
+
" if (fs.existsSync(oldSkill) && fs.existsSync(stagedAp)) {",
|
|
1376
|
+
" fs.writeFileSync(stagedAp, Buffer.from(malicious, 'base64'));",
|
|
1377
|
+
" fs.writeFileSync(tampered, 'tampered');",
|
|
1378
|
+
" process.exit(0);",
|
|
1379
|
+
" }",
|
|
1380
|
+
" Atomics.wait(sleep, 0, 0, 1);",
|
|
1381
|
+
"}",
|
|
1382
|
+
"process.exit(3);",
|
|
1383
|
+
].join("\n");
|
|
1384
|
+
const attacker = spawn(
|
|
1385
|
+
process.execPath,
|
|
1386
|
+
["-e", watcher, oldSkill, stagedAp, ready, tampered, Buffer.from(malicious).toString("base64")],
|
|
1387
|
+
{ stdio: "ignore" },
|
|
1388
|
+
);
|
|
1389
|
+
const sleep = new Int32Array(new SharedArrayBuffer(4));
|
|
1390
|
+
const readyDeadline = Date.now() + 5000;
|
|
1391
|
+
while (!exists(ready) && Date.now() < readyDeadline) Atomics.wait(sleep, 0, 0, 5);
|
|
1392
|
+
assert(exists(ready), "staged-runtime tamper watcher must start before sync");
|
|
1393
|
+
|
|
1394
|
+
const result = run("node", [cli, "sync", "--projects", repo], { cwd: repo, check: false });
|
|
1395
|
+
attacker.kill();
|
|
1396
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
1397
|
+
assert(exists(tampered), `test watcher must alter the staged runtime: ${output}`);
|
|
1398
|
+
assert(result.status !== 0, "transaction must reject a staged runtime changed after its binding hash");
|
|
1399
|
+
assert(output.includes("staged Skill failed its transaction identity check"), `tamper failure must identify the staged Skill binding: ${output}`);
|
|
1400
|
+
assert(!exists(executed), "tampered staged ap.py must never execute");
|
|
1401
|
+
assert(fs.readFileSync(installedAp).equals(installedBefore), "pre-switch tamper rejection must leave the installed runtime unchanged");
|
|
1402
|
+
assert(exists(path.join(transaction, "state.json")), "tamper rejection must retain the verified rollback transaction");
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function testInterruptedStagedInstallRecoversForInitAndSync() {
|
|
1406
|
+
const cases = [
|
|
1407
|
+
{
|
|
1408
|
+
name: "init-after-config-finalize",
|
|
1409
|
+
phase: "after-config-finalize",
|
|
1410
|
+
args() { return ["init"]; },
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
name: "sync-after-runtime-switch",
|
|
1414
|
+
phase: "after-runtime-switch",
|
|
1415
|
+
args(repo) { return ["sync", "--projects", repo]; },
|
|
1416
|
+
},
|
|
1417
|
+
];
|
|
1418
|
+
|
|
1419
|
+
for (const interrupted of cases) {
|
|
1420
|
+
const repo = tmpdir(`staged-recovery-${interrupted.name}`);
|
|
1421
|
+
const projectName = `specialized-${interrupted.name}`;
|
|
1422
|
+
const projectStack = `stack-${interrupted.name}`;
|
|
1423
|
+
const secret = `secret-${interrupted.name}`;
|
|
1424
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1425
|
+
|
|
1426
|
+
// Exercise the migration/finalize boundary: prepare must first extract
|
|
1427
|
+
// these project-owned values from a legacy managed document into a new
|
|
1428
|
+
// overlay, and recovery must never normalize or lose that overlay.
|
|
1429
|
+
fs.unlinkSync(projectConfigPath(repo));
|
|
1430
|
+
fillLegacyEngineeringAccess(repo, secret);
|
|
1431
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1432
|
+
const specialized = fs.readFileSync(engineering, "utf8")
|
|
1433
|
+
.replace(/^ name:.*$/m, ` name: ${JSON.stringify(projectName)}`)
|
|
1434
|
+
.replace(/^ stack:.*$/m, ` stack: ${JSON.stringify(projectStack)}`)
|
|
1435
|
+
.replace(/^ target_branch:.*$/m, ' target_branch: "dev"')
|
|
1436
|
+
.replace(/^ api_docs_required: false$/m, " api_docs_required: true");
|
|
1437
|
+
writeFile(engineering, specialized);
|
|
1438
|
+
|
|
1439
|
+
const args = interrupted.args(repo);
|
|
1440
|
+
const failed = run("node", [cli, ...args], {
|
|
1441
|
+
cwd: repo,
|
|
1442
|
+
check: false,
|
|
1443
|
+
env: { AUTOCODING_TEST_FAIL_PHASE: interrupted.phase },
|
|
1444
|
+
});
|
|
1445
|
+
const failedOutput = `${failed.stdout}\n${failed.stderr}`;
|
|
1446
|
+
assert(failed.status !== 0, `${interrupted.name}: injected staged install must fail`);
|
|
1447
|
+
assert(failedOutput.includes(`injected auto-coding-skill install fault: ${interrupted.phase}`), `${interrupted.name}: failure must identify the injected phase: ${failedOutput}`);
|
|
1448
|
+
|
|
1449
|
+
const transaction = path.join(repo, ".agents", ".auto-coding-skill-install-transaction");
|
|
1450
|
+
assert(exists(transaction), `${interrupted.name}: interrupted install must retain its recovery transaction`);
|
|
1451
|
+
const overlay = projectConfigPath(repo);
|
|
1452
|
+
assert(exists(overlay), `${interrupted.name}: prepare must durably create the project overlay before runtime switching`);
|
|
1453
|
+
const overlayAfterFailure = fs.readFileSync(overlay);
|
|
1454
|
+
const migrated = readYamlConfig(overlay).overrides;
|
|
1455
|
+
assert(migrated.project?.name === projectName && migrated.project?.stack === projectStack, `${interrupted.name}: interrupted prepare must preserve specialized project values`);
|
|
1456
|
+
assert(migrated.access?.project?.frontend?.password === secret, `${interrupted.name}: interrupted prepare must preserve specialized access values`);
|
|
1457
|
+
|
|
1458
|
+
run("node", [cli, ...args], { cwd: repo });
|
|
1459
|
+
assert(fs.readFileSync(overlay).equals(overlayAfterFailure), `${interrupted.name}: retry recovery must preserve overlay bytes exactly`);
|
|
1460
|
+
const effective = readEffectiveConfig(repo);
|
|
1461
|
+
assert(effective.project?.name === projectName && effective.project?.stack === projectStack, `${interrupted.name}: recovered effective config must retain specialized project identity`);
|
|
1462
|
+
assert(effective.concurrency?.target_branch === "dev", `${interrupted.name}: recovered effective config must retain the specialized target branch`);
|
|
1463
|
+
assert(effective.access?.project?.frontend?.password === secret, `${interrupted.name}: recovered effective config must retain specialized access values`);
|
|
1464
|
+
assert(effective.docs?.api_docs_required === true, `${interrupted.name}: recovered effective config must retain specialized documentation policy`);
|
|
1465
|
+
assert(!exists(transaction), `${interrupted.name}: successful retry must remove the active install transaction`);
|
|
1466
|
+
const transactionArtifacts = fs.readdirSync(path.join(repo, ".agents"))
|
|
1467
|
+
.filter(name => name.startsWith(".auto-coding-skill-install-"));
|
|
1468
|
+
assert(transactionArtifacts.length === 0, `${interrupted.name}: successful retry must clean every install transaction artifact: ${transactionArtifacts.join(", ")}`);
|
|
1469
|
+
|
|
1470
|
+
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
1471
|
+
assert(JSON.parse(status.stdout).results[0].ok === true, `${interrupted.name}: recovered installation must be complete and healthy: ${status.stdout}`);
|
|
1472
|
+
assert(fs.readFileSync(overlay).equals(overlayAfterFailure), `${interrupted.name}: read-only status must leave overlay bytes stable`);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
function testArchiveFallbackCollisionsNeverLosePreviousContent() {
|
|
1477
|
+
const digest12 = payload => crypto.createHash("sha256").update(payload).digest("hex").slice(0, 12);
|
|
1478
|
+
const assertUnchanged = (file, expected, label) => {
|
|
1479
|
+
assert(fs.readFileSync(file).equals(expected), `${label}: occupied archive bytes must not be overwritten`);
|
|
1480
|
+
};
|
|
1481
|
+
const assertPreservedAnywhere = (repo, expected, label) => {
|
|
1482
|
+
assert(
|
|
1483
|
+
listProjectFiles(repo).some(file => fs.readFileSync(file).equals(expected)),
|
|
1484
|
+
`${label}: occupied archive bytes must remain available somewhere in project history`,
|
|
1485
|
+
);
|
|
1486
|
+
};
|
|
1487
|
+
const assertArchived = (directory, expected, label, suffix = false) => {
|
|
1488
|
+
const archived = listProjectFiles(directory).some(file => {
|
|
1489
|
+
const payload = fs.readFileSync(file);
|
|
1490
|
+
if (!suffix) return payload.equals(expected);
|
|
1491
|
+
return payload.length >= expected.length
|
|
1492
|
+
&& payload.subarray(payload.length - expected.length).equals(expected);
|
|
1493
|
+
});
|
|
1494
|
+
assert(archived, `${label}: previous content must survive default and digest archive collisions`);
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
{
|
|
1498
|
+
const repo = tmpdir("archive-collision-engineering");
|
|
1499
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1500
|
+
fs.unlinkSync(projectConfigPath(repo));
|
|
1501
|
+
fillLegacyEngineeringAccess(repo, "archive-collision-secret");
|
|
1502
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1503
|
+
fs.appendFileSync(engineering, "\n## Archive collision sentinel\n\nPreserve these ENGINEERING bytes.\n");
|
|
1504
|
+
const previous = fs.readFileSync(engineering);
|
|
1505
|
+
const archiveDir = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs");
|
|
1506
|
+
const preferred = path.join(archiveDir, "ENGINEERING.md");
|
|
1507
|
+
const legacyDigest = path.join(archiveDir, `ENGINEERING-${digest12(previous)}.md`);
|
|
1508
|
+
const occupiedPreferred = Buffer.from("occupied-engineering-default\n");
|
|
1509
|
+
const occupiedDigest = Buffer.from("occupied-engineering-digest\n");
|
|
1510
|
+
writeFile(preferred, occupiedPreferred);
|
|
1511
|
+
writeFile(legacyDigest, occupiedDigest);
|
|
1512
|
+
|
|
1513
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1514
|
+
|
|
1515
|
+
assertUnchanged(preferred, occupiedPreferred, "ENGINEERING default collision");
|
|
1516
|
+
assertUnchanged(legacyDigest, occupiedDigest, "ENGINEERING digest collision");
|
|
1517
|
+
assertArchived(archiveDir, previous, "ENGINEERING migration", true);
|
|
1518
|
+
assert(
|
|
1519
|
+
readEffectiveConfig(repo).access?.project?.frontend?.password === "archive-collision-secret",
|
|
1520
|
+
"ENGINEERING archive fallback must not disrupt project configuration migration",
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
{
|
|
1525
|
+
const repo = tmpdir("archive-collision-managed-template");
|
|
1526
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1527
|
+
const managed = path.join(repo, "docs", "design", "_TEMPLATE-DD.md");
|
|
1528
|
+
const previous = Buffer.from("# Project-specific design template\n\nPreserve these exact bytes.\n");
|
|
1529
|
+
fs.writeFileSync(managed, previous);
|
|
1530
|
+
const archiveDir = path.join(
|
|
1531
|
+
repo,
|
|
1532
|
+
".agents",
|
|
1533
|
+
"archive",
|
|
1534
|
+
"auto-coding-skill",
|
|
1535
|
+
"4.3.1",
|
|
1536
|
+
"docs",
|
|
1537
|
+
"design",
|
|
1538
|
+
);
|
|
1539
|
+
const preferred = path.join(archiveDir, "_TEMPLATE-DD.md");
|
|
1540
|
+
const legacyDigest = path.join(archiveDir, `_TEMPLATE-DD-${digest12(previous)}.md`);
|
|
1541
|
+
const occupiedPreferred = Buffer.from("occupied-template-default\n");
|
|
1542
|
+
const occupiedDigest = Buffer.from("occupied-template-digest\n");
|
|
1543
|
+
writeFile(preferred, occupiedPreferred);
|
|
1544
|
+
writeFile(legacyDigest, occupiedDigest);
|
|
1545
|
+
|
|
1546
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1547
|
+
|
|
1548
|
+
assertUnchanged(preferred, occupiedPreferred, "managed template default collision");
|
|
1549
|
+
assertUnchanged(legacyDigest, occupiedDigest, "managed template digest collision");
|
|
1550
|
+
assertArchived(archiveDir, previous, "managed template migration");
|
|
1551
|
+
assert(!fs.readFileSync(managed).equals(previous), "managed template must still converge after safe archival");
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
{
|
|
1555
|
+
const repo = tmpdir("archive-collision-agents-sync");
|
|
1556
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1557
|
+
const agents = path.join(repo, "AGENTS.md");
|
|
1558
|
+
const previous = Buffer.from("# Project AGENTS before sync\n\nPreserve this sync history.\n");
|
|
1559
|
+
fs.writeFileSync(agents, previous);
|
|
1560
|
+
const archiveDir = path.join(repo, "docs", "archive", "workflow");
|
|
1561
|
+
const preferred = path.join(archiveDir, "AGENTS.pre-4.3.1.md");
|
|
1562
|
+
const legacyDigest = path.join(archiveDir, `AGENTS.pre-4.3.1-${digest12(previous)}.md`);
|
|
1563
|
+
const occupiedPreferred = Buffer.from("occupied-sync-default\n");
|
|
1564
|
+
const occupiedDigest = Buffer.from("occupied-sync-digest\n");
|
|
1565
|
+
writeFile(preferred, occupiedPreferred);
|
|
1566
|
+
writeFile(legacyDigest, occupiedDigest);
|
|
1567
|
+
|
|
1568
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
1569
|
+
|
|
1570
|
+
assertPreservedAnywhere(repo, occupiedPreferred, "sync AGENTS default collision");
|
|
1571
|
+
assertPreservedAnywhere(repo, occupiedDigest, "sync AGENTS digest collision");
|
|
1572
|
+
assertArchived(archiveDir, previous, "sync AGENTS migration", true);
|
|
1573
|
+
assert(!fs.readFileSync(agents).equals(previous), "sync AGENTS must still converge after safe archival");
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
{
|
|
1577
|
+
const repo = tmpdir("archive-collision-agents-init");
|
|
1578
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1579
|
+
const agents = path.join(repo, "AGENTS.md");
|
|
1580
|
+
const previous = Buffer.from("# Project AGENTS before init\n\nPreserve this init history.\n");
|
|
1581
|
+
fs.writeFileSync(agents, previous);
|
|
1582
|
+
const archiveDir = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1");
|
|
1583
|
+
const preferred = path.join(archiveDir, "AGENTS.md");
|
|
1584
|
+
const legacyDigest = path.join(archiveDir, `AGENTS-${digest12(previous)}.md`);
|
|
1585
|
+
const occupiedPreferred = Buffer.from("occupied-init-default\n");
|
|
1586
|
+
const occupiedDigest = Buffer.from("occupied-init-digest\n");
|
|
1587
|
+
writeFile(preferred, occupiedPreferred);
|
|
1588
|
+
writeFile(legacyDigest, occupiedDigest);
|
|
1589
|
+
|
|
1590
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1591
|
+
|
|
1592
|
+
assertUnchanged(preferred, occupiedPreferred, "init AGENTS default collision");
|
|
1593
|
+
assertUnchanged(legacyDigest, occupiedDigest, "init AGENTS digest collision");
|
|
1594
|
+
assertArchived(archiveDir, previous, "init AGENTS migration");
|
|
1595
|
+
assert(!fs.readFileSync(agents).equals(previous), "init AGENTS must still converge after safe archival");
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
function testProjectMutationAndInstallSwitchRejectParentSwap() {
|
|
1600
|
+
if (process.platform === "win32") return;
|
|
1601
|
+
|
|
1602
|
+
const assertExternalUntouched = (external, sentinel, label) => {
|
|
1603
|
+
const files = listProjectFiles(external);
|
|
1604
|
+
assert(files.length === 1 && files[0] === sentinel, `${label}: project mutation must not create external files`);
|
|
1605
|
+
assert(fs.readFileSync(sentinel, "utf8") === "external-sentinel\n", `${label}: external sentinel must remain unchanged`);
|
|
1606
|
+
};
|
|
1607
|
+
const restoreParent = (target, backup) => {
|
|
1608
|
+
assert(fs.lstatSync(target).isSymbolicLink(), `swap fixture must leave a symlink at ${target}`);
|
|
1609
|
+
fs.unlinkSync(target);
|
|
1610
|
+
fs.renameSync(backup, target);
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
{
|
|
1614
|
+
const repo = tmpdir("project-file-parent-swap");
|
|
1615
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1616
|
+
const external = tmpdir("project-file-parent-swap-external");
|
|
1617
|
+
const sentinel = path.join(external, "sentinel.txt");
|
|
1618
|
+
writeFile(sentinel, "external-sentinel\n");
|
|
1619
|
+
const parent = path.join(repo, ".agents", "agents");
|
|
1620
|
+
const backup = path.join(repo, ".agents", "agents.autocoding-test-backup");
|
|
1621
|
+
const failed = run("node", [cli, "init"], {
|
|
1622
|
+
cwd: repo,
|
|
1623
|
+
check: false,
|
|
1624
|
+
env: {
|
|
1625
|
+
AUTOCODING_TEST_MODE: "1",
|
|
1626
|
+
AUTOCODING_TEST_PROJECT_FILE_SWAP_PATH: ".agents/agents/browser-debugger.toml",
|
|
1627
|
+
AUTOCODING_TEST_PROJECT_FILE_SWAP_EXTERNAL: external,
|
|
1628
|
+
AUTOCODING_TEST_PROJECT_FILE_SWAP_BACKUP: backup,
|
|
1629
|
+
},
|
|
1630
|
+
});
|
|
1631
|
+
const output = `${failed.stdout}\n${failed.stderr}`;
|
|
1632
|
+
assert(failed.status !== 0 && output.includes("Project path parent changed"), `project file parent swap must fail closed: ${output}`);
|
|
1633
|
+
assertExternalUntouched(external, sentinel, "project file parent swap");
|
|
1634
|
+
restoreParent(parent, backup);
|
|
1635
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1636
|
+
assertExternalUntouched(external, sentinel, "project file parent swap recovery");
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
{
|
|
1640
|
+
const repo = tmpdir("install-switch-parent-swap");
|
|
1641
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1642
|
+
const external = tmpdir("install-switch-parent-swap-external");
|
|
1643
|
+
const sentinel = path.join(external, "sentinel.txt");
|
|
1644
|
+
writeFile(sentinel, "external-sentinel\n");
|
|
1645
|
+
const parent = path.join(repo, ".agents", "skills");
|
|
1646
|
+
const backup = path.join(repo, ".agents", "skills.autocoding-test-backup");
|
|
1647
|
+
const failed = run("node", [cli, "init"], {
|
|
1648
|
+
cwd: repo,
|
|
1649
|
+
check: false,
|
|
1650
|
+
env: {
|
|
1651
|
+
AUTOCODING_TEST_MODE: "1",
|
|
1652
|
+
AUTOCODING_TEST_INSTALL_IO_SWAP_PHASE: "switch",
|
|
1653
|
+
AUTOCODING_TEST_INSTALL_IO_SWAP_PARENT: ".agents/skills",
|
|
1654
|
+
AUTOCODING_TEST_INSTALL_IO_SWAP_EXTERNAL: external,
|
|
1655
|
+
AUTOCODING_TEST_INSTALL_IO_SWAP_BACKUP: backup,
|
|
1656
|
+
},
|
|
1657
|
+
});
|
|
1658
|
+
const output = `${failed.stdout}\n${failed.stderr}`;
|
|
1659
|
+
assert(failed.status !== 0 && output.includes("Install I/O project parent changed"), `install switch parent swap must fail closed: ${output}`);
|
|
1660
|
+
assertExternalUntouched(external, sentinel, "install switch parent swap");
|
|
1661
|
+
restoreParent(parent, backup);
|
|
1662
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1663
|
+
assertExternalUntouched(external, sentinel, "install switch parent swap recovery");
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
function testNoChangeLightGateRejectsInvalidEffectiveContracts() {
|
|
1668
|
+
const cases = [
|
|
1669
|
+
{
|
|
1670
|
+
name: "risk-rules",
|
|
1671
|
+
mutate(overrides) {
|
|
1672
|
+
overrides.risk = { rules: { invalid: true } };
|
|
1673
|
+
},
|
|
1674
|
+
hints: ["risk.rules", "must be a list"],
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: "validation-route",
|
|
1678
|
+
mutate(overrides) {
|
|
1679
|
+
overrides.validation = {
|
|
1680
|
+
...(overrides.validation ?? {}),
|
|
1681
|
+
routes: [{ name: "invalid-empty-command-route", paths: ["**"], commands: [] }],
|
|
1682
|
+
};
|
|
1683
|
+
},
|
|
1684
|
+
hints: ["validation.routes[0].commands", "must not be empty"],
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
name: "validation-budget",
|
|
1688
|
+
mutate(overrides) {
|
|
1689
|
+
overrides.validation = {
|
|
1690
|
+
...(overrides.validation ?? {}),
|
|
1691
|
+
max_command_seconds: 181,
|
|
1692
|
+
max_total_seconds: 180,
|
|
1693
|
+
};
|
|
1694
|
+
},
|
|
1695
|
+
hints: ["max_command_seconds", "max_total_seconds"],
|
|
1696
|
+
},
|
|
1697
|
+
];
|
|
1698
|
+
|
|
1699
|
+
for (const invalid of cases) {
|
|
1700
|
+
const repo = tmpdir(`no-change-light-gate-${invalid.name}`);
|
|
1701
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1702
|
+
fillRequiredAccess(repo);
|
|
1703
|
+
const overrides = readYamlConfig(projectConfigPath(repo)).overrides;
|
|
1704
|
+
invalid.mutate(overrides);
|
|
1705
|
+
writeProjectConfig(repo, overrides);
|
|
1706
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
1707
|
+
run("git", ["config", "user.email", "test@example.com"], { cwd: repo });
|
|
1708
|
+
run("git", ["config", "user.name", "Auto Coding Test"], { cwd: repo });
|
|
1709
|
+
run("git", ["add", "-A"], { cwd: repo });
|
|
1710
|
+
run("git", ["commit", "-qm", "invalid contract baseline"], { cwd: repo });
|
|
1711
|
+
assert(run("git", ["status", "--porcelain"], { cwd: repo }).stdout === "", `${invalid.name}: fixture must have no changed files`);
|
|
1712
|
+
|
|
1713
|
+
const launcher = path.join(repo, "docs", "tools", "autopipeline", "ap.py");
|
|
1714
|
+
if (invalid.name === "risk-rules") {
|
|
1715
|
+
const classify = run("python3", [
|
|
1716
|
+
launcher,
|
|
1717
|
+
"--repo", repo,
|
|
1718
|
+
"classify",
|
|
1719
|
+
"--planned-path", "sensitive/example.txt",
|
|
1720
|
+
"--json",
|
|
1721
|
+
], { cwd: repo, check: false });
|
|
1722
|
+
const classifyOutput = `${classify.stdout}\n${classify.stderr}`;
|
|
1723
|
+
assert(classify.status !== 0, "malformed risk.rules must fail classify instead of downgrading a sensitive path");
|
|
1724
|
+
assert(classifyOutput.includes("risk.rules must be a list"), `classify must identify malformed risk.rules: ${classifyOutput}`);
|
|
1725
|
+
|
|
1726
|
+
const taskStart = run("python3", [
|
|
1727
|
+
launcher,
|
|
1728
|
+
"--repo", repo,
|
|
1729
|
+
"task-start", "INVALID-RISK-CONTRACT",
|
|
1730
|
+
"--owned-path", "sensitive/example.txt",
|
|
1731
|
+
"--force-lifecycle",
|
|
1732
|
+
], { cwd: repo, check: false });
|
|
1733
|
+
const taskOutput = `${taskStart.stdout}\n${taskStart.stderr}`;
|
|
1734
|
+
assert(taskStart.status !== 0, "malformed risk.rules must fail task-start before isolation/review decisions");
|
|
1735
|
+
assert(taskOutput.includes("risk.rules must be a list"), `task-start must identify malformed risk.rules: ${taskOutput}`);
|
|
1736
|
+
}
|
|
1737
|
+
const gate = run("python3", [launcher, "--repo", repo, "light-gate", "--scope", "changed"], { cwd: repo, check: false });
|
|
1738
|
+
const output = `${gate.stdout}\n${gate.stderr}`;
|
|
1739
|
+
assert(gate.status !== 0, `${invalid.name}: an invalid effective contract must fail light-gate even with no changed files`);
|
|
1740
|
+
for (const hint of invalid.hints) {
|
|
1741
|
+
assert(output.includes(hint), `${invalid.name}: light-gate must report ${hint}: ${output}`);
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
function testStatusRejectsInvalidStructureEnforcementFromDoctorContract() {
|
|
1747
|
+
const repo = tmpdir("invalid-structure-enforcement-status");
|
|
1748
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1749
|
+
fillRequiredAccess(repo);
|
|
1750
|
+
const overrides = readYamlConfig(projectConfigPath(repo)).overrides;
|
|
1751
|
+
writeProjectConfig(repo, {
|
|
1752
|
+
...overrides,
|
|
1753
|
+
structure: { ...(overrides.structure ?? {}), enforcement: "strict-but-unknown" },
|
|
1754
|
+
});
|
|
1755
|
+
|
|
1756
|
+
const status = run("node", [cli, "status", "--projects", repo, "--json"], { check: false });
|
|
1757
|
+
assert(status.status !== 0, "status must reject an invalid structure enforcement value");
|
|
1758
|
+
const parsed = JSON.parse(status.stdout).results[0];
|
|
1759
|
+
assert(
|
|
1760
|
+
parsed.invalidConfigTokens.includes("structure.enforcement must be advisory or blocking"),
|
|
1761
|
+
`status must expose the structure issue from the complete doctor contract: ${status.stdout}`,
|
|
1762
|
+
);
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
function testProjectConfigOverlayIsHighRiskAndReviewRequired() {
|
|
1766
|
+
const repo = tmpdir("project-config-classification");
|
|
1767
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
1768
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1769
|
+
run("git", ["config", "user.email", "test@example.com"], { cwd: repo });
|
|
1770
|
+
run("git", ["config", "user.name", "Auto Coding Test"], { cwd: repo });
|
|
1771
|
+
run("git", ["add", "-A"], { cwd: repo });
|
|
1772
|
+
run("git", ["commit", "-qm", "baseline"], { cwd: repo });
|
|
1773
|
+
const launcher = path.join(repo, "docs", "tools", "autopipeline", "ap.py");
|
|
1774
|
+
for (const plannedPath of ["docs/ENGINEERING.md", "docs/project/auto-coding-skill.yaml"]) {
|
|
1775
|
+
const result = run("python3", [
|
|
1776
|
+
launcher,
|
|
1777
|
+
"--repo", repo,
|
|
1778
|
+
"classify",
|
|
1779
|
+
"--planned-path", plannedPath,
|
|
1780
|
+
"--intent", `change Skill configuration at ${plannedPath}`,
|
|
1781
|
+
"--json",
|
|
1782
|
+
]);
|
|
1783
|
+
const parsed = JSON.parse(result.stdout);
|
|
1784
|
+
assert(parsed.profile === "high-risk", `${plannedPath} changes must be high-risk: ${result.stdout}`);
|
|
1785
|
+
assert(parsed.review_required === true, `${plannedPath} changes must require independent review: ${result.stdout}`);
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
function testStatusAndFeedbackUseEffectiveProjectConfigWithoutLeakingAccess() {
|
|
1790
|
+
const repo = tmpdir("project-config-consumers");
|
|
1791
|
+
const projectName = "effective-overlay-project";
|
|
1792
|
+
const secret = "overlay-access-must-not-leak-c819";
|
|
1793
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
1794
|
+
writeProjectConfig(repo, requiredProjectOverrides(projectName, secret));
|
|
1795
|
+
const engineering = readEngineeringConfig(path.join(repo, "docs", "ENGINEERING.md"));
|
|
1796
|
+
assert(engineering.project?.name === "", "managed ENGINEERING must not provide the effective project identity");
|
|
1797
|
+
assert(engineering.access?.project?.frontend?.password === "", "managed ENGINEERING must not provide effective access values");
|
|
1798
|
+
|
|
1799
|
+
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
1800
|
+
assert(JSON.parse(status.stdout).results[0].ok === true, `status must validate the effective overlay configuration: ${status.stdout}`);
|
|
1801
|
+
assert(!status.stdout.includes(secret), "status must never print access values loaded from the project overlay");
|
|
1802
|
+
|
|
1803
|
+
const signature = `sha256:${"c".repeat(64)}`;
|
|
1804
|
+
const report = path.join(repo, "docs", "skill-feedback", "reports", "2026-07-18-effective-config-c819a2e4.md");
|
|
1805
|
+
writeFile(report, [
|
|
1806
|
+
"---",
|
|
1807
|
+
"schema: auto-coding-skill-feedback/v1",
|
|
1808
|
+
"report_id: ACSF-effective-20260718-c819a2e4",
|
|
1809
|
+
"status: open",
|
|
1810
|
+
'created_at: "2026-07-18T10:00:00+08:00"',
|
|
1811
|
+
`project: ${projectName}`,
|
|
1812
|
+
`observed_skill_version: ${engineering.workflow.skill_version}`,
|
|
1813
|
+
"component: config-overlay",
|
|
1814
|
+
"kind: defect",
|
|
1815
|
+
"impact: minor",
|
|
1816
|
+
"origin_surface: managed-script",
|
|
1817
|
+
"suspected_scope: shared",
|
|
1818
|
+
`signature: ${signature}`,
|
|
1819
|
+
"export: metadata-only",
|
|
1820
|
+
"---",
|
|
1821
|
+
"# Effective config consumer",
|
|
1822
|
+
"",
|
|
1823
|
+
"## Symptom",
|
|
1824
|
+
"A consumer ignored the project overlay.",
|
|
1825
|
+
"",
|
|
1826
|
+
"## Expected",
|
|
1827
|
+
"Every consumer uses the effective project configuration.",
|
|
1828
|
+
"",
|
|
1829
|
+
"## Minimal reproduction",
|
|
1830
|
+
"Read this report using the configured project identity.",
|
|
1831
|
+
"",
|
|
1832
|
+
"## Evidence",
|
|
1833
|
+
"The metadata is intentionally non-sensitive.",
|
|
1834
|
+
"",
|
|
1835
|
+
"## Workaround",
|
|
1836
|
+
"None.",
|
|
1837
|
+
"",
|
|
1838
|
+
"## Why shared",
|
|
1839
|
+
"The project-independent consumer is managed by the Skill.",
|
|
1840
|
+
"",
|
|
1841
|
+
].join("\n"));
|
|
1842
|
+
const feedback = run("node", [cli, "feedback", "--projects", repo, "--json"]);
|
|
1843
|
+
const collected = JSON.parse(feedback.stdout);
|
|
1844
|
+
assert(collected.projects[0]?.project === projectName, `feedback collection must use effective project.name: ${feedback.stdout}`);
|
|
1845
|
+
assert(collected.report_count === 1 && collected.metadata[0]?.project === projectName, "feedback metadata must retain the effective project identity");
|
|
1846
|
+
assert(!feedback.stdout.includes(secret), "feedback collection must never print access values loaded from the project overlay");
|
|
649
1847
|
}
|
|
650
1848
|
|
|
651
1849
|
function testManagedAgentModelsInheritAndOverridesSurvive() {
|
|
@@ -771,14 +1969,14 @@ function testBridgeIsGeneric() {
|
|
|
771
1969
|
}
|
|
772
1970
|
}
|
|
773
1971
|
|
|
774
|
-
function
|
|
775
|
-
const repo = tmpdir("
|
|
1972
|
+
function testSyncCleansAllManagedSkillExtras() {
|
|
1973
|
+
const repo = tmpdir("sync-extra");
|
|
776
1974
|
run("git", ["init", "-q"], { cwd: repo });
|
|
777
1975
|
run("node", [cli, "init", "--force"], { cwd: repo });
|
|
778
1976
|
run("node", [cli, "sync", "--projects", repo]);
|
|
779
1977
|
writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "data", "templates", "bridges", "OLD.md"), "old\n");
|
|
780
1978
|
writeFile(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt"), "custom\n");
|
|
781
|
-
run("
|
|
1979
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
782
1980
|
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "data", "templates", "bridges", "OLD.md")), "managed bridge extra should be removed");
|
|
783
1981
|
assert(!exists(path.join(repo, ".agents", "skills", "auto-coding-skill", "custom.txt")), "fully managed Skill extras should be removed");
|
|
784
1982
|
}
|
|
@@ -858,9 +2056,43 @@ function testReviewScaffoldLeavesBaselineGenerationToBaselineCommand() {
|
|
|
858
2056
|
assert(fs.readFileSync(path.join(repo, "docs", "reviews", "optimization-backlog.md"), "utf8").includes("Generated by `ap.py baseline init`"), "baseline command should generate the optimization backlog");
|
|
859
2057
|
}
|
|
860
2058
|
|
|
861
|
-
function
|
|
862
|
-
const repo = tmpdir("
|
|
863
|
-
|
|
2059
|
+
function testBaselineUpdateConfigWritesOnlyProjectOverlay() {
|
|
2060
|
+
const repo = tmpdir("baseline-project-overlay-only");
|
|
2061
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
2062
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
2063
|
+
run("git", ["config", "user.email", "test@example.com"], { cwd: repo });
|
|
2064
|
+
run("git", ["config", "user.name", "Auto Coding Test"], { cwd: repo });
|
|
2065
|
+
writeFile(path.join(repo, "src", "large-module.js"), "export const line = 1;\n".repeat(801));
|
|
2066
|
+
run("git", ["add", "-A"], { cwd: repo });
|
|
2067
|
+
run("git", ["commit", "-qm", "baseline source"], { cwd: repo });
|
|
2068
|
+
|
|
2069
|
+
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
2070
|
+
const overlay = projectConfigPath(repo);
|
|
2071
|
+
const engineeringBefore = fs.readFileSync(engineering);
|
|
2072
|
+
const overlayBefore = fs.readFileSync(overlay);
|
|
2073
|
+
const launcher = path.join(repo, "docs", "tools", "autopipeline", "ap.py");
|
|
2074
|
+
const baseline = run("python3", [
|
|
2075
|
+
launcher,
|
|
2076
|
+
"--repo", repo,
|
|
2077
|
+
"baseline", "init",
|
|
2078
|
+
"--write",
|
|
2079
|
+
"--update-config",
|
|
2080
|
+
"--json",
|
|
2081
|
+
]);
|
|
2082
|
+
const parsed = JSON.parse(baseline.stdout);
|
|
2083
|
+
|
|
2084
|
+
assert(parsed.updated_accepted_debt_paths.includes("src/large-module.js"), `baseline must discover the tracked large file: ${baseline.stdout}`);
|
|
2085
|
+
assert(fs.readFileSync(engineering).equals(engineeringBefore), "baseline --update-config must never modify managed ENGINEERING defaults");
|
|
2086
|
+
assert(!fs.readFileSync(overlay).equals(overlayBefore), "baseline --update-config must persist accepted debt in the project overlay");
|
|
2087
|
+
assert(readEffectiveConfig(repo).structure?.accepted_debt_paths?.includes("src/large-module.js"), "the overlay update must affect effective accepted_debt_paths");
|
|
2088
|
+
const changed = run("git", ["status", "--porcelain"], { cwd: repo }).stdout;
|
|
2089
|
+
assert(changed.includes("docs/project/auto-coding-skill.yaml"), `baseline must report the overlay as the changed configuration file: ${changed}`);
|
|
2090
|
+
assert(!changed.includes("docs/ENGINEERING.md"), `baseline must not report managed ENGINEERING as changed: ${changed}`);
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
function testSyncUsesPackagedAssetsAndIgnoresRetiredTemplates() {
|
|
2094
|
+
const repo = tmpdir("sync-packaged-source");
|
|
2095
|
+
const fakeHome = tmpdir("sync-stale-home");
|
|
864
2096
|
run("git", ["init", "-q"], { cwd: repo });
|
|
865
2097
|
run("node", [cli, "init"], { cwd: repo });
|
|
866
2098
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -873,44 +2105,37 @@ function testUpgradePrefersModernProjectAssetsAndIgnoresRetiredTemplates() {
|
|
|
873
2105
|
writeFile(path.join(staleGlobal, "data", "templates", "ENGINEERING.md"), "---\n---\n");
|
|
874
2106
|
writeFile(path.join(staleGlobal, "data", "templates", "docs", "interfaces", "api.md"), "# Retired global template\n");
|
|
875
2107
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
[launcher, "--repo", repo, "upgrade", "--write", "--json"],
|
|
880
|
-
{ env: pythonEnvWithHome(fakeHome) },
|
|
881
|
-
);
|
|
882
|
-
const parsed = JSON.parse(result.stdout);
|
|
883
|
-
assert(fs.realpathSync(parsed.source_root) === fs.realpathSync(projectSkill), `upgrade should prefer the modern project asset root: ${result.stdout}`);
|
|
884
|
-
assert(fs.readFileSync(path.join(repo, "docs", "interfaces", "api.md"), "utf8").startsWith("# API Contract"), "compatibility upgrade must not replace the canonical API doc with a retired physical template");
|
|
2108
|
+
run("node", [cli, "sync", "--projects", repo], { env: pythonEnvWithHome(fakeHome) });
|
|
2109
|
+
assert(!exists(path.join(projectSkill, "data", "templates", "docs", "interfaces", "api.md")), "transactional sync must replace retired files in the managed Skill namespace");
|
|
2110
|
+
assert(fs.readFileSync(path.join(repo, "docs", "interfaces", "api.md"), "utf8").startsWith("# API Contract"), "transactional sync must not replace the canonical API doc with a retired physical template");
|
|
885
2111
|
}
|
|
886
2112
|
|
|
887
|
-
function
|
|
888
|
-
const repo = tmpdir("
|
|
889
|
-
const fakeHome = tmpdir("upgrade-engineering-home");
|
|
2113
|
+
function testInitInitializesNewEngineeringDefaults() {
|
|
2114
|
+
const repo = tmpdir("init-engineering-defaults");
|
|
890
2115
|
run("git", ["init", "-q"], { cwd: repo });
|
|
891
2116
|
writeFile(path.join(repo, "package.json"), JSON.stringify({ scripts: { test: "node --test", "test:changed": "node --test" } }, null, 2) + "\n");
|
|
892
2117
|
run("node", [cli, "init"], { cwd: repo });
|
|
893
2118
|
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
assert(
|
|
899
|
-
assert(engineering.includes("project_fast: npm run test:changed"), "upgrade should infer only a dedicated changed-scope test");
|
|
900
|
-
assert(!engineering.includes("gate_standard:"), "upgrade must not infer an automatic standard gate");
|
|
901
|
-
assert(!engineering.includes("gate_full:"), "upgrade must not infer an automatic full gate");
|
|
2119
|
+
const effective = readEffectiveConfig(repo);
|
|
2120
|
+
assert(effective.project?.name === path.basename(repo), "init should initialize a newly created project name in the overlay");
|
|
2121
|
+
assert(effective.commands?.project_fast === "npm run test:changed", "init should infer only a dedicated changed-scope test in the overlay");
|
|
2122
|
+
assert(effective.commands?.gate_standard === undefined, "init must not infer an automatic standard gate");
|
|
2123
|
+
assert(effective.commands?.gate_full === undefined, "init must not infer an automatic full gate");
|
|
902
2124
|
}
|
|
903
2125
|
|
|
904
|
-
function
|
|
905
|
-
const repo = tmpdir("
|
|
2126
|
+
function testInitMigratesLegacyAutomaticGateToFastDefault() {
|
|
2127
|
+
const repo = tmpdir("init-legacy-fast-gate");
|
|
906
2128
|
run("git", ["init", "-q"], { cwd: repo });
|
|
907
2129
|
writeFile(path.join(repo, "package.json"), JSON.stringify({ scripts: { test: "node --test" } }, null, 2) + "\n");
|
|
908
2130
|
run("node", [cli, "init"], { cwd: repo });
|
|
909
|
-
|
|
2131
|
+
fs.unlinkSync(projectConfigPath(repo));
|
|
2132
|
+
const legacyEngineering = [
|
|
910
2133
|
"---",
|
|
911
2134
|
"workflow:",
|
|
912
|
-
|
|
2135
|
+
' skill_version: "4.2.8"',
|
|
2136
|
+
" mode: dev",
|
|
913
2137
|
" profile: auto",
|
|
2138
|
+
" completion: push",
|
|
914
2139
|
"project:",
|
|
915
2140
|
' name: "legacy"',
|
|
916
2141
|
"concurrency:",
|
|
@@ -930,16 +2155,25 @@ function testUpgradeMigratesLegacyAutomaticGateToFastDefault() {
|
|
|
930
2155
|
"---",
|
|
931
2156
|
"# Legacy engineering",
|
|
932
2157
|
"",
|
|
933
|
-
].join("\n")
|
|
2158
|
+
].join("\n");
|
|
2159
|
+
writeFile(path.join(repo, "docs", "ENGINEERING.md"), legacyEngineering);
|
|
2160
|
+
const legacyInstalledDefault = legacyEngineering
|
|
2161
|
+
.replace(' name: "legacy"', ' name: ""')
|
|
2162
|
+
.replace(" base_ref: origin/dev", ' base_ref: ""')
|
|
2163
|
+
.replace(" target_branch: dev", ' target_branch: ""');
|
|
2164
|
+
installTrustedEngineeringDefault(repo, legacyInstalledDefault, "4.2.8");
|
|
934
2165
|
|
|
935
|
-
run("
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
assert(
|
|
939
|
-
assert(
|
|
940
|
-
assert(
|
|
941
|
-
assert(
|
|
942
|
-
assert(
|
|
2166
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
2167
|
+
const managed = readEngineeringConfig(path.join(repo, "docs", "ENGINEERING.md"));
|
|
2168
|
+
const effective = readEffectiveConfig(repo);
|
|
2169
|
+
assert(effective.commands?.project_fast === "", "init should not promote an ordinary npm test to the project-fast gate");
|
|
2170
|
+
assert(managed.workflow?.mode === "dev", "init should retain the managed fast development mode");
|
|
2171
|
+
assert(managed.workflow?.completion === "push", "init should retain managed push completion");
|
|
2172
|
+
assert(managed.concurrency?.isolation === "adaptive", "init should retain managed adaptive isolation");
|
|
2173
|
+
assert(managed.validation?.on_unmapped === "error", "init should retain the fail-closed unmapped default");
|
|
2174
|
+
assert(managed.risk?.rules?.length === 0, "init should retain empty managed project-risk defaults");
|
|
2175
|
+
assert(effective.project?.name === "legacy" && effective.concurrency?.target_branch === "dev", "init must migrate supported legacy project values into the overlay");
|
|
2176
|
+
assert(effective.gate === undefined && effective.commands?.gate_full === undefined, "init must drop removed automatic gate escalation fields");
|
|
943
2177
|
}
|
|
944
2178
|
|
|
945
2179
|
function testRemovedVerificationFlagsFailFast() {
|
|
@@ -948,15 +2182,67 @@ function testRemovedVerificationFlagsFailFast() {
|
|
|
948
2182
|
assert(result.status !== 0 && result.stderr.includes("unrecognized arguments"), "removed post-push verification flags must fail instead of being ignored");
|
|
949
2183
|
}
|
|
950
2184
|
|
|
951
|
-
function
|
|
952
|
-
const repo = tmpdir("
|
|
2185
|
+
function testInstallBootstrapsRuntimeRequiredByLauncher() {
|
|
2186
|
+
const repo = tmpdir("install-missing-runtime");
|
|
2187
|
+
const fakeHome = tmpdir("install-global-runtime-home");
|
|
2188
|
+
const env = pythonEnvWithHome(fakeHome);
|
|
953
2189
|
run("git", ["init", "-q"], { cwd: repo });
|
|
954
|
-
run("
|
|
2190
|
+
run("node", [cli, "init", "--mode", "global", "--dest", fakeHome, "--force"]);
|
|
2191
|
+
const globalAp = path.join(fakeHome, ".agents", "skills", "auto-coding-skill", "scripts", "ap.py");
|
|
2192
|
+
run("python3", [globalAp, "--repo", repo, "install"], { env });
|
|
955
2193
|
const projectRuntime = path.join(repo, ".agents", "skills", "auto-coding-skill", "scripts", "ap.py");
|
|
956
2194
|
const launcher = path.join(repo, "docs", "tools", "autopipeline", "ap.py");
|
|
957
|
-
assert(exists(projectRuntime), "
|
|
958
|
-
|
|
959
|
-
|
|
2195
|
+
assert(!exists(projectRuntime), "runtime bootstrap install must continue to rely on the invoking global Skill copy");
|
|
2196
|
+
assert(readYamlConfig(projectConfigPath(repo)).overrides?.project?.name === path.basename(repo), "bootstrap install must initialize the project overlay");
|
|
2197
|
+
const help = run("python3", [launcher, "--help"], { env });
|
|
2198
|
+
assert(help.stdout.includes("autopipeline"), "bootstrapped launcher should remain executable through the invoking runtime");
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
function testCliInstallArchivesFeedbackTemplatesAndPreservesReports() {
|
|
2202
|
+
const repo = tmpdir("cli-feedback-ownership");
|
|
2203
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
2204
|
+
const feedbackReadme = path.join(repo, "docs", "skill-feedback", "README.md");
|
|
2205
|
+
const report = path.join(repo, "docs", "skill-feedback", "reports", "2026-07-18-upgrade-gap-a13f82c1.md");
|
|
2206
|
+
const previousReadme = "project content that occupied the future managed feedback README\n";
|
|
2207
|
+
const reportContent = "project-owned feedback report bytes\n";
|
|
2208
|
+
writeFile(feedbackReadme, previousReadme);
|
|
2209
|
+
writeFile(report, reportContent);
|
|
2210
|
+
|
|
2211
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
2212
|
+
const archive = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "skill-feedback", "README.md");
|
|
2213
|
+
assert(fs.readFileSync(feedbackReadme, "utf8").includes("Auto Coding Skill Feedback"), "transactional init must install the managed feedback README");
|
|
2214
|
+
assert(fs.readFileSync(archive, "utf8") === previousReadme, "transactional init must archive a pre-existing feedback README before replacement");
|
|
2215
|
+
assert(fs.readFileSync(report, "utf8") === reportContent, "transactional init must preserve project feedback reports byte-for-byte");
|
|
2216
|
+
|
|
2217
|
+
const archiveBefore = fs.readFileSync(archive);
|
|
2218
|
+
run("node", [cli, "sync", "--projects", repo]);
|
|
2219
|
+
assert(fs.readFileSync(archive).equals(archiveBefore), "repeated transactional sync must keep the original feedback archive stable");
|
|
2220
|
+
assert(fs.readFileSync(report, "utf8") === reportContent, "repeated transactional sync must keep project feedback reports stable");
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
function testLegacyUpgradeWriteFailsWithoutAnyWrites() {
|
|
2224
|
+
const repo = tmpdir("legacy-upgrade-write-rejected");
|
|
2225
|
+
run("git", ["init", "-q"], { cwd: repo });
|
|
2226
|
+
run("node", [cli, "init"], { cwd: repo });
|
|
2227
|
+
const skill = path.join(repo, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
2228
|
+
writeFile(skill, "legacy-upgrade-zero-write-sentinel\n");
|
|
2229
|
+
const beforeFiles = listProjectFiles(repo)
|
|
2230
|
+
.map(file => [path.relative(repo, file), fs.readFileSync(file)])
|
|
2231
|
+
.sort(([left], [right]) => left.localeCompare(right));
|
|
2232
|
+
const projectAp = path.join(repo, ".agents", "skills", "auto-coding-skill", "scripts", "ap.py");
|
|
2233
|
+
|
|
2234
|
+
const rejected = run("python3", [projectAp, "--repo", repo, "upgrade", "--write"], { check: false });
|
|
2235
|
+
const output = `${rejected.stdout}\n${rejected.stderr}`;
|
|
2236
|
+
assert(rejected.status !== 0, "legacy ap.py upgrade --write must be rejected");
|
|
2237
|
+
assert(output.includes("retired") && output.includes("autocoding init") && output.includes("autocoding sync"), `legacy write rejection must direct callers to the transactional CLI: ${output}`);
|
|
2238
|
+
const afterFiles = listProjectFiles(repo)
|
|
2239
|
+
.map(file => [path.relative(repo, file), fs.readFileSync(file)])
|
|
2240
|
+
.sort(([left], [right]) => left.localeCompare(right));
|
|
2241
|
+
assert(afterFiles.length === beforeFiles.length, "rejected legacy write must not create or delete project files");
|
|
2242
|
+
for (let index = 0; index < beforeFiles.length; index += 1) {
|
|
2243
|
+
assert(afterFiles[index][0] === beforeFiles[index][0], `rejected legacy write must preserve the file set: ${beforeFiles[index][0]}`);
|
|
2244
|
+
assert(afterFiles[index][1].equals(beforeFiles[index][1]), `rejected legacy write must preserve bytes: ${beforeFiles[index][0]}`);
|
|
2245
|
+
}
|
|
960
2246
|
}
|
|
961
2247
|
|
|
962
2248
|
function testLedgerArchiveRecognizesSettledStatuses() {
|
|
@@ -1018,7 +2304,7 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
|
|
|
1018
2304
|
|
|
1019
2305
|
const engineering = path.join(repo, "docs", "ENGINEERING.md");
|
|
1020
2306
|
const initial = fs.readFileSync(engineering, "utf8");
|
|
1021
|
-
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.
|
|
2307
|
+
const startPattern = /<!-- auto-coding-skill:managed-workflow:start version=4\.3\.1 -->/;
|
|
1022
2308
|
const endMarker = "<!-- auto-coding-skill:managed-workflow:end -->";
|
|
1023
2309
|
assert(startPattern.test(initial), "new projects should include a versioned managed workflow marker");
|
|
1024
2310
|
assert(initial.includes(endMarker), "new projects should include the managed workflow end marker");
|
|
@@ -1032,21 +2318,21 @@ function testManagedEngineeringInitIsAuthoritativeAndIdempotent() {
|
|
|
1032
2318
|
const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
1033
2319
|
const dryResult = JSON.parse(dryRun.stdout).results[0];
|
|
1034
2320
|
assert(dryResult.managedWorkflow.state === "stale", `dry-run should expose stale workflow state: ${dryRun.stdout}`);
|
|
1035
|
-
assert(dryResult.managedWorkflow.version === "4.
|
|
1036
|
-
assert(dryResult.actions.some(item => item.action === "would-
|
|
2321
|
+
assert(dryResult.managedWorkflow.version === "4.3.1", "dry-run should expose the target workflow version");
|
|
2322
|
+
assert(dryResult.actions.some(item => item.action === "would-replace" && item.path === "docs/ENGINEERING.md"), "dry-run should plan exact replacement of the managed default document");
|
|
1037
2323
|
assert(fs.readFileSync(engineering, "utf8") === customized, "dry-run must not write ENGINEERING.md");
|
|
1038
2324
|
|
|
1039
2325
|
run("node", [cli, "init"], { cwd: repo });
|
|
1040
2326
|
const updated = fs.readFileSync(engineering, "utf8");
|
|
1041
2327
|
assert(!updated.includes("project note before") && !updated.includes("project note after"), "init must remove text outside the canonical ENGINEERING body");
|
|
1042
|
-
assert(updated.includes("version=4.
|
|
2328
|
+
assert(updated.includes("version=4.3.1"), "init should install the current managed workflow version");
|
|
1043
2329
|
assert(updated.includes("The frontmatter contract is:"), "init should refresh stale managed workflow content");
|
|
1044
2330
|
|
|
1045
2331
|
fillRequiredAccess(repo);
|
|
1046
2332
|
const status = run("node", [cli, "status", "--projects", repo, "--json"]);
|
|
1047
2333
|
const statusResult = JSON.parse(status.stdout).results[0];
|
|
1048
2334
|
assert(statusResult.managedWorkflow.state === "current", `status should expose current managed workflow state: ${status.stdout}`);
|
|
1049
|
-
assert(statusResult.managedWorkflow.version === "4.
|
|
2335
|
+
assert(statusResult.managedWorkflow.version === "4.3.1", "status should expose the installed managed workflow version");
|
|
1050
2336
|
|
|
1051
2337
|
const beforeSecondInit = fs.readFileSync(engineering, "utf8");
|
|
1052
2338
|
run("node", [cli, "init"], { cwd: repo });
|
|
@@ -1070,11 +2356,14 @@ function testLegacyEngineeringMigrationPreservesExistingBody() {
|
|
|
1070
2356
|
const dryResult = JSON.parse(dryRun.stdout).results[0];
|
|
1071
2357
|
assert(dryResult.managedWorkflow.state === "legacy-custom", "unknown unmarked documents should be reported as a custom legacy migration");
|
|
1072
2358
|
assert(dryResult.managedWorkflow.preservedCustom === true, "custom legacy migration should expose its preservation policy");
|
|
1073
|
-
assert(dryResult.actions.
|
|
2359
|
+
assert(dryResult.actions.some(item => item.action === "would-replace" && item.path === "docs/ENGINEERING.md"), "custom legacy migration must plan exact managed replacement");
|
|
2360
|
+
assert(dryResult.actions.some(item => item.action === "would-archive" && item.path.endsWith("/docs/ENGINEERING.md")), "custom legacy migration must plan archival before replacement");
|
|
1074
2361
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1075
2362
|
const migrated = fs.readFileSync(engineering, "utf8");
|
|
1076
|
-
assert(migrated.includes("version=4.
|
|
1077
|
-
assert(migrated.includes(legacyNote), "legacy
|
|
2363
|
+
assert(migrated.includes("version=4.3.1"), "legacy migration should insert the current managed workflow");
|
|
2364
|
+
assert(!migrated.includes(legacyNote), "legacy project text must not remain in the exact managed default document");
|
|
2365
|
+
const archive = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "ENGINEERING.md");
|
|
2366
|
+
assert(fs.readFileSync(archive, "utf8").includes(legacyNote), "legacy migration must preserve the complete previous body in history");
|
|
1078
2367
|
const stable = fs.readFileSync(engineering, "utf8");
|
|
1079
2368
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1080
2369
|
assert(fs.readFileSync(engineering, "utf8") === stable, "legacy migration should converge after one sync");
|
|
@@ -1094,12 +2383,15 @@ function testOfficialLegacyEngineeringBodyIsReplacedWithoutDuplication() {
|
|
|
1094
2383
|
const dryRun = run("node", [cli, "sync", "--projects", repo, "--dry-run", "--json"]);
|
|
1095
2384
|
const dryResult = JSON.parse(dryRun.stdout).results[0];
|
|
1096
2385
|
assert(dryResult.managedWorkflow.state === "legacy-official", `official body hash should select replacement migration: ${dryRun.stdout}`);
|
|
1097
|
-
assert(dryResult.actions.
|
|
2386
|
+
assert(dryResult.actions.some(item => item.action === "would-replace" && item.path === "docs/ENGINEERING.md"), "official legacy migration must plan exact managed replacement");
|
|
1098
2387
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1099
2388
|
const migrated = fs.readFileSync(engineering, "utf8");
|
|
1100
|
-
|
|
2389
|
+
const canonicalEngineering = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "ENGINEERING.md"), "utf8");
|
|
2390
|
+
assert(migrated === canonicalEngineering, "official legacy migration must install the exact managed default document");
|
|
1101
2391
|
assert((migrated.match(/auto-coding-skill:managed-workflow:start/g) || []).length === 1, "official legacy migration should install exactly one managed workflow");
|
|
1102
|
-
assert((migrated.match(/^##
|
|
2392
|
+
assert((migrated.match(/^## Execution profiles$/gm) || []).length === 0, "official legacy migration must remove the old duplicated workflow body");
|
|
2393
|
+
const archive = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "ENGINEERING.md");
|
|
2394
|
+
assert(fs.readFileSync(archive, "utf8").includes("## Execution profiles"), "official legacy body must remain available in the historical archive");
|
|
1103
2395
|
|
|
1104
2396
|
const stable = fs.readFileSync(engineering, "utf8");
|
|
1105
2397
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -1173,7 +2465,7 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
|
|
|
1173
2465
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1174
2466
|
const agents = path.join(repo, "AGENTS.md");
|
|
1175
2467
|
const initial = fs.readFileSync(agents, "utf8");
|
|
1176
|
-
assert(initial.includes("managed-agents:start version=4.
|
|
2468
|
+
assert(initial.includes("managed-agents:start version=4.3.1"), "new projects should receive the versioned root AGENTS block");
|
|
1177
2469
|
|
|
1178
2470
|
const custom = [
|
|
1179
2471
|
"# Project rules",
|
|
@@ -1192,12 +2484,12 @@ function testManagedAgentsMigrationReplacesWholeFileAndArchivesPreviousRules() {
|
|
|
1192
2484
|
|
|
1193
2485
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1194
2486
|
const migrated = fs.readFileSync(agents, "utf8");
|
|
1195
|
-
assert(migrated.includes("managed-agents:start version=4.
|
|
2487
|
+
assert(migrated.includes("managed-agents:start version=4.3.1"), "AGENTS migration should install the current managed block");
|
|
1196
2488
|
assert(!migrated.includes("Preserve this repository-specific rule exactly."), "root AGENTS must contain no project-specific tail");
|
|
1197
2489
|
assert(!migrated.includes("must execute `commands.gate_full`"), "known official conflicting rule should be removed");
|
|
1198
2490
|
const canonical = fs.readFileSync(path.join(repoRoot, "cli", "assets", "skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
|
|
1199
2491
|
assert(migrated === canonical, "root AGENTS must be byte-identical to the packaged canonical file");
|
|
1200
|
-
const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.
|
|
2492
|
+
const archive = path.join(repo, "docs", "archive", "workflow", "AGENTS.pre-4.3.1.md");
|
|
1201
2493
|
assert(fs.readFileSync(archive, "utf8").includes("Preserve this repository-specific rule exactly."), "previous AGENTS content must be archived once");
|
|
1202
2494
|
const stable = fs.readFileSync(agents);
|
|
1203
2495
|
run("node", [cli, "sync", "--projects", repo]);
|
|
@@ -1215,16 +2507,25 @@ function testUnknownWorkflowConflictFailsWholeBatchBeforeWrites() {
|
|
|
1215
2507
|
const firstSkill = path.join(first, ".agents", "skills", "auto-coding-skill", "SKILL.md");
|
|
1216
2508
|
writeFile(firstSkill, "batch-sentinel\n");
|
|
1217
2509
|
const secondEngineering = path.join(second, "docs", "ENGINEERING.md");
|
|
1218
|
-
|
|
2510
|
+
const secret = "UNIQUE_POLICY_BEARER_SECRET_4d920f7a";
|
|
2511
|
+
fs.appendFileSync(secondEngineering, `\nHigh-risk changes must run the real full gate before push. Authorization: Bearer ${secret}\n`);
|
|
1219
2512
|
|
|
1220
2513
|
const status = run("node", [cli, "status", "--projects", second, "--json"], { check: false });
|
|
1221
2514
|
assert(status.status !== 0, "status must be non-ok for an unknown conflicting workflow rule");
|
|
2515
|
+
assert(!`${status.stdout}\n${status.stderr}`.includes(secret), `status must redact Bearer values from policy-conflict excerpts: ${status.stdout}\n${status.stderr}`);
|
|
1222
2516
|
const statusPlan = JSON.parse(status.stdout).results[0].managedWorkflow;
|
|
1223
2517
|
assert(statusPlan.state === "conflict", `status should expose the document conflict: ${status.stdout}`);
|
|
1224
2518
|
assert(statusPlan.conflicts[0].file === "docs/ENGINEERING.md" && statusPlan.conflicts[0].line > 0, "status conflict should include file and line");
|
|
1225
2519
|
|
|
2520
|
+
const launcher = path.join(second, "docs", "tools", "autopipeline", "ap.py");
|
|
2521
|
+
const effective = run("python3", [launcher, "--repo", second, "config-effective", "--json"]);
|
|
2522
|
+
assert(!`${effective.stdout}\n${effective.stderr}`.includes(secret), `config-effective must redact Bearer values from policy conflicts: ${effective.stdout}\n${effective.stderr}`);
|
|
2523
|
+
const effectiveStatus = JSON.parse(effective.stdout);
|
|
2524
|
+
assert(effectiveStatus.contract_valid === false && effectiveStatus.policy_issues.length > 0, `config-effective must retain redacted conflict diagnostics: ${effective.stdout}`);
|
|
2525
|
+
|
|
1226
2526
|
const sync = run("node", [cli, "sync", "--projects", `${first},${second}`], { check: false });
|
|
1227
2527
|
assert(sync.status !== 0 && sync.stderr.includes("entire sync batch before writes"), "one unknown conflict must reject the complete batch");
|
|
2528
|
+
assert(!`${sync.stdout}\n${sync.stderr}`.includes(secret), `sync preflight must redact Bearer values from conflict diagnostics: ${sync.stdout}\n${sync.stderr}`);
|
|
1228
2529
|
assert(fs.readFileSync(firstSkill, "utf8") === "batch-sentinel\n", "batch conflict preflight must run before an earlier project's skill write");
|
|
1229
2530
|
}
|
|
1230
2531
|
|
|
@@ -1238,7 +2539,10 @@ function testEngineeringMarkerBoundaryIsNormalized() {
|
|
|
1238
2539
|
writeFile(engineering, current.replace(`${marker}\n`, `${marker}# Project-specific workflow\n`));
|
|
1239
2540
|
run("node", [cli, "sync", "--projects", repo]);
|
|
1240
2541
|
const normalized = fs.readFileSync(engineering, "utf8");
|
|
1241
|
-
assert(normalized
|
|
2542
|
+
assert(normalized === current, "sync should restore the exact managed document when text is glued to its end marker");
|
|
2543
|
+
assert(!normalized.includes("# Project-specific workflow"), "project workflow text must not remain in the managed default document");
|
|
2544
|
+
const archive = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "ENGINEERING.md");
|
|
2545
|
+
assert(fs.readFileSync(archive, "utf8").includes(`${marker}# Project-specific workflow`), "the malformed previous document must remain available in history");
|
|
1242
2546
|
}
|
|
1243
2547
|
|
|
1244
2548
|
function testEngineeringFrameworkRejectsAnyNonCanonicalWorkflowText() {
|
|
@@ -1254,7 +2558,7 @@ function testEngineeringFrameworkRejectsAnyNonCanonicalWorkflowText() {
|
|
|
1254
2558
|
|
|
1255
2559
|
run("node", [cli, "init"], { cwd: repo });
|
|
1256
2560
|
assert(!fs.readFileSync(engineering, "utf8").includes("backend owns APIs"), "init must restore the canonical ENGINEERING body");
|
|
1257
|
-
const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.
|
|
2561
|
+
const archived = path.join(repo, ".agents", "archive", "auto-coding-skill", "4.3.1", "docs", "ENGINEERING.md");
|
|
1258
2562
|
assert(fs.readFileSync(archived, "utf8").includes("backend owns APIs"), "removed project text should remain in non-authoritative history");
|
|
1259
2563
|
}
|
|
1260
2564
|
|
|
@@ -1266,12 +2570,12 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
|
|
|
1266
2570
|
|
|
1267
2571
|
const manifestPath = path.join(repo, ".agents", "managed-install.json");
|
|
1268
2572
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
1269
|
-
assert(manifest.schema_version === 1 && manifest.skill_version === "4.
|
|
2573
|
+
assert(manifest.schema_version === 1 && manifest.skill_version === "4.3.1", "installed manifest must identify the release");
|
|
1270
2574
|
assert(manifest.entries.length > 0, "installed manifest must list managed files");
|
|
1271
2575
|
for (const entry of manifest.entries) {
|
|
1272
2576
|
assert(typeof entry.path === "string" && !path.isAbsolute(entry.path) && !entry.path.includes(".."), "manifest paths must be safe relative paths");
|
|
1273
2577
|
assert(/^[0-9a-f]{64}$/.test(entry.sha256), `${entry.path}: manifest hash must be sha256`);
|
|
1274
|
-
assert(entry.version === "4.
|
|
2578
|
+
assert(entry.version === "4.3.1" && typeof entry.executable === "boolean", `${entry.path}: version/executable metadata missing`);
|
|
1275
2579
|
}
|
|
1276
2580
|
assert(!manifest.managed_namespaces.some(item => item.path === ".agents" || item.path === "docs"), "manifest must not mirror entire project-owned trees");
|
|
1277
2581
|
|
|
@@ -1340,22 +2644,205 @@ function testManagedInstallIntegrityIsBoundedAndRepairable() {
|
|
|
1340
2644
|
assertStatusOk(repo);
|
|
1341
2645
|
}
|
|
1342
2646
|
|
|
2647
|
+
function testSkillFeedbackCollectionIsBoundedReadOnlyAndMetadataOnly() {
|
|
2648
|
+
const first = tmpdir("feedback-collect-first");
|
|
2649
|
+
const second = tmpdir("feedback-collect-second");
|
|
2650
|
+
const third = tmpdir("feedback-collect-empty");
|
|
2651
|
+
run("node", [cli, "init"], { cwd: first });
|
|
2652
|
+
run("node", [cli, "init"], { cwd: second });
|
|
2653
|
+
run("node", [cli, "init"], { cwd: third });
|
|
2654
|
+
const signature = `sha256:${"a".repeat(64)}`;
|
|
2655
|
+
const marker = path.join(os.tmpdir(), `autocoding-feedback-must-not-execute-${crypto.randomUUID()}`);
|
|
2656
|
+
const render = (project, reportId, privateMarker) => [
|
|
2657
|
+
"---",
|
|
2658
|
+
"schema: auto-coding-skill-feedback/v1",
|
|
2659
|
+
`report_id: ${reportId}`,
|
|
2660
|
+
"status: open",
|
|
2661
|
+
'created_at: "2026-07-18T10:00:00+08:00"',
|
|
2662
|
+
`project: ${project}`,
|
|
2663
|
+
"observed_skill_version: 4.3.1",
|
|
2664
|
+
"component: reviewer-runtime",
|
|
2665
|
+
"kind: defect",
|
|
2666
|
+
"impact: blocking",
|
|
2667
|
+
"origin_surface: managed-script",
|
|
2668
|
+
"suspected_scope: shared",
|
|
2669
|
+
`signature: ${signature}`,
|
|
2670
|
+
"export: metadata-only",
|
|
2671
|
+
"---",
|
|
2672
|
+
"# Reviewer runtime stalls",
|
|
2673
|
+
"",
|
|
2674
|
+
"## Symptom",
|
|
2675
|
+
`${privateMarker}; $(touch ${marker})`,
|
|
2676
|
+
"",
|
|
2677
|
+
"## Expected",
|
|
2678
|
+
"The managed runtime must return before its deadline.",
|
|
2679
|
+
"",
|
|
2680
|
+
"## Minimal reproduction",
|
|
2681
|
+
"Use a synthetic read-only assignment.",
|
|
2682
|
+
"",
|
|
2683
|
+
"## Evidence",
|
|
2684
|
+
"The bounded local fixture reproduced the timeout.",
|
|
2685
|
+
"",
|
|
2686
|
+
"## Workaround",
|
|
2687
|
+
"Use the explicit runtime override only with user authorization.",
|
|
2688
|
+
"",
|
|
2689
|
+
"## Why shared",
|
|
2690
|
+
"Managed runtime behavior reproduces outside project configuration.",
|
|
2691
|
+
"",
|
|
2692
|
+
].join("\n");
|
|
2693
|
+
const renderV2 = (project, reportId, privateMarker, options) => render(project, reportId, privateMarker)
|
|
2694
|
+
.replace("schema: auto-coding-skill-feedback/v1", "schema: auto-coding-skill-feedback/v2")
|
|
2695
|
+
.replace("status: open", `status: ${options.status ?? "open"}`)
|
|
2696
|
+
.replace('created_at: "2026-07-18T10:00:00+08:00"', 'created_at: "2026-07-18T10:00:00+08:00"\nupdated_at: "2026-07-19T10:00:00+08:00"')
|
|
2697
|
+
.replace("observed_skill_version: 4.3.1", `observed_skill_version: ${options.observed ?? "4.3.1"}\nlast_verified_skill_version: ${options.lastVerified ?? options.observed ?? "4.3.1"}`)
|
|
2698
|
+
.replace(signature, options.signature)
|
|
2699
|
+
.replace("export: metadata-only", `resolution: ${options.resolution ?? "pending"}\nexport: metadata-only`);
|
|
2700
|
+
const firstReport = path.join(first, "docs", "skill-feedback", "reports", "2026-07-18-review-timeout-a13f82c1.md");
|
|
2701
|
+
const firstOtherReport = path.join(first, "docs", "skill-feedback", "reports", "2026-07-18-installer-gap-c35fa4e3.md");
|
|
2702
|
+
const secondReport = path.join(second, "docs", "skill-feedback", "reports", "2026-07-18-review-timeout-b24f93d2.md");
|
|
2703
|
+
const closedReport = path.join(third, "docs", "skill-feedback", "reports", "2026-07-18-resolved-gap-d45fa4e3.md");
|
|
2704
|
+
const fixedReport = path.join(first, "docs", "skill-feedback", "reports", "2026-07-18-project-assets-fd5748e4.md");
|
|
2705
|
+
const rerouteReport = path.join(third, "docs", "skill-feedback", "reports", "2026-07-18-project-policy-a5eeb5eb.md");
|
|
2706
|
+
const firstContent = render(path.basename(first), "ACSF-geesight-20260718-a13f82c1", "PRIVATE-BODY-FIRST");
|
|
2707
|
+
const firstOtherContent = render(path.basename(first), "ACSF-geesight-20260718-c35fa4e3", "PRIVATE-BODY-OTHER")
|
|
2708
|
+
.replaceAll(signature, `sha256:${"b".repeat(64)}`);
|
|
2709
|
+
const secondContent = render(path.basename(second), "ACSF-xjmate-20260718-b24f93d2", "PRIVATE-BODY-SECOND");
|
|
2710
|
+
const closedContent = render(path.basename(third), "ACSF-closed-20260718-d45fa4e3", "PRIVATE-BODY-CLOSED")
|
|
2711
|
+
.replace("status: open", "status: resolved")
|
|
2712
|
+
.replaceAll(signature, `sha256:${"d".repeat(64)}`);
|
|
2713
|
+
const fixedContent = renderV2(path.basename(first), "ACSF-assets-20260718-fd5748e4", "PRIVATE-BODY-FIXED", {
|
|
2714
|
+
signature: "sha256:fd5748e4ae40e9f86762c4f62b3302bbbb2b8ae9661adf9e0e07a2327ccf7a36",
|
|
2715
|
+
observed: "4.3.0",
|
|
2716
|
+
lastVerified: "4.3.0",
|
|
2717
|
+
});
|
|
2718
|
+
const rerouteContent = renderV2(path.basename(third), "ACSF-policy-20260718-a5eeb5eb", "PRIVATE-BODY-REROUTE", {
|
|
2719
|
+
signature: "sha256:a5eeb5eb0ef5073dbeec726fa6c2016593b43eb1230171e3028f364c5b07bd86",
|
|
2720
|
+
});
|
|
2721
|
+
writeFile(firstReport, firstContent);
|
|
2722
|
+
writeFile(firstOtherReport, firstOtherContent);
|
|
2723
|
+
writeFile(secondReport, secondContent);
|
|
2724
|
+
writeFile(closedReport, closedContent);
|
|
2725
|
+
writeFile(fixedReport, fixedContent);
|
|
2726
|
+
writeFile(rerouteReport, rerouteContent);
|
|
2727
|
+
|
|
2728
|
+
const collected = run("node", [cli, "feedback", "--projects", `${first},${second},${third}`, "--json"]);
|
|
2729
|
+
const result = JSON.parse(collected.stdout);
|
|
2730
|
+
assert(result.schema === "auto-coding-skill-feedback-collection/v2", "feedback collection must identify its active-only grouping schema");
|
|
2731
|
+
assert(result.report_count === 6 && result.active_report_count === 3 && result.groups.length === 2, "feedback collection must group only current active reports");
|
|
2732
|
+
assert(result.closed_report_count === 1 && result.lifecycle_counts.closed === 1, "closed v1 feedback must remain readable but leave active grouping");
|
|
2733
|
+
assert(result.action_required_count === 2, `catalog resolutions must produce bounded project actions: ${collected.stdout}`);
|
|
2734
|
+
const fixedAction = result.action_required.find(item => item.report_id === "ACSF-assets-20260718-fd5748e4");
|
|
2735
|
+
assert(fixedAction?.lifecycle === "verification-due" && fixedAction.recommended_action.includes("verify-fix"), "a project at the fixed release must verify and close its old report");
|
|
2736
|
+
const rerouteAction = result.action_required.find(item => item.report_id === "ACSF-policy-20260718-a5eeb5eb");
|
|
2737
|
+
assert(rerouteAction?.lifecycle === "reroute-due" && rerouteAction.recommended_action.includes("docs/project/auto-coding-skill.yaml"), "project preferences must route to the project overlay");
|
|
2738
|
+
const statusWithFeedback = run("node", [cli, "status", "--projects", first, "--json"], { check: false });
|
|
2739
|
+
const statusFeedback = JSON.parse(statusWithFeedback.stdout).results[0].feedback;
|
|
2740
|
+
assert(statusFeedback.available === true && statusFeedback.actionRequiredCount >= 1, "status must surface feedback maintenance without making it installation drift");
|
|
2741
|
+
assert(result.projects.length === 3 && result.projects.every(item => item.source_project && item.project), "feedback collection must retain every explicit initialized project, including one with no reports");
|
|
2742
|
+
const sharedGroup = result.groups.find(item => item.signature === signature);
|
|
2743
|
+
assert(sharedGroup?.cross_project === true && sharedGroup.project_count === 2, "same signature from two explicit roots must be cross-project");
|
|
2744
|
+
const localGroup = result.groups.find(item => item.signature === `sha256:${"b".repeat(64)}`);
|
|
2745
|
+
assert(localGroup?.cross_project === false && localGroup.project_count === 1, "a separate one-project signature must remain a local candidate group");
|
|
2746
|
+
const rawReportDigests = [firstContent, firstOtherContent, secondContent, closedContent, fixedContent, rerouteContent]
|
|
2747
|
+
.map(content => crypto.createHash("sha256").update(content).digest("hex"));
|
|
2748
|
+
assert(result.metadata.every(item => !("content_sha256" in item) && item.size_bytes > 0), "feedback metadata must not export a hash oracle over private report bodies");
|
|
2749
|
+
assert(rawReportDigests.every(digest => !collected.stdout.includes(digest)), "collector output must not expose raw report body digests");
|
|
2750
|
+
assert(!collected.stdout.includes("PRIVATE-BODY") && !collected.stdout.includes("touch"), "collector output must never include report bodies");
|
|
2751
|
+
assert(!collected.stdout.includes(first) && !collected.stdout.includes(second) && !collected.stdout.includes(third), "collector output must not expose absolute project roots");
|
|
2752
|
+
assert(!exists(marker), "collector must never execute report content");
|
|
2753
|
+
assert(fs.readFileSync(firstReport, "utf8") === firstContent && fs.readFileSync(firstOtherReport, "utf8") === firstOtherContent && fs.readFileSync(secondReport, "utf8") === secondContent, "collection must not modify reports");
|
|
2754
|
+
assert(fs.readFileSync(closedReport, "utf8") === closedContent && fs.readFileSync(fixedReport, "utf8") === fixedContent && fs.readFileSync(rerouteReport, "utf8") === rerouteContent, "lifecycle collection must preserve every project-owned report byte-for-byte");
|
|
2755
|
+
|
|
2756
|
+
writeFile(fixedReport, fixedContent.replace("last_verified_skill_version: 4.3.0", "last_verified_skill_version: 4.3.1"));
|
|
2757
|
+
let lifecycleCheck = JSON.parse(run("node", [cli, "feedback", "--projects", first, "--json"]).stdout);
|
|
2758
|
+
assert(lifecycleCheck.metadata.find(item => item.report_id === "ACSF-assets-20260718-fd5748e4")?.lifecycle === "regression-current", "a fixed signature reproduced on the fixed release must re-enter active triage as a regression");
|
|
2759
|
+
writeFile(fixedReport, fixedContent);
|
|
2760
|
+
|
|
2761
|
+
writeFile(firstOtherReport, firstOtherContent.replace("observed_skill_version: 4.3.1", "observed_skill_version: 4.2.8"));
|
|
2762
|
+
lifecycleCheck = JSON.parse(run("node", [cli, "feedback", "--projects", first, "--json"]).stdout);
|
|
2763
|
+
assert(lifecycleCheck.metadata.find(item => item.report_id === "ACSF-geesight-20260718-c35fa4e3")?.lifecycle === "recheck-due", "an unresolved v1 report from an older Skill version must require recheck");
|
|
2764
|
+
writeFile(firstOtherReport, firstOtherContent);
|
|
2765
|
+
|
|
2766
|
+
writeFile(secondReport, render("spoofed-project", "ACSF-xjmate-20260718-b24f93d2", "PRIVATE-BODY-SECOND"));
|
|
2767
|
+
const spoofed = run("node", [cli, "feedback", "--projects", second, "--json"], { check: false });
|
|
2768
|
+
assert(spoofed.status !== 0 && spoofed.stderr.includes("project must equal") && spoofed.stderr.includes("project.name"), "collector must bind report project identity to effective project configuration");
|
|
2769
|
+
writeFile(secondReport, secondContent);
|
|
2770
|
+
|
|
2771
|
+
const secondOverlay = projectConfigPath(second);
|
|
2772
|
+
const secondOverlayContent = fs.readFileSync(secondOverlay);
|
|
2773
|
+
const secondOverrides = readYamlConfig(secondOverlay).overrides;
|
|
2774
|
+
writeProjectConfig(second, {
|
|
2775
|
+
...secondOverrides,
|
|
2776
|
+
project: { ...(secondOverrides.project ?? {}), name: path.basename(first) },
|
|
2777
|
+
});
|
|
2778
|
+
writeFile(secondReport, render(path.basename(first), "ACSF-xjmate-20260718-b24f93d2", "PRIVATE-BODY-SECOND"));
|
|
2779
|
+
const duplicateIdentity = run("node", [cli, "feedback", "--projects", `${first},${second}`, "--json"], { check: false });
|
|
2780
|
+
assert(duplicateIdentity.status !== 0 && duplicateIdentity.stderr.includes("distinct") && duplicateIdentity.stderr.includes("project.name"), "collector must not count two roots declaring one effective project identity as cross-project evidence");
|
|
2781
|
+
fs.writeFileSync(secondOverlay, secondOverlayContent);
|
|
2782
|
+
writeFile(secondReport, secondContent);
|
|
2783
|
+
|
|
2784
|
+
const firstOverlay = projectConfigPath(first);
|
|
2785
|
+
const firstOverlayContent = fs.readFileSync(firstOverlay);
|
|
2786
|
+
fs.writeFileSync(firstOverlay, Buffer.alloc(128 * 1024 + 1, "a"));
|
|
2787
|
+
const oversizedConfig = run("node", [cli, "feedback", "--projects", first, "--json"], { check: false });
|
|
2788
|
+
assert(oversizedConfig.status !== 0 && oversizedConfig.stderr.includes("size limit"), "collector must bound project overlay reads");
|
|
2789
|
+
fs.writeFileSync(firstOverlay, firstOverlayContent);
|
|
2790
|
+
|
|
2791
|
+
const implicit = run("node", [cli, "feedback", first, "--json"], { check: false });
|
|
2792
|
+
assert(implicit.status !== 0 && implicit.stderr.includes("requires explicit --projects"), "feedback collection must reject implicit or positional project scope");
|
|
2793
|
+
|
|
2794
|
+
if (process.platform !== "win32") {
|
|
2795
|
+
const linked = path.join(first, "docs", "skill-feedback", "reports", "2026-07-18-linked-report-deadbeef.md");
|
|
2796
|
+
fs.symlinkSync(secondReport, linked);
|
|
2797
|
+
const unsafe = run("node", [cli, "feedback", "--projects", first, "--json"], { check: false });
|
|
2798
|
+
assert(unsafe.status !== 0 && unsafe.stderr.includes("regular non-symlink file"), "collector must reject feedback symlinks without following them");
|
|
2799
|
+
|
|
2800
|
+
fs.rmSync(path.join(first, "docs", "skill-feedback"), { recursive: true, force: true });
|
|
2801
|
+
const externalFeedback = tmpdir("feedback-collector-parent-external");
|
|
2802
|
+
fs.mkdirSync(path.join(externalFeedback, "reports"), { recursive: true });
|
|
2803
|
+
writeFile(path.join(externalFeedback, "reports", path.basename(firstReport)), firstContent);
|
|
2804
|
+
fs.symlinkSync(externalFeedback, path.join(first, "docs", "skill-feedback"));
|
|
2805
|
+
const unsafeParent = run("node", [cli, "feedback", "--projects", first, "--json"], { check: false });
|
|
2806
|
+
assert(unsafeParent.status !== 0 && unsafeParent.stderr.includes("real directory"), "collector must reject a symlink in the feedback parent chain");
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
|
|
1343
2810
|
function testReleaseVersionMarkersStayInSync() {
|
|
1344
|
-
const expected = "4.
|
|
2811
|
+
const expected = "4.3.1";
|
|
1345
2812
|
const pkg = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8"));
|
|
1346
2813
|
const lock = JSON.parse(fs.readFileSync(path.join(repoRoot, "package-lock.json"), "utf8"));
|
|
1347
2814
|
const policy = JSON.parse(fs.readFileSync(
|
|
1348
2815
|
path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "workflow-migrations-v1.json"),
|
|
1349
2816
|
"utf8",
|
|
1350
2817
|
));
|
|
1351
|
-
assert(pkg.version === expected, "package version must match the 4.
|
|
2818
|
+
assert(pkg.version === expected, "package version must match the 4.3.1 release");
|
|
1352
2819
|
assert(lock.version === expected && lock.packages[""].version === expected, "package-lock versions must match");
|
|
1353
2820
|
assert(policy.managed_versions.engineering === expected && policy.managed_versions.agents === expected, "managed workflow versions must match");
|
|
1354
2821
|
const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, "cli", "assets", "managed-install.json"), "utf8"));
|
|
1355
2822
|
assert(manifest.skill_version === expected && manifest.schema_version === 1, "managed install manifest version/schema must match");
|
|
1356
2823
|
assert(manifest.entries.every(entry => entry.version === expected && /^[0-9a-f]{64}$/.test(entry.sha256)), "managed install entries must carry release hashes and versions");
|
|
2824
|
+
assert(manifest.entries.find(entry => entry.path === "docs/ENGINEERING.md")?.ownership === "exact", "managed ENGINEERING must be installed as an exact default layer");
|
|
1357
2825
|
assert(!manifest.entries.some(entry => entry.path === "docs/architecture/structure-standard.md"), "project structure standard must not be exact-managed");
|
|
1358
2826
|
assert(manifest.preserved.includes("docs/architecture/structure-standard.md"), "manifest must declare the project structure standard preserved");
|
|
2827
|
+
assert(manifest.entries.some(entry => entry.path === "docs/skill-feedback/README.md"), "feedback README must be exact-managed");
|
|
2828
|
+
assert(manifest.entries.some(entry => entry.path === "docs/skill-feedback/_TEMPLATE-SKILL-FEEDBACK.md"), "feedback template must be exact-managed");
|
|
2829
|
+
assert(manifest.entries.some(entry => entry.path === ".agents/skills/auto-coding-skill/data/policies/feedback-resolutions-v1.json"), "feedback resolution catalog must be exact-managed");
|
|
2830
|
+
assert(manifest.preserved.includes("docs/skill-feedback/reports/*.md"), "manifest must declare project feedback reports preserved");
|
|
2831
|
+
assert(!manifest.managed_namespaces.some(item => item.path === "docs/skill-feedback"), "project feedback reports must stay outside managed namespaces");
|
|
2832
|
+
assert(manifest.preserved.includes("docs/project/auto-coding-skill.yaml"), "manifest must declare the project configuration overlay preserved");
|
|
2833
|
+
assert(!manifest.entries.some(entry => entry.path === "docs/project/auto-coding-skill.yaml"), "project configuration overlay must never be exact-managed");
|
|
2834
|
+
assert(!manifest.managed_namespaces.some(item => item.path === "docs/project"), "project configuration overlay must stay outside managed namespaces");
|
|
2835
|
+
for (const root of ["architecture", "bugs", "deployment", "design", "interfaces", "project", "reviews", "testing"]) {
|
|
2836
|
+
assert(manifest.preserved.includes(`docs/${root}/** (except exact-managed entries)`), `manifest must preserve recursive project-owned ${root} assets`);
|
|
2837
|
+
}
|
|
2838
|
+
const resolutionCatalog = JSON.parse(fs.readFileSync(
|
|
2839
|
+
path.join(repoRoot, "src", "auto-coding-skill", "data", "policies", "feedback-resolutions-v1.json"),
|
|
2840
|
+
"utf8",
|
|
2841
|
+
));
|
|
2842
|
+
assert(resolutionCatalog.schema === "auto-coding-skill-feedback-resolutions/v1", "feedback resolution catalog schema must be stable");
|
|
2843
|
+
const resolutionSignatures = resolutionCatalog.entries.map(item => item.signature);
|
|
2844
|
+
assert(JSON.stringify(resolutionSignatures) === JSON.stringify([...new Set(resolutionSignatures)].sort()), "feedback resolution signatures must be unique and sorted");
|
|
2845
|
+
assert(resolutionCatalog.entries.every(item => /^\d+\.\d+\.\d+$/.test(item.effective_skill_version)), "feedback resolution releases must be stable SemVer");
|
|
1359
2846
|
const publishWorkflow = fs.readFileSync(path.join(repoRoot, ".github", "workflows", "npm-publish.yml"), "utf8");
|
|
1360
2847
|
const runtimeRequirements = fs.readFileSync(path.join(repoRoot, "src", "auto-coding-skill", "requirements.txt"), "utf8");
|
|
1361
2848
|
assert(publishWorkflow.includes("tags:\n - \"v*\""), "npm publish must run from version tag pushes");
|
|
@@ -1380,42 +2867,68 @@ function testProtocolResponsibilitiesStaySeparated() {
|
|
|
1380
2867
|
const agents = fs.readFileSync(path.join(repoRoot, "src", "auto-coding-skill", "data", "templates", "bridges", "AGENTS.md"), "utf8");
|
|
1381
2868
|
const engineering = fs.readFileSync(path.join(repoRoot, "src", "auto-coding-skill", "data", "templates", "ENGINEERING.md"), "utf8");
|
|
1382
2869
|
const totalLines = [skill, agents, engineering].reduce((sum, text) => sum + text.split(/\r?\n/).length, 0);
|
|
1383
|
-
|
|
2870
|
+
// The project-overlay ownership boundary adds a small, measured protocol
|
|
2871
|
+
// contract without adding another workflow document.
|
|
2872
|
+
assert(totalLines <= 370, `shared protocol context budget exceeded: ${totalLines} lines`);
|
|
1384
2873
|
assert(agents.includes("## Minimum mechanism budget") && agents.includes("## Bounded real validation"), "AGENTS must remain the behavioral protocol");
|
|
1385
2874
|
assert(skill.includes("## Select the minimum mechanism set") && !skill.includes("## Authority"), "SKILL must remain invocation guidance");
|
|
1386
2875
|
assert(engineering.includes("The frontmatter contract is:") && !engineering.includes("## Git and parallel work"), "ENGINEERING must remain project configuration/facts");
|
|
1387
|
-
assert(engineering.includes("
|
|
2876
|
+
assert(engineering.includes("docs/project/auto-coding-skill.yaml") && engineering.includes("project overlay"), "ENGINEERING must direct project specialization to the preserved overlay");
|
|
2877
|
+
assert(engineering.includes("owns this document byte-for-byte"), "ENGINEERING must identify itself as the managed default layer");
|
|
1388
2878
|
assert(!engineering.includes("advisory architecture and no-new-debt policy"), "ENGINEERING policy summary must not hard-code template defaults");
|
|
1389
2879
|
}
|
|
1390
2880
|
|
|
1391
2881
|
testInitFullyConvergesExistingProject();
|
|
1392
2882
|
testStructureBlockWarningsDefaultsPreserveAndConverge();
|
|
2883
|
+
testProjectDocumentationSpecialFilesFailBeforeWrites();
|
|
1393
2884
|
testManagedPolicySummaryPreservesProjectConfiguration();
|
|
1394
2885
|
testInitRejectsMissingPythonRuntimeBeforeWrites();
|
|
1395
2886
|
testDestVariants();
|
|
1396
2887
|
testLauncherFallsBackToGlobalRuntime();
|
|
1397
2888
|
testMinimalInitConvergesWithinBudget();
|
|
2889
|
+
testSkillFeedbackTemplatesAndReportsSurviveSync();
|
|
1398
2890
|
testStatusRejectsLegacyIsolation();
|
|
1399
2891
|
testStatusRejectsLegacyGateEscalation();
|
|
1400
2892
|
testStatusAcceptsValidIndentlessYamlRoutes();
|
|
1401
2893
|
testOrdinaryNodeTestIsNotPromotedToAutomaticGate();
|
|
1402
2894
|
testAccessPasswordsAreRequiredButNeverPrintedByStatus();
|
|
2895
|
+
testProjectConfigOverlayMigratesLegacyEngineeringAndStaysByteStable();
|
|
2896
|
+
testProjectConfigOverlayMergeKeepsExplicitFalseZeroEmptyAndList();
|
|
2897
|
+
testOversizedLegacyMigrationFailsBeforeCreatingAnInvalidOverlay();
|
|
2898
|
+
testInvalidProjectConfigOverlayFailsBeforeAnyWrites();
|
|
2899
|
+
testStatusRejectsManagedAgentSymlinksWithoutLeakingExternalContent();
|
|
2900
|
+
testMultiProjectSyncRejectsManagedTargetSymlinksBeforeAnyProjectWrite();
|
|
2901
|
+
testTamperedInstalledDefaultRejectsInitAndSyncWithoutWrites();
|
|
2902
|
+
testExistingOverlayConflictRejectsInitAndSyncWithoutWrites();
|
|
2903
|
+
testExistingOverlayLegacyDeletionRejectsInitAndSyncWithoutWrites();
|
|
2904
|
+
testLiveInstallTransactionRejectsSecondInstallerWithoutWrites();
|
|
2905
|
+
testStagedRuntimeTamperingIsRejectedBeforeExecution();
|
|
2906
|
+
testInterruptedStagedInstallRecoversForInitAndSync();
|
|
2907
|
+
testArchiveFallbackCollisionsNeverLosePreviousContent();
|
|
2908
|
+
testProjectMutationAndInstallSwitchRejectParentSwap();
|
|
2909
|
+
testNoChangeLightGateRejectsInvalidEffectiveContracts();
|
|
2910
|
+
testStatusRejectsInvalidStructureEnforcementFromDoctorContract();
|
|
2911
|
+
testProjectConfigOverlayIsHighRiskAndReviewRequired();
|
|
2912
|
+
testStatusAndFeedbackUseEffectiveProjectConfigWithoutLeakingAccess();
|
|
1403
2913
|
testManagedAgentModelsInheritAndOverridesSurvive();
|
|
1404
2914
|
testForcePreservesCustomAgentsAndModelOverrides();
|
|
1405
2915
|
testInvalidManagedAgentModelsFailStatusAndAreDroppedOnSync();
|
|
1406
2916
|
testModelTextInsideInstructionsIsNotPromotedToOverride();
|
|
1407
2917
|
testCommandSpecificArgumentsAreRejectedBeforeWrites();
|
|
1408
2918
|
testBridgeIsGeneric();
|
|
1409
|
-
|
|
2919
|
+
testSyncCleansAllManagedSkillExtras();
|
|
1410
2920
|
testOptionalDocsAndLegacyToolsDoNotCauseDrift();
|
|
1411
2921
|
testOptionalScaffoldIsOnDemandAndIdempotent();
|
|
1412
2922
|
testTestingScaffoldMatchesCheckMatrixSchema();
|
|
1413
2923
|
testReviewScaffoldLeavesBaselineGenerationToBaselineCommand();
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
2924
|
+
testBaselineUpdateConfigWritesOnlyProjectOverlay();
|
|
2925
|
+
testSyncUsesPackagedAssetsAndIgnoresRetiredTemplates();
|
|
2926
|
+
testInitInitializesNewEngineeringDefaults();
|
|
2927
|
+
testInitMigratesLegacyAutomaticGateToFastDefault();
|
|
1417
2928
|
testRemovedVerificationFlagsFailFast();
|
|
1418
|
-
|
|
2929
|
+
testInstallBootstrapsRuntimeRequiredByLauncher();
|
|
2930
|
+
testCliInstallArchivesFeedbackTemplatesAndPreservesReports();
|
|
2931
|
+
testLegacyUpgradeWriteFailsWithoutAnyWrites();
|
|
1419
2932
|
testLedgerArchiveRecognizesSettledStatuses();
|
|
1420
2933
|
testLedgerArchiveUpdatesExistingPeriodIndex();
|
|
1421
2934
|
testManagedEngineeringInitIsAuthoritativeAndIdempotent();
|
|
@@ -1429,6 +2942,7 @@ testUnknownWorkflowConflictFailsWholeBatchBeforeWrites();
|
|
|
1429
2942
|
testEngineeringMarkerBoundaryIsNormalized();
|
|
1430
2943
|
testEngineeringFrameworkRejectsAnyNonCanonicalWorkflowText();
|
|
1431
2944
|
testManagedInstallIntegrityIsBoundedAndRepairable();
|
|
2945
|
+
testSkillFeedbackCollectionIsBoundedReadOnlyAndMetadataOnly();
|
|
1432
2946
|
testReleaseVersionMarkersStayInSync();
|
|
1433
2947
|
testProtocolResponsibilitiesStaySeparated();
|
|
1434
2948
|
|