@warpgogol/forge 9.1.1 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/bin/cli.ts +5 -3
- package/dist/bin/cli.js +5 -3
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +23 -15
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-journal.js +9 -1
- package/dist/os/checks/handlers/counters-journal.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +32 -39
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/lock-holder.d.ts +32 -0
- package/dist/os/core/lock-holder.d.ts.map +1 -0
- package/dist/os/core/lock-holder.js +81 -0
- package/dist/os/core/lock-holder.js.map +1 -0
- package/dist/os/core/stamp-lock.d.ts +30 -0
- package/dist/os/core/stamp-lock.d.ts.map +1 -0
- package/dist/os/core/stamp-lock.js +112 -0
- package/dist/os/core/stamp-lock.js.map +1 -0
- package/dist/os/flow/branch-name.d.ts +56 -0
- package/dist/os/flow/branch-name.d.ts.map +1 -0
- package/dist/os/flow/branch-name.js +108 -0
- package/dist/os/flow/branch-name.js.map +1 -0
- package/dist/os/flow/digest.d.ts +92 -0
- package/dist/os/flow/digest.d.ts.map +1 -0
- package/dist/os/flow/digest.js +663 -0
- package/dist/os/flow/digest.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts +3 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -0
- package/dist/os/flow/flow.module.js +771 -0
- package/dist/os/flow/flow.module.js.map +1 -0
- package/dist/os/flow/git.d.ts +68 -0
- package/dist/os/flow/git.d.ts.map +1 -0
- package/dist/os/flow/git.js +257 -0
- package/dist/os/flow/git.js.map +1 -0
- package/dist/os/flow/guard-files.d.ts +50 -0
- package/dist/os/flow/guard-files.d.ts.map +1 -0
- package/dist/os/flow/guard-files.js +147 -0
- package/dist/os/flow/guard-files.js.map +1 -0
- package/dist/os/flow/handlers/flow-backmerge.d.ts +27 -0
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-backmerge.js +332 -0
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -0
- package/dist/os/flow/handlers/flow-check.d.ts +42 -0
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-check.js +347 -0
- package/dist/os/flow/handlers/flow-check.js.map +1 -0
- package/dist/os/flow/handlers/flow-cut.d.ts +71 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-cut.js +722 -0
- package/dist/os/flow/handlers/flow-cut.js.map +1 -0
- package/dist/os/flow/handlers/flow-digest.d.ts +5 -0
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-digest.js +116 -0
- package/dist/os/flow/handlers/flow-digest.js.map +1 -0
- package/dist/os/flow/handlers/flow-discard.d.ts +22 -0
- package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-discard.js +204 -0
- package/dist/os/flow/handlers/flow-discard.js.map +1 -0
- package/dist/os/flow/handlers/flow-fix.d.ts +47 -0
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-fix.js +532 -0
- package/dist/os/flow/handlers/flow-fix.js.map +1 -0
- package/dist/os/flow/handlers/flow-hold.d.ts +32 -0
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-hold.js +359 -0
- package/dist/os/flow/handlers/flow-hold.js.map +1 -0
- package/dist/os/flow/handlers/flow-install.d.ts +92 -0
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-install.js +883 -0
- package/dist/os/flow/handlers/flow-install.js.map +1 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts +35 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-integrate.js +436 -0
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -0
- package/dist/os/flow/handlers/flow-open.d.ts +63 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-open.js +294 -0
- package/dist/os/flow/handlers/flow-open.js.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +17 -0
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-publication-retire.js +132 -0
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -0
- package/dist/os/flow/handlers/flow-push.d.ts +29 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-push.js +397 -0
- package/dist/os/flow/handlers/flow-push.js.map +1 -0
- package/dist/os/flow/handlers/flow-status.d.ts +65 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-status.js +193 -0
- package/dist/os/flow/handlers/flow-status.js.map +1 -0
- package/dist/os/flow/handlers/flow-unhold.d.ts +20 -0
- package/dist/os/flow/handlers/flow-unhold.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-unhold.js +158 -0
- package/dist/os/flow/handlers/flow-unhold.js.map +1 -0
- package/dist/os/flow/handlers/flow-version.d.ts +39 -0
- package/dist/os/flow/handlers/flow-version.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-version.js +122 -0
- package/dist/os/flow/handlers/flow-version.js.map +1 -0
- package/dist/os/flow/index.d.ts +30 -0
- package/dist/os/flow/index.d.ts.map +1 -0
- package/dist/os/flow/index.js +83 -0
- package/dist/os/flow/index.js.map +1 -0
- package/dist/os/flow/line-version.d.ts +23 -0
- package/dist/os/flow/line-version.d.ts.map +1 -0
- package/dist/os/flow/line-version.js +83 -0
- package/dist/os/flow/line-version.js.map +1 -0
- package/dist/os/flow/locks.d.ts +39 -0
- package/dist/os/flow/locks.d.ts.map +1 -0
- package/dist/os/flow/locks.js +177 -0
- package/dist/os/flow/locks.js.map +1 -0
- package/dist/os/flow/markers.d.ts +49 -0
- package/dist/os/flow/markers.d.ts.map +1 -0
- package/dist/os/flow/markers.js +112 -0
- package/dist/os/flow/markers.js.map +1 -0
- package/dist/os/flow/publication-order.d.ts +25 -0
- package/dist/os/flow/publication-order.d.ts.map +1 -0
- package/dist/os/flow/publication-order.js +75 -0
- package/dist/os/flow/publication-order.js.map +1 -0
- package/dist/os/flow/publish.d.ts +46 -0
- package/dist/os/flow/publish.d.ts.map +1 -0
- package/dist/os/flow/publish.js +209 -0
- package/dist/os/flow/publish.js.map +1 -0
- package/dist/os/flow/registry.d.ts +142 -0
- package/dist/os/flow/registry.d.ts.map +1 -0
- package/dist/os/flow/registry.js +199 -0
- package/dist/os/flow/registry.js.map +1 -0
- package/dist/os/flow/release-level.d.ts +23 -0
- package/dist/os/flow/release-level.d.ts.map +1 -0
- package/dist/os/flow/release-level.js +102 -0
- package/dist/os/flow/release-level.js.map +1 -0
- package/dist/os/flow/release-lines.d.ts +25 -0
- package/dist/os/flow/release-lines.d.ts.map +1 -0
- package/dist/os/flow/release-lines.js +172 -0
- package/dist/os/flow/release-lines.js.map +1 -0
- package/dist/os/flow/release-tags.d.ts +73 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -0
- package/dist/os/flow/release-tags.js +167 -0
- package/dist/os/flow/release-tags.js.map +1 -0
- package/dist/os/flow/repo-kind.d.ts +41 -0
- package/dist/os/flow/repo-kind.d.ts.map +1 -0
- package/dist/os/flow/repo-kind.js +92 -0
- package/dist/os/flow/repo-kind.js.map +1 -0
- package/dist/os/flow/scripts.d.ts +20 -0
- package/dist/os/flow/scripts.d.ts.map +1 -0
- package/dist/os/flow/scripts.js +50 -0
- package/dist/os/flow/scripts.js.map +1 -0
- package/dist/os/flow/semver.d.ts +21 -0
- package/dist/os/flow/semver.d.ts.map +1 -0
- package/dist/os/flow/semver.js +73 -0
- package/dist/os/flow/semver.js.map +1 -0
- package/dist/os/flow/task-files.d.ts +11 -0
- package/dist/os/flow/task-files.d.ts.map +1 -0
- package/dist/os/flow/task-files.js +51 -0
- package/dist/os/flow/task-files.js.map +1 -0
- package/dist/os/flow/tests/helpers.d.ts +55 -0
- package/dist/os/flow/tests/helpers.d.ts.map +1 -0
- package/dist/os/flow/tests/helpers.js +193 -0
- package/dist/os/flow/tests/helpers.js.map +1 -0
- package/dist/os/flow/version-files.d.ts +21 -0
- package/dist/os/flow/version-files.d.ts.map +1 -0
- package/dist/os/flow/version-files.js +94 -0
- package/dist/os/flow/version-files.js.map +1 -0
- package/dist/os/flow/worktree-path.d.ts +31 -0
- package/dist/os/flow/worktree-path.d.ts.map +1 -0
- package/dist/os/flow/worktree-path.js +80 -0
- package/dist/os/flow/worktree-path.js.map +1 -0
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +44 -51
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts +21 -0
- package/dist/os/mission/lockfile.d.ts.map +1 -0
- package/dist/os/mission/lockfile.js +76 -0
- package/dist/os/mission/lockfile.js.map +1 -0
- package/dist/os/mission/mission.module.d.ts.map +1 -1
- package/dist/os/mission/mission.module.js +2 -1
- package/dist/os/mission/mission.module.js.map +1 -1
- package/dist/os/program/handlers/seal.d.ts.map +1 -1
- package/dist/os/program/handlers/seal.js +1 -1
- package/dist/os/program/handlers/seal.js.map +1 -1
- package/dist/os/program/handlers/validate.d.ts.map +1 -1
- package/dist/os/program/handlers/validate.js +1 -1
- package/dist/os/program/handlers/validate.js.map +1 -1
- package/dist/os/program/program.module.d.ts.map +1 -1
- package/dist/os/program/program.module.js +2 -1
- package/dist/os/program/program.module.js.map +1 -1
- package/dist/os/program/schemas.d.ts +4 -6
- package/dist/os/program/schemas.d.ts.map +1 -1
- package/dist/os/program/schemas.js +16 -6
- package/dist/os/program/schemas.js.map +1 -1
- package/dist/os/program/state.d.ts +0 -1
- package/dist/os/program/state.d.ts.map +1 -1
- package/dist/os/program/state.js +1 -7
- package/dist/os/program/state.js.map +1 -1
- package/dist/os/rfc/acceptance.d.ts +21 -0
- package/dist/os/rfc/acceptance.d.ts.map +1 -1
- package/dist/os/rfc/acceptance.js +62 -13
- package/dist/os/rfc/acceptance.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts +19 -0
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +65 -12
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts +6 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +24 -19
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +2 -5
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +10 -8
- 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 +15 -5
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/index.d.ts +2 -2
- package/dist/os/rfc/index.d.ts.map +1 -1
- package/dist/os/rfc/index.js +5 -2
- package/dist/os/rfc/index.js.map +1 -1
- package/dist/os/rfc/probe-batch.d.ts +71 -0
- package/dist/os/rfc/probe-batch.d.ts.map +1 -0
- package/dist/os/rfc/probe-batch.js +251 -0
- package/dist/os/rfc/probe-batch.js.map +1 -0
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +16 -2
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +21 -10
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
- package/dist/os/rfc/verification-refresh.js +20 -13
- package/dist/os/rfc/verification-refresh.js.map +1 -1
- package/dist/os/system/handlers/outbox-validate.d.ts +8 -0
- package/dist/os/system/handlers/outbox-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/outbox-validate.js +102 -0
- package/dist/os/system/handlers/outbox-validate.js.map +1 -0
- package/dist/os/system/handlers/system-map-validate.d.ts +13 -0
- package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -0
- package/dist/os/system/handlers/system-map-validate.js +78 -0
- package/dist/os/system/handlers/system-map-validate.js.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts +10 -0
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -0
- package/dist/os/system/handlers/system-outbox-scan.js +195 -0
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -0
- package/dist/os/system/handlers/system-task-collect.d.ts +13 -0
- package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-collect.js +238 -0
- package/dist/os/system/handlers/system-task-collect.js.map +1 -0
- package/dist/os/system/handlers/system-task-create.d.ts +32 -0
- package/dist/os/system/handlers/system-task-create.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-create.js +216 -0
- package/dist/os/system/handlers/system-task-create.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts +14 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.js +290 -0
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -0
- package/dist/os/system/handlers/system-task-move.d.ts +12 -0
- package/dist/os/system/handlers/system-task-move.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-move.js +217 -0
- package/dist/os/system/handlers/system-task-move.js.map +1 -0
- package/dist/os/system/handlers/system-task-status.d.ts +20 -0
- package/dist/os/system/handlers/system-task-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-task-status.js +139 -0
- package/dist/os/system/handlers/system-task-status.js.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts +12 -0
- package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -0
- package/dist/os/system/handlers/system-versionset-record.js +332 -0
- package/dist/os/system/handlers/system-versionset-record.js.map +1 -0
- package/dist/os/system/index.d.ts +6 -0
- package/dist/os/system/index.d.ts.map +1 -0
- package/dist/os/system/index.js +18 -0
- package/dist/os/system/index.js.map +1 -0
- package/dist/os/system/outbox-schema.d.ts +30 -0
- package/dist/os/system/outbox-schema.d.ts.map +1 -0
- package/dist/os/system/outbox-schema.js +29 -0
- package/dist/os/system/outbox-schema.js.map +1 -0
- package/dist/os/system/repo.d.ts +64 -0
- package/dist/os/system/repo.d.ts.map +1 -0
- package/dist/os/system/repo.js +364 -0
- package/dist/os/system/repo.js.map +1 -0
- package/dist/os/system/scenario-schemas.d.ts +26 -0
- package/dist/os/system/scenario-schemas.d.ts.map +1 -0
- package/dist/os/system/scenario-schemas.js +53 -0
- package/dist/os/system/scenario-schemas.js.map +1 -0
- package/dist/os/system/schemas.d.ts +63 -0
- package/dist/os/system/schemas.d.ts.map +1 -0
- package/dist/os/system/schemas.js +83 -0
- package/dist/os/system/schemas.js.map +1 -0
- package/dist/os/system/system.module.d.ts +3 -0
- package/dist/os/system/system.module.d.ts.map +1 -0
- package/dist/os/system/system.module.js +429 -0
- package/dist/os/system/system.module.js.map +1 -0
- package/dist/os/system/task-schemas.d.ts +108 -0
- package/dist/os/system/task-schemas.d.ts.map +1 -0
- package/dist/os/system/task-schemas.js +152 -0
- package/dist/os/system/task-schemas.js.map +1 -0
- package/dist/os/system/task-store.d.ts +41 -0
- package/dist/os/system/task-store.d.ts.map +1 -0
- package/dist/os/system/task-store.js +142 -0
- package/dist/os/system/task-store.js.map +1 -0
- package/dist/os/system/tests/helpers.d.ts +30 -0
- package/dist/os/system/tests/helpers.d.ts.map +1 -0
- package/dist/os/system/tests/helpers.js +178 -0
- package/dist/os/system/tests/helpers.js.map +1 -0
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +21 -7
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +1 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
- package/dist/os/werkstatt/werkstatt.module.js +2 -82
- package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +0 -3
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +2 -4
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +49 -4
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/create.d.ts +13 -0
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +95 -9
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +2 -47
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/upgrade.d.ts +5 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +70 -1
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/types.d.ts +9 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -2
- package/docs/branch-model.md +98 -0
- package/docs/maintainers/publishing.md +10 -8
- package/docs/reference/cli.md +0 -3
- package/os/adr/handlers/implement-stamp-lock.test.ts +90 -0
- package/os/adr/handlers/implement-stamp.ts +29 -20
- package/os/checks/handlers/counters-journal.test.ts +10 -0
- package/os/checks/handlers/counters-journal.ts +8 -1
- package/os/core/core.module.ts +38 -39
- package/os/core/lock-holder.ts +88 -0
- package/os/core/stamp-lock.ts +142 -0
- package/os/flow/assets/flow-guard.sh +176 -0
- package/os/flow/branch-name.ts +139 -0
- package/os/flow/digest.ts +803 -0
- package/os/flow/flow.module.ts +796 -0
- package/os/flow/git.ts +342 -0
- package/os/flow/guard-files.ts +172 -0
- package/os/flow/handlers/flow-backmerge.ts +488 -0
- package/os/flow/handlers/flow-check.ts +450 -0
- package/os/flow/handlers/flow-cut.ts +1025 -0
- package/os/flow/handlers/flow-digest.ts +130 -0
- package/os/flow/handlers/flow-discard.ts +310 -0
- package/os/flow/handlers/flow-fix.ts +703 -0
- package/os/flow/handlers/flow-hold.ts +500 -0
- package/os/flow/handlers/flow-install.ts +1185 -0
- package/os/flow/handlers/flow-integrate.ts +623 -0
- package/os/flow/handlers/flow-open.ts +447 -0
- package/os/flow/handlers/flow-publication-retire.ts +156 -0
- package/os/flow/handlers/flow-push.ts +488 -0
- package/os/flow/handlers/flow-status.ts +283 -0
- package/os/flow/handlers/flow-unhold.ts +220 -0
- package/os/flow/handlers/flow-version.ts +196 -0
- package/os/flow/index.ts +102 -0
- package/os/flow/line-version.ts +113 -0
- package/os/flow/locks.ts +227 -0
- package/os/flow/markers.ts +135 -0
- package/os/flow/publication-order.ts +99 -0
- package/os/flow/publish.ts +272 -0
- package/os/flow/registry.ts +269 -0
- package/os/flow/release-level.ts +139 -0
- package/os/flow/release-lines.ts +208 -0
- package/os/flow/release-tags.ts +232 -0
- package/os/flow/repo-kind.ts +117 -0
- package/os/flow/scripts.ts +75 -0
- package/os/flow/semver.ts +82 -0
- package/os/flow/task-files.ts +59 -0
- package/os/flow/tests/branch-name.test.ts +136 -0
- package/os/flow/tests/fixtures/branch-names.yaml +56 -0
- package/os/flow/tests/flow-backmerge.test.ts +267 -0
- package/os/flow/tests/flow-check-version.test.ts +138 -0
- package/os/flow/tests/flow-check.test.ts +213 -0
- package/os/flow/tests/flow-cut-prepare.test.ts +298 -0
- package/os/flow/tests/flow-cut.rerun.test.ts +95 -0
- package/os/flow/tests/flow-cut.test.ts +323 -0
- package/os/flow/tests/flow-digest.test.ts +313 -0
- package/os/flow/tests/flow-discard.test.ts +220 -0
- package/os/flow/tests/flow-fix.test.ts +359 -0
- package/os/flow/tests/flow-guard-merge.test.ts +100 -0
- package/os/flow/tests/flow-guard-parity.test.ts +115 -0
- package/os/flow/tests/flow-guard-push.test.ts +100 -0
- package/os/flow/tests/flow-guard.test.ts +135 -0
- package/os/flow/tests/flow-hold.test.ts +465 -0
- package/os/flow/tests/flow-install-baseline.rerun.test.ts +73 -0
- package/os/flow/tests/flow-install-baseline.test.ts +164 -0
- package/os/flow/tests/flow-install-markers.test.ts +161 -0
- package/os/flow/tests/flow-install.rerun.test.ts +212 -0
- package/os/flow/tests/flow-install.test.ts +330 -0
- package/os/flow/tests/flow-integrate.rerun.test.ts +92 -0
- package/os/flow/tests/flow-integrate.test.ts +229 -0
- package/os/flow/tests/flow-open.test.ts +200 -0
- package/os/flow/tests/flow-publication-retire.test.ts +191 -0
- package/os/flow/tests/flow-push-publish.test.ts +282 -0
- package/os/flow/tests/flow-push-supersede.test.ts +221 -0
- package/os/flow/tests/flow-push.test.ts +160 -0
- package/os/flow/tests/flow-stale.test.ts +136 -0
- package/os/flow/tests/flow-status.test.ts +93 -0
- package/os/flow/tests/flow-task-files.test.ts +59 -0
- package/os/flow/tests/flow-version-level.test.ts +116 -0
- package/os/flow/tests/flow-version.test.ts +169 -0
- package/os/flow/tests/helpers.ts +239 -0
- package/os/flow/tests/is-flow-adopted.test.ts +71 -0
- package/os/flow/tests/locks.test.ts +219 -0
- package/os/flow/tests/publication-order.test.ts +102 -0
- package/os/flow/tests/registry.test.ts +150 -0
- package/os/flow/tests/repository-line-version.test.ts +100 -0
- package/os/flow/tests/scripts.test.ts +97 -0
- package/os/flow/tests/state-roots.test.ts +127 -0
- package/os/flow/tests/version-files.test.ts +145 -0
- package/os/flow/version-files.ts +115 -0
- package/os/flow/worktree-path.ts +107 -0
- package/os/mission/handlers/archive.test.ts +108 -36
- package/os/mission/handlers/archive.ts +46 -51
- package/os/mission/lockfile.ts +84 -0
- package/os/mission/mission.module.ts +2 -1
- package/os/program/handlers/seal.ts +1 -1
- package/os/program/handlers/validate.ts +1 -1
- package/os/program/program.module.ts +2 -1
- package/os/program/schemas.ts +51 -34
- package/os/program/state.ts +1 -9
- package/os/rfc/acceptance.ts +84 -19
- package/os/rfc/frontmatter-io.ts +78 -12
- package/os/rfc/handlers/implement-stamp-lock.test.ts +133 -0
- package/os/rfc/handlers/implement-stamp-stale.test.ts +22 -0
- package/os/rfc/handlers/implement-stamp.ts +30 -24
- package/os/rfc/handlers/validate-rules.test.ts +9 -6
- package/os/rfc/handlers/validate-rules.ts +12 -10
- package/os/rfc/handlers/validate.ts +17 -5
- package/os/rfc/index.ts +13 -1
- package/os/rfc/probe-batch.ts +329 -0
- package/os/rfc/rfc.module.ts +19 -2
- package/os/rfc/verification-emit-check.test.ts +22 -0
- package/os/rfc/verification-emit-freshness.test.ts +22 -0
- package/os/rfc/verification-emit.test.ts +22 -0
- package/os/rfc/verification-evidence.ts +21 -16
- package/os/rfc/verification-refresh.test.ts +22 -0
- package/os/rfc/verification-refresh.ts +20 -18
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +9 -0
- package/os/system/handlers/outbox-validate.ts +120 -0
- package/os/system/handlers/system-map-validate.ts +107 -0
- package/os/system/handlers/system-outbox-scan.ts +320 -0
- package/os/system/handlers/system-task-collect.ts +305 -0
- package/os/system/handlers/system-task-create.ts +271 -0
- package/os/system/handlers/system-task-dispatch.ts +387 -0
- package/os/system/handlers/system-task-move.ts +353 -0
- package/os/system/handlers/system-task-status.ts +176 -0
- package/os/system/handlers/system-versionset-record.ts +476 -0
- package/os/system/index.ts +47 -0
- package/os/system/outbox-schema.ts +47 -0
- package/os/system/repo.ts +451 -0
- package/os/system/scenario-schemas.ts +62 -0
- package/os/system/schemas.ts +102 -0
- package/os/system/system.module.ts +449 -0
- package/os/system/task-schemas.ts +190 -0
- package/os/system/task-store.ts +184 -0
- package/os/system/tests/helpers.ts +189 -0
- package/os/system/tests/outbox-validate.test.ts +92 -0
- package/os/system/tests/system-map-validate.test.ts +321 -0
- package/os/system/tests/system-outbox-scan.test.ts +273 -0
- package/os/system/tests/system-profile.test.ts +90 -0
- package/os/system/tests/system-task-collect.test.ts +293 -0
- package/os/system/tests/system-task-dispatch.test.ts +279 -0
- package/os/system/tests/system-task-status.test.ts +153 -0
- package/os/system/tests/system-task.test.ts +330 -0
- package/os/system/tests/system-versionset.test.ts +314 -0
- package/os/werkstatt/handlers/werkstatt-lock-recover.ts +22 -5
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +1 -1
- package/os/werkstatt/werkstatt.module.ts +2 -85
- package/package.json +49 -1
- package/profiles/forge-shell.yaml +22 -10
- package/profiles/godot-game.yaml +24 -13
- package/profiles/knowledge.yaml +19 -0
- package/profiles/phaser-game.yaml +25 -13
- package/profiles/site-workshop.yaml +27 -10
- package/profiles/system.yaml +650 -0
- package/profiles/typescript.yaml +26 -9
- package/skills/fo/fo-outbox/SKILL.md +71 -0
- package/skills/fo/fo-session-retro/SKILL.md +18 -7
- package/skills/fo/fo-step-commit/SKILL.md +2 -1
- package/skills/fo/fo-system-dispatch/SKILL.md +65 -0
- package/skills/fo/fo-task-run/SKILL.md +75 -0
- package/src/config/forge-config.ts +2 -6
- package/src/index.ts +19 -4
- package/src/onboarding/agents-generate.ts +49 -5
- package/src/onboarding/create.ts +101 -9
- package/src/onboarding/doctor.ts +2 -51
- package/src/onboarding/upgrade.ts +86 -1
- package/src/tests/agents-generate-flow.test.ts +132 -0
- package/src/tests/create-flow.test.ts +114 -0
- package/src/tests/create.test.ts +22 -21
- package/src/tests/doctor-autonomy.test.ts +2 -1
- package/src/tests/fixtures/agents-generate-business-before.txt +6 -0
- package/src/tests/implement-stamp.test.ts +26 -3
- package/src/tests/profile-flow-hooks.test.ts +77 -0
- package/src/tests/profile-schema.test.ts +2 -1
- package/src/tests/program-schemas.test.ts +66 -6
- package/src/tests/program-spec-node.test.ts +1 -5
- package/src/tests/rfc-evidence-sync.test.ts +22 -0
- package/src/tests/rfc-implement-stamp-governance.test.ts +25 -1
- package/src/tests/rfc-verification-verdict-ingest.test.ts +22 -0
- package/src/tests/upgrade-flow.test.ts +174 -0
- package/src/types.ts +11 -2
- package/dist/os/werkstatt/handlers/session-close.d.ts +0 -13
- package/dist/os/werkstatt/handlers/session-close.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-close.js +0 -56
- package/dist/os/werkstatt/handlers/session-close.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-engine.d.ts +0 -3
- package/dist/os/werkstatt/handlers/session-engine.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-engine.js +0 -28
- package/dist/os/werkstatt/handlers/session-engine.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-open.d.ts +0 -10
- package/dist/os/werkstatt/handlers/session-open.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-open.js +0 -46
- package/dist/os/werkstatt/handlers/session-open.js.map +0 -1
- package/dist/os/werkstatt/handlers/session-status.d.ts +0 -9
- package/dist/os/werkstatt/handlers/session-status.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/session-status.js +0 -34
- package/dist/os/werkstatt/handlers/session-status.js.map +0 -1
- package/os/werkstatt/handlers/session-close.ts +0 -82
- package/os/werkstatt/handlers/session-engine.ts +0 -34
- package/os/werkstatt/handlers/session-open.ts +0 -68
- package/os/werkstatt/handlers/session-status.ts +0 -55
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>withFlowLock + holderIsDead tests (RFC-1504, AC-1..AC-4): a lock whose
|
|
4
|
+
pid does not exist on this host is broken without waiting; a live pid waits
|
|
5
|
+
to the age limit; a foreign host applies the age rule only; a foreign boot
|
|
6
|
+
id on this host is treated as dead. Uses injected now/sleep — no real waits.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No real repository — lock files live under os.tmpdir().</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1504: step 1 — dead-holder lock tests</item>
|
|
13
|
+
<item>RFC-1504: review fixes — legacy acquiredAt fallback, atomic break claim, verified stamp release, onStale warnings</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
18
|
+
import { tmpdir, hostname } from "node:os";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { spawnSync } from "node:child_process";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { currentBootId, holderIsDead } from "../../core/lock-holder.ts";
|
|
25
|
+
import { withFlowLock, LockTimeoutError } from "../locks.ts";
|
|
26
|
+
|
|
27
|
+
const dirs: string[] = [];
|
|
28
|
+
afterEach(async () => {
|
|
29
|
+
for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
|
|
30
|
+
}, 20_000);
|
|
31
|
+
|
|
32
|
+
const deadPid = (): number => {
|
|
33
|
+
const pid = spawnSync(process.execPath, ["-e", ""]).pid;
|
|
34
|
+
if (pid === undefined) throw new Error("spawn failed — cannot produce a dead pid");
|
|
35
|
+
return pid;
|
|
36
|
+
};
|
|
37
|
+
const livePid = (): number => process.pid;
|
|
38
|
+
const HOST = hostname();
|
|
39
|
+
|
|
40
|
+
function fakeClock(start = 0) {
|
|
41
|
+
let t = start;
|
|
42
|
+
const sleep = async (ms: number): Promise<void> => {
|
|
43
|
+
t += ms;
|
|
44
|
+
};
|
|
45
|
+
return { now: () => t, sleep, advance: (ms: number) => (t += ms) };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const io = { readFile: (p: string) => readFile(p, "utf8") };
|
|
49
|
+
|
|
50
|
+
async function lockDir(): Promise<string> {
|
|
51
|
+
const dir = await mkdtemp(join(tmpdir(), "flow-lock-"));
|
|
52
|
+
dirs.push(dir);
|
|
53
|
+
return dir;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface StaleCall {
|
|
57
|
+
path: string;
|
|
58
|
+
at: string;
|
|
59
|
+
ageMs: number;
|
|
60
|
+
reason?: string;
|
|
61
|
+
pid?: number;
|
|
62
|
+
host?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
describe("holderIsDead (RFC-1504)", () => {
|
|
66
|
+
it("dead pid on this host → dead (AC-1 basis)", () => {
|
|
67
|
+
expect(holderIsDead({ pid: deadPid(), host: HOST })).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("live pid on this host → alive", () => {
|
|
71
|
+
expect(holderIsDead({ pid: livePid(), host: HOST })).toBe(false);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("foreign host → never dead by pid (AC-3 basis)", () => {
|
|
75
|
+
expect(holderIsDead({ pid: deadPid(), host: "other-host" })).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("absent host → never dead by pid", () => {
|
|
79
|
+
expect(holderIsDead({ pid: deadPid() })).toBe(false);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("a pid we cannot signal (EPERM) counts as alive — fail closed", () => {
|
|
83
|
+
// pid 1 belongs to init: signal-0 either succeeds or EPERMs, never ESRCH.
|
|
84
|
+
expect(holderIsDead({ pid: 1, host: HOST })).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("different boot id on this host → dead even with a live pid (AC-4 basis)", () => {
|
|
88
|
+
const boot = currentBootId();
|
|
89
|
+
if (boot === undefined) return; // non-Linux — the boot rule cannot fire
|
|
90
|
+
expect(holderIsDead({ pid: livePid(), host: HOST, bootId: "different-boot" })).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("withFlowLock dead-holder recovery (RFC-1504)", () => {
|
|
95
|
+
it("acquires a dead-holder lock without waiting (AC-1)", async () => {
|
|
96
|
+
const dir = await lockDir();
|
|
97
|
+
const lockPath = join(dir, "test.lock");
|
|
98
|
+
const at = new Date().toISOString();
|
|
99
|
+
await writeFile(lockPath, JSON.stringify({ pid: deadPid(), host: HOST, at }));
|
|
100
|
+
|
|
101
|
+
const stale: StaleCall[] = [];
|
|
102
|
+
const clock = fakeClock();
|
|
103
|
+
const result = await withFlowLock(
|
|
104
|
+
lockPath,
|
|
105
|
+
{
|
|
106
|
+
waitMs: 60_000,
|
|
107
|
+
staleMs: 3_600_000,
|
|
108
|
+
onStale: (l) => stale.push(l as StaleCall),
|
|
109
|
+
now: clock.now,
|
|
110
|
+
sleep: clock.sleep,
|
|
111
|
+
},
|
|
112
|
+
async () => "held",
|
|
113
|
+
io,
|
|
114
|
+
);
|
|
115
|
+
expect(result).toBe("held");
|
|
116
|
+
expect(stale).toHaveLength(1);
|
|
117
|
+
expect(stale[0]?.reason).toBe("dead-holder");
|
|
118
|
+
expect(stale[0]?.pid).toBeGreaterThan(0);
|
|
119
|
+
// Lock released after fn — file is gone.
|
|
120
|
+
await expect(readFile(lockPath, "utf8")).rejects.toThrow();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("waits to the age limit behind a live pid (AC-2)", async () => {
|
|
124
|
+
const dir = await lockDir();
|
|
125
|
+
const lockPath = join(dir, "test.lock");
|
|
126
|
+
const at = new Date().toISOString();
|
|
127
|
+
await writeFile(lockPath, JSON.stringify({ pid: livePid(), host: HOST, at }));
|
|
128
|
+
|
|
129
|
+
const clock = fakeClock();
|
|
130
|
+
const stale: StaleCall[] = [];
|
|
131
|
+
await expect(
|
|
132
|
+
withFlowLock(
|
|
133
|
+
lockPath,
|
|
134
|
+
{
|
|
135
|
+
waitMs: 500,
|
|
136
|
+
staleMs: 3_600_000,
|
|
137
|
+
onStale: (l) => stale.push(l as StaleCall),
|
|
138
|
+
now: clock.now,
|
|
139
|
+
sleep: clock.sleep,
|
|
140
|
+
},
|
|
141
|
+
async () => "held",
|
|
142
|
+
io,
|
|
143
|
+
),
|
|
144
|
+
).rejects.toBeInstanceOf(LockTimeoutError);
|
|
145
|
+
expect(stale).toHaveLength(0);
|
|
146
|
+
// The live lock file survives the refused wait.
|
|
147
|
+
const held = JSON.parse(await readFile(lockPath, "utf8")) as { pid: number };
|
|
148
|
+
expect(held.pid).toBe(livePid());
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("a foreign host applies only the age rule (AC-3)", async () => {
|
|
152
|
+
const dir = await lockDir();
|
|
153
|
+
const lockPath = join(dir, "test.lock");
|
|
154
|
+
const at = new Date().toISOString();
|
|
155
|
+
await writeFile(lockPath, JSON.stringify({ pid: deadPid(), host: "other-host", at }));
|
|
156
|
+
|
|
157
|
+
const clock = fakeClock();
|
|
158
|
+
const stale: StaleCall[] = [];
|
|
159
|
+
await expect(
|
|
160
|
+
withFlowLock(
|
|
161
|
+
lockPath,
|
|
162
|
+
{
|
|
163
|
+
waitMs: 500,
|
|
164
|
+
staleMs: 3_600_000,
|
|
165
|
+
onStale: (l) => stale.push(l as StaleCall),
|
|
166
|
+
now: clock.now,
|
|
167
|
+
sleep: clock.sleep,
|
|
168
|
+
},
|
|
169
|
+
async () => "held",
|
|
170
|
+
io,
|
|
171
|
+
),
|
|
172
|
+
).rejects.toBeInstanceOf(LockTimeoutError);
|
|
173
|
+
expect(stale).toHaveLength(0); // dead pid on a foreign host is not broken
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("a different boot id on this host is broken without waiting (AC-4)", async () => {
|
|
177
|
+
const boot = currentBootId();
|
|
178
|
+
if (boot === undefined) return; // non-Linux platform — rule not applicable
|
|
179
|
+
const dir = await lockDir();
|
|
180
|
+
const lockPath = join(dir, "test.lock");
|
|
181
|
+
const at = new Date().toISOString();
|
|
182
|
+
await writeFile(
|
|
183
|
+
lockPath,
|
|
184
|
+
JSON.stringify({ pid: livePid(), host: HOST, at, bootId: "different-boot" }),
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const stale: StaleCall[] = [];
|
|
188
|
+
const result = await withFlowLock(
|
|
189
|
+
lockPath,
|
|
190
|
+
{
|
|
191
|
+
waitMs: 500,
|
|
192
|
+
staleMs: 3_600_000,
|
|
193
|
+
onStale: (l) => stale.push(l as StaleCall),
|
|
194
|
+
},
|
|
195
|
+
async () => "held",
|
|
196
|
+
io,
|
|
197
|
+
);
|
|
198
|
+
expect(result).toBe("held");
|
|
199
|
+
expect(stale[0]?.reason).toBe("dead-holder");
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("writes bootId into fresh lock content when available", async () => {
|
|
203
|
+
const boot = currentBootId();
|
|
204
|
+
const dir = await lockDir();
|
|
205
|
+
const lockPath = join(dir, "test.lock");
|
|
206
|
+
let captured: { bootId?: string } | null = null;
|
|
207
|
+
await withFlowLock(
|
|
208
|
+
lockPath,
|
|
209
|
+
{ waitMs: 500, staleMs: 3_600_000 },
|
|
210
|
+
async () => {
|
|
211
|
+
captured = JSON.parse(await readFile(lockPath, "utf8")) as { bootId?: string };
|
|
212
|
+
},
|
|
213
|
+
io,
|
|
214
|
+
);
|
|
215
|
+
const content = captured as { bootId?: string } | null;
|
|
216
|
+
if (boot === undefined) expect(content?.bootId).toBeUndefined();
|
|
217
|
+
else expect(content?.bootId).toBe(boot);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Unit tests for planPublications (RFC-1503) — the pure pending-
|
|
4
|
+
publication selection behind flow.digest and flow.push. Covers per-line
|
|
5
|
+
highest selection, semver (not string) order, superseded-on-sight at or
|
|
6
|
+
below the newest published, retired/published filtering, cross-line prefix
|
|
7
|
+
isolation, equal versions and non-semver drops.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No git fixtures — pure function, table-driven.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1503: review r1 F-7 — direct planPublications unit tests</item>
|
|
14
|
+
<item>RFC-1503: review r1 — FLOW-07 on retire journal failure, journal re-read before publish, publication-order unit tests, stale catalog/inventory regen</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { describe, expect, it } from "vitest";
|
|
19
|
+
|
|
20
|
+
import { planPublications } from "../publication-order.ts";
|
|
21
|
+
import { parseVersion, type SemVer } from "../semver.ts";
|
|
22
|
+
|
|
23
|
+
interface Line {
|
|
24
|
+
id: string;
|
|
25
|
+
tagPrefix: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const LINES: Line[] = [
|
|
29
|
+
{ id: "lib", tagPrefix: "lib@" },
|
|
30
|
+
{ id: "lib-sub", tagPrefix: "lib-sub@" },
|
|
31
|
+
{ id: "repo", tagPrefix: "v" },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
function versionOf(tag: string, lineId: string): SemVer | null {
|
|
35
|
+
const line = LINES.find((l) => l.id === lineId);
|
|
36
|
+
if (line === undefined || !tag.startsWith(line.tagPrefix)) return null;
|
|
37
|
+
return parseVersion(tag.slice(line.tagPrefix.length));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const e = (tag: string, line = "lib") => ({ tag, line });
|
|
41
|
+
const plan = (
|
|
42
|
+
candidates: Array<{ tag: string; line: string }>,
|
|
43
|
+
published: string[] = [],
|
|
44
|
+
retired: string[] = [],
|
|
45
|
+
) => planPublications(candidates, new Set(published), new Set(retired), versionOf);
|
|
46
|
+
|
|
47
|
+
describe("planPublications (RFC-1503)", () => {
|
|
48
|
+
it("attempts the highest version per line — semver, not string order", () => {
|
|
49
|
+
const p = plan([e("lib@9.9.0"), e("lib@9.10.0")]);
|
|
50
|
+
expect(p.attempt).toEqual([{ tag: "lib@9.10.0", line: "lib" }]);
|
|
51
|
+
expect(p.superseded).toEqual([{ tag: "lib@9.9.0", line: "lib", by: null }]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("supersedes on sight at or below the newest published version", () => {
|
|
55
|
+
const p = plan([e("lib@1.0.0"), e("lib@0.9.0")], ["lib@1.1.0"]);
|
|
56
|
+
expect(p.attempt).toEqual([]);
|
|
57
|
+
expect(p.superseded).toEqual([
|
|
58
|
+
{ tag: "lib@0.9.0", line: "lib", by: "lib@1.1.0" },
|
|
59
|
+
{ tag: "lib@1.0.0", line: "lib", by: "lib@1.1.0" },
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("a candidate above the newest published still attempts", () => {
|
|
64
|
+
const p = plan([e("lib@1.2.0"), e("lib@1.0.0")], ["lib@1.1.0"]);
|
|
65
|
+
expect(p.attempt).toEqual([{ tag: "lib@1.2.0", line: "lib" }]);
|
|
66
|
+
expect(p.superseded).toEqual([{ tag: "lib@1.0.0", line: "lib", by: "lib@1.1.0" }]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("drops published and retired candidates entirely", () => {
|
|
70
|
+
const p = plan([e("lib@1.0.0"), e("lib@1.1.0"), e("lib@1.2.0")], ["lib@1.1.0"], ["lib@1.0.0"]);
|
|
71
|
+
expect(p.attempt).toEqual([{ tag: "lib@1.2.0", line: "lib" }]);
|
|
72
|
+
expect(p.superseded).toEqual([]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("keeps lines independent — lib does not supersede lib-sub", () => {
|
|
76
|
+
const p = plan([e("lib@1.0.0"), e("lib-sub@0.5.0", "lib-sub")]);
|
|
77
|
+
expect(p.attempt).toEqual([
|
|
78
|
+
{ tag: "lib@1.0.0", line: "lib" },
|
|
79
|
+
{ tag: "lib-sub@0.5.0", line: "lib-sub" },
|
|
80
|
+
]);
|
|
81
|
+
expect(p.superseded).toEqual([]);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("published tags of other lines never form a bar", () => {
|
|
85
|
+
const p = plan([e("lib@1.0.0")], ["lib-sub@9.9.9"]);
|
|
86
|
+
expect(p.attempt).toEqual([{ tag: "lib@1.0.0", line: "lib" }]);
|
|
87
|
+
expect(p.superseded).toEqual([]);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("equal candidate versions: exactly one attempts, deterministically", () => {
|
|
91
|
+
const p = plan([e("lib@1.0.0"), e("lib@1.0.0")]);
|
|
92
|
+
expect(p.attempt).toEqual([{ tag: "lib@1.0.0", line: "lib" }]);
|
|
93
|
+
// The duplicate is shadowed, not attempted twice.
|
|
94
|
+
expect(p.superseded).toEqual([{ tag: "lib@1.0.0", line: "lib", by: null }]);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("drops candidates whose suffix is not strict semver", () => {
|
|
98
|
+
const p = plan([e("lib@next"), e("lib@1.0.0")]);
|
|
99
|
+
expect(p.attempt).toEqual([{ tag: "lib@1.0.0", line: "lib" }]);
|
|
100
|
+
expect(p.superseded).toEqual([]);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Registry contract tests (RFC-1487 step 1): the registry resolves to
|
|
4
|
+
the same file from every worktree (AC-8), a schema-invalid file throws
|
|
5
|
+
FlowRegistrySchemaError and is never rewritten, and concurrent updateRegistry
|
|
6
|
+
calls serialize under the lock.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No lifecycle coverage — flow.open/integrate/discard tests own that.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1487: step 1 — registry tests</item>
|
|
13
|
+
<item>RFC-1487: step 1 — worktree path contracts, O_EXCL locks, branch registry and journal</item>
|
|
14
|
+
<item>RFC-1487: close rfc-1487 review findings — dirty-check parity with git worktree remove, ownership-verified lock release, FLOW-07 registry-error mapping, residual RFC-1462 docs removed
|
|
15
|
+
|
|
16
|
+
The dirty gate for session worktrees now uses full porcelain status
|
|
17
|
+
(untracked files included) because it predicts 'git worktree remove';
|
|
18
|
+
the primary-clean gate keeps tracked-only semantics because it predicts
|
|
19
|
+
'merge --ff-only'. Lock release verifies the held payload before
|
|
20
|
+
unlinking. Registry/journal failures map to FLOW-07 in every handler.
|
|
21
|
+
The final branch-name collision reports FLOW-OPEN-04, flow.discard
|
|
22
|
+
propagates its teardown result and predicts FLOW-DIS-03 on --dry-run,
|
|
23
|
+
and integrate exposes teardown as its own field.</item>
|
|
24
|
+
<item>RFC-1490: step 2 — registry fix/port widening, FORGE_FLOW_COMMIT gitCommit helper, verified version-files writes</item>
|
|
25
|
+
<item>RFC-1491: step 1 — journal base/rewrites + held registry widening, W1-1 discard tip, FLOW-INT-11</item>
|
|
26
|
+
</CHANGE_SUMMARY>
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
30
|
+
import { join } from "node:path";
|
|
31
|
+
|
|
32
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
33
|
+
|
|
34
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
35
|
+
import {
|
|
36
|
+
commonGitDir,
|
|
37
|
+
emptyRegistry,
|
|
38
|
+
FlowRegistrySchemaError,
|
|
39
|
+
flowRegistryEntrySchema,
|
|
40
|
+
readRegistry,
|
|
41
|
+
registryPath,
|
|
42
|
+
updateRegistry,
|
|
43
|
+
type FlowRegistryEntry,
|
|
44
|
+
} from "../registry.ts";
|
|
45
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
46
|
+
|
|
47
|
+
function entry(name: string): FlowRegistryEntry {
|
|
48
|
+
return {
|
|
49
|
+
name,
|
|
50
|
+
kind: "session",
|
|
51
|
+
base: "develop",
|
|
52
|
+
baseSha: "0".repeat(40),
|
|
53
|
+
worktree: `/tmp/${name.replaceAll("/", "-")}`,
|
|
54
|
+
owner: { kind: "session", id: "test" },
|
|
55
|
+
brief: null,
|
|
56
|
+
openedAt: "2026-11-01T00:00:00Z",
|
|
57
|
+
updatedAt: "2026-11-01T00:00:00Z",
|
|
58
|
+
held: null,
|
|
59
|
+
port: null,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const tempDirs: string[] = [];
|
|
64
|
+
async function repo(): Promise<string> {
|
|
65
|
+
const dir = await initRepo({ prefix: "flow-registry-test-" });
|
|
66
|
+
tempDirs.push(dir);
|
|
67
|
+
return dir;
|
|
68
|
+
}
|
|
69
|
+
afterEach(async () => {
|
|
70
|
+
await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })));
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("commonGitDir", () => {
|
|
74
|
+
it("resolves the same directory from the primary and a linked worktree (AC-8)", async () => {
|
|
75
|
+
const dir = await repo();
|
|
76
|
+
const linked = `${dir}-linked`;
|
|
77
|
+
tempDirs.push(linked);
|
|
78
|
+
const add = await gitExec(dir, ["worktree", "add", "-b", "probe-linked", linked]);
|
|
79
|
+
expect(add.exitCode, add.stderr).toBe(0);
|
|
80
|
+
|
|
81
|
+
const fromPrimary = await commonGitDir(ambientIo, dir);
|
|
82
|
+
const fromLinked = await commonGitDir(ambientIo, linked);
|
|
83
|
+
expect(fromPrimary).toBe(fromLinked);
|
|
84
|
+
expect(registryPath(fromPrimary)).toBe(join(fromPrimary, "forge", "registry.yaml"));
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe("readRegistry", () => {
|
|
89
|
+
it("returns the empty registry when the file is absent", async () => {
|
|
90
|
+
const dir = await repo();
|
|
91
|
+
const common = await commonGitDir(ambientIo, dir);
|
|
92
|
+
expect(await readRegistry(ambientIo, common)).toEqual(emptyRegistry());
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("throws FlowRegistrySchemaError on a schema-invalid file and never rewrites it", async () => {
|
|
96
|
+
const dir = await repo();
|
|
97
|
+
const common = await commonGitDir(ambientIo, dir);
|
|
98
|
+
const file = registryPath(common);
|
|
99
|
+
const bad = "schema: forge/flow-registry@1\nbranches: [{ name: 7 }]\n";
|
|
100
|
+
await mkdir(join(common, "forge"), { recursive: true });
|
|
101
|
+
await writeFile(file, bad);
|
|
102
|
+
|
|
103
|
+
await expect(readRegistry(ambientIo, common)).rejects.toThrow(FlowRegistrySchemaError);
|
|
104
|
+
expect(await readFile(file, "utf8")).toBe(bad);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe("flowRegistryEntrySchema held/worktree (RFC-1491)", () => {
|
|
109
|
+
const heldPayload = {
|
|
110
|
+
heldAt: "2026-11-02T00:00:00Z",
|
|
111
|
+
riskCategory: "other" as const,
|
|
112
|
+
reason: "hold it",
|
|
113
|
+
tip: "1".repeat(40),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
it("accepts a held entry with worktree: null", () => {
|
|
117
|
+
const e = { ...entry("auto/session-261102-01-held-x"), worktree: null, held: heldPayload };
|
|
118
|
+
expect(flowRegistryEntrySchema.safeParse(e).success).toBe(true);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("rejects a held entry that still names a worktree", () => {
|
|
122
|
+
const e = { ...entry("auto/session-261102-01-held-y"), held: heldPayload };
|
|
123
|
+
expect(flowRegistryEntrySchema.safeParse(e).success).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("rejects an unheld entry with worktree: null", () => {
|
|
127
|
+
const e = { ...entry("auto/session-261102-01-plain"), worktree: null };
|
|
128
|
+
expect(flowRegistryEntrySchema.safeParse(e).success).toBe(false);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe("updateRegistry", () => {
|
|
133
|
+
it("serializes concurrent updates — five writers leave five entries", async () => {
|
|
134
|
+
const dir = await repo();
|
|
135
|
+
const common = await commonGitDir(ambientIo, dir);
|
|
136
|
+
await Promise.all(
|
|
137
|
+
["a", "b", "c", "d", "e"].map((name) =>
|
|
138
|
+
updateRegistry(ambientIo, common, (r) => ({
|
|
139
|
+
...r,
|
|
140
|
+
branches: [...r.branches, entry(`auto/session-261101-0${name.length}-x${name}`)],
|
|
141
|
+
})),
|
|
142
|
+
),
|
|
143
|
+
);
|
|
144
|
+
const registry = await readRegistry(ambientIo, common);
|
|
145
|
+
expect(registry.branches).toHaveLength(5);
|
|
146
|
+
expect(registry.branches.map((b) => b.name)).toEqual(
|
|
147
|
+
[...registry.branches.map((b) => b.name)].sort(),
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>resolveRepositoryLineVersion tests (RFC-1493 step 1): a tagged repo
|
|
4
|
+
line derives X.Y.Z+N.<head9> from the last annotated tag, an untagged
|
|
5
|
+
line falls back to the version-file value, and a lightweight tag is invisible
|
|
6
|
+
to the release line.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No flow.version report coverage — flow-version.test.ts owns it.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1493: step 1 — public reader tests on throwaway repositories</item>
|
|
13
|
+
<item>RFC-1493: step 1 — forge public release-line version reader</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
|
|
20
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
21
|
+
|
|
22
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
23
|
+
import { resolveRepositoryLineVersion } from "../index.ts";
|
|
24
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
25
|
+
|
|
26
|
+
const dirs: string[] = [];
|
|
27
|
+
|
|
28
|
+
afterEach(async () => {
|
|
29
|
+
for (const dir of dirs.splice(0)) {
|
|
30
|
+
await rm(dir, { recursive: true, force: true });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
async function writeAndCommit(repo: string, file: string, content: string, message = "c"): Promise<void> {
|
|
35
|
+
await mkdir(join(repo, file.split("/").slice(0, -1).join("/")), { recursive: true });
|
|
36
|
+
await writeFile(join(repo, file), content);
|
|
37
|
+
await gitExec(repo, ["add", file]);
|
|
38
|
+
const result = await gitExec(repo, ["commit", "-m", message]);
|
|
39
|
+
if (result.exitCode !== 0) throw new Error(`commit failed: ${result.stderr}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function annotatedTag(repo: string, name: string): Promise<void> {
|
|
43
|
+
const result = await gitExec(repo, [
|
|
44
|
+
"tag", "-a", name, "-m",
|
|
45
|
+
`release ${name}\n\nschema: forge/release-tag@1\nline: repo\nversion: ${name.slice(1)}\nlevel: baseline\nprevious: null\nrfcs: []\nfingerprints: {}`,
|
|
46
|
+
]);
|
|
47
|
+
if (result.exitCode !== 0) throw new Error(`tag ${name} failed: ${result.stderr}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function repoWithRootVersion(version: string): Promise<string> {
|
|
51
|
+
const repo = await initRepo({ prefix: "line-ver-" });
|
|
52
|
+
dirs.push(repo);
|
|
53
|
+
await writeAndCommit(repo, "package.json", `{ "version": "${version}" }\n`, `version ${version}`);
|
|
54
|
+
return repo;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe("resolveRepositoryLineVersion", () => {
|
|
58
|
+
it("a tagged line two commits ahead derives X.Y.Z+2.<head9> with source release-tag", async () => {
|
|
59
|
+
const repo = await repoWithRootVersion("1.0.0");
|
|
60
|
+
await annotatedTag(repo, "v1.0.0");
|
|
61
|
+
await writeAndCommit(repo, "a.txt", "a\n", "post 1");
|
|
62
|
+
await writeAndCommit(repo, "b.txt", "b\n", "post 2");
|
|
63
|
+
|
|
64
|
+
const resolved = await resolveRepositoryLineVersion(repo, ambientIo);
|
|
65
|
+
const head = (await gitExec(repo, ["rev-parse", "--short=9", "HEAD"])).stdout.trim();
|
|
66
|
+
expect(resolved.source).toBe("release-tag");
|
|
67
|
+
expect(resolved.lastTag).toBe("v1.0.0");
|
|
68
|
+
expect(resolved.version).toBe(`1.0.0+2.${head}`);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("an untagged line resolves the version-file value with source version-file", async () => {
|
|
72
|
+
const repo = await repoWithRootVersion("6.451.0");
|
|
73
|
+
await writeAndCommit(repo, "x.txt", "x\n", "later");
|
|
74
|
+
|
|
75
|
+
const resolved = await resolveRepositoryLineVersion(repo, ambientIo);
|
|
76
|
+
expect(resolved.source).toBe("version-file");
|
|
77
|
+
expect(resolved.lastTag).toBeNull();
|
|
78
|
+
expect(resolved.version).toBe("6.451.0");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("a lightweight tag is invisible — the line still resolves version-file", async () => {
|
|
82
|
+
const repo = await repoWithRootVersion("2.3.4");
|
|
83
|
+
const tag = await gitExec(repo, ["tag", "v2.3.4"]);
|
|
84
|
+
if (tag.exitCode !== 0) throw new Error(`lightweight tag failed: ${tag.stderr}`);
|
|
85
|
+
await writeAndCommit(repo, "y.txt", "y\n", "post");
|
|
86
|
+
|
|
87
|
+
const resolved = await resolveRepositoryLineVersion(repo, ambientIo);
|
|
88
|
+
expect(resolved.source).toBe("version-file");
|
|
89
|
+
expect(resolved.lastTag).toBeNull();
|
|
90
|
+
expect(resolved.version).toBe("2.3.4");
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("an untagged line without a version file throws", async () => {
|
|
94
|
+
const repo = await initRepo({ prefix: "line-ver-" });
|
|
95
|
+
dirs.push(repo);
|
|
96
|
+
await writeAndCommit(repo, "only.txt", "x\n", "no package.json");
|
|
97
|
+
|
|
98
|
+
await expect(resolveRepositoryLineVersion(repo, ambientIo)).rejects.toThrow(/package\.json/);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Hook-script runner tests (RFC-1487 step 2): absent script → skipped,
|
|
4
|
+
non-zero exit → failed with a stderr tail, and the primary worktree's copy
|
|
5
|
+
runs even when the branch worktree carries a different one
|
|
6
|
+
(AUDIT-RFC-1487-G1).</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No lifecycle coverage — handler tests own refusal mapping.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1487: step 2 — script runner tests</item>
|
|
13
|
+
<item>RFC-1487: step 2 — primary-side hook-script runner</item>
|
|
14
|
+
<item>RFC-1490: step 4 — ordinary flow.cut (release branch, verified versions, gate, main swap, tags, resume)</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
19
|
+
import { tmpdir } from "node:os";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
25
|
+
import { runFlowScript } from "../scripts.ts";
|
|
26
|
+
|
|
27
|
+
const tempDirs: string[] = [];
|
|
28
|
+
async function dir(): Promise<string> {
|
|
29
|
+
const d = await mkdtemp(join(tmpdir(), "flow-scripts-test-"));
|
|
30
|
+
tempDirs.push(d);
|
|
31
|
+
return d;
|
|
32
|
+
}
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
await Promise.all(tempDirs.splice(0).map((d) => rm(d, { recursive: true, force: true })));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
async function writeScript(root: string, name: string, body: string): Promise<void> {
|
|
38
|
+
await mkdir(join(root, "hooks"), { recursive: true });
|
|
39
|
+
await writeFile(join(root, "hooks", `${name}.sh`), `#!/bin/sh\n${body}\n`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
describe("runFlowScript", () => {
|
|
43
|
+
it("skips when the primary has no script", async () => {
|
|
44
|
+
const primary = await dir();
|
|
45
|
+
const branch = await dir();
|
|
46
|
+
const result = await runFlowScript(ambientIo, "worktree-setup", {
|
|
47
|
+
primary,
|
|
48
|
+
cwd: branch,
|
|
49
|
+
env: {},
|
|
50
|
+
});
|
|
51
|
+
expect(result).toEqual({ status: "skipped", exitCode: null, stderrTail: "", stdout: "" });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("runs the primary copy with cwd and env; exit 0 → done", async () => {
|
|
55
|
+
const primary = await dir();
|
|
56
|
+
const branch = await dir();
|
|
57
|
+
await writeScript(primary, "worktree-setup", 'pwd > "$FLOW_PRIMARY/out.txt"; echo "$FLOW_BRANCH" > branch.txt');
|
|
58
|
+
const result = await runFlowScript(ambientIo, "worktree-setup", {
|
|
59
|
+
primary,
|
|
60
|
+
cwd: branch,
|
|
61
|
+
env: { FLOW_PRIMARY: branch, FLOW_BRANCH: "auto/x" },
|
|
62
|
+
});
|
|
63
|
+
expect(result.status).toBe("done");
|
|
64
|
+
const { readFile } = await import("node:fs/promises");
|
|
65
|
+
expect(await readFile(join(branch, "out.txt"), "utf8")).toContain(branch);
|
|
66
|
+
expect(await readFile(join(branch, "branch.txt"), "utf8")).toContain("auto/x");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("exit 3 → failed with the stderr tail", async () => {
|
|
70
|
+
const primary = await dir();
|
|
71
|
+
const branch = await dir();
|
|
72
|
+
const lines = Array.from({ length: 45 }, (_, i) => `echo "line-${i}" >&2`).join("\n");
|
|
73
|
+
await writeScript(primary, "integration-gate", `${lines}\nexit 3`);
|
|
74
|
+
const result = await runFlowScript(ambientIo, "integration-gate", {
|
|
75
|
+
primary,
|
|
76
|
+
cwd: branch,
|
|
77
|
+
env: {},
|
|
78
|
+
});
|
|
79
|
+
expect(result.status).toBe("failed");
|
|
80
|
+
expect(result.exitCode).toBe(3);
|
|
81
|
+
expect(result.stderrTail).toContain("line-44");
|
|
82
|
+
expect(result.stderrTail).not.toContain("line-4\n");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("uses the primary copy even when the branch worktree carries a different one (G1)", async () => {
|
|
86
|
+
const primary = await dir();
|
|
87
|
+
const branch = await dir();
|
|
88
|
+
await writeScript(primary, "integration-gate", "exit 0");
|
|
89
|
+
await writeScript(branch, "integration-gate", "exit 1");
|
|
90
|
+
const result = await runFlowScript(ambientIo, "integration-gate", {
|
|
91
|
+
primary,
|
|
92
|
+
cwd: branch,
|
|
93
|
+
env: {},
|
|
94
|
+
});
|
|
95
|
+
expect(result.status).toBe("done");
|
|
96
|
+
});
|
|
97
|
+
});
|