@warpgogol/forge 9.1.1 → 9.2.3
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 +31 -0
- package/bin/cli.ts +3 -2
- package/dist/bin/cli.js +3 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +6 -4
- package/dist/os/core/core.module.js.map +1 -1
- 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 +73 -0
- package/dist/os/flow/digest.d.ts.map +1 -0
- package/dist/os/flow/digest.js +634 -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 +716 -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 +63 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-cut.js +636 -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 +110 -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 +200 -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 +443 -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 +419 -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-push.d.ts +22 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-push.js +306 -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 +34 -0
- package/dist/os/flow/locks.d.ts.map +1 -0
- package/dist/os/flow/locks.js +147 -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/publish.d.ts +28 -0
- package/dist/os/flow/publish.d.ts.map +1 -0
- package/dist/os/flow/publish.js +153 -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 +198 -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 +72 -0
- package/dist/os/flow/release-tags.d.ts.map +1 -0
- package/dist/os/flow/release-tags.js +166 -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 +49 -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/tests/helpers.d.ts +52 -0
- package/dist/os/flow/tests/helpers.d.ts.map +1 -0
- package/dist/os/flow/tests/helpers.js +189 -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 +43 -6
- package/dist/os/mission/handlers/archive.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/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/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 +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- 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/core/core.module.ts +7 -4
- package/os/flow/assets/flow-guard.sh +176 -0
- package/os/flow/branch-name.ts +139 -0
- package/os/flow/digest.ts +761 -0
- package/os/flow/flow.module.ts +740 -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 +912 -0
- package/os/flow/handlers/flow-digest.ts +124 -0
- package/os/flow/handlers/flow-discard.ts +301 -0
- package/os/flow/handlers/flow-fix.ts +597 -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 +607 -0
- package/os/flow/handlers/flow-open.ts +447 -0
- package/os/flow/handlers/flow-push.ts +373 -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 +177 -0
- package/os/flow/markers.ts +135 -0
- package/os/flow/publish.ts +201 -0
- package/os/flow/registry.ts +266 -0
- package/os/flow/release-level.ts +139 -0
- package/os/flow/release-lines.ts +208 -0
- package/os/flow/release-tags.ts +231 -0
- package/os/flow/repo-kind.ts +117 -0
- package/os/flow/scripts.ts +73 -0
- package/os/flow/semver.ts +82 -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.rerun.test.ts +95 -0
- package/os/flow/tests/flow-cut.test.ts +319 -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-push-publish.test.ts +282 -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-version-level.test.ts +116 -0
- package/os/flow/tests/flow-version.test.ts +169 -0
- package/os/flow/tests/helpers.ts +235 -0
- package/os/flow/tests/is-flow-adopted.test.ts +71 -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 +27 -0
- package/os/mission/handlers/archive.ts +46 -6
- 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-stale.test.ts +22 -0
- 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/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 +17 -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/typescript.yaml +26 -9
- package/skills/fo/fo-session-retro/SKILL.md +18 -7
- package/skills/fo/fo-step-commit/SKILL.md +2 -1
- package/src/config/forge-config.ts +2 -6
- package/src/index.ts +8 -0
- 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/implement-stamp.test.ts +26 -3
- package/src/tests/profile-flow-hooks.test.ts +77 -0
- 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,359 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>flow.fix + fix-mode flow.cut tests (RFC-1490): a fix branch opens
|
|
4
|
+
at the main tip on a release baseline (FLOW-FIX-01..04 refusals), then
|
|
5
|
+
flow.cut inside it releases the patch into main through the gate, tags it,
|
|
6
|
+
tears the branch down and runs the back-merge (AC-13..16). Also covers the
|
|
7
|
+
patch-only level gate FLOW-CUT-10 and the --lines rejection FLOW-CUT-09.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Never touches the enclosing repository — all fixtures are mkdtemp repos.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<KEY_DECISIONS>
|
|
13
|
+
<item>The fix-open fixture ends a completed ordinary cut so main sits exactly on the repository line's last-tag commit — FLOW-FIX-02's required baseline state.</item>
|
|
14
|
+
</KEY_DECISIONS>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1490: step 6 — fix open, patch release, and refusal tests</item>
|
|
17
|
+
<item>RFC-1490: step 6 — flow.fix + fix-mode cut (patch-only, rebase on moved main, gate target main, trailing back-merge)</item>
|
|
18
|
+
<item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
|
|
19
|
+
<item>RFC-1490: fix-mode cut run inside the fix worktree tears down and back-merges through the primary
|
|
20
|
+
|
|
21
|
+
Steering-session verification of wave 2 (W2-1): flow.cut run inside the fix worktree, the documented path and the one flow.fix's nextSteps print, released main and the tags, then removed that worktree and kept using it as repoRoot. branch -D failed unobserved, leaving an unregistered auto/fix branch, and the trailing back-merge crashed on the vanished directory. The primary is now resolved before the cut and used for every step after the teardown; a failed branch delete surfaces as a FLOW-07 warning. Back-merge refusals are appended to the cut diagnostics instead of replacing them.</item>
|
|
22
|
+
</CHANGE_SUMMARY>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
|
|
26
|
+
import { tmpdir } from "node:os";
|
|
27
|
+
import { join } from "node:path";
|
|
28
|
+
|
|
29
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
30
|
+
|
|
31
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
32
|
+
import type { ForgeRuntimeContext } from "../../../src/types.ts";
|
|
33
|
+
import { collectDigest } from "../digest.ts";
|
|
34
|
+
import { commonGitDir, readRegistry, type FlowRegistryEntry } from "../registry.ts";
|
|
35
|
+
import { gitExec, initRepo, installGuard } from "./helpers.ts";
|
|
36
|
+
import { runFlowCut, runOrdinaryCut } from "../handlers/flow-cut.ts";
|
|
37
|
+
import { fixFlow, runFixCutWithBackmerge } from "../handlers/flow-fix.ts";
|
|
38
|
+
import { integrateFlowBranch } from "../handlers/flow-integrate.ts";
|
|
39
|
+
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
40
|
+
|
|
41
|
+
const dirs: string[] = [];
|
|
42
|
+
afterEach(async () => {
|
|
43
|
+
for (const dir of dirs.splice(0)) {
|
|
44
|
+
await rm(dir, { recursive: true, force: true });
|
|
45
|
+
}
|
|
46
|
+
}, 20_000);
|
|
47
|
+
|
|
48
|
+
async function sha(repo: string, ref: string): Promise<string> {
|
|
49
|
+
return (await gitExec(repo, ["rev-parse", ref])).stdout.trim();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Adopted repo with one completed cut — main sits on the v0.1.1 tag. */
|
|
53
|
+
async function releasedRepo(): Promise<string> {
|
|
54
|
+
const repo = await initRepo({ prefix: "flow-fix-" });
|
|
55
|
+
dirs.push(repo);
|
|
56
|
+
await writeFile(join(repo, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
57
|
+
await writeFile(
|
|
58
|
+
join(repo, "package.json"),
|
|
59
|
+
'{\n "name": "fixture",\n "version": "0.1.0"\n}\n',
|
|
60
|
+
);
|
|
61
|
+
await gitExec(repo, ["add", "-A"]);
|
|
62
|
+
await gitExec(repo, ["commit", "-m", "config"]);
|
|
63
|
+
await gitExec(repo, ["switch", "-c", "develop"]);
|
|
64
|
+
await installGuard(repo);
|
|
65
|
+
await gitExec(repo, ["add", "hooks"]);
|
|
66
|
+
await gitExec(repo, ["commit", "-m", "adopt"], { FORGE_FLOW_OP: "install" });
|
|
67
|
+
await gitExec(repo, ["tag", "-a", "v0.1.0", "main", "-m", "release v0.1.0"]);
|
|
68
|
+
const cut = await runOrdinaryCut(repo, ambientIo, { lines: [], dryRun: false });
|
|
69
|
+
expect(cut.diagnostics).toEqual([]);
|
|
70
|
+
expect(cut.tags).toEqual(["v0.1.1"]);
|
|
71
|
+
return repo;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function fixEntry(repo: string, branch: string | null): Promise<FlowRegistryEntry> {
|
|
75
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
76
|
+
const registry = await readRegistry(ambientIo, common);
|
|
77
|
+
const entry = registry.branches.find((b) => b.name === branch);
|
|
78
|
+
expect(entry).toBeDefined();
|
|
79
|
+
return entry!;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function commitIn(wt: string, file: string, content: string, trailer?: string): Promise<void> {
|
|
83
|
+
await writeFile(join(wt, file), content);
|
|
84
|
+
await gitExec(wt, ["add", file]);
|
|
85
|
+
const args = ["commit", "-m", `add ${file}`];
|
|
86
|
+
if (trailer !== undefined) args.push("--trailer", trailer);
|
|
87
|
+
const r = await gitExec(wt, args, { FORGE_FLOW_OP: "" });
|
|
88
|
+
if (r.exitCode !== 0) throw new Error(`commit in ${wt} failed: ${r.stderr}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Kernel-shaped context for direct runFlowCut dispatch tests. */
|
|
92
|
+
function stubContext(repo: string): ForgeRuntimeContext {
|
|
93
|
+
return {
|
|
94
|
+
workspaceRoot: repo,
|
|
95
|
+
logger: { section() {}, info() {}, warn() {}, error() {}, success() {} },
|
|
96
|
+
dryRun: false,
|
|
97
|
+
outputFormat: "json",
|
|
98
|
+
io: ambientIo,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Land a committed change on develop the model-normal way: session → gate → ff. */
|
|
103
|
+
async function landThroughSession(repo: string, slug: string, file: string, content: string): Promise<void> {
|
|
104
|
+
const opened = await openFlowBranch(repo, ambientIo, {
|
|
105
|
+
kind: "session",
|
|
106
|
+
slug,
|
|
107
|
+
brief: null,
|
|
108
|
+
owner: null,
|
|
109
|
+
dryRun: false,
|
|
110
|
+
});
|
|
111
|
+
expect(opened.opened).toBe(true);
|
|
112
|
+
dirs.push(opened.worktree!);
|
|
113
|
+
await writeFile(join(opened.worktree!, file), content);
|
|
114
|
+
await gitExec(opened.worktree!, ["add", file]);
|
|
115
|
+
const commit = await gitExec(opened.worktree!, ["commit", "-m", slug], { FORGE_FLOW_OP: "" });
|
|
116
|
+
expect(commit.exitCode).toBe(0);
|
|
117
|
+
const integrated = await integrateFlowBranch(repo, ambientIo, {
|
|
118
|
+
branch: opened.branch!,
|
|
119
|
+
dryRun: false,
|
|
120
|
+
});
|
|
121
|
+
expect(integrated.integrated).toBe(true);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
describe("flow.fix", () => {
|
|
125
|
+
it("opens auto/fix-… at the main tip with a kind:fix entry", async () => {
|
|
126
|
+
const repo = await releasedRepo();
|
|
127
|
+
const data = await fixFlow(repo, ambientIo, {
|
|
128
|
+
slug: "null-guard",
|
|
129
|
+
brief: null,
|
|
130
|
+
dryRun: false,
|
|
131
|
+
});
|
|
132
|
+
expect(data.diagnostics).toEqual([]);
|
|
133
|
+
expect(data.opened).toBe(true);
|
|
134
|
+
expect(data.branch).toMatch(/^auto\/fix-\d{6}-\d{2}-null-guard$/);
|
|
135
|
+
expect(data.baseSha).toBe(await sha(repo, "main"));
|
|
136
|
+
const entry = await fixEntry(repo, data.branch);
|
|
137
|
+
expect(entry.kind).toBe("fix");
|
|
138
|
+
expect(entry.base).toBe("main");
|
|
139
|
+
dirs.push(data.worktree!);
|
|
140
|
+
}, 30_000);
|
|
141
|
+
|
|
142
|
+
it("--dry-run plans the fix branch without opening it or refusing (W5-7)", async () => {
|
|
143
|
+
const repo = await releasedRepo();
|
|
144
|
+
const branchesBefore = (await gitExec(repo, ["for-each-ref", "refs/heads"])).stdout;
|
|
145
|
+
const data = await fixFlow(repo, ambientIo, {
|
|
146
|
+
slug: "null-guard",
|
|
147
|
+
brief: null,
|
|
148
|
+
dryRun: true,
|
|
149
|
+
});
|
|
150
|
+
expect(data.diagnostics).toEqual([]);
|
|
151
|
+
expect(data.opened).toBe(false);
|
|
152
|
+
expect(data.branch).toMatch(/^auto\/fix-\d{6}-\d{2}-null-guard$/);
|
|
153
|
+
expect(data.baseSha).toBe(await sha(repo, "main"));
|
|
154
|
+
expect((await gitExec(repo, ["for-each-ref", "refs/heads"])).stdout).toBe(branchesBefore);
|
|
155
|
+
}, 30_000);
|
|
156
|
+
|
|
157
|
+
it("fix-mode cut releases the patch into main, tags it, tears down, back-merges", async () => {
|
|
158
|
+
const repo = await releasedRepo();
|
|
159
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "hotfix", brief: null, dryRun: false });
|
|
160
|
+
dirs.push(fix.worktree!);
|
|
161
|
+
await commitIn(fix.worktree!, "hot.txt", "fix");
|
|
162
|
+
const entry = await fixEntry(repo, fix.branch);
|
|
163
|
+
|
|
164
|
+
const data = await runFixCutWithBackmerge(repo, ambientIo, { entry, linesGiven: false, dryRun: false });
|
|
165
|
+
|
|
166
|
+
expect(data.diagnostics).toEqual([]);
|
|
167
|
+
expect(data.released).toBe(true);
|
|
168
|
+
expect(data.mode).toBe("fix");
|
|
169
|
+
expect(data.tags).toEqual(["v0.1.2"]);
|
|
170
|
+
// main advanced to the fix tip; the fix branch and worktree are gone.
|
|
171
|
+
const mainSha = await sha(repo, "main");
|
|
172
|
+
expect(data.mainAfter).toBe(mainSha);
|
|
173
|
+
expect(await sha(repo, "v0.1.2^{}")).toBe(mainSha);
|
|
174
|
+
expect((await gitExec(repo, ["rev-parse", "--verify", "-q", `refs/heads/${fix.branch}`])).exitCode).not.toBe(0);
|
|
175
|
+
// Back-merge landed the port into develop.
|
|
176
|
+
expect(data.backmerge?.status).toBe("merged");
|
|
177
|
+
const parents = (await gitExec(repo, ["rev-list", "--parents", "-1", "develop"])).stdout.trim().split(/\s+/);
|
|
178
|
+
expect(parents).toHaveLength(3);
|
|
179
|
+
expect(parents[2]).toBe(mainSha);
|
|
180
|
+
const subject = (await gitExec(repo, ["log", "-1", "--format=%s", "develop"])).stdout.trim();
|
|
181
|
+
expect(subject).toBe("release v0.1.2 → develop");
|
|
182
|
+
// Registry carries neither fix nor port entries.
|
|
183
|
+
const common = await commonGitDir(ambientIo, repo);
|
|
184
|
+
expect((await readRegistry(ambientIo, common)).branches).toEqual([]);
|
|
185
|
+
}, 120_000);
|
|
186
|
+
|
|
187
|
+
it("refuses FLOW-CUT-10 when a fix commit demands minor", async () => {
|
|
188
|
+
const repo = await releasedRepo();
|
|
189
|
+
await mkdir(join(repo, "docs/rfcs"), { recursive: true });
|
|
190
|
+
await writeFile(
|
|
191
|
+
join(repo, "docs/rfcs/rfc-1400-test.md"),
|
|
192
|
+
"---\nid: RFC-1400\ntitle: test\nstatus: accepted\nversionBump: minor\n---\n\n# RFC-1400\n",
|
|
193
|
+
);
|
|
194
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "minorfix", brief: null, dryRun: false });
|
|
195
|
+
dirs.push(fix.worktree!);
|
|
196
|
+
await commitIn(fix.worktree!, "hot.txt", "x", "X-RFC: RFC-1400");
|
|
197
|
+
const entry = await fixEntry(repo, fix.branch);
|
|
198
|
+
|
|
199
|
+
const data = await runFixCutWithBackmerge(repo, ambientIo, { entry, linesGiven: false, dryRun: false });
|
|
200
|
+
expect(data.released).toBe(false);
|
|
201
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-CUT-10");
|
|
202
|
+
}, 30_000);
|
|
203
|
+
|
|
204
|
+
it("refuses FLOW-CUT-09 when --lines is passed to a fix cut", async () => {
|
|
205
|
+
const repo = await releasedRepo();
|
|
206
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "linesfix", brief: null, dryRun: false });
|
|
207
|
+
dirs.push(fix.worktree!);
|
|
208
|
+
const entry = await fixEntry(repo, fix.branch);
|
|
209
|
+
const data = await runFixCutWithBackmerge(repo, ambientIo, { entry, linesGiven: true, dryRun: false });
|
|
210
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-CUT-09");
|
|
211
|
+
}, 30_000);
|
|
212
|
+
|
|
213
|
+
it("refuses FLOW-CUT-04 when the fix carries no commits", async () => {
|
|
214
|
+
const repo = await releasedRepo();
|
|
215
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "emptyfix", brief: null, dryRun: false });
|
|
216
|
+
dirs.push(fix.worktree!);
|
|
217
|
+
const entry = await fixEntry(repo, fix.branch);
|
|
218
|
+
const data = await runFixCutWithBackmerge(repo, ambientIo, { entry, linesGiven: false, dryRun: false });
|
|
219
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-CUT-04");
|
|
220
|
+
}, 30_000);
|
|
221
|
+
|
|
222
|
+
it("refuses FLOW-FIX-02 when main moved past its last release", async () => {
|
|
223
|
+
const repo = await releasedRepo();
|
|
224
|
+
// Untagged plumbing commit on main.
|
|
225
|
+
const tree = (await gitExec(repo, ["rev-parse", "main^{tree}"])).stdout.trim();
|
|
226
|
+
const hot = (await gitExec(repo, ["commit-tree", tree, "-p", "main", "-m", "untagged"])).stdout.trim();
|
|
227
|
+
await gitExec(repo, ["update-ref", "refs/heads/main", hot]);
|
|
228
|
+
|
|
229
|
+
const data = await fixFlow(repo, ambientIo, { slug: "toofix", brief: null, dryRun: false });
|
|
230
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-FIX-02");
|
|
231
|
+
}, 30_000);
|
|
232
|
+
|
|
233
|
+
it("refuses FLOW-FIX-04 while a back-merge is pending", async () => {
|
|
234
|
+
const repo = await releasedRepo();
|
|
235
|
+
// Tagged main-side release ahead of develop → pending back-merge.
|
|
236
|
+
const tmp = await mkdtemp(join(tmpdir(), "flow-fix-main-"));
|
|
237
|
+
dirs.push(tmp);
|
|
238
|
+
await gitExec(repo, ["worktree", "add", "--detach", tmp, "main"]);
|
|
239
|
+
await writeFile(join(tmp, "later.txt"), "x");
|
|
240
|
+
await gitExec(tmp, ["add", "later.txt"]);
|
|
241
|
+
await gitExec(tmp, ["commit", "-m", "main-side"], { FORGE_FLOW_OP: "install" });
|
|
242
|
+
const sha2 = await sha(tmp, "HEAD");
|
|
243
|
+
await gitExec(repo, ["tag", "-a", "v0.1.2", sha2, "-m", "release v0.1.2"]);
|
|
244
|
+
await gitExec(repo, ["update-ref", "refs/heads/main", sha2]);
|
|
245
|
+
await gitExec(repo, ["worktree", "remove", "--force", tmp]);
|
|
246
|
+
|
|
247
|
+
const data = await fixFlow(repo, ambientIo, { slug: "latefix", brief: null, dryRun: false });
|
|
248
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-FIX-04");
|
|
249
|
+
}, 30_000);
|
|
250
|
+
|
|
251
|
+
it("refuses FLOW-FIX-01 on an unadopted repository", async () => {
|
|
252
|
+
const repo = await initRepo({ prefix: "flow-fix-" });
|
|
253
|
+
dirs.push(repo);
|
|
254
|
+
const data = await fixFlow(repo, ambientIo, { slug: "nope-fix", brief: null, dryRun: false });
|
|
255
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-FIX-01");
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it("refuses FLOW-FIX-03 on a slug outside the grammar", async () => {
|
|
259
|
+
const repo = await releasedRepo();
|
|
260
|
+
const data = await fixFlow(repo, ambientIo, { slug: "Bad_Slug!", brief: null, dryRun: false });
|
|
261
|
+
expect(data.diagnostics[0]?.ruleId).toBe("FLOW-FIX-03");
|
|
262
|
+
}, 30_000);
|
|
263
|
+
|
|
264
|
+
it("released fix reports backmerge conflict and leaves the port in progress", async () => {
|
|
265
|
+
const repo = await releasedRepo();
|
|
266
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "conflict", brief: null, dryRun: false });
|
|
267
|
+
dirs.push(fix.worktree!);
|
|
268
|
+
// Fix-side change to shared.txt on main; a conflicting develop-side land.
|
|
269
|
+
await commitIn(fix.worktree!, "shared.txt", "main-side\n");
|
|
270
|
+
await landThroughSession(repo, "dev-side", "shared.txt", "develop-side\n");
|
|
271
|
+
const entry = await fixEntry(repo, fix.branch);
|
|
272
|
+
|
|
273
|
+
const data = await runFixCutWithBackmerge(repo, ambientIo, {
|
|
274
|
+
entry,
|
|
275
|
+
linesGiven: false,
|
|
276
|
+
dryRun: false,
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// The release itself completed — the conflict is a report, not a failure.
|
|
280
|
+
expect(data.released).toBe(true);
|
|
281
|
+
expect(data.backmerge?.status).toBe("conflict");
|
|
282
|
+
expect(data.backmerge?.conflicts).toContain("shared.txt");
|
|
283
|
+
expect(data.backmerge?.portWorktree).not.toBeNull();
|
|
284
|
+
dirs.push(data.backmerge!.portWorktree!);
|
|
285
|
+
const mergeHead = await gitExec(data.backmerge!.portWorktree!, [
|
|
286
|
+
"rev-parse",
|
|
287
|
+
"-q",
|
|
288
|
+
"--verify",
|
|
289
|
+
"MERGE_HEAD",
|
|
290
|
+
]);
|
|
291
|
+
expect(mergeHead.exitCode).toBe(0);
|
|
292
|
+
}, 120_000);
|
|
293
|
+
|
|
294
|
+
it("dispatches --branch <fix> through runFlowCut end-to-end", async () => {
|
|
295
|
+
const repo = await releasedRepo();
|
|
296
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "dispatch", brief: null, dryRun: false });
|
|
297
|
+
dirs.push(fix.worktree!);
|
|
298
|
+
await commitIn(fix.worktree!, "hot.txt", "fix");
|
|
299
|
+
|
|
300
|
+
const result = await runFlowCut(
|
|
301
|
+
{ argv: [], flags: { branch: fix.branch! } },
|
|
302
|
+
stubContext(repo),
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
expect(result.data?.released).toBe(true);
|
|
306
|
+
expect(result.data?.mode).toBe("fix");
|
|
307
|
+
expect(result.data?.tags).toEqual(["v0.1.2"]);
|
|
308
|
+
expect(result.data?.backmerge?.status).toBe("merged");
|
|
309
|
+
// No integration-gate.sh in the fixture → the gate script reports skipped.
|
|
310
|
+
expect(result.data?.backmerge?.gate?.status).toBe("skipped");
|
|
311
|
+
}, 120_000);
|
|
312
|
+
it("fix-mode cut run inside the fix worktree back-merges and deletes the fix branch", async () => {
|
|
313
|
+
const repo = await releasedRepo();
|
|
314
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "inside", brief: null, dryRun: false });
|
|
315
|
+
dirs.push(fix.worktree!);
|
|
316
|
+
await commitIn(fix.worktree!, "hot.txt", "fix");
|
|
317
|
+
|
|
318
|
+
// The documented path: flow.cut from the fix worktree itself, no --branch.
|
|
319
|
+
// The cut removes that worktree, so every later step must run from the primary.
|
|
320
|
+
const result = await runFlowCut({ argv: [], flags: {} }, stubContext(fix.worktree!));
|
|
321
|
+
|
|
322
|
+
expect(result.data?.released).toBe(true);
|
|
323
|
+
expect(result.data?.mode).toBe("fix");
|
|
324
|
+
expect(result.data?.tags).toEqual(["v0.1.2"]);
|
|
325
|
+
expect(result.data?.backmerge?.status).toBe("merged");
|
|
326
|
+
expect((await gitExec(repo, ["rev-parse", "--verify", "-q", `refs/heads/${fix.branch}`])).exitCode).not.toBe(0);
|
|
327
|
+
const subject = (await gitExec(repo, ["log", "-1", "--format=%s", "develop"])).stdout.trim();
|
|
328
|
+
expect(subject).toBe("release v0.1.2 → develop");
|
|
329
|
+
}, 120_000);
|
|
330
|
+
|
|
331
|
+
it("digest keeps a develop integration and a later fix release apart", async () => {
|
|
332
|
+
const repo = await releasedRepo();
|
|
333
|
+
const origin = await mkdtemp(join(tmpdir(), "flow-fix-origin-"));
|
|
334
|
+
dirs.push(origin);
|
|
335
|
+
await gitExec(origin, ["init", "--bare", "-b", "develop", "."]);
|
|
336
|
+
await gitExec(repo, ["remote", "add", "origin", origin]);
|
|
337
|
+
const push = await gitExec(repo, ["push", "-u", "origin", "develop", "main"], { FORGE_FLOW_OP: "push" });
|
|
338
|
+
expect(push.exitCode).toBe(0);
|
|
339
|
+
|
|
340
|
+
// develop moves past the release; then a fix shares that same base.
|
|
341
|
+
await landThroughSession(repo, "devwork", "dev.txt", "dev");
|
|
342
|
+
const fix = await fixFlow(repo, ambientIo, { slug: "hotfix", brief: null, dryRun: false });
|
|
343
|
+
dirs.push(fix.worktree!);
|
|
344
|
+
await commitIn(fix.worktree!, "hot.txt", "fix");
|
|
345
|
+
const entry = await fixEntry(repo, fix.branch);
|
|
346
|
+
const cut = await runFixCutWithBackmerge(repo, ambientIo, { entry, linesGiven: false, dryRun: false });
|
|
347
|
+
expect(cut.backmerge?.status).toBe("merged");
|
|
348
|
+
|
|
349
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
350
|
+
const devItem = digest.items.find((i) => i.subjects.includes("devwork"));
|
|
351
|
+
expect(devItem?.kind).toBe("integration");
|
|
352
|
+
expect(devItem?.branch).toMatch(/-devwork$/);
|
|
353
|
+
// The fix commits reach develop only through the back-merge item.
|
|
354
|
+
const port = digest.items.find((i) => i.kind === "backmerge");
|
|
355
|
+
expect(port?.subjects).toEqual(expect.arrayContaining(["add hot.txt", "release v0.1.2 → develop"]));
|
|
356
|
+
expect(port?.commits).toBe(port?.subjects.length);
|
|
357
|
+
expect(digest.items.some((i) => i.kind === "release" && i.branch === fix.branch)).toBe(false);
|
|
358
|
+
}, 180_000);
|
|
359
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>AC-11 (RFC-1490): the pre-merge-commit managed block refuses merge
|
|
4
|
+
commits on develop/main — `git merge --no-ff` into develop exits with
|
|
5
|
+
FLOW-GUARD-01, the same merge on a conforming auto branch succeeds, and
|
|
6
|
+
FORGE_FLOW_OP=install is NOT a merge escape (empty mode vocabulary →
|
|
7
|
+
FLOW-GUARD-04) — proven by real merges through core.hooksPath in throwaway
|
|
8
|
+
repos.</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>No port-branch orchestration — flow-backmerge tests own that.</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1490: step 3 — pre-merge-commit guard coverage</item>
|
|
15
|
+
<item>RFC-1490: pre-merge-commit guard mode + per-mode op vocabulary; amends the wave-1 guard RFC's backmerge escape (AC-11)</item>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { chmod, mkdir, rm, writeFile } from "node:fs/promises";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
managedBlock,
|
|
26
|
+
resolveGuardAssetPath,
|
|
27
|
+
} from "../guard-files.ts";
|
|
28
|
+
import { copyFile } from "node:fs/promises";
|
|
29
|
+
import {
|
|
30
|
+
checkoutOrCreate,
|
|
31
|
+
gitExec,
|
|
32
|
+
initRepo,
|
|
33
|
+
} from "./helpers.ts";
|
|
34
|
+
|
|
35
|
+
const dirs: string[] = [];
|
|
36
|
+
|
|
37
|
+
afterEach(async () => {
|
|
38
|
+
for (const dir of dirs.splice(0)) {
|
|
39
|
+
await rm(dir, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
async function repoWithMergeGuard(): Promise<string> {
|
|
44
|
+
const dir = await initRepo({ prefix: "flow-merge-guard-" });
|
|
45
|
+
dirs.push(dir);
|
|
46
|
+
const hooksDir = join(dir, "hooks");
|
|
47
|
+
await mkdir(hooksDir, { recursive: true });
|
|
48
|
+
await copyFile(resolveGuardAssetPath(), join(hooksDir, "flow-guard.sh"));
|
|
49
|
+
for (const mode of ["pre-commit", "pre-merge-commit"] as const) {
|
|
50
|
+
await writeFile(join(hooksDir, mode), `#!/bin/sh\n${managedBlock(mode)}`);
|
|
51
|
+
await chmod(join(hooksDir, mode), 0o755);
|
|
52
|
+
}
|
|
53
|
+
await chmod(join(hooksDir, "flow-guard.sh"), 0o755);
|
|
54
|
+
const hooksPath = await gitExec(dir, ["config", "core.hooksPath", "hooks"]);
|
|
55
|
+
expect(hooksPath.exitCode).toBe(0);
|
|
56
|
+
return dir;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Seed a side auto branch carrying one commit ahead of `from`. */
|
|
60
|
+
async function seedAutoBranch(repo: string, from: string): Promise<string> {
|
|
61
|
+
await gitExec(repo, ["switch", "-c", "auto/session-260102-01-seed", from]);
|
|
62
|
+
await writeFile(join(repo, "auto-seed.txt"), "seed\n");
|
|
63
|
+
await gitExec(repo, ["add", "auto-seed.txt"]);
|
|
64
|
+
const commit = await gitExec(repo, ["commit", "-m", "seed"]);
|
|
65
|
+
expect(commit.exitCode).toBe(0);
|
|
66
|
+
return "auto/session-260102-01-seed";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
describe("pre-merge-commit guard (AC-11)", () => {
|
|
70
|
+
it("refuses git merge --no-ff into develop with FLOW-GUARD-01", async () => {
|
|
71
|
+
const repo = await repoWithMergeGuard();
|
|
72
|
+
await checkoutOrCreate(repo, "develop");
|
|
73
|
+
const side = await seedAutoBranch(repo, "develop");
|
|
74
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
75
|
+
const merge = await gitExec(repo, ["merge", "--no-ff", "-m", "m", side]);
|
|
76
|
+
expect(merge.exitCode).toBe(1);
|
|
77
|
+
expect(merge.stderr).toContain("FLOW-GUARD-01:");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("allows the same merge on a conforming auto branch", async () => {
|
|
81
|
+
const repo = await repoWithMergeGuard();
|
|
82
|
+
await checkoutOrCreate(repo, "develop");
|
|
83
|
+
const side = await seedAutoBranch(repo, "develop");
|
|
84
|
+
await gitExec(repo, ["switch", "-c", "auto/session-260102-02-port", "develop"]);
|
|
85
|
+
const merge = await gitExec(repo, ["merge", "--no-ff", "-m", "m", side]);
|
|
86
|
+
expect(merge.exitCode).toBe(0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("refuses FORGE_FLOW_OP=install git merge into develop with FLOW-GUARD-04", async () => {
|
|
90
|
+
const repo = await repoWithMergeGuard();
|
|
91
|
+
await checkoutOrCreate(repo, "develop");
|
|
92
|
+
const side = await seedAutoBranch(repo, "develop");
|
|
93
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
94
|
+
const merge = await gitExec(repo, ["merge", "--no-ff", "-m", "m", side], {
|
|
95
|
+
FORGE_FLOW_OP: "install",
|
|
96
|
+
});
|
|
97
|
+
expect(merge.exitCode).toBe(1);
|
|
98
|
+
expect(merge.stderr).toContain("FLOW-GUARD-04:");
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>AC-5: the POSIX guard and the TypeScript grammar must not drift —
|
|
4
|
+
the literal regex text inside assets/flow-guard.sh is byte-identical to
|
|
5
|
+
FLOW_BRANCH_PATTERN, and the installed guard's verdict on every creatable
|
|
6
|
+
branch name of the shared table equals classifyBranch's.</purpose>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1486: step 2 — shell/TypeScript grammar parity test</item>
|
|
10
|
+
<item>RFC-1486: step 2 — POSIX guard asset + behavior/parity tests</item>
|
|
11
|
+
<item>RFC-1486: parity test explicit timeout for repo-root probe runs (AC-5)</item>
|
|
12
|
+
<item>RFC-1490: pre-merge-commit guard mode + per-mode op vocabulary; amends the wave-1 guard RFC's backmerge escape (AC-11)</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { copyFile, mkdir, rm } from "node:fs/promises";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
|
|
21
|
+
import { parse as yamlParse } from "yaml";
|
|
22
|
+
import { afterAll, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { classifyBranch, FLOW_BRANCH_PATTERN } from "../branch-name.ts";
|
|
25
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
26
|
+
import {
|
|
27
|
+
checkoutOrCreate,
|
|
28
|
+
GUARD_ASSET,
|
|
29
|
+
initRepo,
|
|
30
|
+
runGuardDirect,
|
|
31
|
+
} from "./helpers.ts";
|
|
32
|
+
|
|
33
|
+
interface NameRow {
|
|
34
|
+
name: string;
|
|
35
|
+
verdict: "allow" | "refuse";
|
|
36
|
+
rule: "FLOW-GUARD-01" | "FLOW-GUARD-02" | null;
|
|
37
|
+
ref_ok: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const table = yamlParse(
|
|
41
|
+
readFileSync(fileURLToPath(new URL("./fixtures/branch-names.yaml", import.meta.url)), "utf8"),
|
|
42
|
+
) as { rows: NameRow[] };
|
|
43
|
+
|
|
44
|
+
let repo: string | undefined;
|
|
45
|
+
|
|
46
|
+
afterAll(async () => {
|
|
47
|
+
if (repo) await rm(repo, { recursive: true, force: true });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("guard/TypeScript grammar parity", () => {
|
|
51
|
+
it("the regex literal in flow-guard.sh is byte-identical to FLOW_BRANCH_PATTERN", () => {
|
|
52
|
+
const asset = readFileSync(GUARD_ASSET, "utf8");
|
|
53
|
+
expect(asset).toContain(`flow_branch_pattern='${FLOW_BRANCH_PATTERN}'`);
|
|
54
|
+
// The documentation marker and the closed FORGE_FLOW_OP vocabulary that
|
|
55
|
+
// AC-11's probe greps for.
|
|
56
|
+
expect(asset).toContain(">>> forge flow guard");
|
|
57
|
+
expect(asset).toContain("pre-merge-commit");
|
|
58
|
+
expect(asset).toContain("install");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("is valid POSIX sh and carries no bashisms", async () => {
|
|
62
|
+
const check = await ambientIo.exec("sh", ["-n", GUARD_ASSET]);
|
|
63
|
+
expect(check.exitCode, check.stderr).toBe(0);
|
|
64
|
+
const asset = readFileSync(GUARD_ASSET, "utf8");
|
|
65
|
+
for (const bashism of ["[[", "local ", "==[", "function ", "source "]) {
|
|
66
|
+
expect(asset, `flow-guard.sh must not contain bashism ${bashism}`).not.toContain(bashism);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// The row loop spawns real `git`/`sh` processes — comfortably over the
|
|
71
|
+
// 5s default timeout the root vitest config applies under
|
|
72
|
+
// `rfc.acceptance.run`'s repo-root probe invocation.
|
|
73
|
+
it("guard verdicts equal classifyBranch on every creatable table row", { timeout: 120_000 }, async () => {
|
|
74
|
+
// One throwaway repo; the guard file is invoked directly (no hooksPath
|
|
75
|
+
// needed) — the guard resolves the repo through cwd/git rev-parse.
|
|
76
|
+
repo = await initRepo({ prefix: "flow-parity-" });
|
|
77
|
+
const hooksDir = join(repo, "hooks");
|
|
78
|
+
await mkdir(hooksDir, { recursive: true });
|
|
79
|
+
await copyFile(GUARD_ASSET, join(hooksDir, "flow-guard.sh"));
|
|
80
|
+
|
|
81
|
+
const skipped: string[] = [];
|
|
82
|
+
for (const row of table.rows) {
|
|
83
|
+
if (!row.ref_ok) {
|
|
84
|
+
skipped.push(row.name);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
await checkoutOrCreate(repo, row.name);
|
|
88
|
+
const result = await runGuardDirect(repo, { FORGE_FLOW_OP: "" });
|
|
89
|
+
const cls = classifyBranch(row.name);
|
|
90
|
+
const expectedRule =
|
|
91
|
+
cls.kind === "protected"
|
|
92
|
+
? "FLOW-GUARD-01"
|
|
93
|
+
: cls.kind === "nonconforming"
|
|
94
|
+
? "FLOW-GUARD-02"
|
|
95
|
+
: null;
|
|
96
|
+
expect(expectedRule, `classifyBranch("${row.name}") must agree with the table`).toBe(
|
|
97
|
+
row.rule,
|
|
98
|
+
);
|
|
99
|
+
if (expectedRule === null) {
|
|
100
|
+
expect(result.exitCode, `guard must allow "${row.name}": ${result.stderr}`).toBe(0);
|
|
101
|
+
} else {
|
|
102
|
+
expect(result.exitCode, `guard must refuse "${row.name}"`).toBe(1);
|
|
103
|
+
expect(result.stderr, `guard rule for "${row.name}"`).toContain(`${expectedRule}:`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Rows git cannot create as refs are exactly the uncreatable names — and
|
|
108
|
+
// each of them is a refuse verdict (never an allow we failed to probe).
|
|
109
|
+
const uncreatable = table.rows.filter((row) => !row.ref_ok).map((row) => row.name);
|
|
110
|
+
expect(skipped).toEqual(uncreatable);
|
|
111
|
+
for (const name of skipped) {
|
|
112
|
+
expect(classifyBranch(name).kind, `uncreatable "${name}"`).toBe("nonconforming");
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>pre-push guard tests (RFC-1491, AC-4): a plain git push in an adopted
|
|
4
|
+
repository is refused with FLOW-GUARD-05 naming the digest remedy;
|
|
5
|
+
FORGE_FLOW_OP=push passes; FORGE_FLOW_OP=push on a commit path refuses with
|
|
6
|
+
FLOW-GUARD-04 (per-mode closed vocabulary).</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No digest/push command coverage — flow-digest/flow-push tests own that.</item>
|
|
9
|
+
<item>Never touches the enclosing repository — all fixtures are mkdtemp repos.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1491: step 2 — pre-push guard tests</item>
|
|
14
|
+
<item>RFC-1491: step 2 — pre-push guard mode, install steps pre-push + markers, FLOW-10</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { mkdtemp, rm } 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 { gitExec, initRepo, installGuard } from "./helpers.ts";
|
|
25
|
+
|
|
26
|
+
const dirs: string[] = [];
|
|
27
|
+
afterEach(async () => {
|
|
28
|
+
for (const dir of dirs.splice(0)) {
|
|
29
|
+
await rm(dir, { recursive: true, force: true });
|
|
30
|
+
}
|
|
31
|
+
}, 20_000);
|
|
32
|
+
|
|
33
|
+
/** Adopted repo with a bare origin — pushes are hook-guarded. */
|
|
34
|
+
async function adoptedWithOrigin(): Promise<{ repo: string; origin: string }> {
|
|
35
|
+
const repo = await initRepo({ prefix: "flow-push-guard-" });
|
|
36
|
+
dirs.push(repo);
|
|
37
|
+
await installGuard(repo);
|
|
38
|
+
await gitExec(repo, ["add", "hooks"]);
|
|
39
|
+
const adopt = await gitExec(repo, ["commit", "-m", "adopt"], {
|
|
40
|
+
FORGE_FLOW_OP: "install",
|
|
41
|
+
});
|
|
42
|
+
if (adopt.exitCode !== 0) throw new Error(`adopt commit failed: ${adopt.stderr}`);
|
|
43
|
+
await gitExec(repo, ["switch", "-c", "develop"]);
|
|
44
|
+
|
|
45
|
+
const origin = await mkdtemp(join(tmpdir(), "flow-push-origin-"));
|
|
46
|
+
dirs.push(origin);
|
|
47
|
+
const bare = await gitExec(origin, ["init", "--bare", "-b", "develop", "."]);
|
|
48
|
+
if (bare.exitCode !== 0) throw new Error(`bare init failed: ${bare.stderr}`);
|
|
49
|
+
await gitExec(repo, ["remote", "add", "origin", origin]);
|
|
50
|
+
return { repo, origin };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe("flow-guard pre-push (RFC-1491)", () => {
|
|
54
|
+
it("refuses a plain git push with FLOW-GUARD-05 and the digest remedy (AC-4)", async () => {
|
|
55
|
+
const { repo } = await adoptedWithOrigin();
|
|
56
|
+
const push = await gitExec(repo, ["push", "origin", "develop"], {
|
|
57
|
+
FORGE_FLOW_OP: "",
|
|
58
|
+
});
|
|
59
|
+
expect(push.exitCode).not.toBe(0);
|
|
60
|
+
expect(push.stderr).toContain("FLOW-GUARD-05");
|
|
61
|
+
expect(push.stderr).toContain("flow.digest");
|
|
62
|
+
}, 30_000);
|
|
63
|
+
|
|
64
|
+
it("accepts the push under FORGE_FLOW_OP=push", async () => {
|
|
65
|
+
const { repo, origin } = await adoptedWithOrigin();
|
|
66
|
+
const push = await gitExec(repo, ["push", "-u", "origin", "develop"], {
|
|
67
|
+
FORGE_FLOW_OP: "push",
|
|
68
|
+
});
|
|
69
|
+
expect(push.exitCode, push.stderr).toBe(0);
|
|
70
|
+
const remote = await gitExec(origin, ["rev-parse", "refs/heads/develop"]);
|
|
71
|
+
const local = await gitExec(repo, ["rev-parse", "develop"]);
|
|
72
|
+
expect(remote.stdout.trim()).toBe(local.stdout.trim());
|
|
73
|
+
}, 30_000);
|
|
74
|
+
|
|
75
|
+
it("refuses FORGE_FLOW_OP=push on the commit path with FLOW-GUARD-04", async () => {
|
|
76
|
+
const { repo } = await adoptedWithOrigin();
|
|
77
|
+
const commit = await gitExec(repo, ["commit", "--allow-empty", "-m", "x"], {
|
|
78
|
+
FORGE_FLOW_OP: "push",
|
|
79
|
+
});
|
|
80
|
+
expect(commit.exitCode).not.toBe(0);
|
|
81
|
+
expect(commit.stderr).toContain("FLOW-GUARD-04");
|
|
82
|
+
}, 30_000);
|
|
83
|
+
|
|
84
|
+
it("exempts a repository carrying forge.generated.yaml at its root", async () => {
|
|
85
|
+
const { repo, origin } = await adoptedWithOrigin();
|
|
86
|
+
// The extract marker at the top level marks a generator-owned repository.
|
|
87
|
+
const { writeFile } = await import("node:fs/promises");
|
|
88
|
+
await writeFile(
|
|
89
|
+
join(repo, "forge.generated.yaml"),
|
|
90
|
+
"schema: forge/generated@1\ngenerator: repo-extract\n",
|
|
91
|
+
);
|
|
92
|
+
await gitExec(repo, ["add", "forge.generated.yaml"]);
|
|
93
|
+
await gitExec(repo, ["commit", "-m", "marker"], { FORGE_FLOW_OP: "install" });
|
|
94
|
+
const push = await gitExec(repo, ["push", "origin", "develop:refs/heads/develop"], {
|
|
95
|
+
FORGE_FLOW_OP: "",
|
|
96
|
+
});
|
|
97
|
+
expect(push.exitCode, push.stderr).toBe(0);
|
|
98
|
+
void origin;
|
|
99
|
+
}, 30_000);
|
|
100
|
+
});
|