@warpgogol/forge 6.3.6 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +2 -1
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +15 -1
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +98 -13
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +13 -4
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +11 -6
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +34 -5
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +14 -2
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +16 -0
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +71 -5
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/src/skill-schema.d.ts +2 -0
- package/dist/src/skill-schema.d.ts.map +1 -1
- package/dist/src/skill-schema.js +9 -1
- package/dist/src/skill-schema.js.map +1 -1
- package/os/rfc/acceptance.test.ts +111 -0
- package/os/rfc/acceptance.ts +20 -1
- package/os/rfc/handlers/implement-stamp-stale.test.ts +267 -0
- package/os/rfc/handlers/implement-stamp.ts +116 -15
- package/os/rfc/handlers/validate-rules.test.ts +42 -0
- package/os/rfc/handlers/validate-rules.ts +22 -4
- package/os/rfc/rfc-0000-template.md +18 -1
- package/os/rfc/rfc.module.ts +12 -6
- package/os/rfc/types.ts +48 -5
- package/os/rfc/verification-emit-check.test.ts +201 -0
- package/os/rfc/verification-evidence.ts +73 -5
- package/os/rfc/verification-normalize.test.ts +61 -0
- package/package.json +1 -1
- package/skills/_shared/agent-operating-model.md +83 -0
- package/skills/fo/fo-idea/SKILL.md +6 -3
- package/src/onboarding/templates/behavioral-layer-core.md +8 -0
- package/src/skill-schema.ts +9 -1
- package/src/tests/fixtures/agents-generate-business-before.txt +8 -0
- package/src/tests/skill-schema.test.ts +39 -0
|
@@ -12,7 +12,6 @@ verification evidence, and atomically mutates RFC frontmatter.
|
|
|
12
12
|
</non-goals>
|
|
13
13
|
</MODULE_CONTRACT>
|
|
14
14
|
<CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-1053: integrate generateRfcMetrics after successful stamp (non-fatal, guarded by !isDryRun).</item>
|
|
16
15
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
17
16
|
|
|
18
17
|
Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
|
|
@@ -21,7 +20,8 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
21
20
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
22
21
|
<item>Session-retro 2026-10-08: auto-detect picks the sole implement/feat-prefixed candidate among multi-commit references (RFC-IMP-03 no longer blocks full pipelines); ambiguous sets keep blocking with annotated candidate list + earliest-candidate suggestion.</item>
|
|
23
22
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
24
|
-
<
|
|
23
|
+
<item>RFC-1271: review wave — deep probe normalization, malformed-envelope fail-closed, post-stamp re-emit, honest repair hints</item>
|
|
24
|
+
<history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-1053, RFC-IMP-07</history>
|
|
25
25
|
</CHANGE_SUMMARY>
|
|
26
26
|
*/
|
|
27
27
|
|
|
@@ -42,8 +42,15 @@ import {
|
|
|
42
42
|
} from "../frontmatter-io.ts";
|
|
43
43
|
import { evaluateAcceptanceCriteria } from "./validate-rules.ts";
|
|
44
44
|
import { toIsoDate } from "./shared.ts";
|
|
45
|
+
import { byteHashHex, normalizeProbes, runRfcVerificationEmit } from "../verification-evidence.ts";
|
|
45
46
|
import { RFC_DIR, RFC_METADATA_CUTOFF, RFC_PROBE_BINDING_CUTOFF } from "../types.ts";
|
|
46
|
-
import type {
|
|
47
|
+
import type {
|
|
48
|
+
RfcStatus,
|
|
49
|
+
RfcImplementStampViolation,
|
|
50
|
+
RfcImplementStampResult,
|
|
51
|
+
AcceptanceProbe,
|
|
52
|
+
VerificationEvidence,
|
|
53
|
+
} from "../types.ts";
|
|
47
54
|
|
|
48
55
|
// Ambient default for helper fns without a context param — handlers override
|
|
49
56
|
// with `const io = resolveIo(context.io)` inside their own scope.
|
|
@@ -200,16 +207,38 @@ async function releaseRfcLock(lockPath: string): Promise<void> {
|
|
|
200
207
|
async function checkExistingEvidence(
|
|
201
208
|
workspaceRoot: string,
|
|
202
209
|
rfcId: string,
|
|
203
|
-
): Promise<{
|
|
210
|
+
): Promise<{
|
|
211
|
+
exists: boolean;
|
|
212
|
+
overall: string;
|
|
213
|
+
envelope: VerificationEvidence | null;
|
|
214
|
+
malformed: boolean;
|
|
215
|
+
}> {
|
|
204
216
|
const slug = rfcId.toLowerCase();
|
|
205
217
|
const evidencePath = join(workspaceRoot, VERIFICATION_DIR, `${slug}.generated.yaml`);
|
|
218
|
+
let content: string;
|
|
219
|
+
try {
|
|
220
|
+
content = await io.readFile(evidencePath);
|
|
221
|
+
} catch {
|
|
222
|
+
return { exists: false, overall: "missing", envelope: null, malformed: false };
|
|
223
|
+
}
|
|
224
|
+
let parsed: unknown;
|
|
206
225
|
try {
|
|
207
|
-
|
|
208
|
-
const evidence = yamlParse(content) as { overall?: string };
|
|
209
|
-
return { exists: true, overall: String(evidence.overall ?? "") };
|
|
226
|
+
parsed = yamlParse(content);
|
|
210
227
|
} catch {
|
|
211
|
-
return { exists:
|
|
228
|
+
return { exists: true, overall: "malformed", envelope: null, malformed: true };
|
|
212
229
|
}
|
|
230
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
231
|
+
// Fail closed: a committed envelope that parses to a scalar/array is
|
|
232
|
+
// malformed evidence, not absent evidence.
|
|
233
|
+
return { exists: true, overall: "malformed", envelope: null, malformed: true };
|
|
234
|
+
}
|
|
235
|
+
const evidence = parsed as VerificationEvidence;
|
|
236
|
+
return {
|
|
237
|
+
exists: true,
|
|
238
|
+
overall: String(evidence.overall ?? ""),
|
|
239
|
+
envelope: evidence,
|
|
240
|
+
malformed: false,
|
|
241
|
+
};
|
|
213
242
|
}
|
|
214
243
|
|
|
215
244
|
// ─── Frontmatter mutation ────────────────────────────────────────────────────
|
|
@@ -425,11 +454,17 @@ export async function runRfcImplementStamp(
|
|
|
425
454
|
const hasProbes = Array.isArray(acceptance) && (acceptance as unknown[]).length > 0;
|
|
426
455
|
const createdAtStr = String(fm["createdAt"] ?? "");
|
|
427
456
|
const requiresEvidence = createdAtStr >= RFC_METADATA_CUTOFF && hasProbes;
|
|
457
|
+
const rfcFilePath = join(rfcDirPath, targetFile);
|
|
428
458
|
|
|
429
459
|
let evidenceRelPath: string | undefined;
|
|
430
460
|
|
|
461
|
+
// RFC-1271: the envelope is fetched unconditionally — a committed envelope
|
|
462
|
+
// must also be evaluated when hasProbes is now false, because probe
|
|
463
|
+
// deletion IS a criteria change and would otherwise slip past
|
|
464
|
+
// requiresEvidence entirely (RFC-IMP-08 exempts policy/deprecation kinds).
|
|
465
|
+
const evidenceCheck = await checkExistingEvidence(workspaceRoot, targetId);
|
|
466
|
+
|
|
431
467
|
if (requiresEvidence) {
|
|
432
|
-
const evidenceCheck = await checkExistingEvidence(workspaceRoot, targetId);
|
|
433
468
|
if (!evidenceCheck.exists || evidenceCheck.overall !== "pass") {
|
|
434
469
|
violations.push({
|
|
435
470
|
rule: "RFC-IMP-06",
|
|
@@ -441,6 +476,50 @@ export async function runRfcImplementStamp(
|
|
|
441
476
|
}
|
|
442
477
|
}
|
|
443
478
|
|
|
479
|
+
// ── RFC-IMP-09: stale evidence gate (RFC-1271) ────────────────────────────
|
|
480
|
+
// Hashes are recomputed from the working tree; combined with RFC-IMP-04
|
|
481
|
+
// (the RFC file must be committed-clean to stamp) the compared bytes are
|
|
482
|
+
// effectively the committed bytes — deliberate, keeps the gate honest
|
|
483
|
+
// without a second git read. Fires before any frontmatter mutation.
|
|
484
|
+
if (evidenceCheck.exists) {
|
|
485
|
+
if (evidenceCheck.malformed || !evidenceCheck.envelope) {
|
|
486
|
+
violations.push({
|
|
487
|
+
rule: "RFC-IMP-09",
|
|
488
|
+
message: `RFC ${targetId} evidence envelope is malformed (unreadable YAML or non-object content). Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope — or delete the stale envelope file.`,
|
|
489
|
+
});
|
|
490
|
+
} else if (!hasProbes) {
|
|
491
|
+
violations.push({
|
|
492
|
+
rule: "RFC-IMP-09",
|
|
493
|
+
message: `RFC ${targetId} has a committed evidence envelope but no acceptance: list — probes were deleted after emission, which is a criteria change. Either restore the probes and re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope — or delete the stale envelope file (rfc.verification.emit skips probe-less RFCs, so re-emit alone cannot clear this).`,
|
|
494
|
+
});
|
|
495
|
+
} else {
|
|
496
|
+
const rfcMarkdown = await io.readFile(rfcFilePath);
|
|
497
|
+
const currentFileHash = byteHashHex(rfcMarkdown);
|
|
498
|
+
const currentAcceptanceHash = byteHashHex(normalizeProbes(acceptance as AcceptanceProbe[]));
|
|
499
|
+
const env = evidenceCheck.envelope;
|
|
500
|
+
if (!env.rfcFileHash || !env.acceptanceHash) {
|
|
501
|
+
violations.push({
|
|
502
|
+
rule: "RFC-IMP-09",
|
|
503
|
+
message: `RFC ${targetId} evidence envelope lacks hash fields (pre-RFC-0330 format). Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope.`,
|
|
504
|
+
});
|
|
505
|
+
} else if (
|
|
506
|
+
env.rfcFileHash !== currentFileHash ||
|
|
507
|
+
env.acceptanceHash !== currentAcceptanceHash
|
|
508
|
+
) {
|
|
509
|
+
const staleFields = [
|
|
510
|
+
env.rfcFileHash !== currentFileHash ? "rfcFileHash" : "",
|
|
511
|
+
env.acceptanceHash !== currentAcceptanceHash ? "acceptanceHash" : "",
|
|
512
|
+
]
|
|
513
|
+
.filter(Boolean)
|
|
514
|
+
.join(" + ");
|
|
515
|
+
violations.push({
|
|
516
|
+
rule: "RFC-IMP-09",
|
|
517
|
+
message: `RFC ${targetId} evidence is stale: ${staleFields} mismatch — the RFC file or its acceptance list changed after emission. Re-run: site-kernel run rfc.verification.emit --id ${targetId}, then commit the envelope.`,
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
444
523
|
// ── RFC-IMP-08: minimum-one-probe gate (RFC-0997) ─────────────────────────
|
|
445
524
|
// Post-cutoff architecture/contract/command RFCs must declare at least one
|
|
446
525
|
// acceptance probe. Policy and deprecation kinds are exempt.
|
|
@@ -470,7 +549,6 @@ export async function runRfcImplementStamp(
|
|
|
470
549
|
|
|
471
550
|
try {
|
|
472
551
|
// ── Atomic mutation ──────────────────────────────────────────────────────
|
|
473
|
-
const rfcFilePath = join(rfcDirPath, targetFile);
|
|
474
552
|
const rfcSource = await io.readFile(rfcFilePath);
|
|
475
553
|
|
|
476
554
|
const today = toIsoDate(new Date());
|
|
@@ -519,11 +597,33 @@ export async function runRfcImplementStamp(
|
|
|
519
597
|
}
|
|
520
598
|
}
|
|
521
599
|
|
|
522
|
-
// ──
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
600
|
+
// ── RFC-1271: post-stamp evidence re-emit ────────────────────────────────
|
|
601
|
+
// The frontmatter mutation above changes the bytes RFC-IMP-09 binds via
|
|
602
|
+
// rfcFileHash — without re-emission every successful stamp manufactures a
|
|
603
|
+
// stale envelope. Re-emit inside the stamp for probe-bearing RFCs so the
|
|
604
|
+
// committed envelope describes the implemented-state file. Non-fatal:
|
|
605
|
+
// the mutation is already written; a failed re-emit leaves a stale
|
|
606
|
+
// envelope the operator re-emits manually.
|
|
607
|
+
let evidenceReEmitted = false;
|
|
608
|
+
if (hasProbes) {
|
|
609
|
+
try {
|
|
610
|
+
const emitResult = await runRfcVerificationEmit(
|
|
611
|
+
{ argv: [], flags: { id: targetId } },
|
|
612
|
+
context,
|
|
613
|
+
);
|
|
614
|
+
evidenceReEmitted = emitResult.exitCode === 0;
|
|
615
|
+
if (evidenceReEmitted) {
|
|
616
|
+
evidenceRelPath = join(VERIFICATION_DIR, `${targetId.toLowerCase()}.generated.yaml`);
|
|
617
|
+
} else {
|
|
618
|
+
logger.warn(
|
|
619
|
+
`[evidence] post-stamp re-emit failed for ${targetId} — re-run: site-kernel run rfc.verification.emit --id ${targetId}`,
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
} catch (emitErr) {
|
|
623
|
+
logger.warn(
|
|
624
|
+
`[evidence] post-stamp re-emit failed for ${targetId}: ${(emitErr as Error).message}`,
|
|
625
|
+
);
|
|
626
|
+
}
|
|
527
627
|
}
|
|
528
628
|
|
|
529
629
|
if (outputFormat === "pretty") {
|
|
@@ -546,6 +646,7 @@ export async function runRfcImplementStamp(
|
|
|
546
646
|
stampedAt,
|
|
547
647
|
criteriaChecked: criteriaEval.totalChecked,
|
|
548
648
|
...(evidenceRelPath ? { evidencePath: evidenceRelPath } : {}),
|
|
649
|
+
...(hasProbes ? { evidenceReEmitted } : {}),
|
|
549
650
|
...(metricsPath ? { metricsPath } : {}),
|
|
550
651
|
},
|
|
551
652
|
violations: [],
|
|
@@ -760,6 +760,48 @@ describe("RFC-DIR-01: directory structure convention (RFC-0722)", () => {
|
|
|
760
760
|
expect(dir01).toHaveLength(0);
|
|
761
761
|
});
|
|
762
762
|
|
|
763
|
+
test("V-23 fires on non-archived implemented RFC with missing evidence", async () => {
|
|
764
|
+
const parsed = makeParsed("implemented", BASE_BODY, {
|
|
765
|
+
createdAt: "2026-10-01",
|
|
766
|
+
acceptance: [{ probe: "file-exists", path: "x.ts", criterion: "AC-1" }],
|
|
767
|
+
});
|
|
768
|
+
const { add, violations } = makeViolationsCollector();
|
|
769
|
+
await validateSingleRfc(
|
|
770
|
+
"rfc-9999-test.md",
|
|
771
|
+
parsed,
|
|
772
|
+
new Map(),
|
|
773
|
+
new Map(),
|
|
774
|
+
new Set(),
|
|
775
|
+
new Set(),
|
|
776
|
+
new Set(Object.keys(parsed.frontmatter)),
|
|
777
|
+
testWorkspace,
|
|
778
|
+
add,
|
|
779
|
+
);
|
|
780
|
+
const v23 = filterRule(violations, "V-23");
|
|
781
|
+
expect(v23).toHaveLength(1);
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
test("V-23 skips archived implemented RFCs (RFC-1271 — historical evidence drift is not debt)", async () => {
|
|
785
|
+
const parsed = makeParsed("implemented", BASE_BODY, {
|
|
786
|
+
createdAt: "2026-10-01",
|
|
787
|
+
acceptance: [{ probe: "file-exists", path: "x.ts", criterion: "AC-1" }],
|
|
788
|
+
});
|
|
789
|
+
const { add, violations } = makeViolationsCollector();
|
|
790
|
+
await validateSingleRfc(
|
|
791
|
+
"archive/implemented/rfc-9999-test.md",
|
|
792
|
+
parsed,
|
|
793
|
+
new Map(),
|
|
794
|
+
new Map(),
|
|
795
|
+
new Set(),
|
|
796
|
+
new Set(),
|
|
797
|
+
new Set(Object.keys(parsed.frontmatter)),
|
|
798
|
+
testWorkspace,
|
|
799
|
+
add,
|
|
800
|
+
);
|
|
801
|
+
const v23 = filterRule(violations, "V-23");
|
|
802
|
+
expect(v23).toHaveLength(0);
|
|
803
|
+
});
|
|
804
|
+
|
|
763
805
|
test("no warning when RFC file is in verification/ subdirectory", async () => {
|
|
764
806
|
const parsed = makeParsed("accepted", BASE_BODY);
|
|
765
807
|
const { add, violations } = makeViolationsCollector();
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-0795: add V-33 dependsOn referential integrity/self-dependency/rejected-dependency and V-34 batch slug format rules.</item>
|
|
10
9
|
<item>RFC-0997: add V-35 probe→criterion referential integrity, V-36 criterion identifier discipline, V-37 evidence mechanism validity, and computeProbeCoverage for non-blocking coverage reports.</item>
|
|
11
10
|
<item>RFC-1006: add V-38 document readiness completeness, V-39 non-atomic criterion, V-40 unbounded quantity, V-41 weasel verb, V-42 criterion versioning annotation format. Add evaluateDocumentReadiness and extend evaluateAcceptanceCriteria with supersession tracking and reject-checklist scans.</item>
|
|
12
11
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
@@ -15,7 +14,8 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
15
14
|
<item>RFC-1097: sweep — packages/forge + services clean
|
|
16
15
|
|
|
17
16
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
18
|
-
<
|
|
17
|
+
<item>RFC-1271: V-43 verificationTier enum check; V-23 archive exemption (isArchived paths skip evidence-presence — archive-freeze precedent).</item>
|
|
18
|
+
<history>RFC-0303, RFC-0722, RFC-0755, RFC-0795</history>
|
|
19
19
|
</CHANGE_SUMMARY>
|
|
20
20
|
*/
|
|
21
21
|
|
|
@@ -28,13 +28,14 @@ import { parse as yamlParse } from "yaml";
|
|
|
28
28
|
import { validateAcceptanceShape } from "../acceptance.ts";
|
|
29
29
|
import type { ParsedRfc } from "../frontmatter-io.ts";
|
|
30
30
|
import type { ReadAndParseRfcResult } from "../frontmatter-io.ts";
|
|
31
|
-
import type { RfcStatus, RfcKind, RfcScope, Marker } from "../types.ts";
|
|
31
|
+
import type { RfcStatus, RfcKind, RfcScope, RfcVerificationTier, Marker } from "../types.ts";
|
|
32
32
|
import {
|
|
33
33
|
RFC_DIR,
|
|
34
34
|
RFC_ID_PATTERN,
|
|
35
35
|
RFC_STATUSES,
|
|
36
36
|
RFC_KINDS,
|
|
37
37
|
RFC_SCOPES,
|
|
38
|
+
RFC_VERIFICATION_TIERS,
|
|
38
39
|
RFC_FULL_REQUIRED_SECTIONS,
|
|
39
40
|
RFC_METADATA_CUTOFF,
|
|
40
41
|
RFC_VERSION_BUMP_CUTOFF,
|
|
@@ -926,6 +927,20 @@ export async function validateSingleRfc(
|
|
|
926
927
|
}
|
|
927
928
|
}
|
|
928
929
|
|
|
930
|
+
// V-43: valid verificationTier (RFC-1271 — optional; absent is valid)
|
|
931
|
+
const verificationTier = fm["verificationTier"];
|
|
932
|
+
if (
|
|
933
|
+
verificationTier !== undefined &&
|
|
934
|
+
!RFC_VERIFICATION_TIERS.includes(verificationTier as RfcVerificationTier)
|
|
935
|
+
) {
|
|
936
|
+
addViolation(
|
|
937
|
+
rfcId,
|
|
938
|
+
relFile,
|
|
939
|
+
"V-43",
|
|
940
|
+
`Invalid verificationTier "${String(verificationTier)}". Must be one of: ${RFC_VERIFICATION_TIERS.join(", ")}`,
|
|
941
|
+
);
|
|
942
|
+
}
|
|
943
|
+
|
|
929
944
|
// V-15: title consistency
|
|
930
945
|
const titleStr = String(fm["title"] ?? "");
|
|
931
946
|
const headingMatch = body.match(/^#\s+(?:RFC-\d{4}:\s*)?(.+)$/m);
|
|
@@ -1106,9 +1121,12 @@ export async function validateSingleRfc(
|
|
|
1106
1121
|
}
|
|
1107
1122
|
|
|
1108
1123
|
// V-23: verification evidence for post-cutoff, probe-bearing, implemented RFCs
|
|
1124
|
+
// Skip for archived RFCs — archival freezes the document; its envelope records
|
|
1125
|
+
// the state at stamp time and probe decay over moved/renamed paths is expected
|
|
1126
|
+
// historical drift, not actionable debt (precedent: V-13/V-15 archive skips).
|
|
1109
1127
|
const createdAtStr = String(fm["createdAt"] ?? "");
|
|
1110
1128
|
const hasProbes = Array.isArray(fm["acceptance"]) && (fm["acceptance"] as unknown[]).length > 0;
|
|
1111
|
-
if (createdAtStr >= RFC_METADATA_CUTOFF && hasProbes && status === "implemented") {
|
|
1129
|
+
if (!isArchived && createdAtStr >= RFC_METADATA_CUTOFF && hasProbes && status === "implemented") {
|
|
1112
1130
|
const slug = rfcId.toLowerCase();
|
|
1113
1131
|
const evidenceRelPath = path.join(RFC_DIR, "verification", `${slug}.generated.yaml`);
|
|
1114
1132
|
const evidenceAbsPath = path.join(workspaceRoot, evidenceRelPath);
|
|
@@ -52,15 +52,24 @@ appsImpacted: []
|
|
|
52
52
|
packagesImpacted: []
|
|
53
53
|
successSignals: []
|
|
54
54
|
nonGoals: []
|
|
55
|
+
# RFC-1271: Verification tier declares the expected rigor of the acceptance
|
|
56
|
+
# portfolio — standard (default) | high | formal. Policy-level signal reviewed
|
|
57
|
+
# at acceptance; tier-to-portfolio guidance lives in
|
|
58
|
+
# packages/forge/skills/_shared/agent-operating-model.md.
|
|
59
|
+
# verificationTier: standard
|
|
55
60
|
# OPTIONAL machine-checkable acceptance probes, executed on-demand
|
|
56
61
|
# via `pnpm exec forge rfc.acceptance.run --id <this-rfc-id>` (never
|
|
57
62
|
# automatically inside build pipelines).
|
|
63
|
+
# RFC-1271: a probe MAY declare `expectationSource` — who authored the
|
|
64
|
+
# expected result: self | requirement | independent | external — and
|
|
65
|
+
# `limitations`, a free-text caveat about coverage gaps. Both optional.
|
|
58
66
|
# acceptance:
|
|
59
67
|
# - probe: run
|
|
60
68
|
# criterion: AC-1
|
|
61
|
-
# command: "
|
|
69
|
+
# command: "werkstatt run some.command.validate"
|
|
62
70
|
# expect:
|
|
63
71
|
# exitCode: 0
|
|
72
|
+
# expectationSource: independent
|
|
64
73
|
# - probe: file-exists
|
|
65
74
|
# criterion: AC-2
|
|
66
75
|
# path: "packages/my-package/src/some-new-module.ts"
|
|
@@ -234,6 +243,14 @@ interface ExampleResult {
|
|
|
234
243
|
in the same commit.
|
|
235
244
|
- Agents MUST NOT weaken or remove enforcement rules established by this RFC
|
|
236
245
|
without a new RFC that supersedes it.
|
|
246
|
+
- Agents report completion with the RFC-1271 vocabulary: IMPLEMENTED (code
|
|
247
|
+
landed), VERIFIED (independent probes pass), ACCEPTED (human/contract
|
|
248
|
+
acceptance), RELEASED (shipped to consumers). Do not claim a later state
|
|
249
|
+
than the evidence supports.
|
|
250
|
+
- Verification follows the portfolio model in
|
|
251
|
+
packages/forge/skills/_shared/agent-operating-model.md — TDD is one tool,
|
|
252
|
+
not a mandate; proportionate evidence (probes, tests, manual checks)
|
|
253
|
+
is required.
|
|
237
254
|
- If implementation reveals an invariant conflict, run
|
|
238
255
|
`pnpm exec forge rfc.supersede.propose --id <this-rfc-id> --reason "..." --invariant "DNA-N"`
|
|
239
256
|
instead of working around it.
|
package/os/rfc/rfc.module.ts
CHANGED
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
</non-goals>
|
|
8
8
|
</MODULE_CONTRACT>
|
|
9
9
|
<CHANGE_SUMMARY>
|
|
10
|
-
<item>RFC-1097: sweep — werkstatt-engine clean
|
|
11
|
-
|
|
12
|
-
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
|
|
13
10
|
<item>RFC-1173: declare mutatesState on all kernel commands — collectDeclarationDiagnostics emits error-severity MUTATES-STATE-DECLARED, command.manifest.validate is the blocking consumer in packages.check, sweep declares the flag on every command definition (factories hardcode false for read-only check specs)</item>
|
|
14
11
|
<item>RFC-1231: rfc.verification.refresh gains acceptsAllFlag: true — the declared --all flag is now reachable via werkstatt run (consumed selector re-injected as flags.all after the gate).</item>
|
|
15
12
|
<item>RFC-1237: honor dry-run via context.dryRun across kernel commands; verification envelopes keep emit-canonical ownership</item>
|
|
16
13
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
14
|
+
<item>RFC-1271: review wave — deep probe normalization, malformed-envelope fail-closed, post-stamp re-emit, honest repair hints</item>
|
|
17
15
|
<history>RFC-0260, RFC-0795, RFC-1097</history>
|
|
18
16
|
</CHANGE_SUMMARY>
|
|
19
17
|
*/
|
|
@@ -268,6 +266,11 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
268
266
|
kind: "boolean",
|
|
269
267
|
description: "Run probes and report results without writing envelope files.",
|
|
270
268
|
},
|
|
269
|
+
check: {
|
|
270
|
+
kind: "boolean",
|
|
271
|
+
description:
|
|
272
|
+
"RFC-1271: recompute evidence and compare the committed envelope against a fresh run on non-volatile fields (rfcFileHash, acceptanceHash, probes[].ok, probes.length, overall). Writes nothing; exits 1 on divergence or a missing envelope — detects forged/hand-edited evidence.",
|
|
273
|
+
},
|
|
271
274
|
concurrency: {
|
|
272
275
|
kind: "string",
|
|
273
276
|
description:
|
|
@@ -456,11 +459,14 @@ export async function createForgeRfcModule(): Promise<ForgeModule> {
|
|
|
456
459
|
description:
|
|
457
460
|
"RFC-0476: the exclusive atomic path for accepted → implemented transitions. " +
|
|
458
461
|
"Verifies preconditions (accepted status, checked+evidenced criteria, clean tree, " +
|
|
459
|
-
"reachable RFC-referencing commit, passing probe evidence
|
|
460
|
-
"
|
|
462
|
+
"reachable RFC-referencing commit, passing probe evidence, fresh evidence hashes — " +
|
|
463
|
+
"RFC-IMP-09 stale-evidence gate from RFC-1271) then atomically sets " +
|
|
464
|
+
"status: implemented, implementedAt, and updatedAt. For probe-bearing RFCs the " +
|
|
465
|
+
"evidence envelope is re-emitted post-mutation so it binds the implemented-state " +
|
|
466
|
+
"file (RFC-1271). Use --dry-run to preview. Required flags: `--id`.",
|
|
461
467
|
scope: "workspace",
|
|
462
468
|
mutatesState: true,
|
|
463
|
-
writes: ["docs/rfcs/**/*.md"],
|
|
469
|
+
writes: ["docs/rfcs/**/*.md", "docs/rfcs/verification/*.generated.yaml"],
|
|
464
470
|
generates: [],
|
|
465
471
|
reads: ["docs/rfcs/**/*.md", "docs/rfcs/verification/*.generated.yaml"],
|
|
466
472
|
cacheable: false,
|
package/os/rfc/types.ts
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* </non-goals>
|
|
13
13
|
* </MODULE_CONTRACT>
|
|
14
14
|
* * <CHANGE_SUMMARY>
|
|
15
|
-
<item>RFC-0998: added TestProbe and JsonSchemaProbe to AcceptanceProbe union for test and json-schema acceptance probe kinds.</item>
|
|
16
15
|
<item>RFC-0999: added lastRefreshedAt to VerificationEvidence; added RfcVerificationRefreshResult interface.</item>
|
|
17
16
|
<item>RFC-1097: step 6 — compass.migrate codemod run
|
|
18
17
|
|
|
@@ -21,7 +20,8 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
|
|
|
21
20
|
|
|
22
21
|
Sweep batch 2: real KEY_DECISIONS on 10 files, expanded purposes (CONTRACT-02/PURPOSE-02), headers on mission/index + gen-upstreams, sanitizeItemText in summary.record (literal Compass tags corrupted history), excludedPaths for wrangler types, test-fixtures testPattern. forge+services now 0 diagnostics under --mode error.</item>
|
|
23
22
|
<item>RFC-1249: wire werkstatt.commands.validate into packages.check + retire CMD-OUTPUT debt</item>
|
|
24
|
-
<
|
|
23
|
+
<item>RFC-1271: review wave — deep probe normalization, malformed-envelope fail-closed, post-stamp re-emit, honest repair hints</item>
|
|
24
|
+
<history>RFC-0465, RFC-0478, RFC-0480, RFC-0795, RFC-0998</history>
|
|
25
25
|
</CHANGE_SUMMARY>
|
|
26
26
|
***************************************************************/
|
|
27
27
|
|
|
@@ -88,6 +88,36 @@ export const RFC_KINDS: readonly RfcKind[] = [
|
|
|
88
88
|
export type RfcScope = "app" | "workspace";
|
|
89
89
|
|
|
90
90
|
export const RFC_SCOPES: readonly RfcScope[] = ["app", "workspace"] as const; // ─── Frontmatter ─────────────────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* RFC-1271: optional verification rigor declaration — standard (default)
|
|
94
|
+
* checks, high (adds negative-path + independent verification where it
|
|
95
|
+
* genuinely reduces risk), formal (opt-in formal/property methods for
|
|
96
|
+
* precisely specifiable properties). Tier semantics live in
|
|
97
|
+
* `.agents/skills/_shared/agent-operating-model.md`.
|
|
98
|
+
*/
|
|
99
|
+
export type RfcVerificationTier = "standard" | "high" | "formal";
|
|
100
|
+
|
|
101
|
+
export const RFC_VERIFICATION_TIERS: readonly RfcVerificationTier[] = [
|
|
102
|
+
"standard",
|
|
103
|
+
"high",
|
|
104
|
+
"formal",
|
|
105
|
+
] as const;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* RFC-1271: where a check's expected result originates. `self` is
|
|
109
|
+
* implementer-derived (diagnostic, not sole proof); `requirement` follows an
|
|
110
|
+
* accepted requirement; `independent` is fixed before/independently of the
|
|
111
|
+
* implementation; `external` comes from an authoritative external system.
|
|
112
|
+
*/
|
|
113
|
+
export type RfcExpectationSource = "self" | "requirement" | "independent" | "external";
|
|
114
|
+
|
|
115
|
+
export const RFC_EXPECTATION_SOURCES: readonly RfcExpectationSource[] = [
|
|
116
|
+
"self",
|
|
117
|
+
"requirement",
|
|
118
|
+
"independent",
|
|
119
|
+
"external",
|
|
120
|
+
] as const;
|
|
91
121
|
/**
|
|
92
122
|
* Tracks which OS commands this RFC adds, changes, or removes.
|
|
93
123
|
* Used by rfc.validate to cross-check that proposed commands
|
|
@@ -269,7 +299,12 @@ export interface RfcFrontmatter {
|
|
|
269
299
|
* site-kernel CLI itself (string must start with "site-kernel ") — no
|
|
270
300
|
* arbitrary shell, keeping the probe surface auditable and platform-independent.
|
|
271
301
|
*/
|
|
272
|
-
export
|
|
302
|
+
export interface AcceptanceProbeMeta {
|
|
303
|
+
expectationSource?: RfcExpectationSource;
|
|
304
|
+
limitations?: string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export type AcceptanceProbe = (
|
|
273
308
|
| { probe: "run"; command: string; expect: { exitCode: number }; criterion?: string }
|
|
274
309
|
| { probe: "file-exists"; path: string; criterion?: string }
|
|
275
310
|
| { probe: "file-contains"; path: string; pattern: string; criterion?: string }
|
|
@@ -300,7 +335,9 @@ export type AcceptanceProbe =
|
|
|
300
335
|
artifact: string;
|
|
301
336
|
schemaInline: Record<string, unknown>;
|
|
302
337
|
criterion?: string;
|
|
303
|
-
}
|
|
338
|
+
}
|
|
339
|
+
) &
|
|
340
|
+
AcceptanceProbeMeta;
|
|
304
341
|
|
|
305
342
|
export interface ProbeResult {
|
|
306
343
|
probe: AcceptanceProbe;
|
|
@@ -357,6 +394,9 @@ export interface RfcVerificationEmitResult {
|
|
|
357
394
|
skipped: Array<{ rfcId: string; reason: "no-probes" }>;
|
|
358
395
|
diagnostics: Diagnostic[];
|
|
359
396
|
delta?: VerificationDelta;
|
|
397
|
+
/** RFC-1271 `--check`: committed-vs-fresh comparison per RFC — populated
|
|
398
|
+
* only in check mode; `emitted` stays empty (nothing is written). */
|
|
399
|
+
check?: Array<{ rfcId: string; match: boolean; mismatches: string[] }>;
|
|
360
400
|
}
|
|
361
401
|
|
|
362
402
|
export interface RfcVerificationRefreshResult {
|
|
@@ -559,6 +599,7 @@ export interface RfcImplementStampData {
|
|
|
559
599
|
stampedAt: string;
|
|
560
600
|
criteriaChecked: number;
|
|
561
601
|
evidencePath?: string;
|
|
602
|
+
evidenceReEmitted?: boolean;
|
|
562
603
|
metricsPath?: string;
|
|
563
604
|
}
|
|
564
605
|
|
|
@@ -570,7 +611,8 @@ export type RfcImplementStampRule =
|
|
|
570
611
|
| "RFC-IMP-05"
|
|
571
612
|
| "RFC-IMP-06"
|
|
572
613
|
| "RFC-IMP-07"
|
|
573
|
-
| "RFC-IMP-08"
|
|
614
|
+
| "RFC-IMP-08"
|
|
615
|
+
| "RFC-IMP-09";
|
|
574
616
|
|
|
575
617
|
export interface RfcImplementStampViolation {
|
|
576
618
|
rule: RfcImplementStampRule;
|
|
@@ -630,6 +672,7 @@ export const RFC_KNOWN_KEYS: readonly string[] = [
|
|
|
630
672
|
"satisfies",
|
|
631
673
|
"specRef",
|
|
632
674
|
"versionBump",
|
|
675
|
+
"verificationTier",
|
|
633
676
|
"breaksC",
|
|
634
677
|
"liveSpec",
|
|
635
678
|
"dependsOn",
|