@warpgogol/forge 9.3.1 → 9.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +32 -0
- package/CHANGELOG.md +40 -0
- package/README.md +6 -4
- package/README.uk.md +10 -8
- 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 +51 -0
- package/dist/os/flow/dirty-classify.d.ts.map +1 -0
- package/dist/os/flow/dirty-classify.js +83 -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 +110 -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 +75 -38
- 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 +54 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +614 -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-peers.d.ts +24 -0
- package/dist/os/flow/handlers/flow-peers.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-peers.js +99 -0
- package/dist/os/flow/handlers/flow-peers.js.map +1 -0
- 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 +3 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +7 -2
- 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/ops-registry.d.ts +33 -0
- package/dist/os/flow/ops-registry.d.ts.map +1 -0
- package/dist/os/flow/ops-registry.js +177 -0
- package/dist/os/flow/ops-registry.js.map +1 -0
- package/dist/os/flow/preflight.d.ts +157 -0
- package/dist/os/flow/preflight.d.ts.map +1 -0
- package/dist/os/flow/preflight.js +772 -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/standalone-invoke.d.ts +11 -0
- package/dist/os/flow/standalone-invoke.d.ts.map +1 -0
- package/dist/os/flow/standalone-invoke.js +75 -0
- package/dist/os/flow/standalone-invoke.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/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +12 -8
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/importer-block.d.ts +19 -0
- package/dist/os/mission/importer-block.d.ts.map +1 -0
- package/dist/os/mission/importer-block.js +124 -0
- package/dist/os/mission/importer-block.js.map +1 -0
- package/dist/os/mission/lockfile.d.ts +17 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -1
- package/dist/os/mission/lockfile.js +38 -0
- package/dist/os/mission/lockfile.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 +107 -10
- 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 +42 -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-collect.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-collect.js +11 -5
- package/dist/os/system/handlers/system-task-collect.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/prettierignore.d.ts.map +1 -1
- package/dist/src/onboarding/prettierignore.js +2 -0
- package/dist/src/onboarding/prettierignore.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 +120 -0
- package/os/flow/flow.module.ts +119 -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 +124 -56
- 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 +933 -180
- package/os/flow/handlers/flow-open.ts +135 -11
- package/os/flow/handlers/flow-peers.ts +142 -0
- package/os/flow/handlers/flow-status.ts +45 -13
- package/os/flow/index.ts +8 -2
- package/os/flow/line-version.ts +2 -1
- package/os/flow/locks.ts +56 -14
- package/os/flow/ops-registry.ts +194 -0
- package/os/flow/preflight.ts +974 -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/standalone-invoke.ts +85 -0
- package/os/flow/tests/dirty-classify.test.ts +251 -0
- package/os/flow/tests/fixtures/branch-names.yaml +40 -40
- package/os/flow/tests/flow-cut.test.ts +21 -0
- 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 +565 -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 +698 -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/ops-registry.test.ts +136 -0
- 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/handlers/archive.ts +22 -14
- package/os/mission/importer-block.ts +119 -0
- package/os/mission/lockfile.ts +41 -0
- 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 +126 -0
- package/os/rfc/handlers/list-create.ts +130 -10
- 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 +31 -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-collect.ts +11 -5
- 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-collect.test.ts +16 -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 +45 -13
- 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/prettierignore.ts +2 -0
- 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/prettierignore-manage.test.ts +11 -0
- 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,277 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.open pending/dirty surface tests (RFC-1533): the result data
|
|
4
|
+
carries primaryMutations plus a collectFlowStatus-derived pending summary
|
|
5
|
+
excluding the branch just opened; a dirty primary warns FLOW-OPEN-01 without
|
|
6
|
+
blocking; an absent or failing registry degrades to pending: null with a
|
|
7
|
+
FLOW-OPEN-02 warning — never a refusal.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No lifecycle coverage beyond open — integrate/discard have their own files.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1533: pending summary + dirty-primary warning coverage (AC-1/2/3/5/6)</item>
|
|
14
|
+
<item>RFC-1533: surface pending flow branches in flow.open and the pre-user-prompt nudge</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { rm, writeFile } from "node:fs/promises";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
|
|
21
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
22
|
+
|
|
23
|
+
import type { WorkspaceIO } from "../../../src/types.ts";
|
|
24
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
25
|
+
import { formatFlowBranch } from "../branch-name.ts";
|
|
26
|
+
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
27
|
+
import {
|
|
28
|
+
commonGitDir,
|
|
29
|
+
updateRegistry,
|
|
30
|
+
type FlowRegistryEntry,
|
|
31
|
+
} from "../registry.ts";
|
|
32
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
33
|
+
|
|
34
|
+
const NOW = new Date("2026-11-02T12:00:00Z");
|
|
35
|
+
|
|
36
|
+
const dirs: string[] = [];
|
|
37
|
+
afterEach(async () => {
|
|
38
|
+
for (const dir of dirs.splice(0)) {
|
|
39
|
+
await rm(dir, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
}, 15_000);
|
|
42
|
+
|
|
43
|
+
/** Governed repo with a develop branch; returns the primary path. */
|
|
44
|
+
async function governedRepo(): Promise<string> {
|
|
45
|
+
const dir = await initRepo({ prefix: "flow-open-pending-" });
|
|
46
|
+
dirs.push(dir);
|
|
47
|
+
await writeFile(join(dir, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
48
|
+
await gitExec(dir, ["branch", "develop", "HEAD"]);
|
|
49
|
+
return dir;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function registryEntry(
|
|
53
|
+
overrides: Partial<FlowRegistryEntry> & { name: string; baseSha: string },
|
|
54
|
+
): FlowRegistryEntry {
|
|
55
|
+
return {
|
|
56
|
+
kind: "session",
|
|
57
|
+
base: "develop",
|
|
58
|
+
worktree: null,
|
|
59
|
+
owner: { kind: "session", id: "unspecified" },
|
|
60
|
+
brief: null,
|
|
61
|
+
openedAt: NOW.toISOString(),
|
|
62
|
+
updatedAt: NOW.toISOString(),
|
|
63
|
+
held: null,
|
|
64
|
+
port: null,
|
|
65
|
+
...overrides,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function developSha(repo: string): Promise<string> {
|
|
70
|
+
const r = await gitExec(repo, ["rev-parse", "develop"]);
|
|
71
|
+
return r.stdout.trim();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
describe("flow.open pending surface (RFC-1533)", () => {
|
|
75
|
+
it("AC-1/AC-6: dirty primary warns FLOW-OPEN-01, names paths, still opens", async () => {
|
|
76
|
+
const repo = await governedRepo();
|
|
77
|
+
// A tracked mutation: seed.txt was committed by initRepo, now modified.
|
|
78
|
+
await writeFile(join(repo, "seed.txt"), "seed\nmutated\n");
|
|
79
|
+
|
|
80
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
81
|
+
kind: "session",
|
|
82
|
+
slug: "dirty-primary",
|
|
83
|
+
brief: null,
|
|
84
|
+
owner: null,
|
|
85
|
+
dryRun: false,
|
|
86
|
+
now: NOW,
|
|
87
|
+
});
|
|
88
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
89
|
+
|
|
90
|
+
expect(data.opened).toBe(true);
|
|
91
|
+
const warn = data.diagnostics.find((d) => d.ruleId === "FLOW-OPEN-01");
|
|
92
|
+
expect(warn, "FLOW-OPEN-01 warning missing").toBeDefined();
|
|
93
|
+
expect(warn?.severity).toBe("warning");
|
|
94
|
+
expect(warn?.message).toContain("seed.txt");
|
|
95
|
+
expect(data.diagnostics.some((d) => d.severity === "error")).toBe(false);
|
|
96
|
+
expect(data.primaryMutations).toContain("seed.txt");
|
|
97
|
+
}, 15_000);
|
|
98
|
+
|
|
99
|
+
it("clean primary reports no warning and empty primaryMutations", async () => {
|
|
100
|
+
const repo = await governedRepo();
|
|
101
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
102
|
+
kind: "session",
|
|
103
|
+
slug: "clean-primary",
|
|
104
|
+
brief: null,
|
|
105
|
+
owner: null,
|
|
106
|
+
dryRun: false,
|
|
107
|
+
now: NOW,
|
|
108
|
+
});
|
|
109
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
110
|
+
expect(data.diagnostics).toEqual([]);
|
|
111
|
+
expect(data.primaryMutations).toEqual([]);
|
|
112
|
+
}, 15_000);
|
|
113
|
+
|
|
114
|
+
it("AC-2/AC-3: pending counts registered siblings by kind + stale, excluding self", async () => {
|
|
115
|
+
const repo = await governedRepo();
|
|
116
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
117
|
+
|
|
118
|
+
// A stale registered task branch: commit dated >72h back, registry
|
|
119
|
+
// updatedAt just as old.
|
|
120
|
+
const staleName = "auto/task-260730-01-legacy";
|
|
121
|
+
await gitExec(repo, ["switch", "-c", staleName, "develop"]);
|
|
122
|
+
const old = await gitExec(repo, ["commit", "--allow-empty", "-m", "legacy"], {
|
|
123
|
+
GIT_AUTHOR_DATE: "2026-07-30T00:00:00Z",
|
|
124
|
+
GIT_COMMITTER_DATE: "2026-07-30T00:00:00Z",
|
|
125
|
+
});
|
|
126
|
+
expect(old.exitCode, old.stderr).toBe(0);
|
|
127
|
+
const back = await gitExec(repo, ["switch", "-"]);
|
|
128
|
+
expect(back.exitCode, back.stderr).toBe(0);
|
|
129
|
+
|
|
130
|
+
// A fresh registered session branch.
|
|
131
|
+
const freshName = "auto/session-261102-01-fresh";
|
|
132
|
+
await gitExec(repo, ["branch", freshName, "develop"]);
|
|
133
|
+
|
|
134
|
+
const baseSha = await developSha(repo);
|
|
135
|
+
await updateRegistry(ambientIo, common, (r) => ({
|
|
136
|
+
...r,
|
|
137
|
+
branches: [
|
|
138
|
+
...r.branches,
|
|
139
|
+
registryEntry({
|
|
140
|
+
name: staleName,
|
|
141
|
+
kind: "task",
|
|
142
|
+
baseSha,
|
|
143
|
+
worktree: repo,
|
|
144
|
+
owner: { kind: "task", id: "T-0001" },
|
|
145
|
+
openedAt: "2026-07-30T00:00:00Z",
|
|
146
|
+
updatedAt: "2026-07-30T00:00:00Z",
|
|
147
|
+
}),
|
|
148
|
+
registryEntry({ name: freshName, baseSha, worktree: repo }),
|
|
149
|
+
],
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
153
|
+
kind: "session",
|
|
154
|
+
slug: "pending-check",
|
|
155
|
+
brief: null,
|
|
156
|
+
owner: null,
|
|
157
|
+
dryRun: false,
|
|
158
|
+
now: NOW,
|
|
159
|
+
});
|
|
160
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
161
|
+
|
|
162
|
+
expect(data.opened).toBe(true);
|
|
163
|
+
expect(data.pending).toEqual({
|
|
164
|
+
total: 2,
|
|
165
|
+
byKind: { session: 1, task: 1, fix: 0 },
|
|
166
|
+
stale: 1,
|
|
167
|
+
});
|
|
168
|
+
}, 20_000);
|
|
169
|
+
|
|
170
|
+
it("AC-5: absent registry on a dry-run degrades to pending null + FLOW-OPEN-02", async () => {
|
|
171
|
+
const repo = await governedRepo();
|
|
172
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
173
|
+
kind: "session",
|
|
174
|
+
slug: "no-registry",
|
|
175
|
+
brief: null,
|
|
176
|
+
owner: null,
|
|
177
|
+
dryRun: true,
|
|
178
|
+
now: NOW,
|
|
179
|
+
});
|
|
180
|
+
expect(data.pending).toBeNull();
|
|
181
|
+
const warn = data.diagnostics.find((d) => d.ruleId === "FLOW-OPEN-02");
|
|
182
|
+
expect(warn?.severity).toBe("warning");
|
|
183
|
+
}, 15_000);
|
|
184
|
+
|
|
185
|
+
it("AC-5: collect failure mid-open degrades to pending null + warning, still opens", async () => {
|
|
186
|
+
const repo = await governedRepo();
|
|
187
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
188
|
+
// A registered entry whose worktree path makes io.exists throw inside
|
|
189
|
+
// collectFlowStatus — the summary degrades, the open proceeds.
|
|
190
|
+
const boomName = "auto/session-260930-01-boom";
|
|
191
|
+
await gitExec(repo, ["branch", boomName, "develop"]);
|
|
192
|
+
const baseSha = await developSha(repo);
|
|
193
|
+
await updateRegistry(ambientIo, common, (r) => ({
|
|
194
|
+
...r,
|
|
195
|
+
branches: [
|
|
196
|
+
...r.branches,
|
|
197
|
+
registryEntry({
|
|
198
|
+
name: boomName,
|
|
199
|
+
baseSha,
|
|
200
|
+
worktree: join(repo, "BOOM-io-failure"),
|
|
201
|
+
updatedAt: NOW.toISOString(),
|
|
202
|
+
}),
|
|
203
|
+
],
|
|
204
|
+
}));
|
|
205
|
+
const io: WorkspaceIO = {
|
|
206
|
+
...ambientIo,
|
|
207
|
+
exists: (path: string) =>
|
|
208
|
+
path.includes("BOOM-io-failure")
|
|
209
|
+
? Promise.reject(new Error("injected io failure"))
|
|
210
|
+
: ambientIo.exists(path),
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const data = await openFlowBranch(repo, io, {
|
|
214
|
+
kind: "session",
|
|
215
|
+
slug: "pending-fail",
|
|
216
|
+
brief: null,
|
|
217
|
+
owner: null,
|
|
218
|
+
dryRun: false,
|
|
219
|
+
now: NOW,
|
|
220
|
+
});
|
|
221
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
222
|
+
|
|
223
|
+
expect(data.opened).toBe(true);
|
|
224
|
+
expect(data.pending).toBeNull();
|
|
225
|
+
const warn = data.diagnostics.find((d) => d.ruleId === "FLOW-OPEN-02");
|
|
226
|
+
expect(warn?.severity).toBe("warning");
|
|
227
|
+
expect(data.diagnostics.some((d) => d.severity === "error")).toBe(false);
|
|
228
|
+
}, 20_000);
|
|
229
|
+
|
|
230
|
+
it("pending stays empty-shaped on a fresh repo (registered only after open)", async () => {
|
|
231
|
+
const repo = await governedRepo();
|
|
232
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
233
|
+
kind: "session",
|
|
234
|
+
slug: "first-open",
|
|
235
|
+
brief: null,
|
|
236
|
+
owner: null,
|
|
237
|
+
dryRun: false,
|
|
238
|
+
now: NOW,
|
|
239
|
+
});
|
|
240
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
241
|
+
expect(data.pending).toEqual({
|
|
242
|
+
total: 0,
|
|
243
|
+
byKind: { session: 0, task: 0, fix: 0 },
|
|
244
|
+
stale: 0,
|
|
245
|
+
});
|
|
246
|
+
}, 15_000);
|
|
247
|
+
|
|
248
|
+
it("the just-opened branch is excluded from pending", async () => {
|
|
249
|
+
const repo = await governedRepo();
|
|
250
|
+
const first = await openFlowBranch(repo, ambientIo, {
|
|
251
|
+
kind: "session",
|
|
252
|
+
slug: "first",
|
|
253
|
+
brief: null,
|
|
254
|
+
owner: null,
|
|
255
|
+
dryRun: false,
|
|
256
|
+
now: NOW,
|
|
257
|
+
});
|
|
258
|
+
if (first.worktree) dirs.push(first.worktree);
|
|
259
|
+
expect(first.pending?.total).toBe(0);
|
|
260
|
+
|
|
261
|
+
const second = await openFlowBranch(repo, ambientIo, {
|
|
262
|
+
kind: "session",
|
|
263
|
+
slug: "second",
|
|
264
|
+
brief: null,
|
|
265
|
+
owner: null,
|
|
266
|
+
dryRun: false,
|
|
267
|
+
now: NOW,
|
|
268
|
+
});
|
|
269
|
+
if (second.worktree) dirs.push(second.worktree);
|
|
270
|
+
expect(second.branch).toBe(
|
|
271
|
+
formatFlowBranch({ kind: "session", date: NOW, seq: 2, slug: "second" }),
|
|
272
|
+
);
|
|
273
|
+
// The first open is a registered sibling now; the second is excluded.
|
|
274
|
+
expect(second.pending?.total).toBe(1);
|
|
275
|
+
expect(second.pending?.byKind.session).toBe(1);
|
|
276
|
+
}, 20_000);
|
|
277
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<purpose>flow.open tests (RFC-1487 step 3, AC-1/AC-2): the session worktree
|
|
4
4
|
lands beside the primary as <repo>@<branch-slug> from the develop
|
|
5
5
|
tip, NN increments across local and remote-tracking names, refusals
|
|
6
|
-
FLOW-OPEN-
|
|
6
|
+
FLOW-OPEN-10/03/05, and a failing setup script exits 1 while keeping the
|
|
7
7
|
worktree and registry entry.</purpose>
|
|
8
8
|
<non-goals>
|
|
9
9
|
<item>No lifecycle coverage beyond open — integrate/discard have their own files.</item>
|
|
@@ -12,12 +12,15 @@ worktree and registry entry.</purpose>
|
|
|
12
12
|
<CHANGE_SUMMARY>
|
|
13
13
|
<item>RFC-1487: step 3 — flow.open tests</item>
|
|
14
14
|
<item>RFC-1487: step 3 — flow.open with NN assignment over local/remote/registry names</item>
|
|
15
|
+
<item>RFC-1536: evidence — routing/warning tests, FLOW-OPEN-10 validation renumber, owning-worktree doc rule, frictions F-0091/F-0096/F-0106/F-0119 addressed</item>
|
|
15
16
|
</CHANGE_SUMMARY>
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
19
20
|
import { tmpdir } from "node:os";
|
|
20
|
-
import { dirname, join } from "node:path";
|
|
21
|
+
import { basename, dirname, join } from "node:path";
|
|
22
|
+
|
|
23
|
+
import { canonicalRepoDir } from "../../../src/utils/repo-path.ts";
|
|
21
24
|
|
|
22
25
|
import { afterEach, describe, expect, it } from "vitest";
|
|
23
26
|
|
|
@@ -66,10 +69,13 @@ describe("flow.open", () => {
|
|
|
66
69
|
|
|
67
70
|
expect(data.diagnostics).toEqual([]);
|
|
68
71
|
const name = formatFlowBranch({ kind: "session", date: NOW, seq: 1, slug: "forge-flow" });
|
|
69
|
-
|
|
72
|
+
// Product answers in the canonical frame (git's worktree list) — on
|
|
73
|
+
// Windows the mkdtemp 8.3 alias resolves to a different spelling of the
|
|
74
|
+
// same directory, so comparisons go through realpath.
|
|
75
|
+
const expectedPath = join(dirname(repo), `${basename(repo)}@${name.replaceAll("/", "-")}`);
|
|
70
76
|
expect(data.branch).toBe(name);
|
|
71
|
-
expect(data.worktree).toBe(expectedPath);
|
|
72
|
-
expect(data.worktree?.startsWith(dirname(repo))).toBe(true);
|
|
77
|
+
expect(data.worktree).toBe(canonicalRepoDir(expectedPath));
|
|
78
|
+
expect(data.worktree?.startsWith(dirname(canonicalRepoDir(repo)))).toBe(true);
|
|
73
79
|
dirs.push(expectedPath);
|
|
74
80
|
expect(await sha(repo, name)).toBe(developSha);
|
|
75
81
|
expect(data.opened).toBe(true);
|
|
@@ -77,7 +83,7 @@ describe("flow.open", () => {
|
|
|
77
83
|
const common = await commonGitDir(ambientIo, repo);
|
|
78
84
|
const registry = await readRegistry(ambientIo, common);
|
|
79
85
|
const entry = registry.branches.find((b) => b.name === name);
|
|
80
|
-
expect(entry?.worktree).toBe(expectedPath);
|
|
86
|
+
expect(entry?.worktree).toBe(canonicalRepoDir(expectedPath));
|
|
81
87
|
expect(entry?.baseSha).toBe(developSha);
|
|
82
88
|
expect(entry?.owner).toEqual({ kind: "session", id: "unspecified" });
|
|
83
89
|
expect(entry?.held).toBeNull();
|
|
@@ -130,7 +136,7 @@ describe("flow.open", () => {
|
|
|
130
136
|
if (data.worktree) dirs.push(data.worktree);
|
|
131
137
|
}, 15_000);
|
|
132
138
|
|
|
133
|
-
it("refuses FLOW-OPEN-
|
|
139
|
+
it("refuses FLOW-OPEN-10 on an invalid slug", async () => {
|
|
134
140
|
const repo = await governedRepo();
|
|
135
141
|
const data = await openFlowBranch(repo, ambientIo, {
|
|
136
142
|
kind: "session",
|
|
@@ -140,7 +146,7 @@ describe("flow.open", () => {
|
|
|
140
146
|
dryRun: false,
|
|
141
147
|
now: NOW,
|
|
142
148
|
});
|
|
143
|
-
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-OPEN-
|
|
149
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-OPEN-10");
|
|
144
150
|
expect(data.opened).toBe(false);
|
|
145
151
|
}, 15_000);
|
|
146
152
|
|
|
@@ -160,7 +166,7 @@ describe("flow.open", () => {
|
|
|
160
166
|
it("refuses FLOW-OPEN-03 when the target path exists", async () => {
|
|
161
167
|
const repo = await governedRepo();
|
|
162
168
|
const name = formatFlowBranch({ kind: "session", date: NOW, seq: 1, slug: "taken" });
|
|
163
|
-
const target = join(dirname(repo), `${repo
|
|
169
|
+
const target = join(dirname(repo), `${basename(repo)}@${name.replaceAll("/", "-")}`);
|
|
164
170
|
await mkdir(target, { recursive: true });
|
|
165
171
|
dirs.push(target);
|
|
166
172
|
|
|
@@ -197,4 +203,41 @@ describe("flow.open", () => {
|
|
|
197
203
|
const registry = await readRegistry(ambientIo, common);
|
|
198
204
|
expect(registry.branches.some((b) => b.name === data.branch)).toBe(true);
|
|
199
205
|
}, 15_000);
|
|
206
|
+
|
|
207
|
+
it("warns FLOW-OPEN-01 when the primary carries tracked mutations (RFC-1536 AC-2)", async () => {
|
|
208
|
+
const repo = await governedRepo();
|
|
209
|
+
// A tracked mutation in the primary — forge.yaml is committed, then edited.
|
|
210
|
+
await gitExec(repo, ["add", "forge.yaml"]);
|
|
211
|
+
await gitExec(repo, ["commit", "-m", "seed forge.yaml"]);
|
|
212
|
+
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\ndirty: true\n');
|
|
213
|
+
|
|
214
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
215
|
+
kind: "session",
|
|
216
|
+
slug: "dirty-primary",
|
|
217
|
+
brief: null,
|
|
218
|
+
owner: null,
|
|
219
|
+
dryRun: false,
|
|
220
|
+
now: NOW,
|
|
221
|
+
});
|
|
222
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
223
|
+
expect(data.opened).toBe(true);
|
|
224
|
+
const warning = data.diagnostics.find((d) => d.ruleId === "FLOW-OPEN-01");
|
|
225
|
+
expect(warning?.severity).toBe("warning");
|
|
226
|
+
expect(warning?.message).toContain("forge.yaml");
|
|
227
|
+
expect(warning?.message).toContain("NOT swept");
|
|
228
|
+
}, 15_000);
|
|
229
|
+
|
|
230
|
+
it("emits no FLOW-OPEN-01 when the primary is clean (RFC-1536 AC-2)", async () => {
|
|
231
|
+
const repo = await governedRepo();
|
|
232
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
233
|
+
kind: "session",
|
|
234
|
+
slug: "clean-primary",
|
|
235
|
+
brief: null,
|
|
236
|
+
owner: null,
|
|
237
|
+
dryRun: false,
|
|
238
|
+
now: NOW,
|
|
239
|
+
});
|
|
240
|
+
if (data.worktree) dirs.push(data.worktree);
|
|
241
|
+
expect(data.diagnostics.some((d) => d.ruleId === "FLOW-OPEN-01")).toBe(false);
|
|
242
|
+
}, 15_000);
|
|
200
243
|
});
|
|
@@ -17,6 +17,8 @@ with an ours-merge and never force-pushes.</purpose>
|
|
|
17
17
|
<item>RFC-1491: step 5 — flow.push publication tests</item>
|
|
18
18
|
<item>RFC-1491: step 5 — flow.push atomic outbound path + extract publication</item>
|
|
19
19
|
<item>RFC-1491: independent-review pass — shared lock constants, publishable pending filter, declared rules, hold ordering, sha-pinned refspecs</item>
|
|
20
|
+
<item>RFC-1517: add preflight-extract-gates — FLOW-PUB-01 changelog check at ref plus shared PKG-HEALTH-10 fixture-path scan for RFC-1517</item>
|
|
21
|
+
<item>RFC-1517: make pkg-health-10 shipped-set faithful and scan the publish ref</item>
|
|
20
22
|
</CHANGE_SUMMARY>
|
|
21
23
|
*/
|
|
22
24
|
|
|
@@ -28,6 +30,7 @@ import { afterEach, describe, expect, it } from "vitest";
|
|
|
28
30
|
import { ambientIo } from "../../../src/utils/io.ts";
|
|
29
31
|
import { collectDigest } from "../digest.ts";
|
|
30
32
|
import { pushFlow } from "../handlers/flow-push.ts";
|
|
33
|
+
import { verifyLineAtRef } from "../publish.ts";
|
|
31
34
|
import { markerContent } from "../markers.ts";
|
|
32
35
|
import { releaseTagAnnotation, writeReleaseTag } from "../release-tags.ts";
|
|
33
36
|
import { commonGitDir, readJournal } from "../registry.ts";
|
|
@@ -243,6 +246,127 @@ describe("flow.push publications", () => {
|
|
|
243
246
|
expect(await extractLog(log)).toBe("");
|
|
244
247
|
}, 90_000);
|
|
245
248
|
|
|
249
|
+
it("a CHANGELOG missing the [version] section refuses FLOW-PUB-01 before any extract spawn (AC-1)", async () => {
|
|
250
|
+
const { repo, extractLog: log } = await initRepoWithOrigin(dirs, {
|
|
251
|
+
prefix: "flow-pub-",
|
|
252
|
+
fakeExtract: true,
|
|
253
|
+
});
|
|
254
|
+
await addPackageLine(repo);
|
|
255
|
+
await writeFile(
|
|
256
|
+
join(repo, "packages", "lib", "CHANGELOG.md"),
|
|
257
|
+
"# Changelog\n\n## [2.0.0] - 2026-01-01\n\n- earlier release\n",
|
|
258
|
+
);
|
|
259
|
+
await gitExec(repo, ["add", "-A"]);
|
|
260
|
+
await gitExec(repo, ["commit", "-m", "changelog without the publish section"]);
|
|
261
|
+
await gitExec(repo, ["push", "origin", "develop"]);
|
|
262
|
+
await tag(repo, "lib@2.1.0", "lib", "2.1.0", "minor");
|
|
263
|
+
|
|
264
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
265
|
+
const data = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
266
|
+
const pub = data.publications.find((p) => p.tag === "lib@2.1.0");
|
|
267
|
+
expect(pub?.status).toBe("failed");
|
|
268
|
+
expect(pub?.error).toContain("preflight-extract-gates");
|
|
269
|
+
expect(pub?.error).toContain("FLOW-PUB-01");
|
|
270
|
+
expect(pub?.error).toContain("[2.1.0]");
|
|
271
|
+
// The whole point of the preflight — repo-extract never ran.
|
|
272
|
+
expect(await extractLog(log)).toBe("");
|
|
273
|
+
}, 90_000);
|
|
274
|
+
|
|
275
|
+
it("verifyLineAtRef refuses FLOW-PUB-01 pre-extract when the ref's CHANGELOG lacks the section (AC-1)", async () => {
|
|
276
|
+
const { repo, extractLog: log } = await initRepoWithOrigin(dirs, {
|
|
277
|
+
prefix: "flow-pub-",
|
|
278
|
+
fakeExtract: true,
|
|
279
|
+
});
|
|
280
|
+
await addPackageLine(repo);
|
|
281
|
+
await writeFile(
|
|
282
|
+
join(repo, "packages", "lib", "CHANGELOG.md"),
|
|
283
|
+
"# Changelog\n\n## [2.0.0] - 2026-01-01\n\n- earlier release\n",
|
|
284
|
+
);
|
|
285
|
+
await gitExec(repo, ["add", "-A"]);
|
|
286
|
+
await gitExec(repo, ["commit", "-m", "changelog without the publish section"]);
|
|
287
|
+
const sha = (await gitExec(repo, ["rev-parse", "HEAD"])).stdout.trim();
|
|
288
|
+
|
|
289
|
+
const result = await verifyLineAtRef(repo, ambientIo, {
|
|
290
|
+
line: { id: "lib", tagPrefix: "lib@", versionFile: "packages/lib/package.json", paths: ["packages/lib"] },
|
|
291
|
+
ref: sha,
|
|
292
|
+
});
|
|
293
|
+
expect(result.ok).toBe(false);
|
|
294
|
+
expect(result.detail).toContain("preflight-extract-gates");
|
|
295
|
+
expect(result.detail).toContain("FLOW-PUB-01");
|
|
296
|
+
expect(result.detail).toContain("[2.1.0]");
|
|
297
|
+
expect(await extractLog(log)).toBe("");
|
|
298
|
+
}, 90_000);
|
|
299
|
+
|
|
300
|
+
it("a bare [version]: link reference without a release heading refuses FLOW-PUB-01", async () => {
|
|
301
|
+
const { repo, extractLog: log } = await initRepoWithOrigin(dirs, {
|
|
302
|
+
prefix: "flow-pub-",
|
|
303
|
+
fakeExtract: true,
|
|
304
|
+
});
|
|
305
|
+
await addPackageLine(repo);
|
|
306
|
+
await writeFile(
|
|
307
|
+
join(repo, "packages", "lib", "CHANGELOG.md"),
|
|
308
|
+
"# Changelog\n\n## [2.0.0] - 2026-01-01\n\n- earlier release\n\n[2.1.0]: https://example.com/diff\n",
|
|
309
|
+
);
|
|
310
|
+
await gitExec(repo, ["add", "-A"]);
|
|
311
|
+
await gitExec(repo, ["commit", "-m", "changelog with only a link reference"]);
|
|
312
|
+
await gitExec(repo, ["push", "origin", "develop"]);
|
|
313
|
+
await tag(repo, "lib@2.1.0", "lib", "2.1.0", "minor");
|
|
314
|
+
|
|
315
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
316
|
+
const data = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
317
|
+
const pub = data.publications.find((p) => p.tag === "lib@2.1.0");
|
|
318
|
+
expect(pub?.status).toBe("failed");
|
|
319
|
+
expect(pub?.error).toContain("FLOW-PUB-01");
|
|
320
|
+
expect(await extractLog(log)).toBe("");
|
|
321
|
+
}, 90_000);
|
|
322
|
+
|
|
323
|
+
it("a shipped file's root-escaping ../ literal refuses PKG-HEALTH-10 at file:line (AC-7)", async () => {
|
|
324
|
+
const { repo, extractLog: log } = await initRepoWithOrigin(dirs, {
|
|
325
|
+
prefix: "flow-pub-",
|
|
326
|
+
fakeExtract: true,
|
|
327
|
+
});
|
|
328
|
+
await addPackageLine(repo);
|
|
329
|
+
await mkdir(join(repo, "packages", "lib", "src", "tests"), { recursive: true });
|
|
330
|
+
await writeFile(
|
|
331
|
+
join(repo, "packages", "lib", "src", "tests", "fixture.test.ts"),
|
|
332
|
+
'const fixture = "../../../docs/rfcs/rfc-0000-template.md";\nexport { fixture };\n',
|
|
333
|
+
);
|
|
334
|
+
await gitExec(repo, ["add", "-A"]);
|
|
335
|
+
await gitExec(repo, ["commit", "-m", "fixture path escaping the package root"]);
|
|
336
|
+
await gitExec(repo, ["push", "origin", "develop"]);
|
|
337
|
+
await tag(repo, "lib@2.1.0", "lib", "2.1.0", "minor");
|
|
338
|
+
|
|
339
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
340
|
+
const data = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
341
|
+
const pub = data.publications.find((p) => p.tag === "lib@2.1.0");
|
|
342
|
+
expect(pub?.status).toBe("failed");
|
|
343
|
+
expect(pub?.error).toContain("PKG-HEALTH-10");
|
|
344
|
+
expect(pub?.error).toContain("packages/lib/src/tests/fixture.test.ts:1");
|
|
345
|
+
expect(await extractLog(log)).toBe("");
|
|
346
|
+
}, 90_000);
|
|
347
|
+
|
|
348
|
+
it("an uncommitted root-escaping file does NOT refuse — the scan reads the tag's tree (RFC-1517 r1)", async () => {
|
|
349
|
+
const { repo, extractLog: log } = await initRepoWithOrigin(dirs, {
|
|
350
|
+
prefix: "flow-pub-",
|
|
351
|
+
fakeExtract: true,
|
|
352
|
+
});
|
|
353
|
+
await addPackageLine(repo);
|
|
354
|
+
// Untracked escape: never enters the tag's tree, so the extract never
|
|
355
|
+
// ships it — flagging it would be a false refusal.
|
|
356
|
+
await mkdir(join(repo, "packages", "lib", "src"), { recursive: true });
|
|
357
|
+
await writeFile(
|
|
358
|
+
join(repo, "packages", "lib", "src", "scratch.ts"),
|
|
359
|
+
'const scratch = "../../../outside.md";\n',
|
|
360
|
+
);
|
|
361
|
+
await tag(repo, "lib@2.1.0", "lib", "2.1.0", "minor");
|
|
362
|
+
|
|
363
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
364
|
+
const data = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
365
|
+
const pub = data.publications.find((p) => p.tag === "lib@2.1.0");
|
|
366
|
+
expect(pub?.status).toBe("published");
|
|
367
|
+
expect(await extractLog(log)).not.toBe("");
|
|
368
|
+
}, 90_000);
|
|
369
|
+
|
|
246
370
|
it("a non-fast-forward destination reconciles once with an ours-merge", async () => {
|
|
247
371
|
const { repo, parent } = await initRepoWithOrigin(dirs, {
|
|
248
372
|
prefix: "flow-pub-",
|
|
@@ -10,6 +10,7 @@ lastCommitAt/stale/held fields matching the RFC's example shape.</purpose>
|
|
|
10
10
|
<CHANGE_SUMMARY>
|
|
11
11
|
<item>RFC-1487: step 5 — flow.status tests</item>
|
|
12
12
|
<item>RFC-1487: step 5 — flow.discard, flow.status, flow.check FLOW-06/07</item>
|
|
13
|
+
<item>RFC-1515: close rfc-1515 review findings — delete tolerated paths before worktree remove, prune vanished registrations, verified branch -D, shared held-lock render, gated e2e throw, journal toleratedState, edge tests</item>
|
|
13
14
|
</CHANGE_SUMMARY>
|
|
14
15
|
*/
|
|
15
16
|
|
|
@@ -19,6 +20,7 @@ import { join } from "node:path";
|
|
|
19
20
|
import { afterEach, describe, expect, it } from "vitest";
|
|
20
21
|
|
|
21
22
|
import { ambientIo } from "../../../src/utils/io.ts";
|
|
23
|
+
import { canonicalRepoDir } from "../../../src/utils/repo-path.ts";
|
|
22
24
|
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
23
25
|
import { collectFlowStatus } from "../handlers/flow-status.ts";
|
|
24
26
|
import { gitExec, initRepo } from "./helpers.ts";
|
|
@@ -58,7 +60,9 @@ describe("flow.status", () => {
|
|
|
58
60
|
await gitExec(repo, ["commit", "-m", "add d.txt"]); // develop ahead by 1
|
|
59
61
|
|
|
60
62
|
const outcome = await collectFlowStatus(repo, ambientIo, { now: NOW });
|
|
61
|
-
|
|
63
|
+
// primary.path is canonicalized (git's worktree frame) — compare the
|
|
64
|
+
// real spelling of the same directory, not the mkdtemp 8.3 alias.
|
|
65
|
+
expect(outcome.data.primary.path).toBe(canonicalRepoDir(repo));
|
|
62
66
|
expect(outcome.data.primary.branch).toBe("develop");
|
|
63
67
|
expect(outcome.data.primary.clean).toBe(true);
|
|
64
68
|
|
|
@@ -90,4 +94,30 @@ describe("flow.status", () => {
|
|
|
90
94
|
expect(row?.worktree).toBeNull();
|
|
91
95
|
expect(row?.worktreeExists).toBe(false);
|
|
92
96
|
}, 15_000);
|
|
97
|
+
|
|
98
|
+
it("renders a registered entry whose worktree path vanished as vanished, distinct from absent (RFC-1515)", async () => {
|
|
99
|
+
const repo = await initRepo({ prefix: "flow-status-vanished-" });
|
|
100
|
+
dirs.push(repo);
|
|
101
|
+
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
102
|
+
await gitExec(repo, ["branch", "develop", "HEAD"]);
|
|
103
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
104
|
+
|
|
105
|
+
const session = await openFlowBranch(repo, ambientIo, {
|
|
106
|
+
kind: "session",
|
|
107
|
+
slug: "gone",
|
|
108
|
+
brief: "status test",
|
|
109
|
+
owner: null,
|
|
110
|
+
dryRun: false,
|
|
111
|
+
now: NOW,
|
|
112
|
+
});
|
|
113
|
+
await rm(session.worktree!, { recursive: true, force: true });
|
|
114
|
+
await gitExec(repo, ["worktree", "prune"]);
|
|
115
|
+
|
|
116
|
+
const outcome = await collectFlowStatus(repo, ambientIo, { now: NOW });
|
|
117
|
+
const row = outcome.data.branches.find((b) => b.name === session.branch);
|
|
118
|
+
expect(row?.registered).toBe(true);
|
|
119
|
+
expect(row?.worktreeExists).toBe(false);
|
|
120
|
+
expect(row?.vanished).toBe(true);
|
|
121
|
+
expect(row?.dirty).toBeNull();
|
|
122
|
+
}, 15_000);
|
|
93
123
|
});
|
|
@@ -11,6 +11,7 @@ id on this host is treated as dead. Uses injected now/sleep — no real waits.</
|
|
|
11
11
|
<CHANGE_SUMMARY>
|
|
12
12
|
<item>RFC-1504: step 1 — dead-holder lock tests</item>
|
|
13
13
|
<item>RFC-1504: review fixes — legacy acquiredAt fallback, atomic break claim, verified stamp release, onStale warnings</item>
|
|
14
|
+
<item>RFC-1515: close rfc-1515 review findings — delete tolerated paths before worktree remove, prune vanished registrations, verified branch -D, shared held-lock render, gated e2e throw, journal toleratedState, edge tests</item>
|
|
14
15
|
</CHANGE_SUMMARY>
|
|
15
16
|
*/
|
|
16
17
|
|
|
@@ -22,7 +23,7 @@ import { spawnSync } from "node:child_process";
|
|
|
22
23
|
import { afterEach, describe, expect, it } from "vitest";
|
|
23
24
|
|
|
24
25
|
import { currentBootId, holderIsDead } from "../../core/lock-holder.ts";
|
|
25
|
-
import { withFlowLock, LockTimeoutError } from "../locks.ts";
|
|
26
|
+
import { describeHeldLock, withFlowLock, LockTimeoutError } from "../locks.ts";
|
|
26
27
|
|
|
27
28
|
const dirs: string[] = [];
|
|
28
29
|
afterEach(async () => {
|
|
@@ -80,8 +81,10 @@ describe("holderIsDead (RFC-1504)", () => {
|
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
it("a pid we cannot signal (EPERM) counts as alive — fail closed", () => {
|
|
83
|
-
// pid 1
|
|
84
|
-
|
|
84
|
+
// init (pid 1) on POSIX; the System process (pid 4) on Windows — each
|
|
85
|
+
// survives or EPERMs a signal-0 on its own platform, never ESRCH.
|
|
86
|
+
const unsignalablePid = process.platform === "win32" ? 4 : 1;
|
|
87
|
+
expect(holderIsDead({ pid: unsignalablePid, host: HOST })).toBe(false);
|
|
85
88
|
});
|
|
86
89
|
|
|
87
90
|
it("different boot id on this host → dead even with a live pid (AC-4 basis)", () => {
|
|
@@ -217,3 +220,36 @@ describe("withFlowLock dead-holder recovery (RFC-1504)", () => {
|
|
|
217
220
|
else expect(content?.bootId).toBe(boot);
|
|
218
221
|
});
|
|
219
222
|
});
|
|
223
|
+
|
|
224
|
+
describe("describeHeldLock — RFC-1515 lock payload classification", () => {
|
|
225
|
+
it("reports a live local holder with a numeric heldMs", () => {
|
|
226
|
+
const at = new Date(Date.now() - 5_000).toISOString();
|
|
227
|
+
const lock = describeHeldLock({ pid: livePid(), host: HOST, at }, 3_600_000);
|
|
228
|
+
expect(lock.disposition).toBe("live");
|
|
229
|
+
expect(lock.heldMs).toBeGreaterThanOrEqual(5_000);
|
|
230
|
+
expect(lock.pid).toBe(process.pid);
|
|
231
|
+
expect(lock.host).toBe(HOST);
|
|
232
|
+
expect(lock.at).toBe(at);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("reports a dead local pid as dead-holder even inside the stale budget", () => {
|
|
236
|
+
const lock = describeHeldLock(
|
|
237
|
+
{ pid: deadPid(), host: HOST, at: new Date().toISOString() },
|
|
238
|
+
3_600_000,
|
|
239
|
+
);
|
|
240
|
+
expect(lock.disposition).toBe("dead-holder");
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("reports a live holder beyond the stale budget as stale", () => {
|
|
244
|
+
const at = new Date(Date.now() - 7_200_000).toISOString();
|
|
245
|
+
const lock = describeHeldLock({ pid: livePid(), host: HOST, at }, 3_600_000);
|
|
246
|
+
expect(lock.disposition).toBe("stale");
|
|
247
|
+
expect(lock.heldMs).toBeGreaterThan(3_600_000);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("degrades heldMs to null when the holder timestamp never parsed", () => {
|
|
251
|
+
const lock = describeHeldLock({ pid: livePid(), host: HOST, at: "garbage" }, 3_600_000);
|
|
252
|
+
expect(lock.heldMs).toBeNull();
|
|
253
|
+
expect(lock.disposition).toBe("live");
|
|
254
|
+
});
|
|
255
|
+
});
|