@aviaratech/ai-delivery 0.3.42 → 0.3.44
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 +2 -2
- package/dist/agentReadiness.test.js +27 -0
- package/dist/agentReadiness.test.js.map +2 -2
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +2 -2
- package/dist/contributorChecks.test.js +4 -1
- package/dist/contributorChecks.test.js.map +2 -2
- package/dist/currentConsumer.test.js +3 -2
- package/dist/currentConsumer.test.js.map +2 -2
- package/dist/currentTrackingScenario.test.js +3 -2
- package/dist/currentTrackingScenario.test.js.map +2 -2
- package/dist/directoryIndependent.test.js +22 -3
- package/dist/directoryIndependent.test.js.map +3 -3
- package/dist/dispatch.js.map +2 -2
- package/dist/fixtures/builderReady.d.ts +84 -0
- package/dist/fixtures/builderReady.js +58 -0
- package/dist/fixtures/builderReady.js.map +7 -0
- package/dist/fixtures/inertTarget.d.ts +82 -0
- package/dist/fixtures/inertTarget.js +25 -15
- package/dist/fixtures/inertTarget.js.map +2 -2
- package/dist/fixtures/issue63.d.ts +99 -0
- package/dist/fixtures/issue63.js +21 -2
- package/dist/fixtures/issue63.js.map +2 -2
- package/dist/issue.d.ts +23 -2
- package/dist/issue.js +154 -28
- package/dist/issue.js.map +2 -2
- package/dist/issue63Routes.test.js +3 -3
- package/dist/issue63Routes.test.js.map +2 -2
- package/dist/issueBlockerGuard.test.js +16 -5
- package/dist/issueBlockerGuard.test.js.map +2 -2
- package/dist/issueContract.d.ts +247 -2
- package/dist/issueContract.js +188 -24
- package/dist/issueContract.js.map +2 -2
- package/dist/issueContract.test.d.ts +21 -0
- package/dist/issueContract.test.js +276 -17
- package/dist/issueContract.test.js.map +2 -2
- package/dist/issueDates.test.js +5 -6
- package/dist/issueDates.test.js.map +2 -2
- package/dist/issueInfoReadback.test.js +64 -0
- package/dist/issueInfoReadback.test.js.map +2 -2
- package/dist/issueIntake.test.js +190 -35
- package/dist/issueIntake.test.js.map +2 -2
- package/dist/issueJournal.d.ts +13 -9
- package/dist/issueJournal.js +14 -10
- package/dist/issueJournal.js.map +2 -2
- package/dist/issueJournal.test.js +11 -8
- package/dist/issueJournal.test.js.map +2 -2
- package/dist/issueTracking.test.js +135 -2
- package/dist/issueTracking.test.js.map +3 -3
- package/dist/issueWriteRecovery.test.js +12 -12
- package/dist/issueWriteRecovery.test.js.map +2 -2
- package/dist/mcp/index.js +10 -3
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/tools.d.ts +186 -27
- package/dist/mcp/tools.js +25 -7
- package/dist/mcp/tools.js.map +2 -2
- package/dist/pluginPackaging.test.js +6 -3
- package/dist/pluginPackaging.test.js.map +2 -2
- package/dist/readView.d.ts +3 -0
- package/dist/readView.js +1 -1
- package/dist/readView.js.map +2 -2
- package/dist/releaseReconciliation.test.js +20 -6
- package/dist/releaseReconciliation.test.js.map +2 -2
- package/dist/releaseWorkflow.test.js +2 -2
- package/dist/releaseWorkflow.test.js.map +2 -2
- package/dist/review.d.ts +8 -0
- package/dist/review.js +30 -2
- package/dist/review.js.map +2 -2
- package/dist/review.test.js +64 -1
- package/dist/review.test.js.map +2 -2
- package/dist/services/agentReadinessService.d.ts +2 -1
- package/dist/services/agentReadinessService.js +6 -0
- package/dist/services/agentReadinessService.js.map +2 -2
- package/dist/stdoutRegression.test.js +27 -15
- package/dist/stdoutRegression.test.js.map +2 -2
- package/dist/targetRepositoryExecution.test.js +11 -3
- package/dist/targetRepositoryExecution.test.js.map +2 -2
- package/package.json +1 -1
- package/plugins/ai-delivery/.claude-plugin/plugin.json +2 -2
- package/plugins/ai-delivery/plugin.json +1 -1
- package/plugins/ai-delivery/runtime/dist/cli.js +156 -124
- package/plugins/ai-delivery/runtime/package.json +1 -1
- package/plugins/ai-delivery/skills/intake-create/SKILL.md +1 -11
- package/plugins/ai-delivery/skills/ticket-design/SKILL.md +30 -0
|
@@ -12,9 +12,11 @@ import {
|
|
|
12
12
|
renderIssueBody,
|
|
13
13
|
parseIssueBody,
|
|
14
14
|
validateIssue,
|
|
15
|
-
issueWarnings
|
|
15
|
+
issueWarnings,
|
|
16
|
+
IssueValidationError
|
|
16
17
|
} from "./issueContract.js";
|
|
17
18
|
import { AI_DELIVERY_MCP_TOOLS } from "./mcp/index.js";
|
|
19
|
+
import { builderReady } from "./fixtures/builderReady.js";
|
|
18
20
|
const validIssue = () => IssueFields.parse({
|
|
19
21
|
title: "Reject invalid widget identifiers before persistence",
|
|
20
22
|
issueType: "Feature",
|
|
@@ -35,24 +37,25 @@ const validIssue = () => IssueFields.parse({
|
|
|
35
37
|
evidence: ["A portable synthetic identifier fixture."]
|
|
36
38
|
}
|
|
37
39
|
});
|
|
38
|
-
test("
|
|
39
|
-
for (const [
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[4500, true]
|
|
40
|
+
test("body.length counts prose words in problem, outcome and criteria and warns strictly above 300", () => {
|
|
41
|
+
for (const [words, warning] of [
|
|
42
|
+
[299, false],
|
|
43
|
+
[300, false],
|
|
44
|
+
[301, true]
|
|
44
45
|
]) {
|
|
45
46
|
const issue = validIssue();
|
|
46
|
-
issue.problem = "";
|
|
47
|
-
|
|
48
|
-
issue.
|
|
49
|
-
assert.equal(prefix().length, length);
|
|
47
|
+
issue.problem = Array.from({ length: words - 2 }, () => "w").join(" ");
|
|
48
|
+
issue.outcome = "one";
|
|
49
|
+
issue.acceptanceCriteria[0].behavior = "two";
|
|
50
50
|
assert.equal(
|
|
51
51
|
issueWarnings(issue).some((item) => item.code === "body.length"),
|
|
52
52
|
warning,
|
|
53
|
-
String(
|
|
53
|
+
String(words)
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
|
+
const structured = validIssue();
|
|
57
|
+
structured.context.evidence.push("A".repeat(5e3));
|
|
58
|
+
assert.ok(!issueWarnings(structured).some((item) => item.code === "body.length"));
|
|
56
59
|
});
|
|
57
60
|
test("multiline criteria keep nested bullets and verification attached to their own checkbox", () => {
|
|
58
61
|
const issue = validIssue();
|
|
@@ -350,17 +353,16 @@ const warningCases = [
|
|
|
350
353
|
"context"
|
|
351
354
|
],
|
|
352
355
|
[
|
|
353
|
-
"
|
|
356
|
+
"local path",
|
|
354
357
|
(i) => {
|
|
355
|
-
i.context.evidence = ["/
|
|
356
|
-
i.acceptanceCriteria[0].verifiedBy = "/synthetic/machine/test.ts";
|
|
358
|
+
i.context.evidence = ["~/runs/READOUT.md"];
|
|
357
359
|
},
|
|
358
|
-
"local-
|
|
360
|
+
"local-path"
|
|
359
361
|
],
|
|
360
362
|
[
|
|
361
363
|
"long body",
|
|
362
364
|
(i) => {
|
|
363
|
-
i.
|
|
365
|
+
i.problem = Array.from({ length: 301 }, () => "word").join(" ");
|
|
364
366
|
},
|
|
365
367
|
"body.length"
|
|
366
368
|
]
|
|
@@ -372,6 +374,263 @@ for (const [name, mutate, code] of warningCases)
|
|
|
372
374
|
assert.equal(validateIssue(issue).failures.length, 0);
|
|
373
375
|
assert.ok(issueWarnings(issue).some((w) => w.code === code));
|
|
374
376
|
});
|
|
377
|
+
const builderFields = {
|
|
378
|
+
builder: { tier: "frontier", reason: "state-machine" },
|
|
379
|
+
extends: ["src/widget.ts saveWidget (the one widget write path)"],
|
|
380
|
+
decisions: ["Valid id: ^w-[0-9a-f]{8}$. Refuse with InvalidWidgetId."],
|
|
381
|
+
surface: [
|
|
382
|
+
{
|
|
383
|
+
path: "src/widget.ts",
|
|
384
|
+
change: "edit",
|
|
385
|
+
signatures: ["export function saveWidget(w: Widget): void"]
|
|
386
|
+
},
|
|
387
|
+
{ path: "src/old.ts", change: "delete" }
|
|
388
|
+
],
|
|
389
|
+
fences: ["src/store.ts (storage owner)"],
|
|
390
|
+
proof: ["npx vitest run src/widget.test.ts"]
|
|
391
|
+
};
|
|
392
|
+
test("every builder-ready field renders in order and parses back equal", () => {
|
|
393
|
+
const issue = IssueFields.parse({
|
|
394
|
+
...validIssue(),
|
|
395
|
+
...builderFields,
|
|
396
|
+
acceptanceCriteria: [
|
|
397
|
+
{
|
|
398
|
+
behavior: "An invalid widget identifier returns an error without a persistence call.",
|
|
399
|
+
verifiedBy: "src/widget.test.ts",
|
|
400
|
+
examples: [
|
|
401
|
+
{ input: "id 'w-0a1b2c3d'", expected: "one store.put" },
|
|
402
|
+
{
|
|
403
|
+
input: "id ' w-0A1B2C3D'",
|
|
404
|
+
expected: "InvalidWidgetId",
|
|
405
|
+
failure: true
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
});
|
|
411
|
+
const body = renderIssueBody(issue);
|
|
412
|
+
const at = (heading) => body.indexOf(`
|
|
413
|
+
## ${heading}
|
|
414
|
+
`);
|
|
415
|
+
assert.ok(at("Outcome") < at("Builder") && at("Builder") < at("Extends") && at("Extends") < at("Decisions"));
|
|
416
|
+
assert.ok(at("Decisions") < at("Acceptance criteria") && at("Acceptance criteria") < at("Surface"));
|
|
417
|
+
assert.ok(at("Surface") < at("Fences") && at("Fences") < at("Proof") && at("Proof") < at("Out of scope"));
|
|
418
|
+
assert.ok(body.includes("## Builder\n\nfrontier: state-machine\n"));
|
|
419
|
+
assert.ok(
|
|
420
|
+
body.includes(
|
|
421
|
+
" Example: id 'w-0a1b2c3d' \u2192 one store.put\n Example: id ' w-0A1B2C3D' \u2192 InvalidWidgetId (failure)\n"
|
|
422
|
+
)
|
|
423
|
+
);
|
|
424
|
+
assert.ok(
|
|
425
|
+
body.includes("- edit `src/widget.ts`\n export function saveWidget(w: Widget): void\n- delete `src/old.ts`\n")
|
|
426
|
+
);
|
|
427
|
+
const parsed = parseIssueBody(body, { title: issue.title });
|
|
428
|
+
assert.equal(parsed.legacy, false);
|
|
429
|
+
assert.deepEqual(parsed.issue, issue);
|
|
430
|
+
assert.deepEqual(validateIssue(issue).failures, []);
|
|
431
|
+
});
|
|
432
|
+
test("bodies without builder-ready fields re-render byte for byte with no new data keys", () => {
|
|
433
|
+
const body = renderIssueBody(validIssue());
|
|
434
|
+
assert.ok(!/\n## (?:Builder|Extends|Decisions|Surface|Fences|Proof)\n/u.test(body));
|
|
435
|
+
const data = body.split("<!-- ai-delivery:issue-data@1 ")[1];
|
|
436
|
+
for (const key of ["builder", "extends", "decisions", "surface", "fences", "proof", "examples"])
|
|
437
|
+
assert.ok(!data.includes(`"${key}"`), key);
|
|
438
|
+
const parsed = parseIssueBody(body, { title: validIssue().title });
|
|
439
|
+
assert.equal(renderIssueBody(parsed.issue), body);
|
|
440
|
+
assert.equal(
|
|
441
|
+
body.split("\n\n## Acceptance criteria\n\n")[1].split("\n\n## Out of scope")[0],
|
|
442
|
+
"- [ ] An invalid widget identifier returns an error without a persistence call.\n Verified by: A mocked persistence regression asserts the error and zero calls."
|
|
443
|
+
);
|
|
444
|
+
});
|
|
445
|
+
test("malformed builder-ready fields fail at their own field", () => {
|
|
446
|
+
const fails = (extra, field) => {
|
|
447
|
+
const result = validateIssue({ ...validIssue(), ...extra }, false);
|
|
448
|
+
assert.ok(
|
|
449
|
+
result.failures.some((failure) => failure.field.startsWith(field)),
|
|
450
|
+
field
|
|
451
|
+
);
|
|
452
|
+
};
|
|
453
|
+
fails({ builder: { tier: "frontier" } }, "builder");
|
|
454
|
+
fails({ builder: { tier: "frontier", reason: "because" } }, "builder");
|
|
455
|
+
fails({ builder: { tier: "standard", reason: "state-machine" } }, "builder");
|
|
456
|
+
fails({ surface: [{ path: "src/a.ts", change: "move" }] }, "surface");
|
|
457
|
+
});
|
|
458
|
+
test("create and update tools and the portable Ready schema expose the six top-level keys", () => {
|
|
459
|
+
const shape = z.toJSONSchema(IssueWriteSchema).properties;
|
|
460
|
+
for (const tool of ["issue_create", "issue_update"]) {
|
|
461
|
+
const schema = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === tool).inputSchema;
|
|
462
|
+
for (const key of ["builder", "extends", "decisions", "surface", "fences", "proof"])
|
|
463
|
+
assert.deepEqual(z.toJSONSchema(schema).properties?.[key], shape?.[key], `${tool} ${key}`);
|
|
464
|
+
}
|
|
465
|
+
for (const key of ["builder", "extends", "decisions", "surface", "fences", "proof"])
|
|
466
|
+
assert.ok(key in ISSUE_JSON_SCHEMAS.ready.properties, key);
|
|
467
|
+
assert.ok(!ISSUE_JSON_SCHEMAS.ready.required?.includes("builder"));
|
|
468
|
+
});
|
|
469
|
+
test("builderReady has no failures and no warnings", () => {
|
|
470
|
+
assert.deepEqual(validateIssue(builderReady()).failures, []);
|
|
471
|
+
assert.deepEqual(issueWarnings(builderReady()), []);
|
|
472
|
+
});
|
|
473
|
+
const refusalCases = [
|
|
474
|
+
["no decisions", (i) => void (i.decisions = []), "decisions"],
|
|
475
|
+
["blank decision", (i) => void (i.decisions = [" "]), "decisions"],
|
|
476
|
+
["no surface", (i) => void (i.surface = []), "surface"],
|
|
477
|
+
["blank surface path", (i) => void (i.surface = [{ path: " ", change: "edit" }]), "surface"],
|
|
478
|
+
[
|
|
479
|
+
"no examples",
|
|
480
|
+
(i) => {
|
|
481
|
+
delete i.acceptanceCriteria[0].examples;
|
|
482
|
+
},
|
|
483
|
+
"examples"
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
"no failure example",
|
|
487
|
+
(i) => {
|
|
488
|
+
i.acceptanceCriteria[0].examples = [{ input: "a", expected: "b" }];
|
|
489
|
+
},
|
|
490
|
+
"examples.failure"
|
|
491
|
+
],
|
|
492
|
+
["no proof", (i) => void (i.proof = []), "proof"]
|
|
493
|
+
];
|
|
494
|
+
for (const [name, mutate, code] of refusalCases)
|
|
495
|
+
test("Ready with builder refuses " + name, () => {
|
|
496
|
+
const issue = builderReady();
|
|
497
|
+
mutate(issue);
|
|
498
|
+
const failures = validateIssue(issue).failures;
|
|
499
|
+
assert.ok(
|
|
500
|
+
failures.some((f) => f.code === code && f.fixHint.endsWith("See ai-delivery:ticket-design.")),
|
|
501
|
+
code
|
|
502
|
+
);
|
|
503
|
+
});
|
|
504
|
+
test("builder fields are required only with builder, and never for epics or drafts", () => {
|
|
505
|
+
assert.deepEqual(validateIssue(validIssue()).failures, []);
|
|
506
|
+
const bare = { ...builderReady(), decisions: void 0, surface: void 0, proof: void 0, epic: true };
|
|
507
|
+
assert.deepEqual(validateIssue(bare).failures, []);
|
|
508
|
+
assert.deepEqual(validateIssue({ ...bare, epic: void 0, draft: true }, false).failures, []);
|
|
509
|
+
});
|
|
510
|
+
test("requireBuilder refuses a Ready non-epic issue without builder and offers draft", () => {
|
|
511
|
+
assert.throws(
|
|
512
|
+
() => requireIssue(validIssue(), { requireBuilder: true }),
|
|
513
|
+
(error) => error instanceof IssueValidationError && error.failures.some((f) => f.code === "builder.missing" && f.fixHint.includes("draft: true"))
|
|
514
|
+
);
|
|
515
|
+
assert.ok(requireIssue(validIssue()));
|
|
516
|
+
assert.ok(requireIssue(builderReady(), { requireBuilder: true }));
|
|
517
|
+
assert.ok(requireIssue({ ...validIssue(), draft: true }, { requireBuilder: true }));
|
|
518
|
+
assert.ok(requireIssue({ ...validIssue(), epic: true }, { requireBuilder: true }));
|
|
519
|
+
});
|
|
520
|
+
const judgmentCases = [
|
|
521
|
+
["8 points", (i) => void (i.points = 8), "size.points"],
|
|
522
|
+
[
|
|
523
|
+
"seven surface paths",
|
|
524
|
+
(i) => void (i.surface = Array.from({ length: 7 }, (_, n) => ({ path: `src/a${n}.ts`, change: "delete" }))),
|
|
525
|
+
"size.surface"
|
|
526
|
+
],
|
|
527
|
+
[
|
|
528
|
+
"a criterion without examples",
|
|
529
|
+
(i) => {
|
|
530
|
+
i.acceptanceCriteria.push({ behavior: "saveWidget stores a valid id", verifiedBy: "src/widget.test.ts" });
|
|
531
|
+
},
|
|
532
|
+
"examples.ac"
|
|
533
|
+
],
|
|
534
|
+
[
|
|
535
|
+
"a code path without signatures",
|
|
536
|
+
(i) => void (i.surface = [{ path: "src/widget.ts", change: "edit" }]),
|
|
537
|
+
"surface.signature"
|
|
538
|
+
],
|
|
539
|
+
["no fences", (i) => void (i.fences = []), "fences"],
|
|
540
|
+
["blank extends", (i) => void (i.extends = [" "]), "extends"]
|
|
541
|
+
];
|
|
542
|
+
for (const [name, mutate, code] of judgmentCases)
|
|
543
|
+
test("Ready with builder warns, never refuses, for " + name, () => {
|
|
544
|
+
const issue = builderReady();
|
|
545
|
+
mutate(issue);
|
|
546
|
+
assert.deepEqual(validateIssue(issue).failures, []);
|
|
547
|
+
assert.ok(
|
|
548
|
+
issueWarnings(issue).some((w) => w.code === code && w.fixHint.endsWith("See ai-delivery:ticket-design."))
|
|
549
|
+
);
|
|
550
|
+
});
|
|
551
|
+
test("surface.signature skips deleted paths, tests and non-code files", () => {
|
|
552
|
+
const issue = builderReady();
|
|
553
|
+
issue.surface = [
|
|
554
|
+
{ path: "src/gone.ts", change: "delete" },
|
|
555
|
+
{ path: "src/widget.test.ts", change: "edit" },
|
|
556
|
+
{ path: "README.md", change: "edit" }
|
|
557
|
+
];
|
|
558
|
+
assert.ok(!issueWarnings(issue).some((w) => w.code === "surface.signature"));
|
|
559
|
+
});
|
|
560
|
+
test("a legacy Ready issue warns builder.unset and skips builder-only warnings; edge-case and context drop with builder", () => {
|
|
561
|
+
const codes = (issue) => issueWarnings(issue).map((w) => w.code);
|
|
562
|
+
assert.ok(codes(validIssue()).includes("builder.unset"));
|
|
563
|
+
assert.ok(!codes({ ...validIssue(), draft: true }).includes("builder.unset"));
|
|
564
|
+
assert.ok(!codes({ ...validIssue(), epic: true }).includes("builder.unset"));
|
|
565
|
+
assert.ok(!codes(validIssue()).some((code) => code.startsWith("size.") || code === "fences" || code === "extends"));
|
|
566
|
+
const noCopy = builderReady();
|
|
567
|
+
noCopy.acceptanceCriteria[0].behavior = "saveWidget stores valid ids";
|
|
568
|
+
noCopy.context = { components: [], files: [], evidence: [] };
|
|
569
|
+
assert.ok(!codes(noCopy).some((code) => code === "edge-case" || code === "context"));
|
|
570
|
+
});
|
|
571
|
+
test("an 85-character title refuses with its length", () => {
|
|
572
|
+
const failure = validateIssue({ ...validIssue(), title: "x".repeat(85) }).failures.find(
|
|
573
|
+
(f) => f.code === "title.length"
|
|
574
|
+
);
|
|
575
|
+
assert.equal(failure?.fixHint, "The title is 85 characters; shorten it to at most 80.");
|
|
576
|
+
});
|
|
577
|
+
test("the Ready write gate refuses missing Prior work, local paths and a contract over 400 words; other paths warn", () => {
|
|
578
|
+
const words = (n) => Array.from({ length: n }, () => "w").join(" ");
|
|
579
|
+
const gate = (value) => {
|
|
580
|
+
try {
|
|
581
|
+
requireIssue(value, { requireBuilder: true });
|
|
582
|
+
return [];
|
|
583
|
+
} catch (error) {
|
|
584
|
+
if (!(error instanceof IssueValidationError)) throw error;
|
|
585
|
+
return error.failures;
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const fit = { ...builderReady(), outcome: words(140) };
|
|
589
|
+
assert.deepEqual(gate(fit), []);
|
|
590
|
+
assert.deepEqual(issueWarnings(fit), []);
|
|
591
|
+
const prior = gate({ ...fit, priorWork: void 0 });
|
|
592
|
+
assert.deepEqual(
|
|
593
|
+
prior.map((f) => [f.code, f.fixHint]),
|
|
594
|
+
[
|
|
595
|
+
[
|
|
596
|
+
"priorWork",
|
|
597
|
+
"List each search you ran for earlier work on this question and what it found, or 'none found' with the searches."
|
|
598
|
+
]
|
|
599
|
+
]
|
|
600
|
+
);
|
|
601
|
+
const local = gate({ ...fit, context: { components: [], files: [], evidence: ["~/runs/READOUT.md"] } });
|
|
602
|
+
assert.deepEqual(
|
|
603
|
+
local.map((f) => f.fixHint),
|
|
604
|
+
[
|
|
605
|
+
"context.evidence.0 cites a local path (~/); put that evidence on the issue as a comment or artifact and link it instead."
|
|
606
|
+
]
|
|
607
|
+
);
|
|
608
|
+
const long = gate({ ...fit, outcome: words(390) });
|
|
609
|
+
assert.deepEqual(
|
|
610
|
+
long.map((f) => [f.code, f.fixHint]),
|
|
611
|
+
[
|
|
612
|
+
[
|
|
613
|
+
"contract-words",
|
|
614
|
+
"The contract (outcome, files, acceptance, tests, prior work) is 430 words; keep it to 400 and move evidence to a comment or artifact."
|
|
615
|
+
]
|
|
616
|
+
]
|
|
617
|
+
);
|
|
618
|
+
assert.ok(requireIssue({ ...validIssue(), epic: true }, { requireBuilder: true }));
|
|
619
|
+
assert.ok(requireIssue({ ...fit, draft: true, proof: [".local/operator/run.sh"] }, { requireBuilder: true }));
|
|
620
|
+
const existing = { ...fit, priorWork: void 0, outcome: words(800), proof: [".local/operator/run.sh"] };
|
|
621
|
+
assert.deepEqual(validateIssue(existing).failures, []);
|
|
622
|
+
assert.ok(requireIssue(existing));
|
|
623
|
+
assert.deepEqual(
|
|
624
|
+
gate(existing).map((f) => f.code),
|
|
625
|
+
["priorWork", "local-path", "contract-words"]
|
|
626
|
+
);
|
|
627
|
+
});
|
|
628
|
+
test("Prior work round-trips after Extends", () => {
|
|
629
|
+
const issue = IssueFields.parse({ ...builderReady(), priorWork: ["ai#3482: 250 ms floor", "none found"] });
|
|
630
|
+
const body = renderIssueBody(issue);
|
|
631
|
+
assert.ok(body.indexOf("\n## Extends\n") < body.indexOf("\n## Prior work\n"));
|
|
632
|
+
assert.deepEqual(parseIssueBody(body, { title: issue.title }).issue.priorWork, issue.priorWork);
|
|
633
|
+
});
|
|
375
634
|
export {
|
|
376
635
|
validIssue
|
|
377
636
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/issueContract.test.ts"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { test } from 'vitest';\nimport { z } from 'zod';\nimport {\n DraftIssue,\n ReadyIssue,\n IssueFields,\n IssueWriteSchema,\n ISSUE_JSON_SCHEMAS,\n ISSUE_BODY_MARKER,\n requireIssue,\n renderIssueBody,\n parseIssueBody,\n validateIssue,\n issueWarnings,\n} from './issueContract.js';\nimport { AI_DELIVERY_MCP_TOOLS } from './mcp/index.js';\n\nexport const validIssue = () =>\n IssueFields.parse({\n title: 'Reject invalid widget identifiers before persistence',\n issueType: 'Feature',\n points: 2,\n problem: 'Malformed identifiers currently reach persistence.',\n outcome: 'Widget writes reject malformed identifiers before persistence.',\n acceptanceCriteria: [\n {\n behavior: 'An invalid widget identifier returns an error without a persistence call.',\n verifiedBy: 'A mocked persistence regression asserts the error and zero calls.',\n },\n ],\n outOfScope: ['Changing the storage engine.'],\n openQuestions: [],\n context: {\n components: ['widget intake'],\n files: ['src/widget.ts'],\n evidence: ['A portable synthetic identifier fixture.'],\n },\n });\n\ntest('readable body length excludes embedded issue data and warns strictly above 4000', () => {\n for (const [length, warning] of [\n [3500, false],\n [4000, false],\n [4001, true],\n [4500, true],\n ] as const) {\n const issue = validIssue();\n issue.problem = '';\n const prefix = () => renderIssueBody(issue).split('<!-- ai-delivery:issue-data@1 ')[0]!;\n issue.problem = '<'.repeat(length - prefix().length);\n assert.equal(prefix().length, length);\n assert.equal(\n issueWarnings(issue).some((item) => item.code === 'body.length'),\n warning,\n String(length),\n );\n }\n});\n\ntest('multiline criteria keep nested bullets and verification attached to their own checkbox', () => {\n const issue = validIssue();\n issue.acceptanceCriteria = [\n {\n behavior: 'Reject malformed input:\\n- Empty input\\n - Whitespace only\\n- Invalid shape',\n verifiedBy: 'Regression cases:\\n- Empty and malformed',\n },\n { behavior: 'A valid input is stored once.', verifiedBy: 'One observed write.' },\n ];\n const actual = renderIssueBody(issue).split('## Acceptance criteria\\n\\n')[1]!.split('\\n\\n## Out of scope')[0];\n assert.equal(\n actual,\n '- [ ] Reject malformed input:\\n - Empty input\\n - Whitespace only\\n - Invalid shape\\n\\n Verified by: Regression cases:\\n - Empty and malformed\\n- [ ] A valid input is stored once.\\n Verified by: One observed write.',\n );\n});\n\ntest('MCP create/update fields derive from the canonical schema and patch omissions retain no defaults', () => {\n const create = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === 'issue_create')!;\n const update = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === 'issue_update')!;\n const shape = z.toJSONSchema(IssueWriteSchema).properties;\n for (const name of [\n 'acceptanceCriteria',\n 'context',\n 'outOfScope',\n 'openQuestions',\n 'problem',\n 'outcome',\n 'bug',\n 'draft',\n ]) {\n assert.deepEqual(z.toJSONSchema(create.inputSchema).properties?.[name], shape?.[name]);\n assert.deepEqual(z.toJSONSchema(update.inputSchema).properties?.[name], shape?.[name]);\n }\n assert.deepEqual(update.inputSchema.parse({ issueNumber: 17 }), { issueNumber: 17 });\n assert.ok('issueContract' in create);\n assert.deepEqual(\n create.issueContract,\n ISSUE_JSON_SCHEMAS,\n 'portable output is reachable through the existing packaged MCP export',\n );\n});\n\ntest('portable JSON Schema snapshot carries Ready bounds and distinguishes incomplete drafts', () => {\n const ready = ISSUE_JSON_SCHEMAS.ready;\n assert.deepEqual(\n {\n draft: ready.properties?.draft,\n points: ready.properties?.points,\n title: ready.properties?.title,\n openQuestions: ready.properties?.openQuestions,\n },\n {\n draft: { type: 'boolean', const: false, default: false },\n points: { type: 'integer', minimum: 1, maximum: 8 },\n title: { type: 'string', minLength: 10, maxLength: 80 },\n openQuestions: { default: [], type: 'array', items: { type: 'string' }, maxItems: 0 },\n },\n );\n assert.deepEqual(ready.anyOf, [\n { properties: { epic: { const: true } }, required: ['epic'] },\n { required: ['points'] },\n ]);\n assert.ok(!ISSUE_JSON_SCHEMAS.draft.required?.includes('points'));\n});\n\ntest('concrete domain wording remains Ready while generic completion claims fail', () => {\n for (const behavior of [\n 'The independently reviewed head SHA is sent as the merge guard.',\n 'A failed request leaves the Project Done column unchanged.',\n 'A verified token grants access only to its repository.',\n 'The adapter works with a missing local checkout and returns the selected repository.',\n ]) {\n const issue = validIssue();\n issue.acceptanceCriteria[0]!.behavior = behavior;\n assert.deepEqual(validateIssue(issue).failures, [], behavior);\n }\n for (const behavior of [\n 'The widget works correctly.',\n 'The change is reviewed.',\n 'The request is done.',\n 'The interface is user friendly.',\n ]) {\n const issue = validIssue();\n issue.acceptanceCriteria[0]!.behavior = behavior;\n assert.ok(\n validateIssue(issue).failures.some((f) => f.code === 'acceptance-criteria.vague'),\n behavior,\n );\n }\n});\n\ntest('canonical bodies round trip every typed field, multiline markup and comment delimiters', () => {\n const issue = validIssue();\n issue.context.evidence.push('Observed <!-- text -->\\n## nested heading\\n`code`');\n const body = renderIssueBody(issue);\n assert.ok(body.startsWith(ISSUE_BODY_MARKER + '\\n\\n## Status\\n\\nReady'));\n assert.deepEqual(parseIssueBody(body, { title: issue.title }).issue, issue);\n assert.equal(parseIssueBody(body, { title: issue.title }).legacy, false);\n assert.throws(\n () => parseIssueBody(body.replace('## Status\\n\\nReady', '## Status\\n\\nDraft'), { title: issue.title }),\n /body.canonical/u,\n );\n assert.throws(() => parseIssueBody(body, { title: 'Different native title' }), /body.canonical/u);\n});\n\ntest('lenient legacy conversion retains all bytes, portable verification and marker descriptions', () => {\n const body =\n '## Problem\\nA literal ' +\n ISSUE_BODY_MARKER +\n ' is documentation.\\n## Outcome\\nReject malformed identifiers.\\n## Acceptance Criteria\\n- [ ] Invalid identifiers return an error before persistence.\\n## Verification\\nRun the synthetic identifier tests.\\n## Out of scope\\n- Storage engine changes.\\n## Scope\\nsrc/missing-in-this-checkout.ts\\nUnclassified historical text.\\n';\n const parsed = parseIssueBody(body, { title: validIssue().title, points: 2, issueType: 'Feature' });\n assert.equal(parsed.legacy, true);\n assert.equal(parsed.issue.legacyBody, body);\n assert.equal(parsed.issue.acceptanceCriteria[0]?.verifiedBy, 'Run the synthetic identifier tests.');\n const ready = requireIssue(parsed.issue);\n assert.deepEqual(parseIssueBody(renderIssueBody(ready), { title: ready.title }).issue, ready);\n});\n\ntest('legacy conversion never fabricates missing verification or bug evidence', () => {\n const body =\n '## Problem\\nA failure.\\n## Outcome\\nReject invalid widgets.\\n## Acceptance Criteria\\n- [ ] Invalid widgets are rejected before persistence.\\n## Out of scope\\n- Storage changes.\\n';\n const parsed = parseIssueBody(body, { title: validIssue().title, points: 2, issueType: 'Bug' });\n const codes = validateIssue(parsed.issue).failures.map((f) => f.code);\n assert.ok(codes.includes('acceptance-criteria.fields'));\n assert.ok(codes.includes('bug.steps'));\n assert.ok(codes.includes('bug.environment'));\n});\n\nconst blockingCases: [string, (issue: ReturnType<typeof validIssue>) => void, string][] = [\n [\n 'Points13',\n (i) => {\n i.points = 13;\n },\n 'points',\n ],\n [\n 'Points0',\n (i) => {\n i.points = 0;\n },\n 'points',\n ],\n [\n 'Points9',\n (i) => {\n i.points = 9;\n },\n 'points',\n ],\n [\n 'missing behavior',\n (i) => {\n i.acceptanceCriteria[0]!.behavior = '';\n },\n 'acceptance-criteria.fields',\n ],\n [\n 'missing verifiedBy',\n (i) => {\n i.acceptanceCriteria[0]!.verifiedBy = '';\n },\n 'acceptance-criteria.fields',\n ],\n [\n 'vague AC',\n (i) => {\n i.acceptanceCriteria[0]!.behavior = 'The widget works correctly.';\n },\n 'acceptance-criteria.vague',\n ],\n [\n 'no non-goal',\n (i) => {\n i.outOfScope = [];\n },\n 'out-of-scope',\n ],\n [\n 'open question',\n (i) => {\n i.openQuestions = ['Choose the persistence behavior.'];\n },\n 'open-questions',\n ],\n [\n 'vague title',\n (i) => {\n i.title = 'Fix things';\n },\n 'title.specific',\n ],\n [\n 'long title',\n (i) => {\n i.title = 'x'.repeat(81);\n },\n 'title.length',\n ],\n [\n 'type prefix',\n (i) => {\n i.title = 'Bug: Reject invalid widget identifiers';\n },\n 'title.prefix',\n ],\n [\n 'bug fields',\n (i) => {\n i.issueType = 'Bug';\n },\n 'bug',\n ],\n [\n 'secret',\n (i) => {\n i.problem = 'A fixture contains ' + ['gh', 'p_'].join('') + 'A'.repeat(24);\n },\n 'secrets',\n ],\n];\nfor (const [name, mutate, code] of blockingCases)\n test('Ready blocks ' + name + ' with a field and actionable fix hint', () => {\n const issue = validIssue();\n mutate(issue);\n const failures = validateIssue(issue).failures;\n assert.ok(\n failures.some((f) => f.code === code),\n JSON.stringify(failures),\n );\n assert.ok(failures.every((f) => f.field.length > 0 && f.fixHint.length > 10));\n });\n\nfor (const field of ['steps', 'expected', 'actual', 'reproducibility', 'environment'] as const)\n test('Bug requires ' + field, () => {\n const issue = validIssue();\n issue.issueType = 'Bug';\n issue.bug = {\n steps: ['Submit an invalid identifier.'],\n expected: 'No write.',\n actual: 'A write occurs.',\n reproducibility: 'Every invalid input.',\n environment: 'Synthetic server, Node24.',\n };\n if (field === 'steps') issue.bug.steps = [];\n else issue.bug[field] = '';\n assert.ok(validateIssue(issue).failures.some((f) => f.code === 'bug.' + field));\n });\n\ntest('Ready is the default; explicit drafts park incomplete requirements without permitting secrets', () => {\n assert.equal(requireIssue(validIssue()).draft, false);\n assert.equal(ReadyIssue.safeParse({ title: 'Investigate invalid widget identifiers', draft: true }).success, false);\n const draft = requireIssue({ title: 'Investigate invalid widget identifiers', draft: true });\n assert.equal(draft.draft, true);\n assert.match(renderIssueBody(draft), /Draft \u2014 parked/u);\n assert.equal(DraftIssue.safeParse({ ...draft, problem: 'password=' + 'X'.repeat(16) }).success, false);\n});\n\ntest('independent Ready failures remain actionable together when native Points are missing', () => {\n const failures = validateIssue({\n title: 'Investigate malformed widget identifiers',\n issueType: 'Bug',\n problem: 'A malformed identifier reaches storage.',\n outcome: 'Reject malformed identifiers.',\n acceptanceCriteria: [],\n outOfScope: [],\n openQuestions: ['Choose the return shape.'],\n }).failures;\n for (const code of ['points', 'bug', 'acceptance-criteria', 'out-of-scope', 'open-questions'])\n assert.ok(failures.some((f) => f.code === code));\n assert.equal(new Set(failures.map((f) => f.code + ':' + f.field)).size, failures.length);\n});\n\nconst warningCases: [string, (issue: ReturnType<typeof validIssue>) => void, string][] = [\n [\n 'many criteria',\n (i) => {\n i.acceptanceCriteria = Array.from({ length: 8 }, () => ({ ...i.acceptanceCriteria[0]! }));\n },\n 'many-criteria',\n ],\n [\n 'no edge case',\n (i) => {\n i.acceptanceCriteria[0]!.behavior = 'A valid identifier produces exactly one persisted widget.';\n },\n 'edge-case',\n ],\n [\n 'Bug without regression',\n (i) => {\n i.issueType = 'Bug';\n i.bug = {\n steps: ['Submit an invalid identifier.'],\n expected: 'No write.',\n actual: 'A write occurs.',\n reproducibility: 'Every input.',\n environment: 'Synthetic server.',\n };\n i.acceptanceCriteria[0]!.verifiedBy = 'A mock asserts zero persistence calls.';\n },\n 'bug.regression',\n ],\n [\n 'no context',\n (i) => {\n i.context = { files: [], components: [], evidence: [] };\n },\n 'context',\n ],\n [\n 'only local evidence',\n (i) => {\n i.context.evidence = ['/synthetic/machine/proof.txt'];\n i.acceptanceCriteria[0]!.verifiedBy = '/synthetic/machine/test.ts';\n },\n 'local-evidence',\n ],\n [\n 'long body',\n (i) => {\n i.context.evidence.push('A'.repeat(4500));\n },\n 'body.length',\n ],\n];\nfor (const [name, mutate, code] of warningCases)\n test('Warning does not block ' + name, () => {\n const issue = validIssue();\n mutate(issue);\n assert.equal(validateIssue(issue).failures.length, 0);\n assert.ok(issueWarnings(issue).some((w) => w.code === code));\n });\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AAE/B,MAAM,aAAa,MACxB,YAAY,MAAM;AAAA,EAChB,OAAO;AAAA,EACP,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,oBAAoB;AAAA,IAClB;AAAA,MACE,UAAU;AAAA,MACV,YAAY;AAAA,IACd;AAAA,EACF;AAAA,EACA,YAAY,CAAC,8BAA8B;AAAA,EAC3C,eAAe,CAAC;AAAA,EAChB,SAAS;AAAA,IACP,YAAY,CAAC,eAAe;AAAA,IAC5B,OAAO,CAAC,eAAe;AAAA,IACvB,UAAU,CAAC,0CAA0C;AAAA,EACvD;AACF,CAAC;AAEH,KAAK,mFAAmF,MAAM;AAC5F,aAAW,CAAC,QAAQ,OAAO,KAAK;AAAA,IAC9B,CAAC,MAAM,KAAK;AAAA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AAC;",
|
|
4
|
+
"sourcesContent": ["import assert from 'node:assert/strict';\nimport { test } from 'vitest';\nimport { z } from 'zod';\nimport {\n DraftIssue,\n ReadyIssue,\n IssueFields,\n IssueWriteSchema,\n ISSUE_JSON_SCHEMAS,\n ISSUE_BODY_MARKER,\n requireIssue,\n renderIssueBody,\n parseIssueBody,\n validateIssue,\n issueWarnings,\n IssueValidationError,\n} from './issueContract.js';\nimport { AI_DELIVERY_MCP_TOOLS } from './mcp/index.js';\nimport { builderReady } from './fixtures/builderReady.js';\n\nexport const validIssue = () =>\n IssueFields.parse({\n title: 'Reject invalid widget identifiers before persistence',\n issueType: 'Feature',\n points: 2,\n problem: 'Malformed identifiers currently reach persistence.',\n outcome: 'Widget writes reject malformed identifiers before persistence.',\n acceptanceCriteria: [\n {\n behavior: 'An invalid widget identifier returns an error without a persistence call.',\n verifiedBy: 'A mocked persistence regression asserts the error and zero calls.',\n },\n ],\n outOfScope: ['Changing the storage engine.'],\n openQuestions: [],\n context: {\n components: ['widget intake'],\n files: ['src/widget.ts'],\n evidence: ['A portable synthetic identifier fixture.'],\n },\n });\n\ntest('body.length counts prose words in problem, outcome and criteria and warns strictly above 300', () => {\n for (const [words, warning] of [\n [299, false],\n [300, false],\n [301, true],\n ] as const) {\n const issue = validIssue();\n issue.problem = Array.from({ length: words - 2 }, () => 'w').join(' ');\n issue.outcome = 'one';\n issue.acceptanceCriteria[0]!.behavior = 'two';\n assert.equal(\n issueWarnings(issue).some((item) => item.code === 'body.length'),\n warning,\n String(words),\n );\n }\n const structured = validIssue();\n structured.context.evidence.push('A'.repeat(5000));\n assert.ok(!issueWarnings(structured).some((item) => item.code === 'body.length'));\n});\n\ntest('multiline criteria keep nested bullets and verification attached to their own checkbox', () => {\n const issue = validIssue();\n issue.acceptanceCriteria = [\n {\n behavior: 'Reject malformed input:\\n- Empty input\\n - Whitespace only\\n- Invalid shape',\n verifiedBy: 'Regression cases:\\n- Empty and malformed',\n },\n { behavior: 'A valid input is stored once.', verifiedBy: 'One observed write.' },\n ];\n const actual = renderIssueBody(issue).split('## Acceptance criteria\\n\\n')[1]!.split('\\n\\n## Out of scope')[0];\n assert.equal(\n actual,\n '- [ ] Reject malformed input:\\n - Empty input\\n - Whitespace only\\n - Invalid shape\\n\\n Verified by: Regression cases:\\n - Empty and malformed\\n- [ ] A valid input is stored once.\\n Verified by: One observed write.',\n );\n});\n\ntest('MCP create/update fields derive from the canonical schema and patch omissions retain no defaults', () => {\n const create = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === 'issue_create')!;\n const update = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === 'issue_update')!;\n const shape = z.toJSONSchema(IssueWriteSchema).properties;\n for (const name of [\n 'acceptanceCriteria',\n 'context',\n 'outOfScope',\n 'openQuestions',\n 'problem',\n 'outcome',\n 'bug',\n 'draft',\n ]) {\n assert.deepEqual(z.toJSONSchema(create.inputSchema).properties?.[name], shape?.[name]);\n assert.deepEqual(z.toJSONSchema(update.inputSchema).properties?.[name], shape?.[name]);\n }\n assert.deepEqual(update.inputSchema.parse({ issueNumber: 17 }), { issueNumber: 17 });\n assert.ok('issueContract' in create);\n assert.deepEqual(\n create.issueContract,\n ISSUE_JSON_SCHEMAS,\n 'portable output is reachable through the existing packaged MCP export',\n );\n});\n\ntest('portable JSON Schema snapshot carries Ready bounds and distinguishes incomplete drafts', () => {\n const ready = ISSUE_JSON_SCHEMAS.ready;\n assert.deepEqual(\n {\n draft: ready.properties?.draft,\n points: ready.properties?.points,\n title: ready.properties?.title,\n openQuestions: ready.properties?.openQuestions,\n },\n {\n draft: { type: 'boolean', const: false, default: false },\n points: { type: 'integer', minimum: 1, maximum: 8 },\n title: { type: 'string', minLength: 10, maxLength: 80 },\n openQuestions: { default: [], type: 'array', items: { type: 'string' }, maxItems: 0 },\n },\n );\n assert.deepEqual(ready.anyOf, [\n { properties: { epic: { const: true } }, required: ['epic'] },\n { required: ['points'] },\n ]);\n assert.ok(!ISSUE_JSON_SCHEMAS.draft.required?.includes('points'));\n});\n\ntest('concrete domain wording remains Ready while generic completion claims fail', () => {\n for (const behavior of [\n 'The independently reviewed head SHA is sent as the merge guard.',\n 'A failed request leaves the Project Done column unchanged.',\n 'A verified token grants access only to its repository.',\n 'The adapter works with a missing local checkout and returns the selected repository.',\n ]) {\n const issue = validIssue();\n issue.acceptanceCriteria[0]!.behavior = behavior;\n assert.deepEqual(validateIssue(issue).failures, [], behavior);\n }\n for (const behavior of [\n 'The widget works correctly.',\n 'The change is reviewed.',\n 'The request is done.',\n 'The interface is user friendly.',\n ]) {\n const issue = validIssue();\n issue.acceptanceCriteria[0]!.behavior = behavior;\n assert.ok(\n validateIssue(issue).failures.some((f) => f.code === 'acceptance-criteria.vague'),\n behavior,\n );\n }\n});\n\ntest('canonical bodies round trip every typed field, multiline markup and comment delimiters', () => {\n const issue = validIssue();\n issue.context.evidence.push('Observed <!-- text -->\\n## nested heading\\n`code`');\n const body = renderIssueBody(issue);\n assert.ok(body.startsWith(ISSUE_BODY_MARKER + '\\n\\n## Status\\n\\nReady'));\n assert.deepEqual(parseIssueBody(body, { title: issue.title }).issue, issue);\n assert.equal(parseIssueBody(body, { title: issue.title }).legacy, false);\n assert.throws(\n () => parseIssueBody(body.replace('## Status\\n\\nReady', '## Status\\n\\nDraft'), { title: issue.title }),\n /body.canonical/u,\n );\n assert.throws(() => parseIssueBody(body, { title: 'Different native title' }), /body.canonical/u);\n});\n\ntest('lenient legacy conversion retains all bytes, portable verification and marker descriptions', () => {\n const body =\n '## Problem\\nA literal ' +\n ISSUE_BODY_MARKER +\n ' is documentation.\\n## Outcome\\nReject malformed identifiers.\\n## Acceptance Criteria\\n- [ ] Invalid identifiers return an error before persistence.\\n## Verification\\nRun the synthetic identifier tests.\\n## Out of scope\\n- Storage engine changes.\\n## Scope\\nsrc/missing-in-this-checkout.ts\\nUnclassified historical text.\\n';\n const parsed = parseIssueBody(body, { title: validIssue().title, points: 2, issueType: 'Feature' });\n assert.equal(parsed.legacy, true);\n assert.equal(parsed.issue.legacyBody, body);\n assert.equal(parsed.issue.acceptanceCriteria[0]?.verifiedBy, 'Run the synthetic identifier tests.');\n const ready = requireIssue(parsed.issue);\n assert.deepEqual(parseIssueBody(renderIssueBody(ready), { title: ready.title }).issue, ready);\n});\n\ntest('legacy conversion never fabricates missing verification or bug evidence', () => {\n const body =\n '## Problem\\nA failure.\\n## Outcome\\nReject invalid widgets.\\n## Acceptance Criteria\\n- [ ] Invalid widgets are rejected before persistence.\\n## Out of scope\\n- Storage changes.\\n';\n const parsed = parseIssueBody(body, { title: validIssue().title, points: 2, issueType: 'Bug' });\n const codes = validateIssue(parsed.issue).failures.map((f) => f.code);\n assert.ok(codes.includes('acceptance-criteria.fields'));\n assert.ok(codes.includes('bug.steps'));\n assert.ok(codes.includes('bug.environment'));\n});\n\nconst blockingCases: [string, (issue: ReturnType<typeof validIssue>) => void, string][] = [\n [\n 'Points13',\n (i) => {\n i.points = 13;\n },\n 'points',\n ],\n [\n 'Points0',\n (i) => {\n i.points = 0;\n },\n 'points',\n ],\n [\n 'Points9',\n (i) => {\n i.points = 9;\n },\n 'points',\n ],\n [\n 'missing behavior',\n (i) => {\n i.acceptanceCriteria[0]!.behavior = '';\n },\n 'acceptance-criteria.fields',\n ],\n [\n 'missing verifiedBy',\n (i) => {\n i.acceptanceCriteria[0]!.verifiedBy = '';\n },\n 'acceptance-criteria.fields',\n ],\n [\n 'vague AC',\n (i) => {\n i.acceptanceCriteria[0]!.behavior = 'The widget works correctly.';\n },\n 'acceptance-criteria.vague',\n ],\n [\n 'no non-goal',\n (i) => {\n i.outOfScope = [];\n },\n 'out-of-scope',\n ],\n [\n 'open question',\n (i) => {\n i.openQuestions = ['Choose the persistence behavior.'];\n },\n 'open-questions',\n ],\n [\n 'vague title',\n (i) => {\n i.title = 'Fix things';\n },\n 'title.specific',\n ],\n [\n 'long title',\n (i) => {\n i.title = 'x'.repeat(81);\n },\n 'title.length',\n ],\n [\n 'type prefix',\n (i) => {\n i.title = 'Bug: Reject invalid widget identifiers';\n },\n 'title.prefix',\n ],\n [\n 'bug fields',\n (i) => {\n i.issueType = 'Bug';\n },\n 'bug',\n ],\n [\n 'secret',\n (i) => {\n i.problem = 'A fixture contains ' + ['gh', 'p_'].join('') + 'A'.repeat(24);\n },\n 'secrets',\n ],\n];\nfor (const [name, mutate, code] of blockingCases)\n test('Ready blocks ' + name + ' with a field and actionable fix hint', () => {\n const issue = validIssue();\n mutate(issue);\n const failures = validateIssue(issue).failures;\n assert.ok(\n failures.some((f) => f.code === code),\n JSON.stringify(failures),\n );\n assert.ok(failures.every((f) => f.field.length > 0 && f.fixHint.length > 10));\n });\n\nfor (const field of ['steps', 'expected', 'actual', 'reproducibility', 'environment'] as const)\n test('Bug requires ' + field, () => {\n const issue = validIssue();\n issue.issueType = 'Bug';\n issue.bug = {\n steps: ['Submit an invalid identifier.'],\n expected: 'No write.',\n actual: 'A write occurs.',\n reproducibility: 'Every invalid input.',\n environment: 'Synthetic server, Node24.',\n };\n if (field === 'steps') issue.bug.steps = [];\n else issue.bug[field] = '';\n assert.ok(validateIssue(issue).failures.some((f) => f.code === 'bug.' + field));\n });\n\ntest('Ready is the default; explicit drafts park incomplete requirements without permitting secrets', () => {\n assert.equal(requireIssue(validIssue()).draft, false);\n assert.equal(ReadyIssue.safeParse({ title: 'Investigate invalid widget identifiers', draft: true }).success, false);\n const draft = requireIssue({ title: 'Investigate invalid widget identifiers', draft: true });\n assert.equal(draft.draft, true);\n assert.match(renderIssueBody(draft), /Draft \u2014 parked/u);\n assert.equal(DraftIssue.safeParse({ ...draft, problem: 'password=' + 'X'.repeat(16) }).success, false);\n});\n\ntest('independent Ready failures remain actionable together when native Points are missing', () => {\n const failures = validateIssue({\n title: 'Investigate malformed widget identifiers',\n issueType: 'Bug',\n problem: 'A malformed identifier reaches storage.',\n outcome: 'Reject malformed identifiers.',\n acceptanceCriteria: [],\n outOfScope: [],\n openQuestions: ['Choose the return shape.'],\n }).failures;\n for (const code of ['points', 'bug', 'acceptance-criteria', 'out-of-scope', 'open-questions'])\n assert.ok(failures.some((f) => f.code === code));\n assert.equal(new Set(failures.map((f) => f.code + ':' + f.field)).size, failures.length);\n});\n\nconst warningCases: [string, (issue: ReturnType<typeof validIssue>) => void, string][] = [\n [\n 'many criteria',\n (i) => {\n i.acceptanceCriteria = Array.from({ length: 8 }, () => ({ ...i.acceptanceCriteria[0]! }));\n },\n 'many-criteria',\n ],\n [\n 'no edge case',\n (i) => {\n i.acceptanceCriteria[0]!.behavior = 'A valid identifier produces exactly one persisted widget.';\n },\n 'edge-case',\n ],\n [\n 'Bug without regression',\n (i) => {\n i.issueType = 'Bug';\n i.bug = {\n steps: ['Submit an invalid identifier.'],\n expected: 'No write.',\n actual: 'A write occurs.',\n reproducibility: 'Every input.',\n environment: 'Synthetic server.',\n };\n i.acceptanceCriteria[0]!.verifiedBy = 'A mock asserts zero persistence calls.';\n },\n 'bug.regression',\n ],\n [\n 'no context',\n (i) => {\n i.context = { files: [], components: [], evidence: [] };\n },\n 'context',\n ],\n [\n 'local path',\n (i) => {\n i.context.evidence = ['~/runs/READOUT.md'];\n },\n 'local-path',\n ],\n [\n 'long body',\n (i) => {\n i.problem = Array.from({ length: 301 }, () => 'word').join(' ');\n },\n 'body.length',\n ],\n];\nfor (const [name, mutate, code] of warningCases)\n test('Warning does not block ' + name, () => {\n const issue = validIssue();\n mutate(issue);\n assert.equal(validateIssue(issue).failures.length, 0);\n assert.ok(issueWarnings(issue).some((w) => w.code === code));\n });\n\nconst builderFields = {\n builder: { tier: 'frontier' as const, reason: 'state-machine' as const },\n extends: ['src/widget.ts saveWidget (the one widget write path)'],\n decisions: ['Valid id: ^w-[0-9a-f]{8}$. Refuse with InvalidWidgetId.'],\n surface: [\n {\n path: 'src/widget.ts',\n change: 'edit' as const,\n signatures: ['export function saveWidget(w: Widget): void'],\n },\n { path: 'src/old.ts', change: 'delete' as const },\n ],\n fences: ['src/store.ts (storage owner)'],\n proof: ['npx vitest run src/widget.test.ts'],\n};\n\ntest('every builder-ready field renders in order and parses back equal', () => {\n const issue = IssueFields.parse({\n ...validIssue(),\n ...builderFields,\n acceptanceCriteria: [\n {\n behavior: 'An invalid widget identifier returns an error without a persistence call.',\n verifiedBy: 'src/widget.test.ts',\n examples: [\n { input: \"id 'w-0a1b2c3d'\", expected: 'one store.put' },\n {\n input: \"id ' w-0A1B2C3D'\",\n expected: 'InvalidWidgetId',\n failure: true,\n },\n ],\n },\n ],\n });\n const body = renderIssueBody(issue);\n const at = (heading: string) => body.indexOf(`\\n## ${heading}\\n`);\n assert.ok(at('Outcome') < at('Builder') && at('Builder') < at('Extends') && at('Extends') < at('Decisions'));\n assert.ok(at('Decisions') < at('Acceptance criteria') && at('Acceptance criteria') < at('Surface'));\n assert.ok(at('Surface') < at('Fences') && at('Fences') < at('Proof') && at('Proof') < at('Out of scope'));\n assert.ok(body.includes('## Builder\\n\\nfrontier: state-machine\\n'));\n assert.ok(\n body.includes(\n \" Example: id 'w-0a1b2c3d' \u2192 one store.put\\n Example: id ' w-0A1B2C3D' \u2192 InvalidWidgetId (failure)\\n\",\n ),\n );\n assert.ok(\n body.includes('- edit `src/widget.ts`\\n export function saveWidget(w: Widget): void\\n- delete `src/old.ts`\\n'),\n );\n const parsed = parseIssueBody(body, { title: issue.title });\n assert.equal(parsed.legacy, false);\n assert.deepEqual(parsed.issue, issue);\n assert.deepEqual(validateIssue(issue).failures, []);\n});\n\ntest('bodies without builder-ready fields re-render byte for byte with no new data keys', () => {\n const body = renderIssueBody(validIssue());\n assert.ok(!/\\n## (?:Builder|Extends|Decisions|Surface|Fences|Proof)\\n/u.test(body));\n const data = body.split('<!-- ai-delivery:issue-data@1 ')[1]!;\n for (const key of ['builder', 'extends', 'decisions', 'surface', 'fences', 'proof', 'examples'])\n assert.ok(!data.includes(`\"${key}\"`), key);\n const parsed = parseIssueBody(body, { title: validIssue().title });\n assert.equal(renderIssueBody(parsed.issue), body);\n assert.equal(\n body.split('\\n\\n## Acceptance criteria\\n\\n')[1]!.split('\\n\\n## Out of scope')[0],\n '- [ ] An invalid widget identifier returns an error without a persistence call.\\n Verified by: A mocked persistence regression asserts the error and zero calls.',\n );\n});\n\ntest('malformed builder-ready fields fail at their own field', () => {\n const fails = (extra: object, field: string) => {\n const result = validateIssue({ ...validIssue(), ...extra }, false);\n assert.ok(\n result.failures.some((failure) => failure.field.startsWith(field)),\n field,\n );\n };\n fails({ builder: { tier: 'frontier' } }, 'builder');\n fails({ builder: { tier: 'frontier', reason: 'because' } }, 'builder');\n fails({ builder: { tier: 'standard', reason: 'state-machine' } }, 'builder');\n fails({ surface: [{ path: 'src/a.ts', change: 'move' }] }, 'surface');\n});\n\ntest('create and update tools and the portable Ready schema expose the six top-level keys', () => {\n const shape = z.toJSONSchema(IssueWriteSchema).properties;\n for (const tool of ['issue_create', 'issue_update']) {\n const schema = AI_DELIVERY_MCP_TOOLS.find((t) => t.name === tool)!.inputSchema;\n for (const key of ['builder', 'extends', 'decisions', 'surface', 'fences', 'proof'])\n assert.deepEqual(z.toJSONSchema(schema).properties?.[key], shape?.[key], `${tool} ${key}`);\n }\n for (const key of ['builder', 'extends', 'decisions', 'surface', 'fences', 'proof'])\n assert.ok(key in ISSUE_JSON_SCHEMAS.ready.properties!, key);\n assert.ok(!ISSUE_JSON_SCHEMAS.ready.required?.includes('builder'));\n});\n\ntest('builderReady has no failures and no warnings', () => {\n assert.deepEqual(validateIssue(builderReady()).failures, []);\n assert.deepEqual(issueWarnings(builderReady()), []);\n});\n\nconst refusalCases: [string, (i: ReturnType<typeof builderReady>) => void, string][] = [\n ['no decisions', (i) => void (i.decisions = []), 'decisions'],\n ['blank decision', (i) => void (i.decisions = [' ']), 'decisions'],\n ['no surface', (i) => void (i.surface = []), 'surface'],\n ['blank surface path', (i) => void (i.surface = [{ path: ' ', change: 'edit' }]), 'surface'],\n [\n 'no examples',\n (i) => {\n delete i.acceptanceCriteria[0]!.examples;\n },\n 'examples',\n ],\n [\n 'no failure example',\n (i) => {\n i.acceptanceCriteria[0]!.examples = [{ input: 'a', expected: 'b' }];\n },\n 'examples.failure',\n ],\n ['no proof', (i) => void (i.proof = []), 'proof'],\n];\nfor (const [name, mutate, code] of refusalCases)\n test('Ready with builder refuses ' + name, () => {\n const issue = builderReady();\n mutate(issue);\n const failures = validateIssue(issue).failures;\n assert.ok(\n failures.some((f) => f.code === code && f.fixHint.endsWith('See ai-delivery:ticket-design.')),\n code,\n );\n });\n\ntest('builder fields are required only with builder, and never for epics or drafts', () => {\n assert.deepEqual(validateIssue(validIssue()).failures, []);\n const bare = { ...builderReady(), decisions: undefined, surface: undefined, proof: undefined, epic: true as const };\n assert.deepEqual(validateIssue(bare).failures, []);\n assert.deepEqual(validateIssue({ ...bare, epic: undefined, draft: true }, false).failures, []);\n});\n\ntest('requireBuilder refuses a Ready non-epic issue without builder and offers draft', () => {\n assert.throws(\n () => requireIssue(validIssue(), { requireBuilder: true }),\n (error: unknown) =>\n error instanceof IssueValidationError &&\n error.failures.some((f) => f.code === 'builder.missing' && f.fixHint.includes('draft: true')),\n );\n assert.ok(requireIssue(validIssue()));\n assert.ok(requireIssue(builderReady(), { requireBuilder: true }));\n assert.ok(requireIssue({ ...validIssue(), draft: true }, { requireBuilder: true }));\n assert.ok(requireIssue({ ...validIssue(), epic: true }, { requireBuilder: true }));\n});\n\nconst judgmentCases: [string, (i: ReturnType<typeof builderReady>) => void, string][] = [\n ['8 points', (i) => void (i.points = 8), 'size.points'],\n [\n 'seven surface paths',\n (i) =>\n void (i.surface = Array.from({ length: 7 }, (_, n) => ({ path: `src/a${n}.ts`, change: 'delete' as const }))),\n 'size.surface',\n ],\n [\n 'a criterion without examples',\n (i) => {\n i.acceptanceCriteria.push({ behavior: 'saveWidget stores a valid id', verifiedBy: 'src/widget.test.ts' });\n },\n 'examples.ac',\n ],\n [\n 'a code path without signatures',\n (i) => void (i.surface = [{ path: 'src/widget.ts', change: 'edit' }]),\n 'surface.signature',\n ],\n ['no fences', (i) => void (i.fences = []), 'fences'],\n ['blank extends', (i) => void (i.extends = [' ']), 'extends'],\n];\nfor (const [name, mutate, code] of judgmentCases)\n test('Ready with builder warns, never refuses, for ' + name, () => {\n const issue = builderReady();\n mutate(issue);\n assert.deepEqual(validateIssue(issue).failures, []);\n assert.ok(\n issueWarnings(issue).some((w) => w.code === code && w.fixHint.endsWith('See ai-delivery:ticket-design.')),\n );\n });\n\ntest('surface.signature skips deleted paths, tests and non-code files', () => {\n const issue = builderReady();\n issue.surface = [\n { path: 'src/gone.ts', change: 'delete' },\n { path: 'src/widget.test.ts', change: 'edit' },\n { path: 'README.md', change: 'edit' },\n ];\n assert.ok(!issueWarnings(issue).some((w) => w.code === 'surface.signature'));\n});\n\ntest('a legacy Ready issue warns builder.unset and skips builder-only warnings; edge-case and context drop with builder', () => {\n const codes = (issue: Parameters<typeof issueWarnings>[0]) => issueWarnings(issue).map((w) => w.code);\n assert.ok(codes(validIssue()).includes('builder.unset'));\n assert.ok(!codes({ ...validIssue(), draft: true }).includes('builder.unset'));\n assert.ok(!codes({ ...validIssue(), epic: true }).includes('builder.unset'));\n assert.ok(!codes(validIssue()).some((code) => code.startsWith('size.') || code === 'fences' || code === 'extends'));\n const noCopy = builderReady();\n noCopy.acceptanceCriteria[0]!.behavior = 'saveWidget stores valid ids';\n noCopy.context = { components: [], files: [], evidence: [] };\n assert.ok(!codes(noCopy).some((code) => code === 'edge-case' || code === 'context'));\n});\n\ntest('an 85-character title refuses with its length', () => {\n const failure = validateIssue({ ...validIssue(), title: 'x'.repeat(85) }).failures.find(\n (f) => f.code === 'title.length',\n );\n assert.equal(failure?.fixHint, 'The title is 85 characters; shorten it to at most 80.');\n});\n\ntest('the Ready write gate refuses missing Prior work, local paths and a contract over 400 words; other paths warn', () => {\n // builderReady's contract is 40 words outside its one-word outcome.\n const words = (n: number) => Array.from({ length: n }, () => 'w').join(' ');\n const gate = (value: unknown) => {\n try {\n requireIssue(value, { requireBuilder: true });\n return [];\n } catch (error) {\n if (!(error instanceof IssueValidationError)) throw error;\n return error.failures;\n }\n };\n const fit = { ...builderReady(), outcome: words(140) };\n assert.deepEqual(gate(fit), []);\n assert.deepEqual(issueWarnings(fit), []);\n const prior = gate({ ...fit, priorWork: undefined });\n assert.deepEqual(\n prior.map((f) => [f.code, f.fixHint]),\n [\n [\n 'priorWork',\n \"List each search you ran for earlier work on this question and what it found, or 'none found' with the searches.\",\n ],\n ],\n );\n const local = gate({ ...fit, context: { components: [], files: [], evidence: ['~/runs/READOUT.md'] } });\n assert.deepEqual(\n local.map((f) => f.fixHint),\n [\n 'context.evidence.0 cites a local path (~/); put that evidence on the issue as a comment or artifact and link it instead.',\n ],\n );\n const long = gate({ ...fit, outcome: words(390) });\n assert.deepEqual(\n long.map((f) => [f.code, f.fixHint]),\n [\n [\n 'contract-words',\n 'The contract (outcome, files, acceptance, tests, prior work) is 430 words; keep it to 400 and move evidence to a comment or artifact.',\n ],\n ],\n );\n assert.ok(requireIssue({ ...validIssue(), epic: true }, { requireBuilder: true }));\n assert.ok(requireIssue({ ...fit, draft: true, proof: ['.local/operator/run.sh'] }, { requireBuilder: true }));\n const existing = { ...fit, priorWork: undefined, outcome: words(800), proof: ['.local/operator/run.sh'] };\n assert.deepEqual(validateIssue(existing).failures, []);\n assert.ok(requireIssue(existing));\n assert.deepEqual(\n gate(existing).map((f) => f.code),\n ['priorWork', 'local-path', 'contract-words'],\n );\n});\n\ntest('Prior work round-trips after Extends', () => {\n const issue = IssueFields.parse({ ...builderReady(), priorWork: ['ai#3482: 250 ms floor', 'none found'] });\n const body = renderIssueBody(issue);\n assert.ok(body.indexOf('\\n## Extends\\n') < body.indexOf('\\n## Prior work\\n'));\n assert.deepEqual(parseIssueBody(body, { title: issue.title }).issue.priorWork, issue.priorWork);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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CAAC;AAChC,SAAO;AAAA,IACL,KAAK,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,IAChC,CAAC,aAAa,cAAc,gBAAgB;AAAA,EAC9C;AACF,CAAC;AAED,KAAK,wCAAwC,MAAM;AACjD,QAAM,QAAQ,YAAY,MAAM,EAAE,GAAG,aAAa,GAAG,WAAW,CAAC,yBAAyB,YAAY,EAAE,CAAC;AACzG,QAAM,OAAO,gBAAgB,KAAK;AAClC,SAAO,GAAG,KAAK,QAAQ,gBAAgB,IAAI,KAAK,QAAQ,mBAAmB,CAAC;AAC5E,SAAO,UAAU,eAAe,MAAM,EAAE,OAAO,MAAM,MAAM,CAAC,EAAE,MAAM,WAAW,MAAM,SAAS;AAChG,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/issueDates.test.js
CHANGED
|
@@ -6,7 +6,7 @@ import { tmpdir } from "node:os";
|
|
|
6
6
|
import { join, resolve } from "node:path";
|
|
7
7
|
import { loadDeliveryContext, updateIssue, issueInfo } from "./issue.js";
|
|
8
8
|
import { getAiDeliveryMcpTool } from "./mcp/tools.js";
|
|
9
|
-
import { inertTarget, fixtureFields } from "./fixtures/inertTarget.js";
|
|
9
|
+
import { inertTarget, fixtureFields, createFields } from "./fixtures/inertTarget.js";
|
|
10
10
|
function dateFixture() {
|
|
11
11
|
const f = inertTarget();
|
|
12
12
|
const original = f.rest.request;
|
|
@@ -77,8 +77,7 @@ test("MCP creates configured calendar dates and reads every supported field by n
|
|
|
77
77
|
const c = await f.connect();
|
|
78
78
|
try {
|
|
79
79
|
const created = await c.call("issue_create", {
|
|
80
|
-
...
|
|
81
|
-
priority: "High",
|
|
80
|
+
...createFields,
|
|
82
81
|
startDate: "2032-02-29",
|
|
83
82
|
targetDate: "2032-03-01"
|
|
84
83
|
});
|
|
@@ -134,7 +133,7 @@ for (const mode of ["missing", "duplicate", "wrong-type"]) {
|
|
|
134
133
|
const c = await f.connect();
|
|
135
134
|
try {
|
|
136
135
|
const before = f.calls.length;
|
|
137
|
-
const result = await c.call("issue_create", { ...
|
|
136
|
+
const result = await c.call("issue_create", { ...createFields, startDate: "2032-02-29" });
|
|
138
137
|
assert.equal(result.response.isError, true);
|
|
139
138
|
assert.match(result.text, /Start date|duplicate|catalog/u);
|
|
140
139
|
assert.equal(
|
|
@@ -208,7 +207,7 @@ for (const command of ["create", "update"]) {
|
|
|
208
207
|
const root = mkdtempSync(join(tmpdir(), "issue151-cli-"));
|
|
209
208
|
try {
|
|
210
209
|
const file = join(root, "fields.json");
|
|
211
|
-
const args = command === "create" ? ["create", "--title", fixtureFields.title] : ["update", "--issue", "17"];
|
|
210
|
+
const args = command === "create" ? ["create", "--title", fixtureFields.title, "--priority", "High"] : ["update", "--issue", "17"];
|
|
212
211
|
for (const value of ["2032-02-29", null, "2031-02-29"]) {
|
|
213
212
|
writeFileSync(file, JSON.stringify({ ...command === "create" ? fixtureFields : {}, targetDate: value }));
|
|
214
213
|
const result = spawnSync(
|
|
@@ -239,7 +238,7 @@ test("a date-field failure after issue creation reports the known issue without
|
|
|
239
238
|
const c = await f.connect();
|
|
240
239
|
try {
|
|
241
240
|
f.controls.failWrite = true;
|
|
242
|
-
const result = await c.call("issue_create", { ...
|
|
241
|
+
const result = await c.call("issue_create", { ...createFields, startDate: "2032-02-29" });
|
|
243
242
|
assert.equal(result.response.isError, true);
|
|
244
243
|
assert.match(result.text, /Issue #17 was created/u);
|
|
245
244
|
assert.match(result.text, /do not create another/u);
|