@warpgogol/forge 9.3.1 → 9.4.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 +32 -0
- package/CHANGELOG.md +25 -0
- package/README.md +2 -2
- package/bin/cli.ts +4 -4
- package/dist/bin/cli.js +4 -4
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
- package/dist/os/adr/handlers/list-create.js +23 -2
- package/dist/os/adr/handlers/list-create.js.map +1 -1
- package/dist/os/adr/types.d.ts +2 -0
- package/dist/os/adr/types.d.ts.map +1 -1
- package/dist/os/adr/types.js +2 -2
- package/dist/os/adr/types.js.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.js +3 -1
- package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +6 -12
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +2 -0
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +7 -2
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +24 -14
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/conformance/conformance.module.d.ts.map +1 -1
- package/dist/os/conformance/conformance.module.js +21 -4
- package/dist/os/conformance/conformance.module.js.map +1 -1
- package/dist/os/conformance/handlers/conformance-validate.d.ts.map +1 -1
- package/dist/os/conformance/handlers/conformance-validate.js +64 -8
- package/dist/os/conformance/handlers/conformance-validate.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +99 -0
- package/dist/os/core/archive-regen.d.ts.map +1 -0
- package/dist/os/core/archive-regen.js +220 -0
- package/dist/os/core/archive-regen.js.map +1 -0
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +159 -18
- 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 +8 -3
- package/dist/os/core/handlers/assets-helpers.js.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +3 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
- package/dist/os/core/handlers/package-health.d.ts +130 -0
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +548 -7
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
- package/dist/os/core/handlers/release-prepare.js +5 -2
- package/dist/os/core/handlers/release-prepare.js.map +1 -1
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +3 -1
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/dirty-classify.d.ts +48 -0
- package/dist/os/flow/dirty-classify.d.ts.map +1 -0
- package/dist/os/flow/dirty-classify.js +81 -0
- package/dist/os/flow/dirty-classify.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +85 -19
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/gate-engine.d.ts +13 -0
- package/dist/os/flow/gate-engine.d.ts.map +1 -0
- package/dist/os/flow/gate-engine.js +32 -0
- package/dist/os/flow/gate-engine.js.map +1 -0
- package/dist/os/flow/git.d.ts +45 -4
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +95 -27
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.js +12 -5
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +25 -3
- package/dist/os/flow/handlers/flow-check.js.map +1 -1
- package/dist/os/flow/handlers/flow-cut.d.ts +4 -1
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +54 -31
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +33 -5
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +13 -10
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-hold.js +13 -7
- package/dist/os/flow/handlers/flow-hold.js.map +1 -1
- package/dist/os/flow/handlers/flow-install.d.ts +2 -1
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-install.js +56 -13
- package/dist/os/flow/handlers/flow-install.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +48 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +536 -65
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts +14 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +117 -12
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/handlers/flow-status.d.ts +13 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-status.js +35 -14
- package/dist/os/flow/handlers/flow-status.js.map +1 -1
- package/dist/os/flow/index.d.ts +1 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +3 -1
- package/dist/os/flow/index.js.map +1 -1
- package/dist/os/flow/line-version.d.ts.map +1 -1
- package/dist/os/flow/line-version.js +2 -1
- package/dist/os/flow/line-version.js.map +1 -1
- package/dist/os/flow/locks.d.ts +37 -1
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +34 -14
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/preflight.d.ts +114 -0
- package/dist/os/flow/preflight.d.ts.map +1 -0
- package/dist/os/flow/preflight.js +620 -0
- package/dist/os/flow/preflight.js.map +1 -0
- package/dist/os/flow/publish.d.ts +7 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +165 -3
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +26 -1
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +27 -6
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/scripts.d.ts +4 -0
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +8 -2
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/session-checkout.d.ts +33 -0
- package/dist/os/flow/session-checkout.d.ts.map +1 -0
- package/dist/os/flow/session-checkout.js +151 -0
- package/dist/os/flow/session-checkout.js.map +1 -0
- package/dist/os/flow/worktree-path.d.ts.map +1 -1
- package/dist/os/flow/worktree-path.js +9 -3
- package/dist/os/flow/worktree-path.js.map +1 -1
- package/dist/os/instructions/handlers/budget-validate.d.ts +1 -0
- package/dist/os/instructions/handlers/budget-validate.d.ts.map +1 -1
- package/dist/os/instructions/handlers/budget-validate.js +12 -4
- package/dist/os/instructions/handlers/budget-validate.js.map +1 -1
- package/dist/os/instructions/instructions.module.d.ts.map +1 -1
- package/dist/os/instructions/instructions.module.js +4 -1
- package/dist/os/instructions/instructions.module.js.map +1 -1
- package/dist/os/mission/open-missions.d.ts +8 -0
- package/dist/os/mission/open-missions.d.ts.map +1 -0
- package/dist/os/mission/open-missions.js +42 -0
- package/dist/os/mission/open-missions.js.map +1 -0
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +11 -1
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts +14 -0
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +18 -10
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/decision-log.d.ts.map +1 -1
- package/dist/os/rfc/decision-log.js +11 -2
- package/dist/os/rfc/decision-log.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts +23 -0
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +82 -1
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-deviations.js +24 -2
- package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +16 -3
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
- package/dist/os/rfc/handlers/index-graph.js +5 -4
- package/dist/os/rfc/handlers/index-graph.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +83 -8
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +48 -0
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +131 -2
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +21 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +77 -5
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +64 -6
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/next-id.d.ts +38 -0
- package/dist/os/rfc/next-id.d.ts.map +1 -0
- package/dist/os/rfc/next-id.js +165 -0
- package/dist/os/rfc/next-id.js.map +1 -0
- package/dist/os/rfc/probe-batch.d.ts.map +1 -1
- package/dist/os/rfc/probe-batch.js +6 -1
- package/dist/os/rfc/probe-batch.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +36 -8
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +35 -6
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +6 -6
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +81 -28
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +8 -0
- package/dist/os/rfc/verification-origin.d.ts.map +1 -1
- package/dist/os/rfc/verification-origin.js +47 -0
- package/dist/os/rfc/verification-origin.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +31 -7
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/spec/spec-schema.d.ts +8 -0
- package/dist/os/spec/spec-schema.d.ts.map +1 -1
- package/dist/os/spec/spec-schema.js +1 -0
- package/dist/os/spec/spec-schema.js.map +1 -1
- package/dist/os/spec/spec-status.d.ts +8 -0
- package/dist/os/spec/spec-status.d.ts.map +1 -1
- package/dist/os/spec/spec-status.js +18 -6
- package/dist/os/spec/spec-status.js.map +1 -1
- package/dist/os/spec/spec-validate.d.ts.map +1 -1
- package/dist/os/spec/spec-validate.js +62 -15
- package/dist/os/spec/spec-validate.js.map +1 -1
- package/dist/os/spec/spec.module.d.ts.map +1 -1
- package/dist/os/spec/spec.module.js +13 -5
- package/dist/os/spec/spec.module.js.map +1 -1
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -1
- package/dist/os/system/handlers/system-map-validate.js +2 -1
- package/dist/os/system/handlers/system-map-validate.js.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.d.ts +11 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.js +54 -6
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-create.js +6 -1
- package/dist/os/system/handlers/system-task-create.js.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.d.ts +14 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.js +246 -6
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -1
- package/dist/os/system/repo.d.ts +1 -1
- package/dist/os/system/repo.d.ts.map +1 -1
- package/dist/os/system/repo.js +53 -3
- package/dist/os/system/repo.js.map +1 -1
- package/dist/os/system/scenario-schemas.d.ts +109 -3
- package/dist/os/system/scenario-schemas.d.ts.map +1 -1
- package/dist/os/system/scenario-schemas.js +66 -10
- package/dist/os/system/scenario-schemas.js.map +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +69 -17
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/os/system/tests/contract-fixtures.d.ts +17 -0
- package/dist/os/system/tests/contract-fixtures.d.ts.map +1 -0
- package/dist/os/system/tests/contract-fixtures.js +109 -0
- package/dist/os/system/tests/contract-fixtures.js.map +1 -0
- package/dist/src/config/forge-config.d.ts +54 -18
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +41 -9
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/conformance/index.d.ts +6 -0
- package/dist/src/conformance/index.d.ts.map +1 -1
- package/dist/src/conformance/index.js +36 -1
- package/dist/src/conformance/index.js.map +1 -1
- package/dist/src/formal/proof-runner.d.ts.map +1 -1
- package/dist/src/formal/proof-runner.js +10 -2
- package/dist/src/formal/proof-runner.js.map +1 -1
- package/dist/src/migration-adapters/node-typescript-pnpm/index.js +3 -1
- package/dist/src/migration-adapters/node-typescript-pnpm/index.js.map +1 -1
- package/dist/src/migration-adapters/phaser-pnpm/index.js +3 -1
- package/dist/src/migration-adapters/phaser-pnpm/index.js.map +1 -1
- package/dist/src/onboarding/agents-generate.js +4 -4
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/nested-agents-generate.js +3 -1
- package/dist/src/onboarding/nested-agents-generate.js.map +1 -1
- package/dist/src/onboarding/scaffold-project.js +2 -2
- package/dist/src/onboarding/scaffold-project.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +14 -2
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -1
- package/dist/src/onboarding/workspace-discovery.js +3 -1
- package/dist/src/onboarding/workspace-discovery.js.map +1 -1
- package/dist/src/skill-schema.d.ts +3 -0
- package/dist/src/skill-schema.d.ts.map +1 -1
- package/dist/src/skill-schema.js +9 -2
- package/dist/src/skill-schema.js.map +1 -1
- package/dist/src/spec/resolve-spec-source.d.ts +45 -0
- package/dist/src/spec/resolve-spec-source.d.ts.map +1 -0
- package/dist/src/spec/resolve-spec-source.js +153 -0
- package/dist/src/spec/resolve-spec-source.js.map +1 -0
- package/dist/src/utils/command-inventory.d.ts +28 -0
- package/dist/src/utils/command-inventory.d.ts.map +1 -0
- package/dist/src/utils/command-inventory.js +84 -0
- package/dist/src/utils/command-inventory.js.map +1 -0
- package/dist/src/utils/io.d.ts.map +1 -1
- package/dist/src/utils/io.js +6 -1
- package/dist/src/utils/io.js.map +1 -1
- package/dist/src/utils/repo-path.d.ts +10 -0
- package/dist/src/utils/repo-path.d.ts.map +1 -0
- package/dist/src/utils/repo-path.js +52 -0
- package/dist/src/utils/repo-path.js.map +1 -0
- package/dist/src/utils/spawn.d.ts +23 -0
- package/dist/src/utils/spawn.d.ts.map +1 -0
- package/dist/src/utils/spawn.js +83 -0
- package/dist/src/utils/spawn.js.map +1 -0
- package/docs/branch-model.md +1 -1
- package/docs/guides/existing-project.md +1 -1
- package/docs/maintainers/publishing.md +1 -1
- package/docs/reference/cli.md +8 -2
- package/docs/reference/profiles.md +1 -1
- package/os/adr/handlers/list-create.ts +26 -2
- package/os/adr/types.ts +4 -2
- package/os/compass/handlers/compass-audit-handler.ts +6 -1
- package/os/compass/handlers/compass-header-scaffold-handler.ts +12 -11
- package/os/compass/handlers/git-revision.ts +8 -2
- package/os/compass/handlers/summary-record.ts +25 -14
- package/os/compass/handlers/tests/compass-invariant-binding.test.ts +3 -2
- package/os/conformance/conformance.module.ts +21 -4
- package/os/conformance/handlers/conformance-validate.ts +108 -16
- package/os/conformance/handlers/tests/conformance-package-consumer.test.ts +200 -0
- package/os/core/archive-regen.ts +279 -0
- package/os/core/core.module.ts +176 -29
- package/os/core/docs-archive.test.ts +413 -3
- package/os/core/handlers/assets-helpers.ts +8 -3
- package/os/core/handlers/forge-autonomy-validate.ts +3 -1
- package/os/core/handlers/package-health.test.ts +418 -4
- package/os/core/handlers/package-health.ts +629 -7
- package/os/core/handlers/release-prepare.ts +5 -2
- package/os/flow/digest.ts +3 -1
- package/os/flow/dirty-classify.ts +112 -0
- package/os/flow/flow.module.ts +92 -24
- package/os/flow/gate-engine.ts +45 -0
- package/os/flow/git.ts +117 -29
- package/os/flow/handlers/flow-backmerge.ts +14 -4
- package/os/flow/handlers/flow-check.ts +27 -2
- package/os/flow/handlers/flow-cut.ts +97 -46
- package/os/flow/handlers/flow-discard.ts +33 -5
- package/os/flow/handlers/flow-fix.ts +22 -10
- package/os/flow/handlers/flow-hold.ts +20 -7
- package/os/flow/handlers/flow-install.ts +59 -12
- package/os/flow/handlers/flow-integrate.ts +808 -182
- package/os/flow/handlers/flow-open.ts +135 -11
- package/os/flow/handlers/flow-status.ts +45 -13
- package/os/flow/index.ts +3 -1
- package/os/flow/line-version.ts +2 -1
- package/os/flow/locks.ts +56 -14
- package/os/flow/preflight.ts +763 -0
- package/os/flow/publish.ts +200 -5
- package/os/flow/registry.ts +43 -7
- package/os/flow/scripts.ts +13 -2
- package/os/flow/session-checkout.ts +186 -0
- package/os/flow/tests/dirty-classify.test.ts +116 -0
- package/os/flow/tests/fixtures/branch-names.yaml +40 -40
- package/os/flow/tests/flow-discard.test.ts +32 -0
- package/os/flow/tests/flow-guard-parity.test.ts +10 -2
- package/os/flow/tests/flow-install.test.ts +7 -3
- package/os/flow/tests/flow-integrate.gate-report.test.ts +144 -0
- package/os/flow/tests/flow-integrate.preflight.test.ts +561 -0
- package/os/flow/tests/flow-integrate.reattach.test.ts +197 -0
- package/os/flow/tests/flow-integrate.remediation.test.ts +254 -0
- package/os/flow/tests/flow-integrate.test.ts +348 -17
- package/os/flow/tests/flow-open.pending.test.ts +277 -0
- package/os/flow/tests/flow-open.test.ts +52 -9
- package/os/flow/tests/flow-push-publish.test.ts +124 -0
- package/os/flow/tests/flow-status.test.ts +31 -1
- package/os/flow/tests/locks.test.ts +39 -3
- package/os/flow/tests/scripts.test.ts +5 -2
- package/os/flow/tests/state-roots.test.ts +8 -5
- package/os/flow/worktree-path.ts +9 -3
- package/os/formal/handlers/proof-check.test.ts +6 -3
- package/os/instructions/budget.test.ts +31 -0
- package/os/instructions/handlers/budget-validate.ts +13 -4
- package/os/instructions/instructions.module.ts +4 -1
- package/os/mission/open-missions.ts +50 -0
- package/os/queue/decision-ledger.test.ts +18 -0
- package/os/queue/manifest.ts +17 -1
- package/os/rfc/acceptance.ts +30 -10
- package/os/rfc/decision-log.ts +13 -2
- package/os/rfc/frontmatter-io.ts +89 -1
- package/os/rfc/handlers/implement-stamp-deviations.test.ts +83 -0
- package/os/rfc/handlers/implement-stamp-deviations.ts +22 -2
- package/os/rfc/handlers/implement-stamp-stale.test.ts +5 -1
- package/os/rfc/handlers/implement-stamp.ts +16 -3
- package/os/rfc/handlers/index-graph.ts +5 -4
- package/os/rfc/handlers/lifecycle.test.ts +136 -0
- package/os/rfc/handlers/list-create.test.ts +82 -0
- package/os/rfc/handlers/list-create.ts +101 -8
- package/os/rfc/handlers/rfc-evidence-sync.test.ts +504 -0
- package/os/rfc/handlers/rfc-evidence-sync.ts +192 -2
- package/os/rfc/handlers/tests/index-graph.test.ts +2 -1
- package/os/rfc/handlers/validate-rules-rfc1454.test.ts +73 -0
- package/os/rfc/handlers/validate-rules.ts +103 -7
- package/os/rfc/handlers/validate.ts +68 -4
- package/os/rfc/next-id.ts +232 -0
- package/os/rfc/probe-batch.ts +6 -1
- package/os/rfc/rfc.module.ts +41 -8
- package/os/rfc/types.ts +28 -6
- package/os/rfc/verification-emit-freshness.test.ts +5 -1
- package/os/rfc/verification-emit.test.ts +5 -1
- package/os/rfc/verification-evidence.ts +99 -33
- package/os/rfc/verification-origin.ts +59 -0
- package/os/rfc/verification-refresh.test.ts +5 -1
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +5 -1
- package/os/session/handlers/save.ts +35 -7
- package/os/session/tests/session-save.test.ts +154 -0
- package/os/spec/spec-schema.ts +3 -0
- package/os/spec/spec-status.ts +22 -6
- package/os/spec/spec-validate.package-source.test.ts +187 -0
- package/os/spec/spec-validate.ts +65 -14
- package/os/spec/spec.module.ts +13 -5
- package/os/system/handlers/system-map-validate.ts +4 -2
- package/os/system/handlers/system-outbox-scan.ts +65 -21
- package/os/system/handlers/system-task-create.ts +6 -1
- package/os/system/handlers/system-versionset-record.ts +301 -16
- package/os/system/repo.ts +59 -18
- package/os/system/scenario-schemas.ts +91 -12
- package/os/system/system.module.ts +70 -17
- package/os/system/tests/contract-fixtures.ts +139 -0
- package/os/system/tests/scenario-pin-drift-check.test.ts +114 -0
- package/os/system/tests/scenario-validator-check.test.ts +96 -0
- package/os/system/tests/system-task-dispatch.test.ts +4 -1
- package/os/system/tests/system-versionset.test.ts +7 -3
- package/os/system/tests/version-set-v2.test.ts +78 -0
- package/package.json +9 -1
- package/skills/fo/fo-doctor/SKILL.md +151 -0
- package/skills/fo/fo-handoff/SKILL.md +22 -0
- package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +2 -1
- package/skills/fo/fo-idea-implement/SKILL.md +5 -2
- package/skills/fo/fo-idea-plan/SKILL.md +5 -5
- package/skills/fo/fo-session-retro/SKILL.md +37 -11
- package/skills/fo/fo-spec-ingest/SKILL.md +8 -0
- package/skills/fo/fo-system-dispatch/SKILL.md +1 -0
- package/skills/meta/skill-create/SKILL.md +2 -1
- package/src/bin-entry.test.ts +3 -1
- package/src/config/forge-config.ts +57 -13
- package/src/conformance/index.ts +46 -1
- package/src/formal/proof-runner.ts +10 -2
- package/src/migration-adapters/node-typescript-pnpm/index.ts +3 -1
- package/src/migration-adapters/phaser-pnpm/index.ts +3 -1
- package/src/onboarding/agents-generate.ts +4 -4
- package/src/onboarding/nested-agents-generate.ts +3 -1
- package/src/onboarding/scaffold-project.ts +2 -2
- package/src/onboarding/upgrade.ts +13 -2
- package/src/onboarding/workspace-discovery.ts +3 -1
- package/src/pipeline-status.test.ts +1 -1
- package/src/skill-schema.ts +9 -2
- package/src/spec/resolve-spec-source.ts +184 -0
- package/src/tests/acceptance-probe-kinds.test.ts +3 -1
- package/src/tests/agents-generate-domain.test.ts +3 -2
- package/src/tests/agents-generate.test.ts +2 -1
- package/src/tests/create-flow.test.ts +3 -1
- package/src/tests/create.test.ts +12 -2
- package/src/tests/editable-generated-region.test.ts +2 -2
- package/src/tests/fixtures/agents-generate-business-before.txt +2 -0
- package/src/tests/implement-stamp.test.ts +5 -2
- package/src/tests/rfc-implement-stamp-governance.test.ts +6 -2
- package/src/tests/rfc-verification-verdict-ingest.test.ts +5 -1
- package/src/tests/scaffold-project.test.ts +3 -1
- package/src/tests/upgrade.test.ts +79 -3
- package/src/tests/workspace-discovery.test.ts +4 -3
- package/src/utils/command-inventory.ts +105 -0
- package/src/utils/io.ts +6 -1
- package/src/utils/repo-path.ts +49 -0
- package/src/utils/spawn.ts +88 -0
- package/src/tests/rfc-evidence-sync.test.ts +0 -369
- package/src/tests/skill-agents-sync.test.ts +0 -192
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for RFC-1516: the evidence-freshness window in the stamp-sync
|
|
5
|
+
chain — committed-envelope reuse gating (evaluateEvidenceReuse +
|
|
6
|
+
readCommittedEnvelope), heavy-vs-cheap probe partitioning in
|
|
7
|
+
rfc.verification.emit, and --no-evidence-reuse flag forwarding/report
|
|
8
|
+
surfacing in rfc.evidence.sync.
|
|
9
|
+
</purpose>
|
|
10
|
+
<non-goals>
|
|
11
|
+
<item>Not a contract source of truth — the modules under test own the
|
|
12
|
+
authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1516: initial suite — reuse eligibility gates (AC-1/2/5/6),
|
|
17
|
+
journal provenance (AC-3), --no-evidence-reuse (AC-4), kind
|
|
18
|
+
classification, and sync-side flag forwarding.</item>
|
|
19
|
+
<item>RFC-1516: add an evidence-freshness window to the stamp-sync chain for rfc-1516</item>
|
|
20
|
+
<item>RFC-1516: bind evidence reuse to the oldest replayed result and harden committed-envelope reads for rfc-1516</item>
|
|
21
|
+
</CHANGE_SUMMARY>
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// @vitest-environment node
|
|
25
|
+
import { test, expect, describe, vi, beforeEach } from "vitest";
|
|
26
|
+
import fs from "node:fs/promises";
|
|
27
|
+
import { execFileSync } from "node:child_process";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import os from "node:os";
|
|
30
|
+
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
31
|
+
|
|
32
|
+
import { runRfcVerificationEmit } from "../verification-evidence.ts";
|
|
33
|
+
import {
|
|
34
|
+
EVIDENCE_REUSE_WINDOW_MS,
|
|
35
|
+
EVIDENCE_SYNC_EMIT_STEP,
|
|
36
|
+
EVIDENCE_SYNC_STEPS,
|
|
37
|
+
evaluateEvidenceReuse,
|
|
38
|
+
runRfcEvidenceSync,
|
|
39
|
+
} from "./rfc-evidence-sync.ts";
|
|
40
|
+
import { classifyProbeReuse } from "../acceptance.ts";
|
|
41
|
+
import type { ForgeCommandInput, ForgeRuntimeContext } from "../../../src/types.ts";
|
|
42
|
+
|
|
43
|
+
const { mockRunProbe } = vi.hoisted(() => ({
|
|
44
|
+
mockRunProbe: vi.fn(),
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
vi.mock("../acceptance.ts", async (importOriginal) => {
|
|
48
|
+
const orig = await importOriginal<typeof import("../acceptance.ts")>();
|
|
49
|
+
return {
|
|
50
|
+
...orig,
|
|
51
|
+
runProbeSet: async (probes: unknown[], opts: Record<string, unknown>) => {
|
|
52
|
+
const results = [];
|
|
53
|
+
const durationsMs = [];
|
|
54
|
+
for (const p of probes) {
|
|
55
|
+
results.push(
|
|
56
|
+
await mockRunProbe(
|
|
57
|
+
p,
|
|
58
|
+
opts.workspaceRoot,
|
|
59
|
+
opts.commandRegistry,
|
|
60
|
+
opts.forgeRoot,
|
|
61
|
+
opts.outcomeSession,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
durationsMs.push(0);
|
|
65
|
+
}
|
|
66
|
+
return { results, durationsMs };
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const RFC_MD = (id: string, probeYaml: string) => `---
|
|
72
|
+
id: ${id}
|
|
73
|
+
title: "Test ${id}"
|
|
74
|
+
status: accepted
|
|
75
|
+
kind: command
|
|
76
|
+
scope: workspace
|
|
77
|
+
owners:
|
|
78
|
+
- architecture
|
|
79
|
+
createdAt: 2026-01-01
|
|
80
|
+
updatedAt: 2026-01-01
|
|
81
|
+
acceptance:
|
|
82
|
+
${probeYaml}
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
# ${id}
|
|
86
|
+
## Context
|
|
87
|
+
Test.
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const HEAVY_AND_CHEAP = ` - probe: test
|
|
91
|
+
file: x.test.ts
|
|
92
|
+
criterion: AC-1
|
|
93
|
+
expect:
|
|
94
|
+
exitCode: 0
|
|
95
|
+
- probe: file-contains
|
|
96
|
+
path: packages/forge/AGENTS.md
|
|
97
|
+
pattern: anything
|
|
98
|
+
criterion: AC-2
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
function git(root: string, args: string[]) {
|
|
102
|
+
execFileSync("git", args, { cwd: root, stdio: "pipe" });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function setupRepo(): Promise<{ root: string }> {
|
|
106
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), "rfc-1516-sync-"));
|
|
107
|
+
await fs.mkdir(path.join(root, "docs", "rfcs", "verification"), { recursive: true });
|
|
108
|
+
await fs.mkdir(path.join(root, "packages", "forge"), { recursive: true });
|
|
109
|
+
await fs.writeFile(path.join(root, "packages", "forge", "AGENTS.md"), "# x\n");
|
|
110
|
+
git(root, ["init", "-q"]);
|
|
111
|
+
git(root, ["config", "user.email", "t@t"]);
|
|
112
|
+
git(root, ["config", "user.name", "t"]);
|
|
113
|
+
return { root };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const emit = (root: string, flags: Record<string, unknown>) =>
|
|
117
|
+
runRfcVerificationEmit(
|
|
118
|
+
{ argv: [], flags } as unknown as ForgeCommandInput,
|
|
119
|
+
{
|
|
120
|
+
workspaceRoot: root,
|
|
121
|
+
logger: { info: () => {}, warn: () => {} },
|
|
122
|
+
outputFormat: "json",
|
|
123
|
+
dryRun: false,
|
|
124
|
+
} as unknown as ForgeRuntimeContext,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
async function writeRfc(root: string, id: string, probeYaml = HEAVY_AND_CHEAP) {
|
|
128
|
+
await fs.writeFile(path.join(root, "docs", "rfcs", `${id.toLowerCase()}-t.md`), RFC_MD(id, probeYaml));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const envelopePath = (root: string, id: string) =>
|
|
132
|
+
path.join(root, "docs", "rfcs", "verification", `${id.toLowerCase()}.generated.yaml`);
|
|
133
|
+
|
|
134
|
+
/** Emit once with all-ok probes, then commit — HEAD now holds a green,
|
|
135
|
+
* in-window envelope with a matching acceptanceHash. */
|
|
136
|
+
async function commitGreenEnvelope(root: string, id: string) {
|
|
137
|
+
mockRunProbe.mockResolvedValue({ ok: true, detail: "ok" });
|
|
138
|
+
const first = await emit(root, { id });
|
|
139
|
+
expect(first.exitCode).toBe(0);
|
|
140
|
+
const committed = yamlParse(await fs.readFile(envelopePath(root, id), "utf8")) as {
|
|
141
|
+
emittedAt: string;
|
|
142
|
+
acceptanceHash: string;
|
|
143
|
+
};
|
|
144
|
+
git(root, ["add", "-A"]);
|
|
145
|
+
git(root, ["commit", "-qm", "seed"]);
|
|
146
|
+
mockRunProbe.mockClear();
|
|
147
|
+
return committed;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
beforeEach(() => {
|
|
151
|
+
mockRunProbe.mockReset();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe("classifyProbeReuse", () => {
|
|
155
|
+
test("run/test/page/proof are reusable; cheap kinds re-run; unknown is unchecked", () => {
|
|
156
|
+
for (const k of ["run", "test", "page", "proof"]) {
|
|
157
|
+
expect(classifyProbeReuse(k)).toBe("reusable");
|
|
158
|
+
}
|
|
159
|
+
for (const k of [
|
|
160
|
+
"file-exists",
|
|
161
|
+
"file-contains",
|
|
162
|
+
"command-registered",
|
|
163
|
+
"json-schema",
|
|
164
|
+
"reachable",
|
|
165
|
+
]) {
|
|
166
|
+
expect(classifyProbeReuse(k)).toBe("cheap");
|
|
167
|
+
}
|
|
168
|
+
expect(classifyProbeReuse("future-kind")).toBe("unchecked");
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe("evaluateEvidenceReuse", () => {
|
|
173
|
+
const env = (over: Record<string, unknown> = {}) =>
|
|
174
|
+
({
|
|
175
|
+
overall: "pass",
|
|
176
|
+
emittedAt: new Date().toISOString(),
|
|
177
|
+
acceptanceHash: "abc",
|
|
178
|
+
probes: [],
|
|
179
|
+
...over,
|
|
180
|
+
}) as never;
|
|
181
|
+
|
|
182
|
+
test("green + matching + in-window is reusable with provenance", () => {
|
|
183
|
+
const emittedAt = new Date().toISOString();
|
|
184
|
+
const v = evaluateEvidenceReuse({
|
|
185
|
+
committed: env({ emittedAt }),
|
|
186
|
+
acceptanceHashHex: "abc",
|
|
187
|
+
disabled: false,
|
|
188
|
+
});
|
|
189
|
+
expect(v).toEqual({ reusable: true, reason: "envelope-reused", reusedFrom: emittedAt });
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("each gate fails closed with its reason", () => {
|
|
193
|
+
const base = { committed: env(), acceptanceHashHex: "abc", disabled: false };
|
|
194
|
+
expect(evaluateEvidenceReuse({ ...base, disabled: true }).reason).toBe("disabled");
|
|
195
|
+
expect(evaluateEvidenceReuse({ ...base, committed: null }).reason).toBe("absent");
|
|
196
|
+
expect(evaluateEvidenceReuse({ ...base, malformed: true }).reason).toBe("malformed");
|
|
197
|
+
expect(
|
|
198
|
+
evaluateEvidenceReuse({ ...base, committed: env({ overall: "fail" }) }).reason,
|
|
199
|
+
).toBe("not-green");
|
|
200
|
+
expect(
|
|
201
|
+
evaluateEvidenceReuse({ ...base, committed: env({ acceptanceHash: "other" }) }).reason,
|
|
202
|
+
).toBe("acceptance-changed");
|
|
203
|
+
const old = new Date(Date.now() - EVIDENCE_REUSE_WINDOW_MS - 1).toISOString();
|
|
204
|
+
expect(evaluateEvidenceReuse({ ...base, committed: env({ emittedAt: old }) }).reason).toBe(
|
|
205
|
+
"expired",
|
|
206
|
+
);
|
|
207
|
+
expect(evaluateEvidenceReuse({ ...base, committed: env({ emittedAt: "bogus" }) }).reason).toBe(
|
|
208
|
+
"expired",
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test("window boundary: exactly EVIDENCE_REUSE_WINDOW_MS old still reuses", () => {
|
|
213
|
+
const now = Date.now();
|
|
214
|
+
const emittedAt = new Date(now - EVIDENCE_REUSE_WINDOW_MS).toISOString();
|
|
215
|
+
expect(
|
|
216
|
+
evaluateEvidenceReuse({
|
|
217
|
+
committed: env({ emittedAt }),
|
|
218
|
+
acceptanceHashHex: "abc",
|
|
219
|
+
disabled: false,
|
|
220
|
+
now,
|
|
221
|
+
}).reusable,
|
|
222
|
+
).toBe(true);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
describe("rfc.verification.emit — evidence-freshness reuse (RFC-1516)", () => {
|
|
227
|
+
test("AC-1/AC-3: in-window green envelope replays heavy probes, cheap probes re-resolve, journal records provenance", async () => {
|
|
228
|
+
const { root } = await setupRepo();
|
|
229
|
+
await writeRfc(root, "RFC-9991");
|
|
230
|
+
const committed = await commitGreenEnvelope(root, "RFC-9991");
|
|
231
|
+
|
|
232
|
+
const result = await emit(root, { id: "RFC-9991" });
|
|
233
|
+
expect(result.exitCode).toBe(0);
|
|
234
|
+
// Only the cheap file-contains probe re-executed — the test probe's
|
|
235
|
+
// committed record replayed without a subprocess.
|
|
236
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(1);
|
|
237
|
+
const firstCallArg = (mockRunProbe.mock.calls[0] as unknown[])[0] as { probe: string };
|
|
238
|
+
expect(firstCallArg.probe).toBe("file-contains");
|
|
239
|
+
|
|
240
|
+
const entry = result.data!.emitted![0]!;
|
|
241
|
+
expect(entry.reuse).toEqual({
|
|
242
|
+
reusable: true,
|
|
243
|
+
reason: "envelope-reused",
|
|
244
|
+
reusedFrom: committed.emittedAt,
|
|
245
|
+
});
|
|
246
|
+
expect(entry.heavyProbesReused).toEqual(["AC-1"]);
|
|
247
|
+
expect(entry.cheapProbesReRun).toEqual(["AC-2"]);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
test("AC-2: acceptanceHash mismatch re-executes every probe", async () => {
|
|
251
|
+
const { root } = await setupRepo();
|
|
252
|
+
await writeRfc(root, "RFC-9992");
|
|
253
|
+
await commitGreenEnvelope(root, "RFC-9992");
|
|
254
|
+
// Mutate the live acceptance list — the committed hash no longer matches.
|
|
255
|
+
await writeRfc(
|
|
256
|
+
root,
|
|
257
|
+
"RFC-9992",
|
|
258
|
+
`${HEAVY_AND_CHEAP} - probe: file-exists\n path: packages/forge/AGENTS.md\n criterion: AC-3\n`,
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
const result = await emit(root, { id: "RFC-9992" });
|
|
262
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(3);
|
|
263
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("acceptance-changed");
|
|
264
|
+
expect(result.data!.emitted![0]!.heavyProbesReused).toBeUndefined();
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
test("AC-4: --no-evidence-reuse re-executes every probe and journals 'disabled'", async () => {
|
|
268
|
+
const { root } = await setupRepo();
|
|
269
|
+
await writeRfc(root, "RFC-9993");
|
|
270
|
+
await commitGreenEnvelope(root, "RFC-9993");
|
|
271
|
+
|
|
272
|
+
const result = await emit(root, { id: "RFC-9993", "no-evidence-reuse": true });
|
|
273
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
274
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("disabled");
|
|
275
|
+
expect(result.data!.emitted![0]!.reuse?.reusable).toBe(false);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test("AC-5: absent committed envelope → full re-execution with reason 'absent'", async () => {
|
|
279
|
+
const { root } = await setupRepo();
|
|
280
|
+
await writeRfc(root, "RFC-9994");
|
|
281
|
+
git(root, ["add", "-A"]);
|
|
282
|
+
git(root, ["commit", "-qm", "seed"]);
|
|
283
|
+
mockRunProbe.mockResolvedValue({ ok: true, detail: "ok" });
|
|
284
|
+
|
|
285
|
+
const result = await emit(root, { id: "RFC-9994" });
|
|
286
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
287
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("absent");
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
test("AC-5: malformed committed envelope → full re-execution with reason 'malformed'", async () => {
|
|
291
|
+
const { root } = await setupRepo();
|
|
292
|
+
await writeRfc(root, "RFC-9995");
|
|
293
|
+
await fs.writeFile(envelopePath(root, "RFC-9995"), "::: not an envelope :::\n");
|
|
294
|
+
git(root, ["add", "-A"]);
|
|
295
|
+
git(root, ["commit", "-qm", "seed"]);
|
|
296
|
+
mockRunProbe.mockResolvedValue({ ok: true, detail: "ok" });
|
|
297
|
+
|
|
298
|
+
const result = await emit(root, { id: "RFC-9995" });
|
|
299
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
300
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("malformed");
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
test("AC-6: non-green committed envelope is never reused", async () => {
|
|
304
|
+
const { root } = await setupRepo();
|
|
305
|
+
await writeRfc(root, "RFC-9996");
|
|
306
|
+
await commitGreenEnvelope(root, "RFC-9996");
|
|
307
|
+
// Flip the committed envelope to fail — reuse must refuse.
|
|
308
|
+
const env = yamlParse(await fs.readFile(envelopePath(root, "RFC-9996"), "utf8")) as Record<
|
|
309
|
+
string,
|
|
310
|
+
unknown
|
|
311
|
+
>;
|
|
312
|
+
env.overall = "fail";
|
|
313
|
+
await fs.writeFile(envelopePath(root, "RFC-9996"), yamlStringify(env));
|
|
314
|
+
git(root, ["add", "-A"]);
|
|
315
|
+
git(root, ["commit", "-qm", "flip"]);
|
|
316
|
+
|
|
317
|
+
const result = await emit(root, { id: "RFC-9996" });
|
|
318
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
319
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("not-green");
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
test("expired envelope (emittedAt beyond the window) re-executes", async () => {
|
|
323
|
+
const { root } = await setupRepo();
|
|
324
|
+
await writeRfc(root, "RFC-9997");
|
|
325
|
+
await commitGreenEnvelope(root, "RFC-9997");
|
|
326
|
+
const env = yamlParse(await fs.readFile(envelopePath(root, "RFC-9997"), "utf8")) as Record<
|
|
327
|
+
string,
|
|
328
|
+
unknown
|
|
329
|
+
>;
|
|
330
|
+
env.emittedAt = new Date(Date.now() - EVIDENCE_REUSE_WINDOW_MS - 60_000).toISOString();
|
|
331
|
+
await fs.writeFile(envelopePath(root, "RFC-9997"), yamlStringify(env));
|
|
332
|
+
git(root, ["add", "-A"]);
|
|
333
|
+
git(root, ["commit", "-qm", "age"]);
|
|
334
|
+
|
|
335
|
+
const result = await emit(root, { id: "RFC-9997" });
|
|
336
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
337
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("expired");
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
test("anchor chain: stale `resultsFrom` defeats reuse even under a fresh emittedAt", async () => {
|
|
341
|
+
const { root } = await setupRepo();
|
|
342
|
+
await writeRfc(root, "RFC-9998");
|
|
343
|
+
const committed = await commitGreenEnvelope(root, "RFC-9998");
|
|
344
|
+
|
|
345
|
+
// Reuse hit — the emitted envelope stamps the anchor back to the
|
|
346
|
+
// original execution, not this run's emittedAt.
|
|
347
|
+
const second = await emit(root, { id: "RFC-9998" });
|
|
348
|
+
expect(second.data!.emitted![0]!.reuse?.reusable).toBe(true);
|
|
349
|
+
const written = yamlParse(await fs.readFile(envelopePath(root, "RFC-9998"), "utf8")) as {
|
|
350
|
+
emittedAt: string;
|
|
351
|
+
resultsFrom?: string;
|
|
352
|
+
};
|
|
353
|
+
expect(written.resultsFrom).toBe(committed.emittedAt);
|
|
354
|
+
expect(written.emittedAt).not.toBe(committed.emittedAt);
|
|
355
|
+
|
|
356
|
+
// Commit it, then age the anchor past the window — the next emit sees a
|
|
357
|
+
// fresh emittedAt but an expired resultsFrom and re-executes.
|
|
358
|
+
const aged = yamlParse(await fs.readFile(envelopePath(root, "RFC-9998"), "utf8")) as Record<
|
|
359
|
+
string,
|
|
360
|
+
unknown
|
|
361
|
+
>;
|
|
362
|
+
aged.resultsFrom = new Date(Date.now() - EVIDENCE_REUSE_WINDOW_MS - 60_000).toISOString();
|
|
363
|
+
await fs.writeFile(envelopePath(root, "RFC-9998"), yamlStringify(aged));
|
|
364
|
+
git(root, ["add", "-A"]);
|
|
365
|
+
git(root, ["commit", "-qm", "chain"]);
|
|
366
|
+
mockRunProbe.mockClear();
|
|
367
|
+
|
|
368
|
+
const third = await emit(root, { id: "RFC-9998" });
|
|
369
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
370
|
+
expect(third.data!.emitted![0]!.reuse?.reason).toBe("expired");
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test("reused envelope re-pins the live probe declaration and carries committed verdict fields", async () => {
|
|
374
|
+
const { root } = await setupRepo();
|
|
375
|
+
await writeRfc(root, "RFC-9989");
|
|
376
|
+
const committed = await commitGreenEnvelope(root, "RFC-9989");
|
|
377
|
+
const committedHeavy = (
|
|
378
|
+
yamlParse(await fs.readFile(envelopePath(root, "RFC-9989"), "utf8")) as {
|
|
379
|
+
probes: Array<{ ok: boolean; detail: string; durationMs: number }>;
|
|
380
|
+
}
|
|
381
|
+
).probes[0]!;
|
|
382
|
+
|
|
383
|
+
await emit(root, { id: "RFC-9989" });
|
|
384
|
+
const written = yamlParse(await fs.readFile(envelopePath(root, "RFC-9989"), "utf8")) as {
|
|
385
|
+
probes: Array<{
|
|
386
|
+
probe: { probe: string; criterion?: string };
|
|
387
|
+
ok: boolean;
|
|
388
|
+
detail: string;
|
|
389
|
+
durationMs: number;
|
|
390
|
+
}>;
|
|
391
|
+
rfcFileHash: string;
|
|
392
|
+
acceptanceHash: string;
|
|
393
|
+
};
|
|
394
|
+
// Replayed heavy record: committed verdict fields, live declaration.
|
|
395
|
+
expect(written.probes[0]!.probe).toMatchObject({ probe: "test", criterion: "AC-1" });
|
|
396
|
+
expect(written.probes[0]!.ok).toBe(committedHeavy.ok);
|
|
397
|
+
expect(written.probes[0]!.detail).toBe(committedHeavy.detail);
|
|
398
|
+
expect(written.probes[0]!.durationMs).toBe(committedHeavy.durationMs);
|
|
399
|
+
// Hashes re-bind to live bytes, not the committed envelope's.
|
|
400
|
+
expect(written.acceptanceHash).toBe(committed.acceptanceHash);
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
test("--check never reuses: every probe re-executes", async () => {
|
|
404
|
+
const { root } = await setupRepo();
|
|
405
|
+
await writeRfc(root, "RFC-9988");
|
|
406
|
+
await commitGreenEnvelope(root, "RFC-9988");
|
|
407
|
+
|
|
408
|
+
const result = await emit(root, { id: "RFC-9988", check: true });
|
|
409
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
410
|
+
expect(result.data!.check?.[0]?.match).toBe(true);
|
|
411
|
+
expect(result.data!.emitted).toHaveLength(0);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
test.each([
|
|
415
|
+
["empty probes array", { probes: [] }],
|
|
416
|
+
["null record entries", { probes: [null, null] }],
|
|
417
|
+
])(
|
|
418
|
+
"crafted committed envelope (%s) degrades to 'malformed', never a partial reuse",
|
|
419
|
+
async (_label, patch) => {
|
|
420
|
+
const { root } = await setupRepo();
|
|
421
|
+
await writeRfc(root, "RFC-9987");
|
|
422
|
+
await commitGreenEnvelope(root, "RFC-9987");
|
|
423
|
+
const env = yamlParse(await fs.readFile(envelopePath(root, "RFC-9987"), "utf8")) as Record<
|
|
424
|
+
string,
|
|
425
|
+
unknown
|
|
426
|
+
>;
|
|
427
|
+
Object.assign(env, patch);
|
|
428
|
+
await fs.writeFile(envelopePath(root, "RFC-9987"), yamlStringify(env));
|
|
429
|
+
git(root, ["add", "-A"]);
|
|
430
|
+
git(root, ["commit", "-qm", "craft"]);
|
|
431
|
+
|
|
432
|
+
const result = await emit(root, { id: "RFC-9987" });
|
|
433
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
434
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("malformed");
|
|
435
|
+
},
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
test("future emittedAt is outside the window", async () => {
|
|
439
|
+
const { root } = await setupRepo();
|
|
440
|
+
await writeRfc(root, "RFC-9986");
|
|
441
|
+
await commitGreenEnvelope(root, "RFC-9986");
|
|
442
|
+
const env = yamlParse(await fs.readFile(envelopePath(root, "RFC-9986"), "utf8")) as Record<
|
|
443
|
+
string,
|
|
444
|
+
unknown
|
|
445
|
+
>;
|
|
446
|
+
env.emittedAt = new Date(Date.now() + 60 * 60_000).toISOString();
|
|
447
|
+
await fs.writeFile(envelopePath(root, "RFC-9986"), yamlStringify(env));
|
|
448
|
+
git(root, ["add", "-A"]);
|
|
449
|
+
git(root, ["commit", "-qm", "future"]);
|
|
450
|
+
|
|
451
|
+
const result = await emit(root, { id: "RFC-9986" });
|
|
452
|
+
expect(mockRunProbe).toHaveBeenCalledTimes(2);
|
|
453
|
+
expect(result.data!.emitted![0]!.reuse?.reason).toBe("expired");
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
describe("rfc.evidence.sync — flag forwarding + report surfacing (RFC-1516)", () => {
|
|
458
|
+
const makeSyncContext = (invoke: ReturnType<typeof vi.fn>) =>
|
|
459
|
+
({
|
|
460
|
+
workspaceRoot: "/tmp/x",
|
|
461
|
+
logger: { info: () => {}, warn: () => {} },
|
|
462
|
+
outputFormat: "json",
|
|
463
|
+
dryRun: false,
|
|
464
|
+
invoke,
|
|
465
|
+
}) as unknown as ForgeRuntimeContext;
|
|
466
|
+
|
|
467
|
+
test("--no-evidence-reuse reaches the emit step's flags", async () => {
|
|
468
|
+
const invoke = vi.fn(async (_name: string, _flags?: Record<string, string>) => ({
|
|
469
|
+
exitCode: 0,
|
|
470
|
+
filesModified: [] as string[],
|
|
471
|
+
}));
|
|
472
|
+
const result = await runRfcEvidenceSync(
|
|
473
|
+
{ argv: [], flags: { id: "RFC-9999", "no-evidence-reuse": true } } as unknown as ForgeCommandInput,
|
|
474
|
+
makeSyncContext(invoke),
|
|
475
|
+
);
|
|
476
|
+
expect(result.exitCode).toBe(0);
|
|
477
|
+
const emitCall = invoke.mock.calls.find((c) => c[0] === EVIDENCE_SYNC_EMIT_STEP);
|
|
478
|
+
expect(emitCall?.[1]).toEqual({ id: "RFC-9999", "no-evidence-reuse": "true" });
|
|
479
|
+
expect(invoke).toHaveBeenCalledTimes(EVIDENCE_SYNC_STEPS.length + 1);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
test("the emit step's reuse verdict surfaces on the sync report", async () => {
|
|
483
|
+
const reuse = { reusable: true, reason: "envelope-reused", reusedFrom: "2026-11-06T10:00:00Z" };
|
|
484
|
+
const invoke = vi.fn(async (name: string, _flags?: Record<string, string>) =>
|
|
485
|
+
name === EVIDENCE_SYNC_EMIT_STEP
|
|
486
|
+
? {
|
|
487
|
+
exitCode: 0,
|
|
488
|
+
filesModified: ["docs/rfcs/verification/rfc-9999.generated.yaml"],
|
|
489
|
+
data: {
|
|
490
|
+
emitted: [{ reuse, heavyProbesReused: ["AC-1"], cheapProbesReRun: ["AC-2"] }],
|
|
491
|
+
},
|
|
492
|
+
}
|
|
493
|
+
: { exitCode: 0, filesModified: [] },
|
|
494
|
+
);
|
|
495
|
+
const result = await runRfcEvidenceSync(
|
|
496
|
+
{ argv: [], flags: { id: "RFC-9999" } } as unknown as ForgeCommandInput,
|
|
497
|
+
makeSyncContext(invoke),
|
|
498
|
+
);
|
|
499
|
+
expect(result.exitCode).toBe(0);
|
|
500
|
+
expect(result.data!.data!.reuse).toEqual(reuse);
|
|
501
|
+
expect(result.data!.data!.heavyProbesReused).toEqual(["AC-1"]);
|
|
502
|
+
expect(result.data!.data!.cheapProbesReRun).toEqual(["AC-2"]);
|
|
503
|
+
});
|
|
504
|
+
});
|