@warpgogol/forge 9.7.0 → 10.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/AGENTS.md +50 -27
- package/CHANGELOG.md +52 -0
- package/bin/cli.js +0 -0
- package/dist/os/adr/handlers/archive.d.ts.map +1 -1
- package/dist/os/adr/handlers/archive.js +3 -7
- package/dist/os/adr/handlers/archive.js.map +1 -1
- package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
- package/dist/os/adr/handlers/list-create.js +8 -6
- package/dist/os/adr/handlers/list-create.js.map +1 -1
- package/dist/os/audit/handlers/archive.d.ts.map +1 -1
- package/dist/os/audit/handlers/archive.js +3 -7
- package/dist/os/audit/handlers/archive.js.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure-symbols.js +35 -4
- package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +1 -0
- package/dist/os/core/archive-regen.d.ts.map +1 -1
- package/dist/os/core/archive-regen.js +31 -6
- package/dist/os/core/archive-regen.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +6 -69
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
- package/dist/os/core/handlers/assets-helpers.js +2 -3
- package/dist/os/core/handlers/assets-helpers.js.map +1 -1
- package/dist/os/core/handlers/determinism-check.d.ts.map +1 -1
- package/dist/os/core/handlers/determinism-check.js +2 -3
- package/dist/os/core/handlers/determinism-check.js.map +1 -1
- package/dist/os/core/handlers/pinned-check.d.ts +13 -0
- package/dist/os/core/handlers/pinned-check.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-check.js +25 -0
- package/dist/os/core/handlers/pinned-check.js.map +1 -1
- package/dist/os/core/handlers/pinned-types.d.ts +7 -0
- package/dist/os/core/handlers/pinned-types.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.js +24 -1
- package/dist/os/core/handlers/pinned-validate.js.map +1 -1
- package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
- package/dist/os/core/handlers/release-prepare.js +2 -4
- package/dist/os/core/handlers/release-prepare.js.map +1 -1
- package/dist/os/flow/digest.d.ts +73 -1
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +344 -92
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/evidence-lock.d.ts +36 -0
- package/dist/os/flow/evidence-lock.d.ts.map +1 -0
- package/dist/os/flow/evidence-lock.js +156 -0
- package/dist/os/flow/evidence-lock.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +36 -14
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/git.d.ts +50 -3
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +144 -12
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +3 -5
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-peers.js +1 -1
- package/dist/os/flow/handlers/flow-peers.js.map +1 -1
- package/dist/os/flow/handlers/flow-push.d.ts +81 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +642 -138
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/locks.d.ts +8 -0
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +6 -3
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/{mission → flow}/open-missions.d.ts +1 -2
- package/dist/os/flow/open-missions.d.ts.map +1 -0
- package/dist/os/flow/open-missions.js +37 -0
- package/dist/os/flow/open-missions.js.map +1 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +5 -3
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/registry.d.ts +9 -5
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +2 -2
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/friction/friction.module.d.ts.map +1 -1
- package/dist/os/friction/friction.module.js +30 -5
- package/dist/os/friction/friction.module.js.map +1 -1
- package/dist/os/friction/handlers/friction-add.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-add.js +10 -17
- package/dist/os/friction/handlers/friction-add.js.map +1 -1
- package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-migrate.js +188 -2
- package/dist/os/friction/handlers/friction-migrate.js.map +1 -1
- package/dist/os/friction/store.d.ts +4 -0
- package/dist/os/friction/store.d.ts.map +1 -1
- package/dist/os/friction/store.js +20 -0
- package/dist/os/friction/store.js.map +1 -1
- package/dist/os/friction/types.d.ts +12 -0
- package/dist/os/friction/types.d.ts.map +1 -1
- package/dist/os/friction/types.js +8 -0
- package/dist/os/friction/types.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +38 -5
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
- package/dist/os/plan/handlers/archive.d.ts.map +1 -1
- package/dist/os/plan/handlers/archive.js +3 -7
- package/dist/os/plan/handlers/archive.js.map +1 -1
- package/dist/os/rfc/handlers/archive.d.ts.map +1 -1
- package/dist/os/rfc/handlers/archive.js +3 -7
- package/dist/os/rfc/handlers/archive.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +15 -7
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/session/handlers/archive.d.ts.map +1 -1
- package/dist/os/session/handlers/archive.js +3 -7
- package/dist/os/session/handlers/archive.js.map +1 -1
- package/dist/os/system/handlers/system-product-register.d.ts +24 -0
- package/dist/os/system/handlers/system-product-register.d.ts.map +1 -0
- package/dist/os/system/handlers/system-product-register.js +322 -0
- package/dist/os/system/handlers/system-product-register.js.map +1 -0
- package/dist/os/system/handlers/system-products-status.d.ts +23 -0
- package/dist/os/system/handlers/system-products-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-products-status.js +235 -0
- package/dist/os/system/handlers/system-products-status.js.map +1 -0
- package/dist/os/system/schemas.d.ts +13 -0
- package/dist/os/system/schemas.d.ts.map +1 -1
- package/dist/os/system/schemas.js +15 -0
- package/dist/os/system/schemas.js.map +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +113 -3
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/src/command-modules.d.ts.map +1 -1
- package/dist/src/command-modules.js +0 -2
- package/dist/src/command-modules.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +2 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +11 -10
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +27 -2
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts +0 -5
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +6 -79
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
- package/dist/src/onboarding/npm-token-check.js +2 -2
- package/dist/src/onboarding/npm-token-check.js.map +1 -1
- package/dist/src/profiles/stack-profile.js +2 -2
- package/dist/src/types.js +2 -2
- package/dist/src/utils/hash.d.ts +1 -0
- package/dist/src/utils/hash.d.ts.map +1 -1
- package/dist/src/utils/hash.js +4 -0
- package/dist/src/utils/hash.js.map +1 -1
- package/dist/{os/mission → src/utils}/lockfile.d.ts +1 -18
- package/dist/src/utils/lockfile.d.ts.map +1 -0
- package/dist/src/utils/lockfile.js +70 -0
- package/dist/src/utils/lockfile.js.map +1 -0
- package/dist/src/utils/verifier-git.d.ts +27 -1
- package/dist/src/utils/verifier-git.d.ts.map +1 -1
- package/dist/src/utils/verifier-git.js +36 -6
- package/dist/src/utils/verifier-git.js.map +1 -1
- package/docs/reference/system-hub.md +104 -0
- package/os/adr/handlers/archive.ts +3 -11
- package/os/adr/handlers/list-create.test.ts +174 -0
- package/os/adr/handlers/list-create.ts +16 -8
- package/os/audit/handlers/archive.ts +3 -11
- package/os/codebase/handlers/codebase-measure-symbols.ts +32 -4
- package/os/core/archive-regen.ts +33 -7
- package/os/core/core.module.ts +10 -76
- package/os/core/docs-archive.test.ts +25 -0
- package/os/core/handlers/assets-helpers.ts +2 -4
- package/os/core/handlers/determinism-check.ts +2 -3
- package/os/core/handlers/lifecycle-handlers.test.ts +529 -0
- package/os/core/handlers/pinned-check.ts +30 -0
- package/os/core/handlers/pinned-types.ts +7 -0
- package/os/core/handlers/pinned-validate.ts +28 -3
- package/os/core/handlers/release-prepare.ts +2 -4
- package/os/correctness/gate/trust-boundary-cx18.test.ts +1 -1
- package/os/flow/digest.ts +436 -95
- package/os/flow/evidence-lock.ts +184 -0
- package/os/flow/flow.module.ts +37 -14
- package/os/flow/git.ts +206 -11
- package/os/flow/handlers/flow-digest.ts +12 -8
- package/os/flow/handlers/flow-peers.ts +1 -1
- package/os/flow/handlers/flow-push.ts +725 -137
- package/os/flow/locks.ts +24 -7
- package/os/flow/open-missions.ts +45 -0
- package/os/flow/preflight.ts +5 -3
- package/os/flow/registry.ts +7 -3
- package/os/flow/tests/digest-id-inputs.test.ts +106 -0
- package/os/flow/tests/digest-persist.test.ts +243 -0
- package/os/flow/tests/evidence-preflight-surface-skip.test.ts +218 -0
- package/os/flow/tests/flow-push-attest.test.ts +137 -0
- package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
- package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
- package/os/flow/tests/release-lines.test.ts +136 -0
- package/os/flow/tests/state-roots.test.ts +1 -48
- package/os/friction/friction-add.test.ts +42 -0
- package/os/friction/friction-migrate.test.ts +67 -2
- package/os/friction/friction.module.ts +33 -5
- package/os/friction/handlers/friction-add.ts +10 -15
- package/os/friction/handlers/friction-migrate.ts +220 -1
- package/os/friction/store.ts +19 -0
- package/os/friction/types.ts +8 -0
- package/os/gate/handlers/gate-probe-catalog.ts +39 -7
- package/os/gate/handlers/gate-probe-ratchet.test.ts +57 -22
- package/os/plan/handlers/archive.ts +3 -11
- package/os/rfc/handlers/archive.ts +3 -11
- package/os/rfc/handlers/list-create.ts +22 -17
- package/os/rfc/handlers/validate-corpus.test.ts +149 -0
- package/os/rfc/probe-batch.test.ts +253 -0
- package/os/rfc/verifier/rfc-1391/ac10-operating-model-policy.acceptance.test.ts +63 -0
- package/os/session/handlers/archive.ts +3 -11
- package/os/system/handlers/system-product-register.ts +492 -0
- package/os/system/handlers/system-products-status.ts +395 -0
- package/os/system/schemas.ts +17 -0
- package/os/system/system.module.ts +117 -3
- package/os/system/tests/system-product-register.test.ts +304 -0
- package/os/system/tests/system-products-status.test.ts +154 -0
- package/package.json +161 -506
- package/profiles/root-agents-system.md +82 -0
- package/profiles/system.yaml +1 -0
- package/src/command-modules.ts +0 -2
- package/src/config/forge-config.ts +16 -11
- package/src/index.ts +0 -2
- package/src/onboarding/create-superfolder-guard.test.ts +73 -0
- package/src/onboarding/create.ts +28 -2
- package/src/onboarding/doctor.ts +9 -96
- package/src/onboarding/npm-token-check.ts +3 -3
- package/src/profiles/stack-profile.ts +2 -2
- package/src/tests/evidence-consult-serialization.test.ts +202 -0
- package/src/tests/pinned-validate.test.ts +194 -0
- package/src/tests/pkg-health-self-scan.test.ts +29 -0
- package/src/tests/profile-flow-hooks.test.ts +1 -0
- package/src/tests/profile-schema.test.ts +1 -0
- package/src/tests/rfc-evidence-sync.test.ts +369 -0
- package/src/tests/skill-agents-sync.test.ts +192 -0
- package/src/tests/stack-profile.test.ts +1 -0
- package/src/types.ts +2 -2
- package/src/utils/hash.ts +5 -0
- package/src/utils/lockfile.ts +78 -0
- package/src/utils/verifier-git.ts +53 -5
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts +0 -25
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +0 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +0 -208
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +0 -1
- package/dist/os/mission/handlers/archive.d.ts +0 -4
- package/dist/os/mission/handlers/archive.d.ts.map +0 -1
- package/dist/os/mission/handlers/archive.js +0 -587
- package/dist/os/mission/handlers/archive.js.map +0 -1
- package/dist/os/mission/importer-block.d.ts +0 -19
- package/dist/os/mission/importer-block.d.ts.map +0 -1
- package/dist/os/mission/importer-block.js +0 -124
- package/dist/os/mission/importer-block.js.map +0 -1
- package/dist/os/mission/index.d.ts +0 -2
- package/dist/os/mission/index.d.ts.map +0 -1
- package/dist/os/mission/index.js +0 -15
- package/dist/os/mission/index.js.map +0 -1
- package/dist/os/mission/lockfile.d.ts.map +0 -1
- package/dist/os/mission/lockfile.js +0 -138
- package/dist/os/mission/lockfile.js.map +0 -1
- package/dist/os/mission/mission.module.d.ts +0 -3
- package/dist/os/mission/mission.module.d.ts.map +0 -1
- package/dist/os/mission/mission.module.js +0 -63
- package/dist/os/mission/mission.module.js.map +0 -1
- package/dist/os/mission/open-missions.d.ts.map +0 -1
- package/dist/os/mission/open-missions.js +0 -42
- package/dist/os/mission/open-missions.js.map +0 -1
- package/dist/os/mission/types.d.ts +0 -23
- package/dist/os/mission/types.d.ts.map +0 -1
- package/dist/os/mission/types.js +0 -19
- package/dist/os/mission/types.js.map +0 -1
- package/dist/os/werkstatt/handlers/lock.d.ts +0 -10
- package/dist/os/werkstatt/handlers/lock.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/lock.js +0 -153
- package/dist/os/werkstatt/handlers/lock.js.map +0 -1
- package/dist/os/werkstatt/handlers/schema.d.ts +0 -33
- package/dist/os/werkstatt/handlers/schema.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/schema.js +0 -42
- package/dist/os/werkstatt/handlers/schema.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +0 -15
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +0 -171
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +0 -18
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +0 -51
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +0 -11
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +0 -86
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +0 -1
- package/dist/os/werkstatt/handlers/workspace-deps.d.ts +0 -12
- package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/workspace-deps.js +0 -42
- package/dist/os/werkstatt/handlers/workspace-deps.js.map +0 -1
- package/dist/os/werkstatt/index.d.ts +0 -7
- package/dist/os/werkstatt/index.d.ts.map +0 -1
- package/dist/os/werkstatt/index.js +0 -18
- package/dist/os/werkstatt/index.js.map +0 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts +0 -3
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +0 -1
- package/dist/os/werkstatt/werkstatt.module.js +0 -91
- package/dist/os/werkstatt/werkstatt.module.js.map +0 -1
- package/os/core/handlers/forge-autonomy-validate.ts +0 -276
- package/os/correctness/gate/trust-boundary-cx19.test.ts +0 -514
- package/os/mission/handlers/archive.test.ts +0 -764
- package/os/mission/handlers/archive.ts +0 -719
- package/os/mission/handlers/ship-inflight-degraded.test.ts +0 -105
- package/os/mission/importer-block.ts +0 -119
- package/os/mission/index.ts +0 -15
- package/os/mission/lockfile.ts +0 -152
- package/os/mission/mission.module.ts +0 -68
- package/os/mission/open-missions.ts +0 -50
- package/os/mission/types.ts +0 -42
- package/os/werkstatt/handlers/lock.ts +0 -168
- package/os/werkstatt/handlers/schema.ts +0 -47
- package/os/werkstatt/handlers/werkstatt-lock-recover.ts +0 -206
- package/os/werkstatt/handlers/werkstatt-lock-status.ts +0 -82
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +0 -112
- package/os/werkstatt/handlers/workspace-deps.ts +0 -56
- package/os/werkstatt/index.ts +0 -39
- package/os/werkstatt/werkstatt.module.ts +0 -95
- package/src/tests/doctor-autonomy.test.ts +0 -246
- package/src/tests/forge-autonomy-validate.test.ts +0 -159
- package/src/tests/werkstatt-lock.test.ts +0 -357
package/os/friction/types.ts
CHANGED
|
@@ -20,6 +20,7 @@ consistent with the JSON payload. r3 review verdict: pass.</item>
|
|
|
20
20
|
<item>RFC-1601: ledger writers assign + refusals teach the violated rule (RFC-1601)
|
|
21
21
|
|
|
22
22
|
FRICTION-11 flags any out-of-vocabulary friction field value at validate, naming field+value+closed set — the mechanical detector for hand-edit corruption (F-0206/F-0244). queue.decision is the new decision-ledger writer: schema-gated append stamping createdAt/answeredAt, next-free Q-id default, QUEUE-05/QUEUE-DEC-01 refusals carrying the minimal shape. ecosystem.commit --rfc/--adr normalize bare digits or refuse EC-35 with the format statement — the F-0248 silent-injection-skip class is closed, and a summary-record failure now names the id + skipped injection. RFC-IMP-10 refusal leads with the rule statement; pipeline conventions and guides point at the command write path.</item>
|
|
23
|
+
<item>RFC-1639: additive record fields — level (repo|folder), origin, migratedFrom</item>
|
|
23
24
|
<history>RFC-1433</history>
|
|
24
25
|
</CHANGE_SUMMARY>
|
|
25
26
|
*/
|
|
@@ -64,6 +65,13 @@ export const frictionEntrySchema = z.object({
|
|
|
64
65
|
measureKind: z.enum(FRICTION_MEASURE_KINDS).optional(),
|
|
65
66
|
// RFC-1466: remediation-catalog ids this friction's scar was migrated into.
|
|
66
67
|
catalogRefs: z.array(z.string().min(1)).optional(),
|
|
68
|
+
// RFC-1639: "folder" marks records about the superfolder rather than the
|
|
69
|
+
// repo holding the registry — metadata only, never a second namespace.
|
|
70
|
+
level: z.enum(["repo", "folder"]).optional(),
|
|
71
|
+
// RFC-1639: provenance for `friction.migrate --from` ingests — the source
|
|
72
|
+
// registry's dir basename and the record's old id there.
|
|
73
|
+
origin: z.string().min(1).optional(),
|
|
74
|
+
migratedFrom: z.string().regex(FRICTION_ID_PATTERN).optional(),
|
|
67
75
|
artifacts: z.array(z.string().min(1)),
|
|
68
76
|
status: z.enum(FRICTION_STATUSES),
|
|
69
77
|
recurrences: z.number().int().min(0),
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>F-0287: union the committed check-counters projection into emittedIds — journals are worktree-local, so fresh session checkouts could never reproduce primary's firing evidence and the ratchet refused on inherited develop debt</item>
|
|
10
9
|
<item>RFC-1592: make probe-catalog liveness worktree-reproducible and exclude app-scope rules (F-0287)</item>
|
|
11
10
|
<item>F-0287 r2: union shared flow-journal refusal ids into emittedIds — integrate refusals journal {rule} to <commonGitDir>/forge/journal.jsonl, the only firing evidence that outlives session worktrees for rebase-class rules (FLOW-INT-02) no file fixture can seed</item>
|
|
12
11
|
<item>RFC-1592: union shared flow-journal refusal ids into probe-catalog emittedIds — FLOW-INT-02 and rebase-class rules keep firing evidence after the session worktree's counters journal dies with it (F-0287 r2)</item>
|
|
13
12
|
<item>RFC-1592: use synthetic FLOW-INT-99 in the shared-journal liveness test — a real rule id literal in the diff trips FLOW-INT-19's duplicate governance scan (F-0287 r2 follow-up)</item>
|
|
14
|
-
<
|
|
13
|
+
<item>RFC-1642: make the probe ratchet reproducible — bound fixture is liveness, mutating rules exempt</item>
|
|
14
|
+
<history>F-0287, RFC-1469, RFC-1485, RFC-1592</history>
|
|
15
15
|
</CHANGE_SUMMARY>
|
|
16
16
|
*/
|
|
17
17
|
|
|
@@ -237,6 +237,30 @@ async function commandScopeMap(
|
|
|
237
237
|
return out;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
/**
|
|
241
|
+
* RFC-1640 follow-up: command → mutatesState from the generated command
|
|
242
|
+
* manifest. A mutating command's rules cannot be proven by a gate.probe
|
|
243
|
+
* fixture (the probe injects a violation and invokes a CHECK command), so the
|
|
244
|
+
* ratchet exempts them the same way it exempts app-scope rules.
|
|
245
|
+
*/
|
|
246
|
+
async function commandMutatesStateMap(
|
|
247
|
+
root: string,
|
|
248
|
+
io: ReturnType<typeof resolveIo>,
|
|
249
|
+
): Promise<Map<string, boolean>> {
|
|
250
|
+
const src = await io
|
|
251
|
+
.readFile(path.join(root, "docs/command-manifest.generated.yaml"))
|
|
252
|
+
.catch(() => null);
|
|
253
|
+
const out = new Map<string, boolean>();
|
|
254
|
+
if (src === null) return out;
|
|
255
|
+
const parsed = yamlParse(src) as {
|
|
256
|
+
commands?: { name?: unknown; mutatesState?: unknown }[];
|
|
257
|
+
} | null;
|
|
258
|
+
for (const c of parsed?.commands ?? []) {
|
|
259
|
+
if (typeof c.name === "string") out.set(c.name, c.mutatesState === true);
|
|
260
|
+
}
|
|
261
|
+
return out;
|
|
262
|
+
}
|
|
263
|
+
|
|
240
264
|
export async function runGateProbeCatalog(
|
|
241
265
|
input: ForgeCommandInput,
|
|
242
266
|
context: ForgeRuntimeContext,
|
|
@@ -292,9 +316,17 @@ export async function runGateProbeCatalog(
|
|
|
292
316
|
// F-0287/RFC-1518 D-001); commands missing from the manifest stay in-domain
|
|
293
317
|
// (fail-closed).
|
|
294
318
|
const commandScope = await commandScopeMap(root, io);
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
)
|
|
319
|
+
const commandMutates = await commandMutatesStateMap(root, io);
|
|
320
|
+
// RFC-1640 follow-up: a mutating command's rule cannot be proven by a
|
|
321
|
+
// gate.probe fixture (the probe injects a violation and invokes a check),
|
|
322
|
+
// so it is exempt from the unprobed ratchet — like app-scope rules, which
|
|
323
|
+
// the app-side gate judges. Their coverage is the command's unit tests.
|
|
324
|
+
const ratchetRules = errorRules.filter((r) => {
|
|
325
|
+
if (r.command === undefined) return true;
|
|
326
|
+
if (commandScope.get(r.command) === "app") return false;
|
|
327
|
+
if (commandMutates.get(r.command) === true) return false;
|
|
328
|
+
return true;
|
|
329
|
+
});
|
|
298
330
|
const unprobedErrorRules = errorRules.filter((r) => !bound.has(r.id)).map((r) => r.id);
|
|
299
331
|
// PROBE-05: fixture bindings pointing at rules no longer declared anywhere.
|
|
300
332
|
const allDeclared = new Set(allRules.map((r) => r.id));
|
|
@@ -359,7 +391,7 @@ export async function runGateProbeCatalog(
|
|
|
359
391
|
const ratchetIds = new Set(ratchetRules.map((r) => r.id));
|
|
360
392
|
const livenessById = new Map(ratchetRules.map((r) => [r.id, livenessOf(r)]));
|
|
361
393
|
const noneRules = ratchetRules
|
|
362
|
-
.filter((r) => livenessById.get(r.id) === "none")
|
|
394
|
+
.filter((r) => !bound.has(r.id) && livenessById.get(r.id) === "none")
|
|
363
395
|
.map((r) => r.id)
|
|
364
396
|
.sort();
|
|
365
397
|
|
|
@@ -370,7 +402,7 @@ export async function runGateProbeCatalog(
|
|
|
370
402
|
// Baseline entries owned by app-scope commands are out of this surface's
|
|
371
403
|
// domain — the app-side gate judges their liveness. A rule gone from the
|
|
372
404
|
// inventory entirely is stale regardless of scope.
|
|
373
|
-
ratchetIds.has(id) ? livenessById.get(id) !== "none" : !allDeclared.has(id),
|
|
405
|
+
ratchetIds.has(id) ? bound.has(id) || livenessById.get(id) !== "none" : !allDeclared.has(id),
|
|
374
406
|
);
|
|
375
407
|
|
|
376
408
|
if (writeBaseline) {
|
|
@@ -6,32 +6,11 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-1592: probe-or-retire ratchet for blocking check rules
|
|
10
|
-
|
|
11
|
-
Every error-severity check rule now needs liveness evidence — a bound
|
|
12
|
-
gate-probe fixture that has actually run — or an explicit entry in the
|
|
13
|
-
shrink-only unprobed baseline, enforced by gate.probe.catalog --check
|
|
14
|
-
(PROBE-06/07) and wired into the worktree gate as probe-ratchet.
|
|
15
|
-
|
|
16
|
-
- probe-runs journal (docs/.index/gate-probes/runs.jsonl) records each
|
|
17
|
-
gate.probe fixture execution; shared liveness.ts joins fixtures x
|
|
18
|
-
journal for catalog + contribution report (liveness: none|fixture|fired)
|
|
19
|
-
- gate.probe.catalog --check/--write-baseline: PROBE-06 unprobed error
|
|
20
|
-
rule, PROBE-07 stale baseline entry, PROBE-08 baseline growth refusal
|
|
21
|
-
(shrink-only, no file modification), PROBE-09 expired/undeclared
|
|
22
|
-
warnOnly provisional step
|
|
23
|
-
- checks.contribution.report adds liveness to every rule record
|
|
24
|
-
- KernelPipelineStep/RuleDescriptor gain provisionalUntil; the two
|
|
25
|
-
warnOnly pipeline steps carry future dates
|
|
26
|
-
- worktree gate adds probe-ratchet step; gate-domains + forge pre-lock
|
|
27
|
-
DELTA_STEP_SPECS mirror updated
|
|
28
|
-
- build-verification policy states blocking rules are probed or retired;
|
|
29
|
-
fo-session-retro preserves probe/retire evidence for escape frictions
|
|
30
|
-
- baseline adopted at 1678 entries (forge/unprobed-baseline@1)</item>
|
|
31
9
|
<item>F-0287: committed-counters union + scope:app domain exclusion tests — evidence reproducibility across worktrees</item>
|
|
32
10
|
<item>RFC-1592: make probe-catalog liveness worktree-reproducible and exclude app-scope rules (F-0287)</item>
|
|
33
11
|
<item>RFC-1592: union shared flow-journal refusal ids into probe-catalog emittedIds — FLOW-INT-02 and rebase-class rules keep firing evidence after the session worktree's counters journal dies with it (F-0287 r2)</item>
|
|
34
12
|
<item>RFC-1592: use synthetic FLOW-INT-99 in the shared-journal liveness test — a real rule id literal in the diff trips FLOW-INT-19's duplicate governance scan (F-0287 r2 follow-up)</item>
|
|
13
|
+
<item>RFC-1642: make the probe ratchet reproducible — bound fixture is liveness, mutating rules exempt</item>
|
|
35
14
|
<history>RFC-1592</history>
|
|
36
15
|
</CHANGE_SUMMARY>
|
|
37
16
|
*/
|
|
@@ -125,6 +104,35 @@ async function writeBaseline(rules: string[]) {
|
|
|
125
104
|
);
|
|
126
105
|
}
|
|
127
106
|
|
|
107
|
+
/** Seed the inventory with a validator bound to a command (for the mutating exemption). */
|
|
108
|
+
async function seedInventoryForCommand(
|
|
109
|
+
command: string,
|
|
110
|
+
rules: { id: string; severity?: string }[],
|
|
111
|
+
) {
|
|
112
|
+
await mkdir(join(root, "docs"), { recursive: true });
|
|
113
|
+
const body = rules
|
|
114
|
+
.map((r) => ` - id: ${r.id}\n severity: ${r.severity ?? "error"}`)
|
|
115
|
+
.join("\n");
|
|
116
|
+
await writeFile(
|
|
117
|
+
join(root, "docs", "validator-inventory.generated.yaml"),
|
|
118
|
+
`contracts:\n - contract: knowledge\n validators:\n - command: ${command}\n rules:\n${body}\n`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Seed the generated command manifest with scope + mutatesState per command. */
|
|
123
|
+
async function seedCommandManifest(
|
|
124
|
+
commands: { name: string; mutatesState?: boolean; scope?: string }[],
|
|
125
|
+
) {
|
|
126
|
+
await mkdir(join(root, "docs"), { recursive: true });
|
|
127
|
+
const body = commands
|
|
128
|
+
.map(
|
|
129
|
+
(c) =>
|
|
130
|
+
` - name: ${c.name}\n scope: ${c.scope ?? "workspace"}\n mutatesState: ${c.mutatesState === true}`,
|
|
131
|
+
)
|
|
132
|
+
.join("\n");
|
|
133
|
+
await writeFile(join(root, "docs", "command-manifest.generated.yaml"), `commands:\n${body}\n`);
|
|
134
|
+
}
|
|
135
|
+
|
|
128
136
|
beforeEach(async () => {
|
|
129
137
|
root = await mkdtemp(join(tmpdir(), "probe-ratchet-"));
|
|
130
138
|
});
|
|
@@ -326,4 +334,31 @@ describe("gate.probe.catalog ratchet (RFC-1592)", () => {
|
|
|
326
334
|
expect(msg).toContain("WS-ONLY-01");
|
|
327
335
|
expect(msg).not.toContain("FLOW-INT-99");
|
|
328
336
|
});
|
|
337
|
+
|
|
338
|
+
test("RFC-1640 follow-up: a bound fixture counts as liveness without a recorded probe run (reproducible across checkouts)", async () => {
|
|
339
|
+
await seedInventory([{ id: "BOUND-NORUN-01" }]);
|
|
340
|
+
await seedFixture("BOUND-NORUN-01");
|
|
341
|
+
// No probe-run journal entry and no baseline entry — the committed fixture alone is evidence.
|
|
342
|
+
const res = await runGateProbeCatalog(flags({ check: true }), ctx());
|
|
343
|
+
expect(res.exitCode).toBe(0);
|
|
344
|
+
expect(res.data?.diagnostics ?? []).toHaveLength(0);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
test("RFC-1640 follow-up: a mutating-command error rule is exempt from the unprobed ratchet", async () => {
|
|
348
|
+
await seedInventoryForCommand("demo.mutate", [{ id: "MUT-06" }]);
|
|
349
|
+
await seedCommandManifest([{ name: "demo.mutate", mutatesState: true }]);
|
|
350
|
+
// No fixture, no baseline — a mutating command's rule cannot be probe-fixtured → exempt.
|
|
351
|
+
const res = await runGateProbeCatalog(flags({ check: true }), ctx());
|
|
352
|
+
expect(res.exitCode).toBe(0);
|
|
353
|
+
expect(res.data?.diagnostics ?? []).toHaveLength(0);
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
test("RFC-1640 follow-up: a non-mutating command's unprobed error rule still flags PROBE-06", async () => {
|
|
357
|
+
await seedInventoryForCommand("demo.check", [{ id: "CHECK-06" }]);
|
|
358
|
+
await seedCommandManifest([{ name: "demo.check", mutatesState: false }]);
|
|
359
|
+
const res = await runGateProbeCatalog(flags({ check: true }), ctx());
|
|
360
|
+
expect(res.exitCode).toBe(1);
|
|
361
|
+
const p6 = res.data?.diagnostics?.filter((d) => d.ruleId === "PROBE-06") ?? [];
|
|
362
|
+
expect(p6.map((d) => d.message).join()).toContain("CHECK-06");
|
|
363
|
+
});
|
|
329
364
|
});
|
|
@@ -28,7 +28,7 @@ import type {
|
|
|
28
28
|
} from "../../../src/types.ts";
|
|
29
29
|
import { PLAN_DIR } from "../types.ts";
|
|
30
30
|
import type { PlanArchiveResult } from "../types.ts";
|
|
31
|
-
import { loadPinnedManifest,
|
|
31
|
+
import { loadPinnedManifest, isArchiveBlocked } from "../../core/handlers/pinned-check.ts";
|
|
32
32
|
|
|
33
33
|
const TERMINAL_STATUSES = ["implemented", "rejected", "superseded"] as const;
|
|
34
34
|
|
|
@@ -98,11 +98,7 @@ export async function runPlanArchive(
|
|
|
98
98
|
|
|
99
99
|
// RFC-0733: Check if file is pinned before moving
|
|
100
100
|
// Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
|
|
101
|
-
if (
|
|
102
|
-
pinnedManifest &&
|
|
103
|
-
isPinned(pinnedManifest, relFile) &&
|
|
104
|
-
!isIntraDirMove(pinnedManifest, relFile, targetRel)
|
|
105
|
-
) {
|
|
101
|
+
if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
|
|
106
102
|
skipped.push({
|
|
107
103
|
id: rfcId,
|
|
108
104
|
file: relFile,
|
|
@@ -151,11 +147,7 @@ export async function runPlanArchive(
|
|
|
151
147
|
|
|
152
148
|
// RFC-0733: Check if file is pinned before moving
|
|
153
149
|
// Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
|
|
154
|
-
if (
|
|
155
|
-
pinnedManifest &&
|
|
156
|
-
isPinned(pinnedManifest, relFile) &&
|
|
157
|
-
!isIntraDirMove(pinnedManifest, relFile, targetRel)
|
|
158
|
-
) {
|
|
150
|
+
if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
|
|
159
151
|
skipped.push({
|
|
160
152
|
id: rfcId,
|
|
161
153
|
file: relFile,
|
|
@@ -33,7 +33,7 @@ import type {
|
|
|
33
33
|
} from "../../../src/types.ts";
|
|
34
34
|
import { RFC_DIR } from "../types.ts";
|
|
35
35
|
import { toIsoDate } from "./shared.ts";
|
|
36
|
-
import { loadPinnedManifest,
|
|
36
|
+
import { loadPinnedManifest, isArchiveBlocked } from "../../core/handlers/pinned-check.ts";
|
|
37
37
|
|
|
38
38
|
export const RFC_TERMINAL_STATUSES = ["implemented", "rejected", "superseded"] as const;
|
|
39
39
|
|
|
@@ -124,11 +124,7 @@ export async function runRfcArchive(
|
|
|
124
124
|
|
|
125
125
|
// RFC-0733: Check if file is pinned before moving
|
|
126
126
|
// Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
|
|
127
|
-
if (
|
|
128
|
-
pinnedManifest &&
|
|
129
|
-
isPinned(pinnedManifest, relFile) &&
|
|
130
|
-
!isIntraDirMove(pinnedManifest, relFile, targetRel)
|
|
131
|
-
) {
|
|
127
|
+
if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
|
|
132
128
|
skipped.push({ id, file: relFile, reason: "pinned (protected by .forge/pinned.yaml)" });
|
|
133
129
|
if (outputFormat === "pretty") {
|
|
134
130
|
logger.warn(` pinned: skipping ${relFile} (protected)`);
|
|
@@ -173,11 +169,7 @@ export async function runRfcArchive(
|
|
|
173
169
|
|
|
174
170
|
// RFC-0733: Check if file is pinned before moving
|
|
175
171
|
// Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
|
|
176
|
-
if (
|
|
177
|
-
pinnedManifest &&
|
|
178
|
-
isPinned(pinnedManifest, relFile) &&
|
|
179
|
-
!isIntraDirMove(pinnedManifest, relFile, targetRel)
|
|
180
|
-
) {
|
|
172
|
+
if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
|
|
181
173
|
skipped.push({ id, file: relFile, reason: "pinned (protected by .forge/pinned.yaml)" });
|
|
182
174
|
if (outputFormat === "pretty") {
|
|
183
175
|
logger.warn(` pinned: skipping ${relFile} (protected)`);
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
</non-goals>
|
|
7
7
|
</MODULE_CONTRACT>
|
|
8
8
|
<CHANGE_SUMMARY>
|
|
9
|
-
<item>RFC-1482: emit validation-compliant RFC skeletons and surface contract breaches at authoring time</item>
|
|
10
9
|
<item>RFC-1534: --amends flag seeds amends: and merges the draft id into the amended file's amendedBy[] in the same pass (line-level, F-0056); unreadable counterpart downgrades to a pending report.</item>
|
|
11
10
|
<item>RFC-1514: attach corrected invocations to blocking diagnostics so retry is one-shot</item>
|
|
12
11
|
<item>RFC-1536: owning-checkout routing, FLOW-OPEN-01 dirty-primary warning, shared governance-id allocation (RFC+ADR)</item>
|
|
13
12
|
<item>RFC-1546: derive-and-repair recoverable state across flow surfaces (AC-1..AC-5)</item>
|
|
14
|
-
<
|
|
13
|
+
<item>RFC-1536: degrade rfc.create session hint when the enclosing repo is unverifiable</item>
|
|
14
|
+
<history>RFC-0303, RFC-1097, RFC-1138, RFC-1139, RFC-1364, RFC-1467, RFC-1482</history>
|
|
15
15
|
</CHANGE_SUMMARY>
|
|
16
16
|
*/
|
|
17
17
|
|
|
@@ -281,8 +281,7 @@ export async function runRfcCreate(
|
|
|
281
281
|
.join("; ");
|
|
282
282
|
const reviewBand = byId(
|
|
283
283
|
scoredAll.filter(
|
|
284
|
-
(d) =>
|
|
285
|
-
TERMINAL_KINDS.has(d.kind) && d.score >= REVIEW_SCORE && d.score < REPROPOSED_SCORE,
|
|
284
|
+
(d) => TERMINAL_KINDS.has(d.kind) && d.score >= REVIEW_SCORE && d.score < REPROPOSED_SCORE,
|
|
286
285
|
),
|
|
287
286
|
);
|
|
288
287
|
const reviewBandIds = reviewBand.map((d) => d.rfcId);
|
|
@@ -439,9 +438,7 @@ export async function runRfcCreate(
|
|
|
439
438
|
const closing = content.indexOf("\n---\n");
|
|
440
439
|
if (closing !== -1) {
|
|
441
440
|
content =
|
|
442
|
-
content.slice(0, closing + 1) +
|
|
443
|
-
`acceptance:\n${stubs}\n` +
|
|
444
|
-
content.slice(closing + 1);
|
|
441
|
+
content.slice(0, closing + 1) + `acceptance:\n${stubs}\n` + content.slice(closing + 1);
|
|
445
442
|
}
|
|
446
443
|
}
|
|
447
444
|
// RFC-1467: cite the acknowledged/review-band precedents in `related`
|
|
@@ -468,14 +465,24 @@ export async function runRfcCreate(
|
|
|
468
465
|
const targetPath = path.join(rfcDirPath, fileName);
|
|
469
466
|
// RFC-1536: reserve on the shared surface BEFORE the file write — a
|
|
470
467
|
// sibling session sees the claimed id even if this write never lands.
|
|
471
|
-
const landed = new Set<number>(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
468
|
+
const landed = new Set<number>(
|
|
469
|
+
files.map((f) => {
|
|
470
|
+
const m = path.basename(f).match(/^rfc-(\d{4})/);
|
|
471
|
+
return m ? parseInt(m[1]!, 10) : 0;
|
|
472
|
+
}),
|
|
473
|
+
);
|
|
475
474
|
const reserved = await appendReservation(
|
|
476
475
|
io,
|
|
477
476
|
workspaceRoot,
|
|
478
|
-
{
|
|
477
|
+
{
|
|
478
|
+
kind: "rfc",
|
|
479
|
+
id: candidate,
|
|
480
|
+
// RFC-1536: `session` is a lifecycle hint, not a claim input — an
|
|
481
|
+
// unverifiable enclosing repo (phantom .git plant, load refusal)
|
|
482
|
+
// degrades to null like friction's "manual" attribution rather
|
|
483
|
+
// than sinking the whole create on a metadata read.
|
|
484
|
+
session: await currentBranch(workspaceRoot, io).catch(() => null),
|
|
485
|
+
},
|
|
479
486
|
landed,
|
|
480
487
|
);
|
|
481
488
|
for (const warning of reserved.warnings) {
|
|
@@ -511,11 +518,9 @@ export async function runRfcCreate(
|
|
|
511
518
|
}
|
|
512
519
|
}
|
|
513
520
|
const wrote = amendedFile
|
|
514
|
-
? await appendRfcFrontmatterListEntry(
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
[nextId],
|
|
518
|
-
)
|
|
521
|
+
? await appendRfcFrontmatterListEntry(path.join(rfcDirPath, amendedFile), "amendedBy", [
|
|
522
|
+
nextId,
|
|
523
|
+
])
|
|
519
524
|
: undefined;
|
|
520
525
|
amendsSync = { amended: amendsId, wroteCounterpart: wrote !== undefined };
|
|
521
526
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for the frontmatter-only corpus read path — readRfcFrontmatter bounded-head semantics, >64 KiB full-parse fallback, error parity, and AC-9 frontmatter parity across the real corpus (RFC-1489).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1489: frontmatter-only corpus read coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { test, expect, describe } from "vitest";
|
|
16
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { tmpdir } from "node:os";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
readRfcFrontmatter,
|
|
22
|
+
readAndParseRfc,
|
|
23
|
+
listRfcFiles,
|
|
24
|
+
} from "../frontmatter-io.ts";
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
describe("readRfcFrontmatter — AC-5/AC-6 corpus reads", () => {
|
|
28
|
+
const fmDoc = (id: string, extra = ""): string =>
|
|
29
|
+
`---\nid: ${id}\nstatus: draft\n${extra}---\n\n# Body ${id}\n\nSome body text.\n`;
|
|
30
|
+
|
|
31
|
+
test("returns frontmatter with an empty body (AC-5)", async () => {
|
|
32
|
+
const dir = mkdtempSync(join(tmpdir(), "fm-io-"));
|
|
33
|
+
try {
|
|
34
|
+
writeFileSync(join(dir, "rfc-0001-a.md"), fmDoc("RFC-0001"));
|
|
35
|
+
const res = await readRfcFrontmatter(dir, "rfc-0001-a.md");
|
|
36
|
+
expect(res && "parsed" in res ? res.parsed.frontmatter["id"] : undefined).toBe("RFC-0001");
|
|
37
|
+
expect(res && "parsed" in res ? res.parsed.body : "x").toBe("");
|
|
38
|
+
} finally {
|
|
39
|
+
rmSync(dir, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("falls back to full parse when the closing fence exceeds the bound (AC-6)", async () => {
|
|
44
|
+
const dir = mkdtempSync(join(tmpdir(), "fm-io-big-"));
|
|
45
|
+
try {
|
|
46
|
+
// A >64 KiB frontmatter block: the bounded head cannot see the fence.
|
|
47
|
+
const big = `note: "${"y".repeat(70 * 1024)}"\n`;
|
|
48
|
+
writeFileSync(join(dir, "rfc-0002-big.md"), fmDoc("RFC-0002", big));
|
|
49
|
+
const res = await readRfcFrontmatter(dir, "rfc-0002-big.md");
|
|
50
|
+
expect(res && "parsed" in res ? res.parsed.frontmatter["id"] : undefined).toBe("RFC-0002");
|
|
51
|
+
// Full-parse fallback populates the body.
|
|
52
|
+
expect(res && "parsed" in res ? res.parsed.body : "").toContain("# Body RFC-0002");
|
|
53
|
+
} finally {
|
|
54
|
+
rmSync(dir, { recursive: true, force: true });
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("small file without a closing fence yields empty frontmatter", async () => {
|
|
59
|
+
const dir = mkdtempSync(join(tmpdir(), "fm-io-nofm-"));
|
|
60
|
+
try {
|
|
61
|
+
writeFileSync(join(dir, "rfc-0003-bare.md"), "# No frontmatter\n\nbody\n");
|
|
62
|
+
const res = await readRfcFrontmatter(dir, "rfc-0003-bare.md");
|
|
63
|
+
expect(res && "parsed" in res ? res.parsed.frontmatter : { x: 1 }).toEqual({});
|
|
64
|
+
} finally {
|
|
65
|
+
rmSync(dir, { recursive: true, force: true });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("malformed YAML produces the same error variant as full parse", async () => {
|
|
70
|
+
const dir = mkdtempSync(join(tmpdir(), "fm-io-bad-"));
|
|
71
|
+
try {
|
|
72
|
+
writeFileSync(join(dir, "rfc-0004-bad.md"), "---\nid: [unclosed\n---\nbody\n");
|
|
73
|
+
const slim = await readRfcFrontmatter(dir, "rfc-0004-bad.md");
|
|
74
|
+
const full = await readAndParseRfc(dir, "rfc-0004-bad.md");
|
|
75
|
+
expect(slim && "error" in slim).toBe(true);
|
|
76
|
+
expect(full && "error" in full).toBe(true);
|
|
77
|
+
expect(slim && "error" in slim ? slim.error : "").toBe(
|
|
78
|
+
full && "error" in full ? full.error : "",
|
|
79
|
+
);
|
|
80
|
+
} finally {
|
|
81
|
+
rmSync(dir, { recursive: true, force: true });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe("AC-9 — frontmatter-only corpus produces the same rule input as full parse", () => {
|
|
87
|
+
test(
|
|
88
|
+
"every corpus file: frontmatter identical between the two paths",
|
|
89
|
+
async () => {
|
|
90
|
+
// v10 (RFC-1649): the authoring monorepo carries no hundred-file RFC
|
|
91
|
+
// corpus of its own — the v9 test scanned werkstatt's. The parity
|
|
92
|
+
// property is generic, so the corpus is synthesized here: diverse YAML
|
|
93
|
+
// shapes exercising exactly the scan/parse divergence surface (nested
|
|
94
|
+
// maps, flow + block sequences, multiline scalars, unicode, quotes,
|
|
95
|
+
// empty + malformed frontmatter).
|
|
96
|
+
const dir = mkdtempSync(join(tmpdir(), "fm-corpus-"));
|
|
97
|
+
try {
|
|
98
|
+
const shapes: Array<[string, string]> = [
|
|
99
|
+
["simple", "id: RFC-1001\nstatus: draft\n"],
|
|
100
|
+
["nested-map", "id: RFC-1002\nmeta:\n author: a\n tags:\n x: 1\n"],
|
|
101
|
+
["flow-seq", "id: RFC-1003\nrefs: [RFC-0001, RFC-0002]\n"],
|
|
102
|
+
["block-seq", "id: RFC-1004\nrefs:\n - RFC-0001\n - RFC-0002\n"],
|
|
103
|
+
["multiline-literal", "id: RFC-1005\nnote: |\n line one\n line two\n"],
|
|
104
|
+
["multiline-folded", "id: RFC-1006\nnote: >\n fold one\n fold two\n"],
|
|
105
|
+
["unicode", "id: RFC-1007\ntitle: Ünïcödé — тест\n"],
|
|
106
|
+
["quoted", 'id: RFC-1008\ntitle: "quoted: with colon"\n'],
|
|
107
|
+
["single-quoted", "id: RFC-1009\ntitle: 'single ''quote'''\n"],
|
|
108
|
+
["numbers", "id: RFC-1010\nversion: 2\nratio: 0.5\n"],
|
|
109
|
+
["booleans", "id: RFC-1011\nactive: true\narchived: false\n"],
|
|
110
|
+
["null-value", "id: RFC-1012\nsuperseded-by: null\n"],
|
|
111
|
+
["empty-fm", ""],
|
|
112
|
+
["deep-nesting", "id: RFC-1014\na:\n b:\n c:\n d: [1, 2, { e: f }]\n"],
|
|
113
|
+
["colon-in-value", "id: RFC-1015\nurl: https://example.com/x\n"],
|
|
114
|
+
["dashes-in-key", "id: RFC-1016\nx-custom-key: v\n"],
|
|
115
|
+
["long-value", `id: RFC-1017\nnote: "${"y".repeat(2000)}"\n`],
|
|
116
|
+
["mixed-types", "id: RFC-1018\nn: 1\ns: text\nb: true\nl:\n - 1\n - two\n"],
|
|
117
|
+
["indented-seq", "id: RFC-1019\nitems:\n - one\n - two\n"],
|
|
118
|
+
["comment-in-fm", "id: RFC-1020\n# a comment\nstatus: draft\n"],
|
|
119
|
+
["date-ish", "id: RFC-1021\ncreated: 2026-11-25\n"],
|
|
120
|
+
["empty-string", 'id: RFC-1022\nnote: ""\n'],
|
|
121
|
+
["anchor-free-dup", "id: RFC-1023\nx: a\ny: a\nz: a\n"],
|
|
122
|
+
["malformed-unclosed", "id: [unclosed\n"],
|
|
123
|
+
];
|
|
124
|
+
for (const [name, fm] of shapes) {
|
|
125
|
+
writeFileSync(join(dir, `rfc-${name}.md`), `---\n${fm}---\n\n# Body\n\ntext\n`);
|
|
126
|
+
}
|
|
127
|
+
const files = await listRfcFiles(dir);
|
|
128
|
+
expect(files.length).toBeGreaterThan(15);
|
|
129
|
+
for (const f of files) {
|
|
130
|
+
const slim = await readRfcFrontmatter(dir, f);
|
|
131
|
+
const full = await readAndParseRfc(dir, f);
|
|
132
|
+
if (!slim || !full) continue;
|
|
133
|
+
if ("error" in slim || "error" in full) {
|
|
134
|
+
expect("error" in slim, `error parity for ${f}`).toBe("error" in full);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
// Referential rules consume only this map — identical input means an
|
|
138
|
+
// identical violation set.
|
|
139
|
+
expect(slim.parsed.frontmatter, `frontmatter parity for ${f}`).toEqual(
|
|
140
|
+
full.parsed.frontmatter,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
} finally {
|
|
144
|
+
rmSync(dir, { recursive: true, force: true });
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
120_000,
|
|
148
|
+
);
|
|
149
|
+
});
|