@warpgogol/forge 9.6.3 → 9.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/README.md +12 -0
- package/bin/cli.ts +40 -2
- package/dist/bin/cli.js +39 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/archive.d.ts.map +1 -1
- package/dist/os/adr/handlers/archive.js +3 -7
- package/dist/os/adr/handlers/archive.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +55 -19
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
- package/dist/os/adr/handlers/list-create.js +8 -6
- package/dist/os/adr/handlers/list-create.js.map +1 -1
- package/dist/os/adr/handlers/validate.d.ts.map +1 -1
- package/dist/os/adr/handlers/validate.js +55 -21
- package/dist/os/adr/handlers/validate.js.map +1 -1
- package/dist/os/adversarial/adversarial.module.d.ts +3 -0
- package/dist/os/adversarial/adversarial.module.d.ts.map +1 -0
- package/dist/os/adversarial/adversarial.module.js +128 -0
- package/dist/os/adversarial/adversarial.module.js.map +1 -0
- package/dist/os/adversarial/catalog.d.ts +11 -0
- package/dist/os/adversarial/catalog.d.ts.map +1 -0
- package/dist/os/adversarial/catalog.js +72 -0
- package/dist/os/adversarial/catalog.js.map +1 -0
- package/dist/os/adversarial/runner.d.ts +17 -0
- package/dist/os/adversarial/runner.d.ts.map +1 -0
- package/dist/os/adversarial/runner.js +479 -0
- package/dist/os/adversarial/runner.js.map +1 -0
- package/dist/os/agent/handlers/agent-tiers-validate.d.ts.map +1 -1
- package/dist/os/agent/handlers/agent-tiers-validate.js +21 -7
- package/dist/os/agent/handlers/agent-tiers-validate.js.map +1 -1
- package/dist/os/agent/index.js +1 -1
- package/dist/os/agent-tools/agent-tools.module.d.ts +3 -0
- package/dist/os/agent-tools/agent-tools.module.d.ts.map +1 -0
- package/dist/os/agent-tools/agent-tools.module.js +80 -0
- package/dist/os/agent-tools/agent-tools.module.js.map +1 -0
- package/dist/os/agent-tools/generate.d.ts +18 -0
- package/dist/os/agent-tools/generate.d.ts.map +1 -0
- package/dist/os/agent-tools/generate.js +79 -0
- package/dist/os/agent-tools/generate.js.map +1 -0
- package/dist/os/agent-tools/handlers/tools-generate.d.ts +16 -0
- package/dist/os/agent-tools/handlers/tools-generate.d.ts.map +1 -0
- package/dist/os/agent-tools/handlers/tools-generate.js +108 -0
- package/dist/os/agent-tools/handlers/tools-generate.js.map +1 -0
- package/dist/os/agent-tools/index.d.ts +7 -0
- package/dist/os/agent-tools/index.d.ts.map +1 -0
- package/dist/os/agent-tools/index.js +16 -0
- package/dist/os/agent-tools/index.js.map +1 -0
- package/dist/os/agent-tools/manifest.d.ts +26 -0
- package/dist/os/agent-tools/manifest.d.ts.map +1 -0
- package/dist/os/agent-tools/manifest.js +70 -0
- package/dist/os/agent-tools/manifest.js.map +1 -0
- package/dist/os/agent-tools/serve.d.ts +21 -0
- package/dist/os/agent-tools/serve.d.ts.map +1 -0
- package/dist/os/agent-tools/serve.js +99 -0
- package/dist/os/agent-tools/serve.js.map +1 -0
- package/dist/os/agent-tools/server.d.ts +53 -0
- package/dist/os/agent-tools/server.d.ts.map +1 -0
- package/dist/os/agent-tools/server.js +381 -0
- package/dist/os/agent-tools/server.js.map +1 -0
- package/dist/os/agent-tools/types.d.ts +72 -0
- package/dist/os/agent-tools/types.d.ts.map +1 -0
- package/dist/os/agent-tools/types.js +74 -0
- package/dist/os/agent-tools/types.js.map +1 -0
- package/dist/os/audit/handlers/archive.d.ts.map +1 -1
- package/dist/os/audit/handlers/archive.js +3 -7
- package/dist/os/audit/handlers/archive.js.map +1 -1
- package/dist/os/authority/authority.module.d.ts.map +1 -1
- package/dist/os/authority/authority.module.js +17 -2
- package/dist/os/authority/authority.module.js.map +1 -1
- package/dist/os/checks/checks.module.d.ts.map +1 -1
- package/dist/os/checks/checks.module.js +44 -11
- package/dist/os/checks/checks.module.js.map +1 -1
- package/dist/os/checks/handlers/contribution-report.d.ts +3 -0
- package/dist/os/checks/handlers/contribution-report.d.ts.map +1 -1
- package/dist/os/checks/handlers/contribution-report.js +142 -23
- package/dist/os/checks/handlers/contribution-report.js.map +1 -1
- package/dist/os/checks/handlers/counters-export.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-export.js +75 -8
- package/dist/os/checks/handlers/counters-export.js.map +1 -1
- package/dist/os/checks/handlers/counters-validate.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-validate.js +1 -1
- package/dist/os/checks/handlers/counters-validate.js.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure.js +15 -18
- package/dist/os/codebase/handlers/codebase-measure.js.map +1 -1
- package/dist/os/codebase/index.d.ts.map +1 -1
- package/dist/os/codebase/index.js +4 -1
- package/dist/os/codebase/index.js.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.d.ts +4 -2
- package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.js +229 -37
- package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +45 -2
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +44 -4
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +31 -5
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +153 -55
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +44 -9
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/context/context.module.d.ts.map +1 -1
- package/dist/os/context/context.module.js +23 -4
- package/dist/os/context/context.module.js.map +1 -1
- package/dist/os/context/handlers/context-assemble.d.ts.map +1 -1
- package/dist/os/context/handlers/context-assemble.js +109 -16
- package/dist/os/context/handlers/context-assemble.js.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.d.ts.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.js +34 -9
- package/dist/os/context/handlers/context-slate-eval.js.map +1 -1
- package/dist/os/context/handlers/index-build.d.ts.map +1 -1
- package/dist/os/context/handlers/index-build.js +119 -26
- package/dist/os/context/handlers/index-build.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +56 -4
- package/dist/os/core/archive-regen.d.ts.map +1 -1
- package/dist/os/core/archive-regen.js +173 -15
- package/dist/os/core/archive-regen.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +187 -50
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts +9 -2
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +81 -0
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
- package/dist/os/core/handlers/package-health.js +6 -6
- package/dist/os/core/handlers/pinned-check.d.ts +13 -0
- package/dist/os/core/handlers/pinned-check.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-check.js +25 -0
- package/dist/os/core/handlers/pinned-check.js.map +1 -1
- package/dist/os/core/handlers/pinned-types.d.ts +7 -0
- package/dist/os/core/handlers/pinned-types.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.js +24 -1
- package/dist/os/core/handlers/pinned-validate.js.map +1 -1
- package/dist/os/core/handlers/policy-digest.d.ts +11 -0
- package/dist/os/core/handlers/policy-digest.d.ts.map +1 -0
- package/dist/os/core/handlers/policy-digest.js +421 -0
- package/dist/os/core/handlers/policy-digest.js.map +1 -0
- package/dist/os/correctness/audit/snapshot.d.ts.map +1 -1
- package/dist/os/correctness/audit/snapshot.js +46 -15
- package/dist/os/correctness/audit/snapshot.js.map +1 -1
- package/dist/os/correctness/correctness.module.d.ts.map +1 -1
- package/dist/os/correctness/correctness.module.js +5 -3
- package/dist/os/correctness/correctness.module.js.map +1 -1
- package/dist/os/correctness/gate/frozen.d.ts +84 -9
- package/dist/os/correctness/gate/frozen.d.ts.map +1 -1
- package/dist/os/correctness/gate/frozen.js +573 -53
- package/dist/os/correctness/gate/frozen.js.map +1 -1
- package/dist/os/correctness/gate/origin.d.ts +2 -0
- package/dist/os/correctness/gate/origin.d.ts.map +1 -1
- package/dist/os/correctness/gate/origin.js +68 -35
- package/dist/os/correctness/gate/origin.js.map +1 -1
- package/dist/os/correctness/gate/repo.d.ts +58 -2
- package/dist/os/correctness/gate/repo.d.ts.map +1 -1
- package/dist/os/correctness/gate/repo.js +177 -15
- package/dist/os/correctness/gate/repo.js.map +1 -1
- package/dist/os/correctness/gate/run.d.ts +6 -0
- package/dist/os/correctness/gate/run.d.ts.map +1 -1
- package/dist/os/correctness/gate/run.js +394 -62
- package/dist/os/correctness/gate/run.js.map +1 -1
- package/dist/os/correctness/gate/runner.d.ts.map +1 -1
- package/dist/os/correctness/gate/runner.js +42 -8
- package/dist/os/correctness/gate/runner.js.map +1 -1
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts +5 -1
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -1
- package/dist/os/correctness/gate/tests/gate-fixture.js +23 -1
- package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -1
- package/dist/os/correctness/gate/types.d.ts +3 -0
- package/dist/os/correctness/gate/types.d.ts.map +1 -1
- package/dist/os/correctness/gate/types.js +1 -0
- package/dist/os/correctness/gate/types.js.map +1 -1
- package/dist/os/correctness/handlers/gate.d.ts.map +1 -1
- package/dist/os/correctness/handlers/gate.js +2 -0
- package/dist/os/correctness/handlers/gate.js.map +1 -1
- package/dist/os/correctness/handlers/validate.d.ts +30 -0
- package/dist/os/correctness/handlers/validate.d.ts.map +1 -1
- package/dist/os/correctness/handlers/validate.js +20 -7
- package/dist/os/correctness/handlers/validate.js.map +1 -1
- package/dist/os/correctness/manifest-schema.d.ts +2 -2
- package/dist/os/correctness/references.d.ts +19 -0
- package/dist/os/correctness/references.d.ts.map +1 -1
- package/dist/os/correctness/references.js +57 -22
- package/dist/os/correctness/references.js.map +1 -1
- package/dist/os/correctness/workspace.d.ts +22 -2
- package/dist/os/correctness/workspace.d.ts.map +1 -1
- package/dist/os/correctness/workspace.js +194 -18
- package/dist/os/correctness/workspace.js.map +1 -1
- package/dist/os/flow/branch-name.d.ts.map +1 -1
- package/dist/os/flow/branch-name.js +2 -4
- package/dist/os/flow/branch-name.js.map +1 -1
- package/dist/os/flow/correctness-step.d.ts.map +1 -1
- package/dist/os/flow/correctness-step.js +83 -17
- package/dist/os/flow/correctness-step.js.map +1 -1
- package/dist/os/flow/digest.d.ts +98 -9
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +802 -185
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/dup-id-scan.d.ts +23 -0
- package/dist/os/flow/dup-id-scan.d.ts.map +1 -0
- package/dist/os/flow/dup-id-scan.js +171 -0
- package/dist/os/flow/dup-id-scan.js.map +1 -0
- package/dist/os/flow/evidence-lock.d.ts +36 -0
- package/dist/os/flow/evidence-lock.d.ts.map +1 -0
- package/dist/os/flow/evidence-lock.js +156 -0
- package/dist/os/flow/evidence-lock.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +155 -19
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/git.d.ts +124 -11
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +793 -84
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/guard-files.d.ts.map +1 -1
- package/dist/os/flow/guard-files.js +3 -5
- package/dist/os/flow/guard-files.js.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.js +2 -2
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +2 -2
- package/dist/os/flow/handlers/flow-cut.d.ts +38 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +325 -186
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +5 -6
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +6 -6
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +34 -12
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-hold.js +12 -21
- package/dist/os/flow/handlers/flow-hold.js.map +1 -1
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-install.js +19 -18
- package/dist/os/flow/handlers/flow-install.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +50 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +624 -135
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts +11 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +82 -12
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +2 -2
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.js +36 -16
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -1
- package/dist/os/flow/handlers/flow-push.d.ts +91 -2
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +806 -52
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/handlers/flow-status.d.ts +6 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-status.js +13 -10
- package/dist/os/flow/handlers/flow-status.js.map +1 -1
- package/dist/os/flow/handlers/flow-swept.d.ts +30 -0
- package/dist/os/flow/handlers/flow-swept.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-swept.js +135 -0
- package/dist/os/flow/handlers/flow-swept.js.map +1 -0
- package/dist/os/flow/handlers/flow-version.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-version.js +3 -5
- package/dist/os/flow/handlers/flow-version.js.map +1 -1
- package/dist/os/flow/index.d.ts +2 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +7 -4
- package/dist/os/flow/index.js.map +1 -1
- package/dist/os/flow/line-version.d.ts.map +1 -1
- package/dist/os/flow/line-version.js +20 -3
- package/dist/os/flow/line-version.js.map +1 -1
- package/dist/os/flow/locks.d.ts +15 -0
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +20 -7
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/markers.d.ts +1 -1
- package/dist/os/flow/markers.d.ts.map +1 -1
- package/dist/os/flow/markers.js +14 -5
- package/dist/os/flow/markers.js.map +1 -1
- package/dist/os/flow/ops-registry.d.ts.map +1 -1
- package/dist/os/flow/ops-registry.js +19 -6
- package/dist/os/flow/ops-registry.js.map +1 -1
- package/dist/os/flow/post-rebase-regen.d.ts +30 -8
- package/dist/os/flow/post-rebase-regen.d.ts.map +1 -1
- package/dist/os/flow/post-rebase-regen.js +172 -20
- package/dist/os/flow/post-rebase-regen.js.map +1 -1
- package/dist/os/flow/pre-lock.d.ts +61 -0
- package/dist/os/flow/pre-lock.d.ts.map +1 -0
- package/dist/os/flow/pre-lock.js +265 -0
- package/dist/os/flow/pre-lock.js.map +1 -0
- package/dist/os/flow/preflight.d.ts +6 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +87 -13
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/primary-dirt.d.ts +63 -0
- package/dist/os/flow/primary-dirt.d.ts.map +1 -0
- package/dist/os/flow/primary-dirt.js +259 -0
- package/dist/os/flow/primary-dirt.js.map +1 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +32 -10
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +21 -9
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +16 -9
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/release-level.d.ts +2 -0
- package/dist/os/flow/release-level.d.ts.map +1 -1
- package/dist/os/flow/release-level.js +23 -5
- package/dist/os/flow/release-level.js.map +1 -1
- package/dist/os/flow/release-lines.js +1 -1
- package/dist/os/flow/release-tags.d.ts +1 -1
- package/dist/os/flow/release-tags.d.ts.map +1 -1
- package/dist/os/flow/release-tags.js +43 -19
- package/dist/os/flow/release-tags.js.map +1 -1
- package/dist/os/flow/repo-kind.d.ts.map +1 -1
- package/dist/os/flow/repo-kind.js +6 -3
- package/dist/os/flow/repo-kind.js.map +1 -1
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +40 -7
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/semver.js +1 -1
- package/dist/os/flow/session-checkout.js +3 -3
- package/dist/os/flow/standalone-invoke.js +2 -2
- package/dist/os/flow/tests/helpers.d.ts +28 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +159 -19
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/flow/version-files.d.ts.map +1 -1
- package/dist/os/flow/version-files.js +3 -2
- package/dist/os/flow/version-files.js.map +1 -1
- package/dist/os/flow/worktree-path.d.ts.map +1 -1
- package/dist/os/flow/worktree-path.js +1 -1
- package/dist/os/flow/worktree-path.js.map +1 -1
- package/dist/os/friction/friction.module.d.ts.map +1 -1
- package/dist/os/friction/friction.module.js +160 -31
- package/dist/os/friction/friction.module.js.map +1 -1
- package/dist/os/friction/handlers/friction-add.d.ts +13 -0
- package/dist/os/friction/handlers/friction-add.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-add.js +189 -0
- package/dist/os/friction/handlers/friction-add.js.map +1 -0
- package/dist/os/friction/handlers/friction-migrate.d.ts +23 -0
- package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-migrate.js +354 -0
- package/dist/os/friction/handlers/friction-migrate.js.map +1 -0
- package/dist/os/friction/handlers/friction-validate.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-validate.js +144 -106
- package/dist/os/friction/handlers/friction-validate.js.map +1 -1
- package/dist/os/friction/index.d.ts +2 -0
- package/dist/os/friction/index.d.ts.map +1 -1
- package/dist/os/friction/index.js +3 -1
- package/dist/os/friction/index.js.map +1 -1
- package/dist/os/friction/store.d.ts +72 -0
- package/dist/os/friction/store.d.ts.map +1 -0
- package/dist/os/friction/store.js +251 -0
- package/dist/os/friction/store.js.map +1 -0
- package/dist/os/friction/types.d.ts +13 -1
- package/dist/os/friction/types.d.ts.map +1 -1
- package/dist/os/friction/types.js +19 -13
- package/dist/os/friction/types.js.map +1 -1
- package/dist/os/gate/gate.module.d.ts.map +1 -1
- package/dist/os/gate/gate.module.js +47 -6
- package/dist/os/gate/gate.module.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts +17 -2
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +376 -44
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe.js +90 -10
- package/dist/os/gate/handlers/gate-probe.js.map +1 -1
- package/dist/os/gate/handlers/liveness.d.ts +30 -0
- package/dist/os/gate/handlers/liveness.d.ts.map +1 -0
- package/dist/os/gate/handlers/liveness.js +94 -0
- package/dist/os/gate/handlers/liveness.js.map +1 -0
- package/dist/os/gate/handlers/probe-runs-journal.d.ts +44 -0
- package/dist/os/gate/handlers/probe-runs-journal.d.ts.map +1 -0
- package/dist/os/gate/handlers/probe-runs-journal.js +157 -0
- package/dist/os/gate/handlers/probe-runs-journal.js.map +1 -0
- package/dist/os/gate-run/gate-run.module.d.ts.map +1 -1
- package/dist/os/gate-run/gate-run.module.js +3 -0
- package/dist/os/gate-run/gate-run.module.js.map +1 -1
- package/dist/os/gate-run/index.d.ts.map +1 -1
- package/dist/os/gate-run/index.js +10 -0
- package/dist/os/gate-run/index.js.map +1 -1
- package/dist/os/gate-run/record.d.ts +1 -0
- package/dist/os/gate-run/record.d.ts.map +1 -1
- package/dist/os/gate-run/record.js +2 -0
- package/dist/os/gate-run/record.js.map +1 -1
- package/dist/os/gate-run/status.d.ts.map +1 -1
- package/dist/os/gate-run/status.js +4 -1
- package/dist/os/gate-run/status.js.map +1 -1
- package/dist/os/gate-run/types.d.ts +7 -0
- package/dist/os/gate-run/types.d.ts.map +1 -1
- package/dist/os/gate-run/types.js +1 -0
- package/dist/os/gate-run/types.js.map +1 -1
- package/dist/os/instructions/handlers/scar-migrate.d.ts +3 -0
- package/dist/os/instructions/handlers/scar-migrate.d.ts.map +1 -1
- package/dist/os/instructions/handlers/scar-migrate.js +23 -66
- package/dist/os/instructions/handlers/scar-migrate.js.map +1 -1
- package/dist/os/instructions/instructions.module.d.ts.map +1 -1
- package/dist/os/instructions/instructions.module.js +32 -5
- package/dist/os/instructions/instructions.module.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js +31 -10
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.js +24 -12
- package/dist/os/knowledge/handlers/knowledge-rebuild.js.map +1 -1
- package/dist/os/knowledge/knowledge.module.d.ts.map +1 -1
- package/dist/os/knowledge/knowledge.module.js +20 -4
- package/dist/os/knowledge/knowledge.module.js.map +1 -1
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +3 -7
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts.map +1 -1
- package/dist/os/mission/lockfile.js +44 -20
- package/dist/os/mission/lockfile.js.map +1 -1
- package/dist/os/naming/naming-convention.js +2 -2
- package/dist/os/naming/naming-convention.js.map +1 -1
- package/dist/os/plan/handlers/archive.d.ts.map +1 -1
- package/dist/os/plan/handlers/archive.js +3 -7
- package/dist/os/plan/handlers/archive.js.map +1 -1
- package/dist/os/program/discovery.d.ts +14 -5
- package/dist/os/program/discovery.d.ts.map +1 -1
- package/dist/os/program/discovery.js +64 -46
- package/dist/os/program/discovery.js.map +1 -1
- package/dist/os/program/handlers/complete.d.ts.map +1 -1
- package/dist/os/program/handlers/complete.js +28 -10
- package/dist/os/program/handlers/complete.js.map +1 -1
- package/dist/os/program/handlers/lease.js +12 -2
- package/dist/os/program/handlers/lease.js.map +1 -1
- package/dist/os/program/handlers/seal.js +3 -3
- package/dist/os/program/handlers/seal.js.map +1 -1
- package/dist/os/program/handlers/validate.js +3 -3
- package/dist/os/program/handlers/validate.js.map +1 -1
- package/dist/os/queue/handlers/queue-decision.d.ts +10 -0
- package/dist/os/queue/handlers/queue-decision.d.ts.map +1 -0
- package/dist/os/queue/handlers/queue-decision.js +177 -0
- package/dist/os/queue/handlers/queue-decision.js.map +1 -0
- package/dist/os/queue/handlers/queue-validate.d.ts.map +1 -1
- package/dist/os/queue/handlers/queue-validate.js +18 -22
- package/dist/os/queue/handlers/queue-validate.js.map +1 -1
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +1 -2
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/queue/queue.module.d.ts.map +1 -1
- package/dist/os/queue/queue.module.js +89 -4
- package/dist/os/queue/queue.module.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +4 -3
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/archive.d.ts.map +1 -1
- package/dist/os/rfc/handlers/archive.js +3 -7
- package/dist/os/rfc/handlers/archive.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.js +6 -3
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +65 -29
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
- package/dist/os/rfc/handlers/index-graph.js +13 -0
- package/dist/os/rfc/handlers/index-graph.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +15 -7
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +52 -10
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +1 -0
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +172 -50
- 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 +0 -3
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/next-id.d.ts +7 -1
- package/dist/os/rfc/next-id.d.ts.map +1 -1
- package/dist/os/rfc/next-id.js +122 -5
- package/dist/os/rfc/next-id.js.map +1 -1
- package/dist/os/rfc/outcome-probe.d.ts.map +1 -1
- package/dist/os/rfc/outcome-probe.js +5 -2
- package/dist/os/rfc/outcome-probe.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -1
- package/dist/os/rfc/reachable-symbol.js +61 -19
- package/dist/os/rfc/reachable-symbol.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +26 -4
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +28 -3
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +13 -3
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +72 -24
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +41 -3
- package/dist/os/rfc/verification-origin.d.ts.map +1 -1
- package/dist/os/rfc/verification-origin.js +314 -50
- package/dist/os/rfc/verification-origin.js.map +1 -1
- package/dist/os/rfc/verifier/rfc-1391/support.js +1 -1
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
- package/dist/os/rfc/verify-workspace.js +148 -48
- package/dist/os/rfc/verify-workspace.js.map +1 -1
- package/dist/os/session/handlers/archive.d.ts.map +1 -1
- package/dist/os/session/handlers/archive.js +3 -7
- package/dist/os/session/handlers/archive.js.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +42 -11
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +50 -24
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/session/handlers/session-audit-report.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit-report.js +21 -6
- package/dist/os/session/handlers/session-audit-report.js.map +1 -1
- package/dist/os/session/handlers/session-audit.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit.js +22 -9
- package/dist/os/session/handlers/session-audit.js.map +1 -1
- package/dist/os/session/session.module.d.ts.map +1 -1
- package/dist/os/session/session.module.js +29 -9
- package/dist/os/session/session.module.js.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.js +36 -18
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
- package/dist/os/system/handlers/system-product-register.d.ts +24 -0
- package/dist/os/system/handlers/system-product-register.d.ts.map +1 -0
- package/dist/os/system/handlers/system-product-register.js +322 -0
- package/dist/os/system/handlers/system-product-register.js.map +1 -0
- package/dist/os/system/handlers/system-products-status.d.ts +23 -0
- package/dist/os/system/handlers/system-products-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-products-status.js +235 -0
- package/dist/os/system/handlers/system-products-status.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-dispatch.js +14 -16
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.js +3 -3
- package/dist/os/system/scenario-schemas.js +1 -1
- package/dist/os/system/schemas.d.ts +13 -0
- package/dist/os/system/schemas.d.ts.map +1 -1
- package/dist/os/system/schemas.js +15 -0
- package/dist/os/system/schemas.js.map +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +126 -11
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/os/system/task-schemas.d.ts +3 -3
- package/dist/os/trajectory/handlers/journal-io.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/journal-io.js +2 -2
- package/dist/os/trajectory/handlers/journal-io.js.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.js +49 -9
- package/dist/os/trajectory/handlers/outcome-record.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.js +75 -21
- package/dist/os/trajectory/handlers/trajectory-index.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.js +38 -10
- package/dist/os/trajectory/handlers/trajectory-recall.js.map +1 -1
- package/dist/os/trajectory/trajectory.module.d.ts.map +1 -1
- package/dist/os/trajectory/trajectory.module.js +35 -7
- package/dist/os/trajectory/trajectory.module.js.map +1 -1
- package/dist/src/adversarial/types.d.ts +44 -0
- package/dist/src/adversarial/types.d.ts.map +1 -0
- package/dist/src/adversarial/types.js +82 -0
- package/dist/src/adversarial/types.js.map +1 -0
- package/dist/src/authority/delegations.d.ts +1 -1
- package/dist/src/authority/delegations.d.ts.map +1 -1
- package/dist/src/authority/delegations.js +9 -2
- package/dist/src/authority/delegations.js.map +1 -1
- package/dist/src/command-modules.d.ts.map +1 -1
- package/dist/src/command-modules.js +2 -0
- package/dist/src/command-modules.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +67 -1
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +116 -13
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/correctness/policy-bundle.d.ts +72 -0
- package/dist/src/correctness/policy-bundle.d.ts.map +1 -0
- package/dist/src/correctness/policy-bundle.js +170 -0
- package/dist/src/correctness/policy-bundle.js.map +1 -0
- package/dist/src/knowledge/paths.d.ts +21 -0
- package/dist/src/knowledge/paths.d.ts.map +1 -0
- package/dist/src/knowledge/paths.js +57 -0
- package/dist/src/knowledge/paths.js.map +1 -0
- package/dist/src/knowledge/sync.d.ts +7 -0
- package/dist/src/knowledge/sync.d.ts.map +1 -1
- package/dist/src/knowledge/sync.js +41 -13
- package/dist/src/knowledge/sync.js.map +1 -1
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +27 -2
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/init.d.ts.map +1 -1
- package/dist/src/onboarding/init.js +19 -5
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
- package/dist/src/onboarding/npm-token-check.js +9 -1
- package/dist/src/onboarding/npm-token-check.js.map +1 -1
- package/dist/src/onboarding/scaffold-project.d.ts.map +1 -1
- package/dist/src/onboarding/scaffold-project.js +17 -5
- package/dist/src/onboarding/scaffold-project.js.map +1 -1
- package/dist/src/onboarding/trust-boundary.d.ts +16 -0
- package/dist/src/onboarding/trust-boundary.d.ts.map +1 -0
- package/dist/src/onboarding/trust-boundary.js +806 -0
- package/dist/src/onboarding/trust-boundary.js.map +1 -0
- package/dist/src/onboarding/upgrade.d.ts +4 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +120 -9
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/profiles/stack-profile.js +2 -2
- package/dist/src/types.d.ts +6 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +4 -4
- package/dist/src/utils/verifier-git.d.ts +1329 -0
- package/dist/src/utils/verifier-git.d.ts.map +1 -0
- package/dist/src/utils/verifier-git.js +7827 -0
- package/dist/src/utils/verifier-git.js.map +1 -0
- package/dist/src/validators/skill-validate.d.ts.map +1 -1
- package/dist/src/validators/skill-validate.js +17 -5
- package/dist/src/validators/skill-validate.js.map +1 -1
- package/docs/adversarial/downgrade-forge/scenario.yaml +22 -0
- package/docs/adversarial/drop-manifest-entry/scenario.yaml +25 -0
- package/docs/adversarial/edit-frozen-file/scenario.yaml +24 -0
- package/docs/adversarial/edit-policy-key/scenario.yaml +41 -0
- package/docs/adversarial/forge-review-record/scenario.yaml +34 -0
- package/docs/adversarial/grow-allow/scenario.yaml +46 -0
- package/docs/adversarial/mixed-weakening/scenario.yaml +26 -0
- package/docs/adversarial/rebind-checkrun/scenario.yaml +41 -0
- package/docs/adversarial/self-exempt/scenario.yaml +41 -0
- package/docs/adversarial/shrink-policy-decl/scenario.yaml +41 -0
- package/docs/adversarial/spoof-verifier-trailer/scenario.yaml +26 -0
- package/docs/adversarial/weaken-oracle/scenario.yaml +22 -0
- package/docs/maintainers/publishing.md +1 -1
- package/docs/reference/correctness-gate.md +35 -5
- package/docs/reference/forge-yaml.md +16 -0
- package/docs/reference/system-hub.md +104 -0
- package/docs/reference/trust-boundary.md +36 -0
- package/os/adr/handlers/archive.ts +3 -11
- package/os/adr/handlers/implement-stamp.ts +56 -26
- package/os/adr/handlers/list-create.test.ts +174 -0
- package/os/adr/handlers/list-create.ts +16 -8
- package/os/adr/handlers/validate.ts +66 -28
- package/os/adversarial/adversarial.module.ts +147 -0
- package/os/adversarial/catalog.test.ts +96 -0
- package/os/adversarial/catalog.ts +79 -0
- package/os/adversarial/runner.ts +533 -0
- package/os/agent/handlers/agent-tiers-validate.ts +39 -10
- package/os/agent/index.ts +1 -1
- package/os/agent-tools/agent-tools.module.ts +84 -0
- package/os/agent-tools/generate.ts +104 -0
- package/os/agent-tools/handlers/tools-generate.ts +137 -0
- package/os/agent-tools/index.ts +23 -0
- package/os/agent-tools/manifest.ts +95 -0
- package/os/agent-tools/serve.ts +127 -0
- package/os/agent-tools/server.ts +460 -0
- package/os/agent-tools/tool-server.test.ts +226 -0
- package/os/agent-tools/tools-generate.test.ts +204 -0
- package/os/agent-tools/types.ts +139 -0
- package/os/audit/handlers/archive.ts +3 -11
- package/os/authority/authority.module.ts +17 -2
- package/os/checks/checks.module.ts +46 -11
- package/os/checks/handlers/contribution-liveness.test.ts +142 -0
- package/os/checks/handlers/contribution-report.test.ts +46 -11
- package/os/checks/handlers/contribution-report.ts +222 -44
- package/os/checks/handlers/counters-export.test.ts +179 -8
- package/os/checks/handlers/counters-export.ts +77 -9
- package/os/checks/handlers/counters-journal.test.ts +25 -5
- package/os/checks/handlers/counters-validate.test.ts +21 -6
- package/os/checks/handlers/counters-validate.ts +4 -2
- package/os/checks/handlers/variant-candidates.test.ts +6 -2
- package/os/codebase/handlers/codebase-measure.ts +17 -20
- package/os/codebase/index.ts +4 -1
- package/os/compass/handlers/compass-audit-handler.ts +236 -38
- package/os/compass/handlers/compass-header-scaffold-handler.ts +47 -2
- package/os/compass/handlers/compass-migrate-handler.ts +46 -4
- package/os/compass/handlers/git-revision.ts +183 -63
- package/os/compass/handlers/summary-record.ts +48 -10
- package/os/context/context.module.ts +23 -4
- package/os/context/handlers/context-assemble.test.ts +5 -2
- package/os/context/handlers/context-assemble.ts +144 -28
- package/os/context/handlers/context-slate-eval.test.ts +11 -5
- package/os/context/handlers/context-slate-eval.ts +36 -10
- package/os/context/handlers/index-build.ts +179 -40
- package/os/context/handlers/no-model-deps.test.ts +8 -3
- package/os/context/handlers/slate-fill.test.ts +7 -2
- package/os/core/archive-regen.ts +209 -18
- package/os/core/core.module.ts +215 -51
- package/os/core/docs-archive.test.ts +159 -37
- package/os/core/handlers/forge-autonomy-validate.ts +104 -2
- package/os/core/handlers/package-health.ts +6 -6
- package/os/core/handlers/pinned-check.ts +30 -0
- package/os/core/handlers/pinned-types.ts +7 -0
- package/os/core/handlers/pinned-validate.ts +28 -3
- package/os/core/handlers/policy-digest.test.ts +143 -0
- package/os/core/handlers/policy-digest.ts +470 -0
- package/os/correctness/audit/snapshot.ts +46 -22
- package/os/correctness/correctness-chain.test.ts +6 -2
- package/os/correctness/correctness.module.ts +6 -3
- package/os/correctness/gate/anchor-events.test.ts +5 -1
- package/os/correctness/gate/freeze-coverage.test.ts +1 -1
- package/os/correctness/gate/freeze-diff.test.ts +1 -1
- package/os/correctness/gate/frozen.ts +691 -58
- package/os/correctness/gate/gate-mode.test.ts +5 -1
- package/os/correctness/gate/hardening.test.ts +5 -2
- package/os/correctness/gate/origin.ts +77 -37
- package/os/correctness/gate/policy-freeze-cx.test.ts +174 -0
- package/os/correctness/gate/policy-freeze-cx10.test.ts +873 -0
- package/os/correctness/gate/policy-freeze-cx11.test.ts +534 -0
- package/os/correctness/gate/policy-freeze-cx12.test.ts +488 -0
- package/os/correctness/gate/policy-freeze-cx13.test.ts +734 -0
- package/os/correctness/gate/policy-freeze-cx14.test.ts +533 -0
- package/os/correctness/gate/policy-freeze-cx15.test.ts +830 -0
- package/os/correctness/gate/policy-freeze-cx16.test.ts +652 -0
- package/os/correctness/gate/policy-freeze-cx17.test.ts +717 -0
- package/os/correctness/gate/policy-freeze-cx18.test.ts +705 -0
- package/os/correctness/gate/policy-freeze-cx19.test.ts +376 -0
- package/os/correctness/gate/policy-freeze-cx2.test.ts +691 -0
- package/os/correctness/gate/policy-freeze-cx20.test.ts +572 -0
- package/os/correctness/gate/policy-freeze-cx21.test.ts +423 -0
- package/os/correctness/gate/policy-freeze-cx22.test.ts +978 -0
- package/os/correctness/gate/policy-freeze-cx23.test.ts +431 -0
- package/os/correctness/gate/policy-freeze-cx24.test.ts +509 -0
- package/os/correctness/gate/policy-freeze-cx25.test.ts +1064 -0
- package/os/correctness/gate/policy-freeze-cx3.test.ts +569 -0
- package/os/correctness/gate/policy-freeze-cx4.test.ts +731 -0
- package/os/correctness/gate/policy-freeze-cx5.test.ts +577 -0
- package/os/correctness/gate/policy-freeze-cx6.test.ts +944 -0
- package/os/correctness/gate/policy-freeze-cx7.test.ts +622 -0
- package/os/correctness/gate/policy-freeze-cx8.test.ts +638 -0
- package/os/correctness/gate/policy-freeze-cx9.test.ts +959 -0
- package/os/correctness/gate/policy-freeze.test.ts +249 -0
- package/os/correctness/gate/repo.ts +194 -15
- package/os/correctness/gate/run.ts +444 -65
- package/os/correctness/gate/runner.ts +41 -8
- package/os/correctness/gate/tests/gate-fixture.ts +27 -2
- package/os/correctness/gate/tier-high.test.ts +5 -1
- package/os/correctness/gate/trust-boundary-cx1.test.ts +1020 -0
- package/os/correctness/gate/trust-boundary-cx10.test.ts +755 -0
- package/os/correctness/gate/trust-boundary-cx11.test.ts +515 -0
- package/os/correctness/gate/trust-boundary-cx12.test.ts +552 -0
- package/os/correctness/gate/trust-boundary-cx13.test.ts +446 -0
- package/os/correctness/gate/trust-boundary-cx14.test.ts +375 -0
- package/os/correctness/gate/trust-boundary-cx15.test.ts +421 -0
- package/os/correctness/gate/trust-boundary-cx16.test.ts +487 -0
- package/os/correctness/gate/trust-boundary-cx17.test.ts +319 -0
- package/os/correctness/gate/trust-boundary-cx18.test.ts +516 -0
- package/os/correctness/gate/trust-boundary-cx19.test.ts +514 -0
- package/os/correctness/gate/trust-boundary-cx2.test.ts +979 -0
- package/os/correctness/gate/trust-boundary-cx20.test.ts +216 -0
- package/os/correctness/gate/trust-boundary-cx22.test.ts +193 -0
- package/os/correctness/gate/trust-boundary-cx23.test.ts +283 -0
- package/os/correctness/gate/trust-boundary-cx24.test.ts +180 -0
- package/os/correctness/gate/trust-boundary-cx25.test.ts +482 -0
- package/os/correctness/gate/trust-boundary-cx26.test.ts +408 -0
- package/os/correctness/gate/trust-boundary-cx27.test.ts +983 -0
- package/os/correctness/gate/trust-boundary-cx28.test.ts +587 -0
- package/os/correctness/gate/trust-boundary-cx29a.test.ts +226 -0
- package/os/correctness/gate/trust-boundary-cx29b.test.ts +271 -0
- package/os/correctness/gate/trust-boundary-cx29c.test.ts +217 -0
- package/os/correctness/gate/trust-boundary-cx29d.test.ts +544 -0
- package/os/correctness/gate/trust-boundary-cx29e.test.ts +207 -0
- package/os/correctness/gate/trust-boundary-cx29f.test.ts +226 -0
- package/os/correctness/gate/trust-boundary-cx29g.test.ts +74 -0
- package/os/correctness/gate/trust-boundary-cx3.test.ts +929 -0
- package/os/correctness/gate/trust-boundary-cx30a.test.ts +195 -0
- package/os/correctness/gate/trust-boundary-cx30b.test.ts +296 -0
- package/os/correctness/gate/trust-boundary-cx31a.test.ts +129 -0
- package/os/correctness/gate/trust-boundary-cx31b.test.ts +333 -0
- package/os/correctness/gate/trust-boundary-cx31c.test.ts +259 -0
- package/os/correctness/gate/trust-boundary-cx31d.test.ts +132 -0
- package/os/correctness/gate/trust-boundary-cx32a.test.ts +275 -0
- package/os/correctness/gate/trust-boundary-cx32b.test.ts +509 -0
- package/os/correctness/gate/trust-boundary-cx32c.test.ts +211 -0
- package/os/correctness/gate/trust-boundary-cx32d.test.ts +184 -0
- package/os/correctness/gate/trust-boundary-cx33a.test.ts +250 -0
- package/os/correctness/gate/trust-boundary-cx33b.test.ts +287 -0
- package/os/correctness/gate/trust-boundary-cx33c.test.ts +122 -0
- package/os/correctness/gate/trust-boundary-cx33d.test.ts +357 -0
- package/os/correctness/gate/trust-boundary-cx33e.test.ts +96 -0
- package/os/correctness/gate/trust-boundary-cx34a.test.ts +283 -0
- package/os/correctness/gate/trust-boundary-cx34b.test.ts +228 -0
- package/os/correctness/gate/trust-boundary-cx34d.test.ts +282 -0
- package/os/correctness/gate/trust-boundary-cx34e.test.ts +224 -0
- package/os/correctness/gate/trust-boundary-cx34f.test.ts +250 -0
- package/os/correctness/gate/trust-boundary-cx34g.test.ts +179 -0
- package/os/correctness/gate/trust-boundary-cx34h.test.ts +293 -0
- package/os/correctness/gate/trust-boundary-cx34i.test.ts +245 -0
- package/os/correctness/gate/trust-boundary-cx35a.test.ts +181 -0
- package/os/correctness/gate/trust-boundary-cx35b.test.ts +137 -0
- package/os/correctness/gate/trust-boundary-cx35c.test.ts +149 -0
- package/os/correctness/gate/trust-boundary-cx35d.test.ts +121 -0
- package/os/correctness/gate/trust-boundary-cx35e.test.ts +108 -0
- package/os/correctness/gate/trust-boundary-cx36.test.ts +120 -0
- package/os/correctness/gate/trust-boundary-cx37.test.ts +430 -0
- package/os/correctness/gate/trust-boundary-cx38.test.ts +436 -0
- package/os/correctness/gate/trust-boundary-cx39.test.ts +432 -0
- package/os/correctness/gate/trust-boundary-cx4.test.ts +764 -0
- package/os/correctness/gate/trust-boundary-cx40.test.ts +264 -0
- package/os/correctness/gate/trust-boundary-cx41.test.ts +460 -0
- package/os/correctness/gate/trust-boundary-cx42.test.ts +432 -0
- package/os/correctness/gate/trust-boundary-cx43.test.ts +257 -0
- package/os/correctness/gate/trust-boundary-cx5.test.ts +998 -0
- package/os/correctness/gate/trust-boundary-cx6.test.ts +701 -0
- package/os/correctness/gate/trust-boundary-cx7.test.ts +1007 -0
- package/os/correctness/gate/trust-boundary-cx8.test.ts +929 -0
- package/os/correctness/gate/trust-boundary-cx9.test.ts +993 -0
- package/os/correctness/gate/types.ts +4 -0
- package/os/correctness/handlers/gate.ts +2 -0
- package/os/correctness/handlers/validate.ts +63 -12
- package/os/correctness/references.ts +63 -20
- package/os/correctness/workspace.ts +203 -22
- package/os/flow/branch-name.ts +3 -6
- package/os/flow/correctness-step.ts +91 -17
- package/os/flow/digest.ts +962 -201
- package/os/flow/dup-id-scan.ts +187 -0
- package/os/flow/evidence-lock.ts +184 -0
- package/os/flow/flow.module.ts +162 -19
- package/os/flow/git.ts +952 -86
- package/os/flow/guard-files.ts +5 -14
- package/os/flow/handlers/flow-backmerge.ts +11 -22
- package/os/flow/handlers/flow-check.ts +2 -2
- package/os/flow/handlers/flow-cut.ts +459 -252
- package/os/flow/handlers/flow-digest.ts +14 -9
- package/os/flow/handlers/flow-discard.ts +6 -6
- package/os/flow/handlers/flow-fix.ts +104 -29
- package/os/flow/handlers/flow-hold.ts +24 -37
- package/os/flow/handlers/flow-install.ts +61 -33
- package/os/flow/handlers/flow-integrate.ts +992 -209
- package/os/flow/handlers/flow-open.ts +104 -12
- package/os/flow/handlers/flow-publication-retire.ts +38 -17
- package/os/flow/handlers/flow-push.ts +925 -73
- package/os/flow/handlers/flow-status.ts +32 -13
- package/os/flow/handlers/flow-swept.ts +185 -0
- package/os/flow/handlers/flow-version.ts +5 -18
- package/os/flow/index.ts +8 -4
- package/os/flow/line-version.ts +21 -8
- package/os/flow/locks.ts +44 -16
- package/os/flow/markers.ts +16 -5
- package/os/flow/ops-registry.ts +25 -7
- package/os/flow/post-rebase-regen.ts +218 -25
- package/os/flow/pre-lock.ts +334 -0
- package/os/flow/preflight.ts +110 -17
- package/os/flow/primary-dirt.ts +319 -0
- package/os/flow/publish.ts +35 -17
- package/os/flow/registry.ts +29 -15
- package/os/flow/release-level.ts +25 -12
- package/os/flow/release-lines.ts +4 -5
- package/os/flow/release-tags.ts +47 -19
- package/os/flow/repo-kind.ts +6 -3
- package/os/flow/scripts.ts +40 -7
- package/os/flow/semver.ts +1 -1
- package/os/flow/session-checkout.ts +3 -3
- package/os/flow/standalone-invoke.ts +2 -2
- package/os/flow/tests/branch-name.test.ts +15 -7
- package/os/flow/tests/digest-id-inputs.test.ts +106 -0
- package/os/flow/tests/digest-persist.test.ts +243 -0
- package/os/flow/tests/evidence-preflight-surface-skip.test.ts +218 -0
- package/os/flow/tests/flow-backmerge.test.ts +8 -6
- package/os/flow/tests/flow-check.test.ts +6 -11
- package/os/flow/tests/flow-cut-prepare.test.ts +64 -15
- package/os/flow/tests/flow-cut.rerun.test.ts +1 -1
- package/os/flow/tests/flow-cut.test.ts +230 -11
- package/os/flow/tests/flow-detachable.test.ts +10 -2
- package/os/flow/tests/flow-digest.test.ts +109 -29
- package/os/flow/tests/flow-fix.test.ts +96 -20
- package/os/flow/tests/flow-guard-parity.test.ts +55 -53
- package/os/flow/tests/flow-guard-push.test.ts +39 -2
- package/os/flow/tests/flow-guard.test.ts +5 -10
- package/os/flow/tests/flow-hold.test.ts +43 -10
- package/os/flow/tests/flow-install-markers.test.ts +47 -20
- package/os/flow/tests/flow-install.rerun.test.ts +18 -9
- package/os/flow/tests/flow-install.test.ts +19 -19
- package/os/flow/tests/flow-integrate-correctness-gate.test.ts +3 -4
- package/os/flow/tests/flow-integrate-prelock.test.ts +392 -0
- package/os/flow/tests/flow-integrate.gate-report.test.ts +2 -4
- package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +33 -0
- package/os/flow/tests/flow-integrate.preflight.test.ts +36 -1
- package/os/flow/tests/flow-integrate.test.ts +375 -21
- package/os/flow/tests/flow-open.test.ts +123 -9
- package/os/flow/tests/flow-publication-retire.test.ts +13 -6
- package/os/flow/tests/flow-push-attest.test.ts +137 -0
- package/os/flow/tests/flow-push-publish.test.ts +45 -19
- package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
- package/os/flow/tests/flow-push-supersede.test.ts +37 -34
- package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
- package/os/flow/tests/flow-push-verifier-review.test.ts +190 -0
- package/os/flow/tests/flow-push.test.ts +15 -7
- package/os/flow/tests/flow-status.test.ts +54 -1
- package/os/flow/tests/flow-swept.test.ts +105 -0
- package/os/flow/tests/flow-task-files.test.ts +18 -4
- package/os/flow/tests/helpers.test.ts +91 -0
- package/os/flow/tests/helpers.ts +188 -19
- package/os/flow/tests/locks.test.ts +5 -4
- package/os/flow/tests/post-rebase-regen.test.ts +315 -0
- package/os/flow/tests/scripts.test.ts +8 -4
- package/os/flow/tests/state-roots.test.ts +8 -11
- package/os/flow/version-files.ts +4 -2
- package/os/flow/worktree-path.ts +3 -9
- package/os/friction/friction-add.test.ts +183 -0
- package/os/friction/friction-migrate.test.ts +203 -0
- package/os/friction/friction-store.test.ts +184 -0
- package/os/friction/friction-validate.test.ts +133 -21
- package/os/friction/friction.module.ts +169 -31
- package/os/friction/handlers/friction-add.ts +263 -0
- package/os/friction/handlers/friction-migrate.ts +425 -0
- package/os/friction/handlers/friction-validate.ts +238 -176
- package/os/friction/index.ts +14 -1
- package/os/friction/qa-log-shards.test.ts +111 -0
- package/os/friction/store.ts +303 -0
- package/os/friction/types.ts +19 -13
- package/os/gate/gate.module.ts +47 -6
- package/os/gate/handlers/gate-probe-catalog.test.ts +1 -1
- package/os/gate/handlers/gate-probe-catalog.ts +445 -42
- package/os/gate/handlers/gate-probe-ratchet.test.ts +364 -0
- package/os/gate/handlers/gate-probe.test.ts +27 -5
- package/os/gate/handlers/gate-probe.ts +110 -12
- package/os/gate/handlers/liveness.ts +113 -0
- package/os/gate/handlers/probe-runs-journal.ts +167 -0
- package/os/gate-run/gate-run.module.ts +3 -0
- package/os/gate-run/index.ts +11 -0
- package/os/gate-run/record.ts +8 -1
- package/os/gate-run/status.ts +9 -1
- package/os/gate-run/tests/gate-run-record.test.ts +11 -1
- package/os/gate-run/tests/gate-run-status.test.ts +2 -0
- package/os/gate-run/types.ts +8 -0
- package/os/instructions/budget.test.ts +32 -7
- package/os/instructions/handlers/scar-migrate.ts +55 -66
- package/os/instructions/instructions.module.ts +32 -5
- package/os/knowledge/handlers/knowledge-authz-probe.ts +38 -12
- package/os/knowledge/handlers/knowledge-rebuild.test.ts +5 -2
- package/os/knowledge/handlers/knowledge-rebuild.ts +39 -16
- package/os/knowledge/knowledge.module.ts +21 -4
- package/os/mission/handlers/archive.test.ts +47 -30
- package/os/mission/handlers/archive.ts +3 -11
- package/os/mission/lockfile.ts +47 -20
- package/os/naming/naming-convention.test.ts +1 -0
- package/os/naming/naming-convention.ts +2 -2
- package/os/plan/handlers/archive.ts +3 -11
- package/os/program/discovery.ts +70 -44
- package/os/program/handlers/complete.ts +28 -10
- package/os/program/handlers/lease.ts +11 -2
- package/os/program/handlers/seal.ts +3 -3
- package/os/program/handlers/validate.ts +3 -3
- package/os/queue/handlers/queue-decision.ts +253 -0
- package/os/queue/handlers/queue-validate.ts +24 -23
- package/os/queue/manifest.ts +1 -2
- package/os/queue/queue-decision.test.ts +262 -0
- package/os/queue/queue.module.ts +93 -4
- package/os/rfc/frontmatter-io.ts +6 -3
- package/os/rfc/handlers/archive.ts +3 -11
- package/os/rfc/handlers/implement-stamp-origin.ts +6 -3
- package/os/rfc/handlers/implement-stamp.ts +65 -46
- package/os/rfc/handlers/index-graph.ts +14 -0
- package/os/rfc/handlers/list-create.ts +22 -17
- package/os/rfc/handlers/rfc-evidence-sync.ts +62 -22
- package/os/rfc/handlers/validate-moves.test.ts +221 -0
- package/os/rfc/handlers/validate-probe-meta.test.ts +21 -1
- package/os/rfc/handlers/validate-rules.ts +216 -60
- package/os/rfc/handlers/validate.ts +1 -5
- package/os/rfc/next-id.ts +155 -21
- package/os/rfc/outcome-probe.ts +13 -4
- package/os/rfc/reachable-symbol.ts +65 -43
- package/os/rfc/rfc-0000-template.md +10 -0
- package/os/rfc/rfc.module.ts +26 -4
- package/os/rfc/types.ts +31 -3
- package/os/rfc/verification-evidence.ts +74 -25
- package/os/rfc/verification-origin.ts +358 -62
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/fixtures/no-report.proof.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/fixtures/small-domain.proof.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/support.ts +1 -1
- package/os/rfc/verify-workspace.ts +147 -53
- package/os/session/handlers/archive.ts +3 -11
- package/os/session/handlers/metrics-rfc.ts +42 -11
- package/os/session/handlers/save.ts +52 -28
- package/os/session/handlers/session-audit-detectors.test.ts +16 -6
- package/os/session/handlers/session-audit-report.test.ts +9 -3
- package/os/session/handlers/session-audit-report.ts +34 -8
- package/os/session/handlers/session-audit.test.ts +25 -7
- package/os/session/handlers/session-audit.ts +49 -23
- package/os/session/session.module.ts +31 -9
- package/os/system/handlers/system-outbox-scan.ts +45 -17
- package/os/system/handlers/system-product-register.ts +492 -0
- package/os/system/handlers/system-products-status.ts +395 -0
- package/os/system/handlers/system-task-dispatch.ts +17 -21
- package/os/system/handlers/system-versionset-record.ts +3 -3
- package/os/system/scenario-schemas.ts +1 -1
- package/os/system/schemas.ts +17 -0
- package/os/system/system.module.ts +130 -11
- package/os/system/tests/scenario-pin-drift-check.test.ts +2 -0
- package/os/system/tests/scenario-validator-check.test.ts +2 -0
- package/os/system/tests/system-product-register.test.ts +304 -0
- package/os/system/tests/system-products-status.test.ts +154 -0
- package/os/system/tests/system-task-collect.test.ts +25 -15
- package/os/system/tests/system-task-dispatch.test.ts +18 -7
- package/os/system/tests/system-task-status.test.ts +7 -1
- package/os/system/tests/system-task.test.ts +15 -4
- package/os/system/tests/version-set-v2.test.ts +2 -0
- package/os/trajectory/handlers/extract-units.test.ts +11 -6
- package/os/trajectory/handlers/journal-io.ts +21 -7
- package/os/trajectory/handlers/outcome-record.test.ts +28 -8
- package/os/trajectory/handlers/outcome-record.ts +65 -18
- package/os/trajectory/handlers/producer-trust.test.ts +22 -8
- package/os/trajectory/handlers/trajectory-index.test.ts +75 -29
- package/os/trajectory/handlers/trajectory-index.ts +116 -38
- package/os/trajectory/handlers/trajectory-recall.test.ts +67 -19
- package/os/trajectory/handlers/trajectory-recall.ts +115 -41
- package/os/trajectory/handlers/trajectory.test.ts +19 -7
- package/os/trajectory/handlers/verdict-binding.test.ts +138 -33
- package/os/trajectory/trajectory.module.ts +35 -7
- package/os/yaml/scalars.test.ts +1 -1
- package/package.json +30 -1
- package/profiles/godot-game.yaml +4 -4
- package/profiles/root-agents-system.md +82 -0
- package/profiles/system.yaml +1 -0
- package/skills/_shared/fo-pipeline-conventions.md +15 -13
- package/skills/fo/fo-handoff/SKILL.md +10 -2
- package/skills/fo/fo-idea-audit/SKILL.md +4 -0
- package/skills/fo/fo-idea-create-rfc/SKILL.md +21 -10
- package/skills/fo/fo-idea-implement/SKILL.md +2 -10
- package/skills/fo/fo-idea-plan/SKILL.md +7 -5
- package/skills/fo/fo-knowledge-distill/SKILL.md +15 -4
- package/skills/fo/fo-memory-sync/SKILL.md +7 -6
- package/skills/fo/fo-reproduce/SKILL.md +2 -1
- package/skills/fo/fo-session-retro/SKILL.md +87 -44
- package/skills/fo/fo-session-save/SKILL.md +4 -3
- package/skills/fo/fo-system-dispatch/SKILL.md +9 -0
- package/skills/shared/grilling/SKILL.md +17 -9
- package/skills/shared/knowledge/learned-principles.md +1 -1
- package/skills/shared/writing-great-skills/SKILL.md +4 -3
- package/src/adversarial/types.ts +100 -0
- package/src/authority/delegations.ts +9 -2
- package/src/command-modules.ts +6 -0
- package/src/config/forge-config.ts +151 -13
- package/src/correctness/policy-bundle.ts +187 -0
- package/src/knowledge/paths.ts +75 -0
- package/src/knowledge/sync.ts +42 -18
- package/src/onboarding/create-superfolder-guard.test.ts +73 -0
- package/src/onboarding/create.ts +28 -2
- package/src/onboarding/init.ts +20 -5
- package/src/onboarding/npm-token-check.ts +9 -1
- package/src/onboarding/scaffold-project.ts +16 -5
- package/src/onboarding/trust-boundary.test.ts +179 -0
- package/src/onboarding/trust-boundary.ts +825 -0
- package/src/onboarding/upgrade.ts +149 -9
- package/src/profiles/stack-profile.ts +2 -2
- package/src/scaffold/github/CODEOWNERS.template +14 -0
- package/src/scaffold/github/forge-policy.template.yml +40 -0
- package/src/tests/bindings-schema.test.ts +5 -1
- package/src/tests/create.test.ts +74 -20
- package/src/tests/evidence-consult-serialization.test.ts +202 -0
- package/src/tests/forge-config.test.ts +5 -2
- package/src/tests/knowledge-paths.test.ts +80 -0
- package/src/tests/pinned-validate.test.ts +194 -0
- package/src/tests/profile-flow-hooks.test.ts +1 -0
- package/src/tests/profile-schema.test.ts +1 -0
- package/src/tests/skill-validate.test.ts +76 -0
- package/src/tests/stack-profile.test.ts +1 -0
- package/src/types.ts +11 -6
- package/src/utils/verifier-git.ts +8732 -0
- package/src/validators/skill-validate.ts +17 -5
- /package/skills/fo/fo-memory-sync/{qa-log.md → qa-log/legacy.md} +0 -0
- /package/skills/fo/fo-session-save/{qa-log.md → qa-log/legacy.md} +0 -0
- /package/skills/shared/grilling/{qa-log.md → qa-log/legacy.md} +0 -0
|
@@ -13,25 +13,20 @@ at cleanup without moving develop again.</purpose>
|
|
|
13
13
|
</non-goals>
|
|
14
14
|
</MODULE_CONTRACT>
|
|
15
15
|
<KEY_DECISIONS>
|
|
16
|
-
<item>The integration lock covers steps 1–5
|
|
17
|
-
<item>
|
|
18
|
-
<item>Rerun detection is
|
|
19
|
-
<item>
|
|
20
|
-
<item>Task-file preservation runs
|
|
16
|
+
<item>The integration lock covers steps 1–5 — cleanup is idempotent, so a crashed holder cannot wedge the queue.</item>
|
|
17
|
+
<item>Git calls after worktree removal run with -C <primary> — the caller's cwd may be the removed directory.</item>
|
|
18
|
+
<item>Rerun detection is isAncestor(branchTip, develop) on a registered entry — a contained tip means merge done.</item>
|
|
19
|
+
<item>A develop move between rebase and merge despite the lock lands FLOW-INT-07 — reruns rebase onto the new tip.</item>
|
|
20
|
+
<item>Task-file preservation runs before teardown, owner.kind task only — copy failure refuses cleanup (FLOW-INT-04), report survives.</item>
|
|
21
|
+
<item>docs.archive's deferral clears only when every deferred owner ran — a skipped owner keeps .git/forge/deferred-regen.json.</item>
|
|
21
22
|
</KEY_DECISIONS>
|
|
22
23
|
<CHANGE_SUMMARY>
|
|
23
|
-
<item>
|
|
24
|
-
<item>
|
|
25
|
-
<item>RFC-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
Step (3b) judges only paths the owner run changed, validates before staging, skips owners not runnable without an engine build, runs ecosystem.manifest.generate last; e2e log write guarded and run-stamped; Unhandled Errors rule out timeout-only; lost-run wait test; publish pre-filter comment. RFC-1574/1575/1576 record DEV-1..8.</item>
|
|
31
|
-
<item>RFC-1580: correctness.gate and the flow.integrate step
|
|
32
|
-
|
|
33
|
-
Add os/correctness/gate (frozen set at --base, weakening diff incl. byte changes without verifier trailers and frozen exempt mode, git-derived oracle origin with forge/oracle-review@1 records, argv oracle runner with timeout, schema-hash substrate attestation, anchor events, tier high/formal, forge/correctness-bundle@1), the correctness.gate command, test-side helpers @warpgogol/forge/correctness, bindings.paths.oracleReviewsDir, and flow.integrate spawning the primary install's gate after hooks/integration-gate.sh (FLOW-INT-18, --accept-weakening with an X-Correctness-Weakening trailer commit). Flow and system test primaries get a stand-in forge binary; integration warnings now survive the cleanup report.</item>
|
|
34
|
-
<history>RFC-1487, RFC-1490, RFC-1491, RFC-1504, RFC-1509, RFC-1515, RFC-1528, RFC-1531, RFC-1532, RFC-1536, RFC-1537, RFC-1538, RFC-1543, RFC-1544, RFC-1545</history>
|
|
24
|
+
<item>RFC-1622: bind RFC-1622 manifest regeneration to rendered bytes</item>
|
|
25
|
+
<item>RFC-1622: record RFC-1622 integration phase timings</item>
|
|
26
|
+
<item>RFC-1622: honor RFC-1622 receipt capability</item>
|
|
27
|
+
<item>RFC-1622: revalidate RFC-1622 owner on retry</item>
|
|
28
|
+
<item>RFC-1616: ride evidence-flux refusals through the integrate gate phase</item>
|
|
29
|
+
<history>ADR-0128, ADR-0130, RFC-1487, RFC-1490, RFC-1491, RFC-1504, RFC-1509, RFC-1515, RFC-1528, RFC-1531, RFC-1532, RFC-1536, RFC-1537, RFC-1538, RFC-1543, RFC-1544, RFC-1545, RFC-1574, RFC-1580, RFC-1589, RFC-1597, RFC-1598, RFC-1599, RFC-1600, RFC-1602, RFC-1616, RFC-1619</history>
|
|
35
30
|
</CHANGE_SUMMARY>
|
|
36
31
|
*/
|
|
37
32
|
|
|
@@ -45,8 +40,10 @@ import type {
|
|
|
45
40
|
WorkspaceIO,
|
|
46
41
|
} from "../../../src/types.ts";
|
|
47
42
|
import { resolveIo } from "../../../src/utils/io.ts";
|
|
43
|
+
import { EVIDENCE_REFUSED_PREFIX } from "../../../src/utils/verifier-git.ts";
|
|
48
44
|
import {
|
|
49
45
|
AUTO_CLEAN_PASS_CLASSES,
|
|
46
|
+
FOREIGN_PRIMARY_DIRT_HINT,
|
|
50
47
|
SWEEP_COMMIT_SUBJECT,
|
|
51
48
|
classifyDirtyPath,
|
|
52
49
|
classifyDirtyTree,
|
|
@@ -83,12 +80,22 @@ import {
|
|
|
83
80
|
type FlowRegistryEntry,
|
|
84
81
|
} from "../registry.ts";
|
|
85
82
|
import { runFlowScript, type FlowScriptResult } from "../scripts.ts";
|
|
83
|
+
import {
|
|
84
|
+
deltaChangedPaths,
|
|
85
|
+
gateReportSteps,
|
|
86
|
+
recordPreLockVerdict,
|
|
87
|
+
resolveDeltaStepDomains,
|
|
88
|
+
selectDeltaGateSteps,
|
|
89
|
+
type DeltaGateSelection,
|
|
90
|
+
type IntegrateGateMode,
|
|
91
|
+
} from "../pre-lock.ts";
|
|
86
92
|
import {
|
|
87
93
|
postRebaseOwners,
|
|
88
94
|
regenerateAfterRebase,
|
|
89
95
|
type PostRebaseRegenResult,
|
|
90
96
|
} from "../post-rebase-regen.ts";
|
|
91
97
|
import { standaloneInvoke } from "../standalone-invoke.ts";
|
|
98
|
+
import { clearDeferredRegen, consumeDeferredRegen } from "../../core/archive-regen.ts";
|
|
92
99
|
import { preserveTaskFiles } from "../task-files.ts";
|
|
93
100
|
import { flowWorktreePath, primaryWorktree } from "../worktree-path.ts";
|
|
94
101
|
import { pruneReservationsForSession } from "../../rfc/next-id.ts";
|
|
@@ -101,7 +108,15 @@ export const INTEGRATE_LOCK_STALE_MS = 2 * 3_600_000;
|
|
|
101
108
|
/** RFC-1515 AC-4: the refused lock attempt reports who holds it. */
|
|
102
109
|
export type LockDiagnostic = HeldLockDiagnostic;
|
|
103
110
|
|
|
111
|
+
export interface FlowPhaseTiming {
|
|
112
|
+
phase: string;
|
|
113
|
+
attempt: number;
|
|
114
|
+
durationMs: number;
|
|
115
|
+
disposition: "completed" | "failed";
|
|
116
|
+
}
|
|
117
|
+
|
|
104
118
|
export interface FlowIntegrateData {
|
|
119
|
+
phaseTimings?: FlowPhaseTiming[];
|
|
105
120
|
branch: string | null;
|
|
106
121
|
integrated: boolean;
|
|
107
122
|
/** develop tip before this invocation. */
|
|
@@ -126,6 +141,9 @@ export interface FlowIntegrateData {
|
|
|
126
141
|
/** RFC-1538: generated-file rebase conflicts auto-resolved via their owner
|
|
127
142
|
* commands — journaled, never silently merged. */
|
|
128
143
|
autoResolved?: string[];
|
|
144
|
+
/** RFC-1598: autoResolved paths resolved by take-theirs on an uncheckable
|
|
145
|
+
* side — correctness defers to the post-rebase regen fold. */
|
|
146
|
+
autoResolveDeferred?: string[];
|
|
129
147
|
/** RFC-1574: post-rebase regeneration of derived manifests (step 3b). */
|
|
130
148
|
postRebaseRegen?: PostRebaseRegenResult;
|
|
131
149
|
/** RFC-1538: which checkout's build ran the integration gate. */
|
|
@@ -146,9 +164,42 @@ export interface FlowIntegrateData {
|
|
|
146
164
|
staleImporterCommitSha?: string;
|
|
147
165
|
/** RFC-1515: holder payload when FLOW-INT-08 refused on a held lock. */
|
|
148
166
|
lock?: LockDiagnostic;
|
|
167
|
+
/** RFC-1589: how the integration gate ran — unset on the legacy
|
|
168
|
+
* under-lock sequence (pre-lock machinery not engaged). */
|
|
169
|
+
gateMode?: IntegrateGateMode;
|
|
170
|
+
/** RFC-1589: wall time the integration lock was held this run — the
|
|
171
|
+
* pre-lock comparison metric; unset on the legacy path. */
|
|
172
|
+
lockHeldMs?: number;
|
|
173
|
+
/** RFC-1589: Phase-A runs this integrate needed (1 unless develop moved
|
|
174
|
+
* or the branch state went stale and the attempt was discarded). */
|
|
175
|
+
preLockAttempts?: number;
|
|
176
|
+
/** RFC-1589: the locked-delta step selection computed from the develop
|
|
177
|
+
* delta — recorded for audit; the real gate's own RFC-1582 selection
|
|
178
|
+
* decides which rows actually ran. */
|
|
179
|
+
deltaSelection?: DeltaGateSelection;
|
|
149
180
|
diagnostics: Diagnostic[];
|
|
150
181
|
}
|
|
151
182
|
|
|
183
|
+
/** RFC-1599 FLOW-INT-20: primary tracked dirt coexisting with a live
|
|
184
|
+
* session — an audit warning on the pass path and beside FLOW-INT-03
|
|
185
|
+
* refusals; never itself the refusal cause. */
|
|
186
|
+
function foreignDirtWarning(
|
|
187
|
+
rows: Array<{ path: string; owningSession: string | null }>,
|
|
188
|
+
): Diagnostic {
|
|
189
|
+
return {
|
|
190
|
+
ruleId: "FLOW-INT-20",
|
|
191
|
+
severity: "warning",
|
|
192
|
+
message:
|
|
193
|
+
`primary checkout carries ${rows.length} tracked mutation(s) while a live session exists: ` +
|
|
194
|
+
rows
|
|
195
|
+
.slice(0, 10)
|
|
196
|
+
.map((f) => (f.owningSession !== null ? `${f.path} (${f.owningSession})` : f.path))
|
|
197
|
+
.join(", ") +
|
|
198
|
+
(rows.length > 10 ? ` (+${rows.length - 10} more)` : ""),
|
|
199
|
+
fixHint: FOREIGN_PRIMARY_DIRT_HINT,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
152
203
|
function refuse(
|
|
153
204
|
ruleId: string,
|
|
154
205
|
message: string,
|
|
@@ -265,6 +316,7 @@ async function cleanupIntegrated(
|
|
|
265
316
|
staleImporterCommitSha?: string;
|
|
266
317
|
},
|
|
267
318
|
journalGateReport?: string,
|
|
319
|
+
journalGateMode?: { gateMode: string; lockHeldMs: number; preLockAttempts: number },
|
|
268
320
|
): Promise<{ cleanedUp: boolean; diagnostics: Diagnostic[]; gate: FlowScriptResult | null }> {
|
|
269
321
|
const branchExistsNow = await branchExists(primary, io, entry.name);
|
|
270
322
|
let teardownRan: FlowScriptResult | null = null;
|
|
@@ -399,6 +451,7 @@ async function cleanupIntegrated(
|
|
|
399
451
|
? { staleImporterCommitSha: journalRemediation.staleImporterCommitSha }
|
|
400
452
|
: {}),
|
|
401
453
|
...(journalGateReport !== undefined ? { gateReport: journalGateReport } : {}),
|
|
454
|
+
...(journalGateMode !== undefined ? journalGateMode : {}),
|
|
402
455
|
});
|
|
403
456
|
} catch (error) {
|
|
404
457
|
if (error instanceof LockTimeoutError || error instanceof FlowRegistrySchemaError) {
|
|
@@ -431,7 +484,9 @@ export async function integrateFlowBranch(
|
|
|
431
484
|
io: WorkspaceIO,
|
|
432
485
|
opts: Parameters<typeof integrateFlowBranchAttempt>[2],
|
|
433
486
|
): Promise<FlowIntegrateData> {
|
|
434
|
-
const
|
|
487
|
+
const phaseTimings: FlowPhaseTiming[] = [];
|
|
488
|
+
const data = await integrateFlowBranchAttempt(repoRoot, io, { ...opts, phaseTimings });
|
|
489
|
+
data.phaseTimings = phaseTimings;
|
|
435
490
|
const error = data.diagnostics.find((d) => d.severity === "error");
|
|
436
491
|
if (error !== undefined && data.branch !== null) {
|
|
437
492
|
// Best-effort bookkeeping — a journal write failure never adds a refusal.
|
|
@@ -460,37 +515,132 @@ export async function integrateFlowBranch(
|
|
|
460
515
|
return data;
|
|
461
516
|
}
|
|
462
517
|
|
|
518
|
+
interface IntegrateAttemptOpts {
|
|
519
|
+
branch: string | null;
|
|
520
|
+
dryRun: boolean;
|
|
521
|
+
phaseTimings?: FlowPhaseTiming[];
|
|
522
|
+
now?: Date;
|
|
523
|
+
onProgress?: (m: string) => void;
|
|
524
|
+
/** Caller already holds the integration lock (flow.cut/fix releases). */
|
|
525
|
+
lockHeld?: boolean;
|
|
526
|
+
/** Test seam — shrink the lock-wait budget so a held lock refuses fast. */
|
|
527
|
+
lockWaitMs?: number;
|
|
528
|
+
/** Gate target — passed to the integration gate as FORGE_FLOW_TARGET. */
|
|
529
|
+
target?: "develop" | "main";
|
|
530
|
+
/** RFC-1528: kernel invoke port for the bounded preflight validators. */
|
|
531
|
+
invoke?: ForgeInvokeCommand;
|
|
532
|
+
/** RFC-1597 (F-0273): the workspace root `invoke` is bound to — defaults to
|
|
533
|
+
* `repoRoot`. Owner commands that WRITE (rebase auto-resolve, post-rebase
|
|
534
|
+
* regen) only use it when it equals the target worktree; an invoke bound
|
|
535
|
+
* elsewhere lands generated output in the wrong checkout. Read-only
|
|
536
|
+
* preflight validators keep the bound root regardless. */
|
|
537
|
+
invokeRoot?: string;
|
|
538
|
+
/** RFC-1598 (F-0243): generator port bound to a checked-out conflict side.
|
|
539
|
+
* The rebase auto-resolver materializes `theirs`/`ours` into a detached
|
|
540
|
+
* side checkout and invokes owner commands THERE — never against the
|
|
541
|
+
* mixed mid-rebase index — so a generator that resolves a module graph
|
|
542
|
+
* sees a consistent tree. Production binds `standaloneInvoke`; tests pass
|
|
543
|
+
* a stub factory bound to the side dir. */
|
|
544
|
+
sideInvoke?: (sideDir: string) => ForgeInvokeCommand;
|
|
545
|
+
/** RFC-1528: command registry for preflight resolvability. */
|
|
546
|
+
commandRegistry?: CommandRegistry;
|
|
547
|
+
/** RFC-1531: recreate a vanished registered worktree inside the lock. */
|
|
548
|
+
reattach?: boolean;
|
|
549
|
+
/** RFC-1531: delete disposable-classified dirty paths, then re-evaluate. */
|
|
550
|
+
autoClean?: boolean;
|
|
551
|
+
/** RFC-1531: sweep remaining dirty entries into a fixed-subject commit. */
|
|
552
|
+
autocommit?: boolean;
|
|
553
|
+
/** RFC-1543: seconds to wait for live foreign claim-holders on primary (default 600, 0 = fail-fast). */
|
|
554
|
+
waitForeignSeconds?: number;
|
|
555
|
+
/** RFC-1580: operator-accepted weakening reason (isolated weakening session only). */
|
|
556
|
+
acceptWeakening?: string;
|
|
557
|
+
/** RFC-1589: run the expensive gate steps BEFORE acquiring integrate.lock
|
|
558
|
+
* (FORGE_INTEGRATE_PRELOCK=1). Non-port entries only — port keeps the
|
|
559
|
+
* under-lock sequence, as does a caller-held lock. */
|
|
560
|
+
preLock?: boolean;
|
|
561
|
+
/** RFC-1589 test seam — replace the develop-delta step selection. */
|
|
562
|
+
deltaGateSelector?: (deltaPaths: string[]) => Promise<{ selected: string[]; total: number }>;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/** Everything the unlocked gate phase produced that the locked tail or a
|
|
566
|
+
* restart needs — the pre-lock verdict's coverage record. */
|
|
567
|
+
interface IntegrateGateState {
|
|
568
|
+
branch: string;
|
|
569
|
+
entry: FlowRegistryEntry;
|
|
570
|
+
branchWorktree: string;
|
|
571
|
+
/** develop tip when the sequence started (data.developBefore). */
|
|
572
|
+
developBefore: string;
|
|
573
|
+
/** The base the branch rebased onto and the gate diffed against (B0). */
|
|
574
|
+
rebaseBase: string;
|
|
575
|
+
/** Post-gate branch tip the recorded pre-lock verdict covers. */
|
|
576
|
+
branchTip: string;
|
|
577
|
+
dirtyToleratedState: string[];
|
|
578
|
+
toleratedDirt: Array<{ path: string; class: string }>;
|
|
579
|
+
autoResolved: string[];
|
|
580
|
+
/** RFC-1598: subset of autoResolved resolved by take-theirs on an
|
|
581
|
+
* uncheckable side — defers correctness to the post-rebase regen fold. */
|
|
582
|
+
autoResolveDeferred?: string[];
|
|
583
|
+
postRebaseRegen?: PostRebaseRegenResult;
|
|
584
|
+
manifestValidationDeferred: boolean;
|
|
585
|
+
reattachedTo?: string;
|
|
586
|
+
autoCleaned?: string[];
|
|
587
|
+
autocommitSha?: string;
|
|
588
|
+
restoredImporters?: string[];
|
|
589
|
+
staleImporterCommitSha?: string;
|
|
590
|
+
gate: FlowScriptResult;
|
|
591
|
+
engine: { source: "session" | "primary"; root: string };
|
|
592
|
+
warnings: Diagnostic[];
|
|
593
|
+
correctness: {
|
|
594
|
+
status: string;
|
|
595
|
+
bundlePath: string | null;
|
|
596
|
+
acceptedWeakening: string | null;
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** The gate phase either produced a complete (refused/done) integrate data
|
|
601
|
+
* or a ready state the merge tail or locked phase continues from. */
|
|
602
|
+
type GatePhaseResult = FlowIntegrateData | { kind: "ready"; state: IntegrateGateState };
|
|
603
|
+
|
|
604
|
+
/** RFC-1589: Phase-A attempts are bounded — two discards force locked-full. */
|
|
605
|
+
const MAX_PRELOCK_ATTEMPTS = 3;
|
|
606
|
+
|
|
607
|
+
type LockedPhaseResult =
|
|
608
|
+
| { kind: "restart" }
|
|
609
|
+
| {
|
|
610
|
+
kind: "result";
|
|
611
|
+
data: FlowIntegrateData;
|
|
612
|
+
mode: IntegrateGateMode;
|
|
613
|
+
lockHeldMs: number;
|
|
614
|
+
deltaSelection?: DeltaGateSelection;
|
|
615
|
+
};
|
|
616
|
+
|
|
463
617
|
async function integrateFlowBranchAttempt(
|
|
464
618
|
repoRoot: string,
|
|
465
619
|
io: WorkspaceIO,
|
|
466
|
-
opts:
|
|
467
|
-
branch: string | null;
|
|
468
|
-
dryRun: boolean;
|
|
469
|
-
now?: Date;
|
|
470
|
-
onProgress?: (m: string) => void;
|
|
471
|
-
/** Caller already holds the integration lock (flow.cut/fix releases). */
|
|
472
|
-
lockHeld?: boolean;
|
|
473
|
-
/** Test seam — shrink the lock-wait budget so a held lock refuses fast. */
|
|
474
|
-
lockWaitMs?: number;
|
|
475
|
-
/** Gate target — passed to the integration gate as FORGE_FLOW_TARGET. */
|
|
476
|
-
target?: "develop" | "main";
|
|
477
|
-
/** RFC-1528: kernel invoke port for the bounded preflight validators. */
|
|
478
|
-
invoke?: ForgeInvokeCommand;
|
|
479
|
-
/** RFC-1528: command registry for preflight resolvability. */
|
|
480
|
-
commandRegistry?: CommandRegistry;
|
|
481
|
-
/** RFC-1531: recreate a vanished registered worktree inside the lock. */
|
|
482
|
-
reattach?: boolean;
|
|
483
|
-
/** RFC-1531: delete disposable-classified dirty paths, then re-evaluate. */
|
|
484
|
-
autoClean?: boolean;
|
|
485
|
-
/** RFC-1531: sweep remaining dirty entries into a fixed-subject commit. */
|
|
486
|
-
autocommit?: boolean;
|
|
487
|
-
/** RFC-1543: seconds to wait for live foreign claim-holders on primary (default 600, 0 = fail-fast). */
|
|
488
|
-
waitForeignSeconds?: number;
|
|
489
|
-
/** RFC-1580: operator-accepted weakening reason (isolated weakening session only). */
|
|
490
|
-
acceptWeakening?: string;
|
|
491
|
-
},
|
|
620
|
+
opts: IntegrateAttemptOpts,
|
|
492
621
|
): Promise<FlowIntegrateData> {
|
|
493
622
|
const now = opts.now ?? new Date();
|
|
623
|
+
let attemptNumber = 0;
|
|
624
|
+
const measure = async <T>(
|
|
625
|
+
phase: string,
|
|
626
|
+
run: () => Promise<T>,
|
|
627
|
+
failed: (result: T) => boolean = () => false,
|
|
628
|
+
): Promise<T> => {
|
|
629
|
+
const start = Date.now();
|
|
630
|
+
let disposition: FlowPhaseTiming["disposition"] = "failed";
|
|
631
|
+
try {
|
|
632
|
+
const result = await run();
|
|
633
|
+
disposition = failed(result) ? "failed" : "completed";
|
|
634
|
+
return result;
|
|
635
|
+
} finally {
|
|
636
|
+
opts.phaseTimings?.push({
|
|
637
|
+
phase,
|
|
638
|
+
attempt: attemptNumber,
|
|
639
|
+
durationMs: Date.now() - start,
|
|
640
|
+
disposition,
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
};
|
|
494
644
|
|
|
495
645
|
const branch = opts.branch ?? (await currentBranch(repoRoot, io));
|
|
496
646
|
if (branch === null) {
|
|
@@ -653,7 +803,249 @@ async function integrateFlowBranchAttempt(
|
|
|
653
803
|
|
|
654
804
|
// Steps 0–5 under the integration lock (or inside the caller's lock when
|
|
655
805
|
// lockHeld — flow.cut holds it across the whole release).
|
|
656
|
-
|
|
806
|
+
//
|
|
807
|
+
// RFC-1589: the sequence is factored into integrateGatePhase (everything
|
|
808
|
+
// up to and including the correctness gate) + integrateMergeTail (the
|
|
809
|
+
// primary-clean check and fast-forward) so FORGE_INTEGRATE_PRELOCK can
|
|
810
|
+
// run the expensive phase before acquiring integrate.lock and hold the
|
|
811
|
+
// lock only for revalidation, a develop-delta gate, and the merge.
|
|
812
|
+
const rebaseOnto = async (
|
|
813
|
+
worktree: string,
|
|
814
|
+
target: string,
|
|
815
|
+
partial: { branch: string; developBefore: string },
|
|
816
|
+
): Promise<FlowIntegrateData | { autoResolved: string[]; autoResolveDeferred: string[] }> => {
|
|
817
|
+
const autoResolved: string[] = [];
|
|
818
|
+
const autoResolveDeferred: string[] = [];
|
|
819
|
+
let rebase = await git(worktree, io, ["rebase", target]);
|
|
820
|
+
let guard = 0;
|
|
821
|
+
while (rebase.exitCode !== 0 && guard++ < 8) {
|
|
822
|
+
const conflicts = await git(worktree, io, ["diff", "--name-only", "--diff-filter=U"]);
|
|
823
|
+
const paths = conflicts.stdout
|
|
824
|
+
.split("\n")
|
|
825
|
+
.map((l) => l.trim())
|
|
826
|
+
.filter((l) => l.length > 0);
|
|
827
|
+
const { classifyRebaseConflicts } = await import("../preflight.ts");
|
|
828
|
+
const verdict = await classifyRebaseConflicts(worktree, io, paths);
|
|
829
|
+
const resolvable =
|
|
830
|
+
paths.length > 0 &&
|
|
831
|
+
verdict.nonGenerated.length === 0 &&
|
|
832
|
+
verdict.owners.length === paths.length;
|
|
833
|
+
if (!resolvable) {
|
|
834
|
+
await git(worktree, io, ["rebase", "--abort"]);
|
|
835
|
+
return rebaseConflictRefusal(
|
|
836
|
+
worktree,
|
|
837
|
+
io,
|
|
838
|
+
rebase,
|
|
839
|
+
paths,
|
|
840
|
+
partial,
|
|
841
|
+
verdict.owners.length > 0 ? " — mixed generated/non-generated conflict set" : "",
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
// RFC-1598 (F-0243): run each owner generator inside a fully
|
|
845
|
+
// checked-out side — never against the mixed mid-rebase index, where
|
|
846
|
+
// a module-resolving generator loads a broken graph. `theirs`
|
|
847
|
+
// (REBASE_HEAD, the branch commit being replayed) is preferred
|
|
848
|
+
// because the branch's tooling produced the artifact; `ours` (the
|
|
849
|
+
// rebase target tip) is the fallback. The side checkout lands inside
|
|
850
|
+
// the worktree so `pnpm exec` resolves the worktree's install while
|
|
851
|
+
// the checked-out pnpm-workspace.yaml keeps the spawned engine bound
|
|
852
|
+
// to the side tree. A side the generator cannot run on falls through
|
|
853
|
+
// to the next; a side whose generator ran and refused fails hard.
|
|
854
|
+
const sideInvoke = (dir: string) =>
|
|
855
|
+
opts.sideInvoke?.(dir) ??
|
|
856
|
+
standaloneInvoke(
|
|
857
|
+
io,
|
|
858
|
+
dir,
|
|
859
|
+
verdict.owners.map((o) => o.command),
|
|
860
|
+
);
|
|
861
|
+
let lastGenError: string | null = null;
|
|
862
|
+
let resolved = false;
|
|
863
|
+
const sides: Array<{ name: "theirs" | "ours"; ref: string }> = [
|
|
864
|
+
{ name: "theirs", ref: "REBASE_HEAD" },
|
|
865
|
+
{ name: "ours", ref: target },
|
|
866
|
+
];
|
|
867
|
+
for (const side of sides) {
|
|
868
|
+
const sha = await git(worktree, io, ["rev-parse", side.ref]);
|
|
869
|
+
if (sha.exitCode !== 0) continue;
|
|
870
|
+
const sideDir = join(worktree, `.flow-side-${side.name}-${guard}`);
|
|
871
|
+
// A crashed earlier integrate can leave the dir behind — clear it
|
|
872
|
+
// so the checkout attempt does not defer on stale residue.
|
|
873
|
+
await io.rm(sideDir, { recursive: true }).catch(() => undefined);
|
|
874
|
+
await git(worktree, io, ["worktree", "prune"]);
|
|
875
|
+
const add = await git(worktree, io, [
|
|
876
|
+
"worktree",
|
|
877
|
+
"add",
|
|
878
|
+
"--detach",
|
|
879
|
+
sideDir,
|
|
880
|
+
sha.stdout.trim(),
|
|
881
|
+
]);
|
|
882
|
+
if (add.exitCode !== 0) continue;
|
|
883
|
+
try {
|
|
884
|
+
const invoker = sideInvoke(sideDir);
|
|
885
|
+
let sideFailed = false;
|
|
886
|
+
const staged: string[] = [];
|
|
887
|
+
for (const o of verdict.owners) {
|
|
888
|
+
const regen = await invoker(o.command, o.flags);
|
|
889
|
+
if (regen.ok === false || (regen.exitCode !== undefined && regen.exitCode !== 0)) {
|
|
890
|
+
lastGenError = `${o.path}: ${o.command} — ${regen.summary ?? `exit ${regen.exitCode}`}`;
|
|
891
|
+
sideFailed = true;
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
let regenerated: string;
|
|
895
|
+
try {
|
|
896
|
+
regenerated = await io.readFile(join(sideDir, o.path));
|
|
897
|
+
} catch {
|
|
898
|
+
lastGenError = `${o.path}: ${o.command} produced no output on the ${side.name} side`;
|
|
899
|
+
sideFailed = true;
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
// RFC-1545 AC-4: a successful generator that left conflict
|
|
903
|
+
// markers behind must not be committed — escalate like a
|
|
904
|
+
// failure.
|
|
905
|
+
if (/^(<{7}|={7}|>{7})/m.test(regenerated)) {
|
|
906
|
+
lastGenError = `${o.path}: ${o.command} left conflict markers in the regenerated output`;
|
|
907
|
+
sideFailed = true;
|
|
908
|
+
break;
|
|
909
|
+
}
|
|
910
|
+
await io.writeFile(join(worktree, o.path), regenerated);
|
|
911
|
+
await git(worktree, io, ["add", "--", o.path]);
|
|
912
|
+
opts.onProgress?.(
|
|
913
|
+
`conflict: ${o.path} — regenerated via ${o.command} on the ${side.name} side`,
|
|
914
|
+
);
|
|
915
|
+
staged.push(o.path);
|
|
916
|
+
}
|
|
917
|
+
if (!sideFailed) {
|
|
918
|
+
autoResolved.push(...staged);
|
|
919
|
+
resolved = true;
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
} finally {
|
|
923
|
+
await git(worktree, io, ["worktree", "remove", "--force", sideDir]);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
if (!resolved && lastGenError === null) {
|
|
927
|
+
// Neither side could be checked out — take-theirs and defer
|
|
928
|
+
// correctness to the post-rebase regen fold (RFC-1598 AC-4).
|
|
929
|
+
for (const o of verdict.owners) {
|
|
930
|
+
// `git checkout --theirs` is blocked by the agent-session git
|
|
931
|
+
// wrapper — materialize the stage-3 (theirs) blob through the
|
|
932
|
+
// read-only `git show` + io write instead (RFC-1545).
|
|
933
|
+
const theirs = await git(worktree, io, ["show", `:3:${o.path}`]);
|
|
934
|
+
if (theirs.exitCode === 0) {
|
|
935
|
+
await io.writeFile(join(worktree, o.path), theirs.stdout);
|
|
936
|
+
}
|
|
937
|
+
await git(worktree, io, ["add", "--", o.path]);
|
|
938
|
+
autoResolved.push(o.path);
|
|
939
|
+
autoResolveDeferred.push(o.path);
|
|
940
|
+
}
|
|
941
|
+
opts.onProgress?.(
|
|
942
|
+
`conflict: ${paths.join(", ")} — no side checkable; took theirs, deferring regeneration to post-rebase fold`,
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
if (!resolved && lastGenError !== null) {
|
|
946
|
+
await git(worktree, io, ["rebase", "--abort"]);
|
|
947
|
+
return refuse(
|
|
948
|
+
"FLOW-INT-02",
|
|
949
|
+
`auto-resolve of generated conflict failed: ${lastGenError}`,
|
|
950
|
+
"resolve the rebase inside the session worktree manually, commit, and re-run flow.integrate",
|
|
951
|
+
partial,
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
rebase = await git(worktree, io, ["-c", "core.editor=true", "rebase", "--continue"]);
|
|
955
|
+
}
|
|
956
|
+
if (rebase.exitCode !== 0) {
|
|
957
|
+
const conflicts = await git(worktree, io, ["diff", "--name-only", "--diff-filter=U"]);
|
|
958
|
+
const paths = conflicts.stdout
|
|
959
|
+
.split("\n")
|
|
960
|
+
.map((l) => l.trim())
|
|
961
|
+
.filter((l) => l.length > 0);
|
|
962
|
+
await git(worktree, io, ["rebase", "--abort"]);
|
|
963
|
+
return rebaseConflictRefusal(worktree, io, rebase, paths, partial);
|
|
964
|
+
}
|
|
965
|
+
return { autoResolved, autoResolveDeferred };
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
const regenManifests = async (
|
|
969
|
+
worktree: string,
|
|
970
|
+
partial: { branch: string; developBefore: string; rebased: boolean; baseSha: string },
|
|
971
|
+
): Promise<PostRebaseRegenResult | FlowIntegrateData | null> => {
|
|
972
|
+
const owners = await postRebaseOwners(worktree, io);
|
|
973
|
+
// RFC-1602: docs.archive defers its invalidated owner inventory into
|
|
974
|
+
// .git/forge/deferred-regen.json — the fold sweeps it here so the
|
|
975
|
+
// archive command returns in seconds. Deferred owners carry their
|
|
976
|
+
// recorded flags; their full artifact path set joins the owned set.
|
|
977
|
+
const deferred = await consumeDeferredRegen({ workspaceRoot: worktree });
|
|
978
|
+
const extraOwnedPaths: string[] = [];
|
|
979
|
+
if (deferred) {
|
|
980
|
+
for (const owner of deferred.record.owners) {
|
|
981
|
+
const ownedPaths = owner.artifactPaths.filter((p) => !p.includes("*"));
|
|
982
|
+
extraOwnedPaths.push(...ownedPaths);
|
|
983
|
+
if (!owners.some((o) => o.command === owner.command)) {
|
|
984
|
+
owners.push({
|
|
985
|
+
path: ownedPaths[0] ?? owner.command,
|
|
986
|
+
command: owner.command,
|
|
987
|
+
flags: owner.flags,
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
owners.sort(
|
|
992
|
+
(a, b) =>
|
|
993
|
+
Number(a.command === "ecosystem.manifest.generate") -
|
|
994
|
+
Number(b.command === "ecosystem.manifest.generate"),
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
if (owners.length === 0) return null;
|
|
998
|
+
// RFC-1597 (F-0273): the kernel invoke port runs owner commands at the
|
|
999
|
+
// CALLER's workspace root — for flow.cut and any primary-side integrate
|
|
1000
|
+
// that root is the primary, so generated writes land there uncommitted
|
|
1001
|
+
// while the worktree fold sees no diff (and step (5) then refuses
|
|
1002
|
+
// FLOW-INT-03 on the heal's own collateral). The kernel invoke is used
|
|
1003
|
+
// only when the caller IS this worktree; otherwise the standalone spawn
|
|
1004
|
+
// targets the worktree directly — skipped when it cannot run there.
|
|
1005
|
+
const kernelBoundHere = opts.invoke !== undefined && (opts.invokeRoot ?? repoRoot) === worktree;
|
|
1006
|
+
const invoker = kernelBoundHere
|
|
1007
|
+
? opts.invoke!
|
|
1008
|
+
: standaloneInvoke(io, worktree, [
|
|
1009
|
+
...owners.map((o) => o.command),
|
|
1010
|
+
"ecosystem.manifest.validate",
|
|
1011
|
+
]);
|
|
1012
|
+
// RFC-1574: the standalone fallback spawns `pnpm exec werkstatt run`
|
|
1013
|
+
// in the worktree — without an engine build there it cannot run, and
|
|
1014
|
+
// the owners are skipped rather than refused.
|
|
1015
|
+
const notRunnable =
|
|
1016
|
+
!kernelBoundHere && !(await io.exists(join(worktree, "node_modules", ".bin", "werkstatt")))
|
|
1017
|
+
? new Set(owners.map((o) => o.command))
|
|
1018
|
+
: undefined;
|
|
1019
|
+
const regen = await regenerateAfterRebase({
|
|
1020
|
+
branchWorktree: worktree,
|
|
1021
|
+
io,
|
|
1022
|
+
invoke: invoker,
|
|
1023
|
+
owners,
|
|
1024
|
+
extraOwnedPaths,
|
|
1025
|
+
baseSha: partial.baseSha,
|
|
1026
|
+
onProgress: opts.onProgress,
|
|
1027
|
+
...(notRunnable ? { notRunnable } : {}),
|
|
1028
|
+
});
|
|
1029
|
+
if ("refused" in regen) {
|
|
1030
|
+
return refuse("FLOW-INT-12", regen.message, regen.fixHint, partial);
|
|
1031
|
+
}
|
|
1032
|
+
// Consume the record only when every deferred owner actually ran — a
|
|
1033
|
+
// notRunnable-skipped owner keeps the record for a runnable fold.
|
|
1034
|
+
if (deferred) {
|
|
1035
|
+
const pending = deferred.record.owners.filter((o) => !regen.ran.includes(o.command));
|
|
1036
|
+
if (pending.length === 0) {
|
|
1037
|
+
clearDeferredRegen(deferred.file);
|
|
1038
|
+
} else {
|
|
1039
|
+
opts.onProgress?.(
|
|
1040
|
+
`deferred regen: ${pending.map((o) => o.command).join(", ")} skipped here — record kept for a runnable fold`,
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return regen;
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
const integrateGatePhase = async (gateModeEnv?: IntegrateGateMode): Promise<GatePhaseResult> => {
|
|
1048
|
+
attemptNumber += 1;
|
|
657
1049
|
const developBefore = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
658
1050
|
const hasBranch = await branchExists(primary, io, branch);
|
|
659
1051
|
|
|
@@ -934,25 +1326,42 @@ async function integrateFlowBranchAttempt(
|
|
|
934
1326
|
// RFC-1537: declared regenerable dirt tolerated on this attempt —
|
|
935
1327
|
// surfaced in data + journaled on integrate/refusal, never committed.
|
|
936
1328
|
let toleratedDirt: Array<{ path: string; class: string }> = [];
|
|
1329
|
+
// RFC-1599: primary dirt rows with live-session attribution — warning
|
|
1330
|
+
// surfaced in the diagnostics collector below, never a refusal.
|
|
1331
|
+
let foreignDirt: Array<{ path: string; owningSession: string | null }> = [];
|
|
937
1332
|
// RFC-1528: bounded preflight — dirty-tree checks with lockfile
|
|
938
1333
|
// classification, then the four validators that used to fire only inside
|
|
939
1334
|
// the expensive integration gate. Non-port path only (port entries keep
|
|
940
1335
|
// their own FLOW-INT-09/10 semantics); first failure refuses before the
|
|
941
1336
|
// rebase and before the gate spawns.
|
|
1337
|
+
let manifestValidationDeferred = false;
|
|
942
1338
|
if (entry.port === null) {
|
|
1339
|
+
manifestValidationDeferred =
|
|
1340
|
+
opts.invoke?.manifestReceiptV1 === true &&
|
|
1341
|
+
(opts.invokeRoot ?? repoRoot) === branchWorktree &&
|
|
1342
|
+
(await postRebaseOwners(branchWorktree, io)).some(
|
|
1343
|
+
(owner) => owner.command === "ecosystem.manifest.generate",
|
|
1344
|
+
);
|
|
943
1345
|
const { runIntegratePreflight } = await import("../preflight.ts");
|
|
944
|
-
const preflight = await
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1346
|
+
const preflight = await measure(
|
|
1347
|
+
"preflight",
|
|
1348
|
+
async () =>
|
|
1349
|
+
runIntegratePreflight({
|
|
1350
|
+
primary,
|
|
1351
|
+
branchWorktree,
|
|
1352
|
+
branch,
|
|
1353
|
+
io,
|
|
1354
|
+
worktreeDirty: dirty,
|
|
1355
|
+
invoke: opts.invoke,
|
|
1356
|
+
deferManifestValidation: manifestValidationDeferred,
|
|
1357
|
+
commandRegistry: opts.commandRegistry,
|
|
1358
|
+
waitForeignSeconds: opts.waitForeignSeconds,
|
|
1359
|
+
onProgress: opts.onProgress,
|
|
1360
|
+
}),
|
|
1361
|
+
(result) => !result.ok,
|
|
1362
|
+
);
|
|
955
1363
|
toleratedDirt = preflight.tolerated;
|
|
1364
|
+
foreignDirt = preflight.foreignDirt ?? [];
|
|
956
1365
|
for (const skipped of preflight.skipped) {
|
|
957
1366
|
opts.onProgress?.(
|
|
958
1367
|
skipped.reason === "no-invoke"
|
|
@@ -964,7 +1373,7 @@ async function integrateFlowBranchAttempt(
|
|
|
964
1373
|
opts.onProgress?.(`tolerated regenerable state: ${t.path} (${t.class})`);
|
|
965
1374
|
}
|
|
966
1375
|
if (!preflight.ok && preflight.refuse) {
|
|
967
|
-
|
|
1376
|
+
const refusal = refuse(
|
|
968
1377
|
preflight.refuse.ruleId,
|
|
969
1378
|
preflight.refuse.message,
|
|
970
1379
|
preflight.refuse.fixHint,
|
|
@@ -981,6 +1390,15 @@ async function integrateFlowBranchAttempt(
|
|
|
981
1390
|
},
|
|
982
1391
|
preflight.refuse.data,
|
|
983
1392
|
);
|
|
1393
|
+
// RFC-1599: the same foreignDirt rows that warn on the pass path ride
|
|
1394
|
+
// a FLOW-INT-03 refusal as a warning diagnostic — attribution is
|
|
1395
|
+
// audit, never the refusal's cause.
|
|
1396
|
+
const refusalRows = preflight.refuse.data?.foreignDirt as
|
|
1397
|
+
Array<{ path: string; owningSession: string | null }> | undefined;
|
|
1398
|
+
if (refusalRows !== undefined && refusalRows.length > 0) {
|
|
1399
|
+
refusal.diagnostics.push(foreignDirtWarning(refusalRows));
|
|
1400
|
+
}
|
|
1401
|
+
return refusal;
|
|
984
1402
|
}
|
|
985
1403
|
} else if (dirty.entries.length > 0) {
|
|
986
1404
|
// Port path keeps its own refusal surface but the same regenerable
|
|
@@ -1053,98 +1471,44 @@ async function integrateFlowBranchAttempt(
|
|
|
1053
1471
|
}
|
|
1054
1472
|
}
|
|
1055
1473
|
|
|
1474
|
+
// (2d) RFC-1600 AC-3: duplicate-governance-id preflight — the branch's
|
|
1475
|
+
// new artifacts must not collide with ids develop already carries
|
|
1476
|
+
// (file families + rule literals). Refusal only, never auto-renumber;
|
|
1477
|
+
// port entries keep their merge shape and skip the scan.
|
|
1478
|
+
if (entry.port === null) {
|
|
1479
|
+
const { scanDuplicateGovernanceIds } = await import("../dup-id-scan.ts");
|
|
1480
|
+
const dups = await scanDuplicateGovernanceIds(primary, io, "develop", branch);
|
|
1481
|
+
const duplicates = [...dups.fileIds, ...dups.ruleIds];
|
|
1482
|
+
if (duplicates.length > 0) {
|
|
1483
|
+
return refuse(
|
|
1484
|
+
"FLOW-INT-19",
|
|
1485
|
+
`duplicate governance id(s) on ${branch}: ${duplicates
|
|
1486
|
+
.map((d) => `${d.id} (branch: ${d.onBranch}; develop: ${d.onDevelop})`)
|
|
1487
|
+
.join("; ")}`,
|
|
1488
|
+
"renumber the branch artifacts via the family's next-id, regenerate the index surfaces, then re-run flow.integrate — allocation races are prevented by forge/rfc-reservations.yaml",
|
|
1489
|
+
{ branch, developBefore },
|
|
1490
|
+
{ duplicates },
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1056
1495
|
// (3) rebase onto the current develop — never for port entries.
|
|
1057
1496
|
// RFC-1538: a conflict confined to generated artifacts resolves via its
|
|
1058
1497
|
// owner command (checkout --theirs + regenerate + continue) — the
|
|
1059
1498
|
// generated-file doctrine applied inside the rebase path; anything else
|
|
1060
1499
|
// still refuses FLOW-INT-02 for a human.
|
|
1061
1500
|
const rebaseBase = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
1062
|
-
|
|
1501
|
+
let autoResolved: string[] = [];
|
|
1502
|
+
let autoResolveDeferred: string[] = [];
|
|
1063
1503
|
if (entry.port === null) {
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
const { classifyRebaseConflicts } = await import("../preflight.ts");
|
|
1073
|
-
const verdict = await classifyRebaseConflicts(branchWorktree, io, paths);
|
|
1074
|
-
// RFC-1545 AC-2: without a kernel invoke port the standalone adapter
|
|
1075
|
-
// spawns the allowlisted owner commands in the worktree — the
|
|
1076
|
-
// resolution contract is identical either way.
|
|
1077
|
-
const invoker =
|
|
1078
|
-
opts.invoke ??
|
|
1079
|
-
standaloneInvoke(
|
|
1080
|
-
io,
|
|
1081
|
-
branchWorktree,
|
|
1082
|
-
verdict.owners.map((o) => o.command),
|
|
1083
|
-
);
|
|
1084
|
-
const resolvable =
|
|
1085
|
-
paths.length > 0 &&
|
|
1086
|
-
verdict.nonGenerated.length === 0 &&
|
|
1087
|
-
verdict.owners.length === paths.length;
|
|
1088
|
-
if (!resolvable) {
|
|
1089
|
-
await git(branchWorktree, io, ["rebase", "--abort"]);
|
|
1090
|
-
return rebaseConflictRefusal(
|
|
1091
|
-
branchWorktree,
|
|
1092
|
-
io,
|
|
1093
|
-
rebase,
|
|
1094
|
-
paths,
|
|
1095
|
-
{ branch, developBefore },
|
|
1096
|
-
verdict.owners.length > 0 ? " — mixed generated/non-generated conflict set" : "",
|
|
1097
|
-
);
|
|
1098
|
-
}
|
|
1099
|
-
let failed = false;
|
|
1100
|
-
for (const o of verdict.owners) {
|
|
1101
|
-
// `git checkout --theirs` is blocked by the agent-session git
|
|
1102
|
-
// wrapper — materialize the stage-3 (theirs) blob through the
|
|
1103
|
-
// read-only `git show` + io write instead (RFC-1545).
|
|
1104
|
-
const theirs = await git(branchWorktree, io, ["show", `:3:${o.path}`]);
|
|
1105
|
-
if (theirs.exitCode === 0) {
|
|
1106
|
-
await io.writeFile(join(branchWorktree, o.path), theirs.stdout);
|
|
1107
|
-
}
|
|
1108
|
-
const regen = await invoker(o.command, o.flags);
|
|
1109
|
-
if (regen.ok === false || (regen.exitCode !== undefined && regen.exitCode !== 0)) {
|
|
1110
|
-
await git(branchWorktree, io, ["rebase", "--abort"]);
|
|
1111
|
-
failed = true;
|
|
1112
|
-
return refuse(
|
|
1113
|
-
"FLOW-INT-02",
|
|
1114
|
-
`auto-resolve of generated conflict ${o.path} failed: ${o.command} — ${regen.summary ?? `exit ${regen.exitCode}`}`,
|
|
1115
|
-
"resolve the rebase inside the session worktree manually, commit, and re-run flow.integrate",
|
|
1116
|
-
{ branch, developBefore },
|
|
1117
|
-
);
|
|
1118
|
-
}
|
|
1119
|
-
// RFC-1545 AC-4: a successful generator that left conflict markers
|
|
1120
|
-
// behind must not be committed — escalate like a failure.
|
|
1121
|
-
const regenerated = await io.readFile(join(branchWorktree, o.path));
|
|
1122
|
-
if (/^(<{7}|={7}|>{7})/m.test(regenerated)) {
|
|
1123
|
-
await git(branchWorktree, io, ["rebase", "--abort"]);
|
|
1124
|
-
failed = true;
|
|
1125
|
-
return refuse(
|
|
1126
|
-
"FLOW-INT-02",
|
|
1127
|
-
`auto-resolve of generated conflict ${o.path} failed: ${o.command} left conflict markers in the regenerated output`,
|
|
1128
|
-
"resolve the rebase inside the session worktree manually, commit, and re-run flow.integrate",
|
|
1129
|
-
{ branch, developBefore },
|
|
1130
|
-
);
|
|
1131
|
-
}
|
|
1132
|
-
await git(branchWorktree, io, ["add", "--", o.path]);
|
|
1133
|
-
opts.onProgress?.(`conflict: ${o.path} — regenerated via ${o.command}`);
|
|
1134
|
-
autoResolved.push(o.path);
|
|
1135
|
-
}
|
|
1136
|
-
if (failed) break;
|
|
1137
|
-
rebase = await git(branchWorktree, io, ["-c", "core.editor=true", "rebase", "--continue"]);
|
|
1138
|
-
}
|
|
1139
|
-
if (rebase.exitCode !== 0) {
|
|
1140
|
-
const conflicts = await git(branchWorktree, io, ["diff", "--name-only", "--diff-filter=U"]);
|
|
1141
|
-
const paths = conflicts.stdout
|
|
1142
|
-
.split("\n")
|
|
1143
|
-
.map((l) => l.trim())
|
|
1144
|
-
.filter((l) => l.length > 0);
|
|
1145
|
-
await git(branchWorktree, io, ["rebase", "--abort"]);
|
|
1146
|
-
return rebaseConflictRefusal(branchWorktree, io, rebase, paths, { branch, developBefore });
|
|
1147
|
-
}
|
|
1504
|
+
const rebased = await measure(
|
|
1505
|
+
"rebase",
|
|
1506
|
+
() => rebaseOnto(branchWorktree, "develop", { branch, developBefore }),
|
|
1507
|
+
(result) => "diagnostics" in result,
|
|
1508
|
+
);
|
|
1509
|
+
if ("diagnostics" in rebased) return rebased;
|
|
1510
|
+
autoResolved = rebased.autoResolved;
|
|
1511
|
+
autoResolveDeferred = rebased.autoResolveDeferred;
|
|
1148
1512
|
}
|
|
1149
1513
|
|
|
1150
1514
|
// (3b) RFC-1574: post-rebase regeneration — derived manifests depend on
|
|
@@ -1152,39 +1516,30 @@ async function integrateFlowBranchAttempt(
|
|
|
1152
1516
|
// change is committed before the gate judges it (F-0168).
|
|
1153
1517
|
let postRebaseRegen: PostRebaseRegenResult | undefined;
|
|
1154
1518
|
if (entry.port === null) {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
standaloneInvoke(io, branchWorktree, [
|
|
1160
|
-
...owners.map((o) => o.command),
|
|
1161
|
-
"ecosystem.manifest.validate",
|
|
1162
|
-
]);
|
|
1163
|
-
// RFC-1574: the standalone fallback spawns `pnpm exec werkstatt run`
|
|
1164
|
-
// in the worktree — without an engine build there it cannot run, and
|
|
1165
|
-
// the owners are skipped rather than refused.
|
|
1166
|
-
const notRunnable =
|
|
1167
|
-
opts.invoke === undefined &&
|
|
1168
|
-
!(await io.exists(join(branchWorktree, "node_modules", ".bin", "werkstatt")))
|
|
1169
|
-
? new Set(owners.map((o) => o.command))
|
|
1170
|
-
: undefined;
|
|
1171
|
-
const regen = await regenerateAfterRebase({
|
|
1172
|
-
branchWorktree,
|
|
1173
|
-
io,
|
|
1174
|
-
invoke: invoker,
|
|
1175
|
-
owners,
|
|
1176
|
-
onProgress: opts.onProgress,
|
|
1177
|
-
...(notRunnable ? { notRunnable } : {}),
|
|
1178
|
-
});
|
|
1179
|
-
if ("refused" in regen) {
|
|
1180
|
-
return refuse("FLOW-INT-12", regen.message, regen.fixHint, {
|
|
1519
|
+
const regen = await measure(
|
|
1520
|
+
"regeneration",
|
|
1521
|
+
() =>
|
|
1522
|
+
regenManifests(branchWorktree, {
|
|
1181
1523
|
branch,
|
|
1182
1524
|
developBefore,
|
|
1183
1525
|
rebased: true,
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1526
|
+
baseSha: rebaseBase,
|
|
1527
|
+
}),
|
|
1528
|
+
(result) => result !== null && "diagnostics" in result,
|
|
1529
|
+
);
|
|
1530
|
+
if (regen !== null && "diagnostics" in regen) return regen;
|
|
1531
|
+
if (
|
|
1532
|
+
manifestValidationDeferred &&
|
|
1533
|
+
(regen === null || !regen.ran.includes("ecosystem.manifest.generate"))
|
|
1534
|
+
) {
|
|
1535
|
+
return refuse(
|
|
1536
|
+
"FLOW-INT-12",
|
|
1537
|
+
"the deferred ecosystem manifest owner was unavailable after rebase",
|
|
1538
|
+
"restore the manifest owner and re-run flow.integrate",
|
|
1539
|
+
{ branch, developBefore, rebased: true },
|
|
1540
|
+
);
|
|
1187
1541
|
}
|
|
1542
|
+
postRebaseRegen = regen ?? undefined;
|
|
1188
1543
|
}
|
|
1189
1544
|
|
|
1190
1545
|
// (4) integration gate — the primary's script, executed by the session
|
|
@@ -1193,6 +1548,9 @@ async function integrateFlowBranchAttempt(
|
|
|
1193
1548
|
const { resolveGateEngine } = await import("../gate-engine.ts");
|
|
1194
1549
|
const engine = await resolveGateEngine(branchWorktree, primary, io);
|
|
1195
1550
|
const warnings: Diagnostic[] = [];
|
|
1551
|
+
if (foreignDirt.length > 0) {
|
|
1552
|
+
warnings.push(foreignDirtWarning(foreignDirt));
|
|
1553
|
+
}
|
|
1196
1554
|
if (
|
|
1197
1555
|
engine.source === "primary" &&
|
|
1198
1556
|
(await io.exists(join(primary, "hooks", "integration-gate.sh")))
|
|
@@ -1206,16 +1564,22 @@ async function integrateFlowBranchAttempt(
|
|
|
1206
1564
|
});
|
|
1207
1565
|
}
|
|
1208
1566
|
opts.onProgress?.(`gate engine: ${engine.source} (${engine.root})`);
|
|
1209
|
-
const gate = await
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1567
|
+
const gate = await measure(
|
|
1568
|
+
"repository-gate",
|
|
1569
|
+
() =>
|
|
1570
|
+
runFlowScript(io, "integration-gate", {
|
|
1571
|
+
primary,
|
|
1572
|
+
cwd: engine.root,
|
|
1573
|
+
env: {
|
|
1574
|
+
FLOW_PRIMARY: primary,
|
|
1575
|
+
FLOW_BRANCH: branch,
|
|
1576
|
+
FLOW_BASE_SHA: rebaseBase,
|
|
1577
|
+
FORGE_FLOW_TARGET: opts.target ?? "develop",
|
|
1578
|
+
...(gateModeEnv !== undefined ? { FORGE_GATE_MODE: gateModeEnv } : {}),
|
|
1579
|
+
},
|
|
1580
|
+
}),
|
|
1581
|
+
(result) => result.status === "failed",
|
|
1582
|
+
);
|
|
1219
1583
|
if (gate.status === "failed") {
|
|
1220
1584
|
return refuse(
|
|
1221
1585
|
"FLOW-INT-05",
|
|
@@ -1230,14 +1594,18 @@ async function integrateFlowBranchAttempt(
|
|
|
1230
1594
|
|
|
1231
1595
|
// (4b) RFC-1580: correctness gate from the PRIMARY install, judging the
|
|
1232
1596
|
// session worktree against the develop tip it integrates into.
|
|
1233
|
-
const { runCorrectnessStep
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1597
|
+
const { runCorrectnessStep } = await import("../correctness-step.ts");
|
|
1598
|
+
const correctness = await measure(
|
|
1599
|
+
"correctness-gate",
|
|
1600
|
+
() =>
|
|
1601
|
+
runCorrectnessStep(io, {
|
|
1602
|
+
primary,
|
|
1603
|
+
worktree: branchWorktree,
|
|
1604
|
+
base: rebaseBase,
|
|
1605
|
+
...(opts.acceptWeakening ? { acceptWeakening: opts.acceptWeakening } : {}),
|
|
1606
|
+
}),
|
|
1607
|
+
(result) => Boolean(result.refusal),
|
|
1608
|
+
);
|
|
1241
1609
|
if (correctness.refusal) {
|
|
1242
1610
|
return refuse(
|
|
1243
1611
|
"FLOW-INT-18",
|
|
@@ -1252,6 +1620,66 @@ async function integrateFlowBranchAttempt(
|
|
|
1252
1620
|
`correctness gate: ${correctness.status}${correctness.bundlePath ? ` (${correctness.bundlePath})` : ""}`,
|
|
1253
1621
|
);
|
|
1254
1622
|
|
|
1623
|
+
const state: IntegrateGateState = {
|
|
1624
|
+
branch,
|
|
1625
|
+
entry,
|
|
1626
|
+
branchWorktree,
|
|
1627
|
+
developBefore,
|
|
1628
|
+
rebaseBase,
|
|
1629
|
+
branchTip: (await git(primary, io, ["rev-parse", branch])).stdout.trim(),
|
|
1630
|
+
dirtyToleratedState: dirty.toleratedState,
|
|
1631
|
+
toleratedDirt,
|
|
1632
|
+
autoResolved,
|
|
1633
|
+
manifestValidationDeferred,
|
|
1634
|
+
...(autoResolveDeferred.length > 0 ? { autoResolveDeferred } : {}),
|
|
1635
|
+
...(postRebaseRegen !== undefined ? { postRebaseRegen } : {}),
|
|
1636
|
+
...(reattachedTo !== undefined ? { reattachedTo } : {}),
|
|
1637
|
+
...(autoCleaned !== undefined ? { autoCleaned } : {}),
|
|
1638
|
+
...(autocommitSha !== undefined ? { autocommitSha } : {}),
|
|
1639
|
+
...(restoredImporters !== undefined ? { restoredImporters } : {}),
|
|
1640
|
+
...(staleImporterCommitSha !== undefined ? { staleImporterCommitSha } : {}),
|
|
1641
|
+
gate,
|
|
1642
|
+
engine,
|
|
1643
|
+
warnings,
|
|
1644
|
+
correctness: {
|
|
1645
|
+
status: correctness.status,
|
|
1646
|
+
bundlePath: correctness.bundlePath,
|
|
1647
|
+
acceptedWeakening: correctness.acceptedWeakening,
|
|
1648
|
+
},
|
|
1649
|
+
};
|
|
1650
|
+
return { kind: "ready", state };
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
// (5) primary must sit clean on develop, then fast-forward — the locked
|
|
1654
|
+
// tail shared by the legacy sequence and the pre-lock Phase B.
|
|
1655
|
+
const integrateMergeTail = async (
|
|
1656
|
+
s: IntegrateGateState,
|
|
1657
|
+
extras?: {
|
|
1658
|
+
gateMode?: IntegrateGateMode;
|
|
1659
|
+
lockHeldMs?: number;
|
|
1660
|
+
preLockAttempts?: number;
|
|
1661
|
+
deltaSelection?: DeltaGateSelection;
|
|
1662
|
+
},
|
|
1663
|
+
): Promise<FlowIntegrateData> => {
|
|
1664
|
+
const {
|
|
1665
|
+
branch,
|
|
1666
|
+
entry,
|
|
1667
|
+
branchWorktree,
|
|
1668
|
+
developBefore,
|
|
1669
|
+
gate,
|
|
1670
|
+
engine,
|
|
1671
|
+
warnings,
|
|
1672
|
+
autoResolved,
|
|
1673
|
+
autoResolveDeferred,
|
|
1674
|
+
postRebaseRegen,
|
|
1675
|
+
reattachedTo,
|
|
1676
|
+
autoCleaned,
|
|
1677
|
+
autocommitSha,
|
|
1678
|
+
restoredImporters,
|
|
1679
|
+
staleImporterCommitSha,
|
|
1680
|
+
correctness,
|
|
1681
|
+
} = s;
|
|
1682
|
+
let toleratedDirt = [...s.toleratedDirt];
|
|
1255
1683
|
// (5) primary must sit clean on develop, then fast-forward. Mid-gate
|
|
1256
1684
|
// importer churn from another session's open mission tolerates here too
|
|
1257
1685
|
// (RFC-1537) — the same classifier the preflight ran.
|
|
@@ -1298,6 +1726,7 @@ async function integrateFlowBranchAttempt(
|
|
|
1298
1726
|
}
|
|
1299
1727
|
if (correctness.acceptedWeakening) {
|
|
1300
1728
|
// RFC-1580: the accepted weakening is recorded on the integration itself.
|
|
1729
|
+
const { CORRECTNESS_WEAKENING_TRAILER } = await import("../correctness-step.ts");
|
|
1301
1730
|
const trailer = await git(branchWorktree, io, [
|
|
1302
1731
|
"commit",
|
|
1303
1732
|
"--allow-empty",
|
|
@@ -1331,9 +1760,12 @@ async function integrateFlowBranchAttempt(
|
|
|
1331
1760
|
rebased: entry.port === null,
|
|
1332
1761
|
gate,
|
|
1333
1762
|
cleanedUp: false,
|
|
1334
|
-
...(
|
|
1763
|
+
...(s.dirtyToleratedState.length > 0 ? { toleratedState: s.dirtyToleratedState } : {}),
|
|
1335
1764
|
...(toleratedDirt.length > 0 ? { toleratedDirt } : {}),
|
|
1336
1765
|
...(autoResolved.length > 0 ? { autoResolved } : {}),
|
|
1766
|
+
...(autoResolveDeferred !== undefined && autoResolveDeferred.length > 0
|
|
1767
|
+
? { autoResolveDeferred }
|
|
1768
|
+
: {}),
|
|
1337
1769
|
...(postRebaseRegen !== undefined ? { postRebaseRegen } : {}),
|
|
1338
1770
|
...(reattachedTo !== undefined ? { reattachedTo } : {}),
|
|
1339
1771
|
...(autoCleaned !== undefined && autoCleaned.length > 0 ? { autoCleaned } : {}),
|
|
@@ -1348,32 +1780,364 @@ async function integrateFlowBranchAttempt(
|
|
|
1348
1780
|
bundlePath: correctness.bundlePath,
|
|
1349
1781
|
acceptedWeakening: correctness.acceptedWeakening,
|
|
1350
1782
|
},
|
|
1783
|
+
...(extras?.gateMode !== undefined ? { gateMode: extras.gateMode } : {}),
|
|
1784
|
+
...(extras?.lockHeldMs !== undefined ? { lockHeldMs: extras.lockHeldMs } : {}),
|
|
1785
|
+
...(extras?.preLockAttempts !== undefined ? { preLockAttempts: extras.preLockAttempts } : {}),
|
|
1786
|
+
...(extras?.deltaSelection !== undefined ? { deltaSelection: extras.deltaSelection } : {}),
|
|
1351
1787
|
diagnostics: warnings,
|
|
1352
1788
|
};
|
|
1353
1789
|
};
|
|
1354
1790
|
|
|
1791
|
+
// RFC-1616 follow-up: the gate phase's consult preamble (rev-parse /
|
|
1792
|
+
// branchExists / worktreeList / statusDirty) is judged evidence — a
|
|
1793
|
+
// foreign write landing mid-consult refuses the same transient class the
|
|
1794
|
+
// preflight's foreign-dirt wait already rides out. The phase is rerun-safe
|
|
1795
|
+
// by construction (integratePreLock loops it, and every mutation inside is
|
|
1796
|
+
// idempotent under re-validation), so a consult refusal retries the phase
|
|
1797
|
+
// while the flux cap holds — a surface that stays unprovable past it is
|
|
1798
|
+
// structural, not merely churning, and still throws.
|
|
1799
|
+
const GATE_PHASE_FLUX_MS = 30_000;
|
|
1800
|
+
const integrateGatePhaseRidingFlux = async (
|
|
1801
|
+
gateModeEnv?: IntegrateGateMode,
|
|
1802
|
+
): Promise<GatePhaseResult> => {
|
|
1803
|
+
const fluxDeadline = Date.now() + GATE_PHASE_FLUX_MS;
|
|
1804
|
+
for (;;) {
|
|
1805
|
+
try {
|
|
1806
|
+
return await integrateGatePhase(gateModeEnv);
|
|
1807
|
+
} catch (e) {
|
|
1808
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
1809
|
+
if (!msg.includes(EVIDENCE_REFUSED_PREFIX) || Date.now() >= fluxDeadline) {
|
|
1810
|
+
throw e;
|
|
1811
|
+
}
|
|
1812
|
+
opts.onProgress?.(
|
|
1813
|
+
`primary surface unprovable mid-read — retrying the gate phase consult (up to ${Math.ceil((fluxDeadline - Date.now()) / 1000)}s)`,
|
|
1814
|
+
);
|
|
1815
|
+
await new Promise((r) =>
|
|
1816
|
+
setTimeout(r, Math.min(5_000, Math.max(0, fluxDeadline - Date.now()))),
|
|
1817
|
+
);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
const integrateInner = async (): Promise<FlowIntegrateData> => {
|
|
1823
|
+
const phase = await integrateGatePhaseRidingFlux();
|
|
1824
|
+
if (!("state" in phase)) return phase;
|
|
1825
|
+
return measure(
|
|
1826
|
+
"finalization",
|
|
1827
|
+
() => integrateMergeTail(phase.state),
|
|
1828
|
+
(result) => result.diagnostics.some((diagnostic) => diagnostic.severity === "error"),
|
|
1829
|
+
);
|
|
1830
|
+
};
|
|
1831
|
+
|
|
1832
|
+
/** RFC-1589 Phase B — inside integrate.lock: revalidate the Phase-A
|
|
1833
|
+
* verdict's coverage, read B1, and either fast-forward on the still-fresh
|
|
1834
|
+
* verdict (pre-lock), run the develop-delta selection under the lock
|
|
1835
|
+
* (locked-delta), or run the complete gate (locked-full) once the attempt
|
|
1836
|
+
* budget is spent. A "restart" result releases the lock and discards the
|
|
1837
|
+
* attempt — the caller re-runs Phase A against the moved develop. */
|
|
1838
|
+
const integrateLockedPhase = async (
|
|
1839
|
+
s: IntegrateGateState,
|
|
1840
|
+
attempt: number,
|
|
1841
|
+
): Promise<LockedPhaseResult> => {
|
|
1842
|
+
const lockStart = Date.now();
|
|
1843
|
+
const out = (
|
|
1844
|
+
mode: IntegrateGateMode,
|
|
1845
|
+
data: FlowIntegrateData,
|
|
1846
|
+
deltaSelection?: DeltaGateSelection,
|
|
1847
|
+
): LockedPhaseResult => ({
|
|
1848
|
+
kind: "result",
|
|
1849
|
+
mode,
|
|
1850
|
+
data,
|
|
1851
|
+
lockHeldMs: Date.now() - lockStart,
|
|
1852
|
+
...(deltaSelection !== undefined ? { deltaSelection } : {}),
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
// RFC-1538 revalidation — the registry/worktree observed before the
|
|
1856
|
+
// lock wait can have moved while Phase A ran unlocked.
|
|
1857
|
+
const liveRegistry = await readRegistry(io, common);
|
|
1858
|
+
const liveEntry = liveRegistry.branches.find((b) => b.name === branch);
|
|
1859
|
+
if (liveEntry === undefined) {
|
|
1860
|
+
const liveBranch = await branchExists(primary, io, branch);
|
|
1861
|
+
const liveContained =
|
|
1862
|
+
liveBranch &&
|
|
1863
|
+
(await isAncestor(
|
|
1864
|
+
primary,
|
|
1865
|
+
io,
|
|
1866
|
+
(await git(primary, io, ["rev-parse", branch])).stdout.trim(),
|
|
1867
|
+
"develop",
|
|
1868
|
+
));
|
|
1869
|
+
if (liveContained || !liveBranch) {
|
|
1870
|
+
return out("pre-lock", {
|
|
1871
|
+
branch,
|
|
1872
|
+
integrated: true,
|
|
1873
|
+
developBefore: s.developBefore,
|
|
1874
|
+
developAfter: s.developBefore,
|
|
1875
|
+
rebased: false,
|
|
1876
|
+
gate: null,
|
|
1877
|
+
cleanedUp: true,
|
|
1878
|
+
disposition: "already-integrated",
|
|
1879
|
+
diagnostics: [],
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
return out(
|
|
1883
|
+
"pre-lock",
|
|
1884
|
+
refuse(
|
|
1885
|
+
"FLOW-INT-15",
|
|
1886
|
+
`registry entry for ${branch} vanished while waiting on the integration lock, but the branch is not contained in develop (mid-teardown state)`,
|
|
1887
|
+
"run flow.status for the live view; recover the orphaned entry with flow.discard",
|
|
1888
|
+
{ branch, developBefore: s.developBefore },
|
|
1889
|
+
),
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
if (!(await io.exists(s.branchWorktree))) {
|
|
1893
|
+
return out(
|
|
1894
|
+
"pre-lock",
|
|
1895
|
+
refuse(
|
|
1896
|
+
"FLOW-INT-15",
|
|
1897
|
+
`registry entry for ${branch} names worktree ${s.branchWorktree}, which does not exist (vanished mid-wait state — the branch is not contained in develop)`,
|
|
1898
|
+
"re-run with --reattach to recreate the worktree, or run flow.status for the live view and flow.discard to drop the entry",
|
|
1899
|
+
{ branch, developBefore: s.developBefore },
|
|
1900
|
+
{ vanished: true },
|
|
1901
|
+
),
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// The recorded verdict binds an exact branch tip and a clean worktree —
|
|
1906
|
+
// new commits or fresh dirt mean Phase A's gate no longer covers the
|
|
1907
|
+
// tree; the attempt is discarded (or, on the last attempt, the full
|
|
1908
|
+
// gate re-runs under the lock to cover the moved state honestly).
|
|
1909
|
+
const tipNow = (await git(primary, io, ["rev-parse", branch])).stdout.trim();
|
|
1910
|
+
const dirtyNow = await statusDirty(s.branchWorktree, io);
|
|
1911
|
+
const tipMoved = tipNow !== s.branchTip;
|
|
1912
|
+
const dirtArrived = dirtyNow.entries.length > 0;
|
|
1913
|
+
if ((tipMoved || dirtArrived) && attempt < MAX_PRELOCK_ATTEMPTS) {
|
|
1914
|
+
opts.onProgress?.(
|
|
1915
|
+
`pre-lock attempt ${attempt}: ${tipMoved ? "branch tip" : "worktree"} moved during the lock wait — discarding and restarting Phase A`,
|
|
1916
|
+
);
|
|
1917
|
+
return { kind: "restart" };
|
|
1918
|
+
}
|
|
1919
|
+
if (dirtArrived) {
|
|
1920
|
+
return out(
|
|
1921
|
+
"pre-lock",
|
|
1922
|
+
refuse(
|
|
1923
|
+
"FLOW-INT-01",
|
|
1924
|
+
`worktree ${s.branchWorktree} has ${dirtyNow.entries.length} uncommitted change(s) that arrived during the lock wait`,
|
|
1925
|
+
"commit or revert the uncommitted changes inside the session worktree, then re-run",
|
|
1926
|
+
{ branch, developBefore: s.developBefore },
|
|
1927
|
+
),
|
|
1928
|
+
);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
const b1 = (await git(primary, io, ["rev-parse", "develop"])).stdout.trim();
|
|
1932
|
+
let mode: IntegrateGateMode;
|
|
1933
|
+
let deltaSelection: DeltaGateSelection | undefined;
|
|
1934
|
+
if (b1 === s.rebaseBase && !tipMoved) {
|
|
1935
|
+
mode = "pre-lock";
|
|
1936
|
+
opts.onProgress?.(
|
|
1937
|
+
`pre-lock verdict still fresh (develop unmoved at ${b1.slice(0, 9)}) — no under-lock gate`,
|
|
1938
|
+
);
|
|
1939
|
+
} else {
|
|
1940
|
+
if (b1 !== s.rebaseBase) {
|
|
1941
|
+
// Develop moved between the Phase-A verdict and the lock — rebase
|
|
1942
|
+
// and regenerate onto B1 before the delta selection runs.
|
|
1943
|
+
const rebased = await measure(
|
|
1944
|
+
"rebase",
|
|
1945
|
+
() =>
|
|
1946
|
+
rebaseOnto(s.branchWorktree, b1, {
|
|
1947
|
+
branch,
|
|
1948
|
+
developBefore: s.developBefore,
|
|
1949
|
+
}),
|
|
1950
|
+
(result) => "diagnostics" in result,
|
|
1951
|
+
);
|
|
1952
|
+
if ("diagnostics" in rebased) return out("locked-delta", rebased);
|
|
1953
|
+
s.autoResolved.push(...rebased.autoResolved);
|
|
1954
|
+
if (rebased.autoResolveDeferred.length > 0) {
|
|
1955
|
+
(s.autoResolveDeferred ??= []).push(...rebased.autoResolveDeferred);
|
|
1956
|
+
}
|
|
1957
|
+
const regen = await measure(
|
|
1958
|
+
"regeneration",
|
|
1959
|
+
() =>
|
|
1960
|
+
regenManifests(s.branchWorktree, {
|
|
1961
|
+
branch,
|
|
1962
|
+
developBefore: s.developBefore,
|
|
1963
|
+
rebased: true,
|
|
1964
|
+
baseSha: b1,
|
|
1965
|
+
}),
|
|
1966
|
+
(result) => result !== null && "diagnostics" in result,
|
|
1967
|
+
);
|
|
1968
|
+
if (regen !== null && "diagnostics" in regen) return out("locked-delta", regen);
|
|
1969
|
+
if (
|
|
1970
|
+
s.manifestValidationDeferred &&
|
|
1971
|
+
(regen === null || !regen.ran.includes("ecosystem.manifest.generate"))
|
|
1972
|
+
) {
|
|
1973
|
+
return out(
|
|
1974
|
+
"locked-delta",
|
|
1975
|
+
refuse(
|
|
1976
|
+
"FLOW-INT-12",
|
|
1977
|
+
"the deferred ecosystem manifest owner was unavailable after rebase",
|
|
1978
|
+
"restore the manifest owner and re-run flow.integrate",
|
|
1979
|
+
{ branch, developBefore: s.developBefore, rebased: true },
|
|
1980
|
+
),
|
|
1981
|
+
);
|
|
1982
|
+
}
|
|
1983
|
+
if (regen !== null) s.postRebaseRegen = regen;
|
|
1984
|
+
}
|
|
1985
|
+
if (attempt >= MAX_PRELOCK_ATTEMPTS) {
|
|
1986
|
+
mode = "locked-full";
|
|
1987
|
+
} else {
|
|
1988
|
+
const deltaRead =
|
|
1989
|
+
b1 !== s.rebaseBase ? await deltaChangedPaths(io, primary, s.rebaseBase, b1) : [];
|
|
1990
|
+
if (deltaRead === null) {
|
|
1991
|
+
// The delta enumeration is unverifiable — a narrower locked
|
|
1992
|
+
// gate would run on fabricated dirt; run the full gate
|
|
1993
|
+
// (CX-174).
|
|
1994
|
+
mode = "locked-full";
|
|
1995
|
+
} else {
|
|
1996
|
+
deltaSelection =
|
|
1997
|
+
opts.deltaGateSelector !== undefined
|
|
1998
|
+
? await opts.deltaGateSelector(deltaRead)
|
|
1999
|
+
: selectDeltaGateSteps(deltaRead, await resolveDeltaStepDomains(io, primary));
|
|
2000
|
+
if (deltaSelection.selected.length * 2 > deltaSelection.total) {
|
|
2001
|
+
opts.onProgress?.(
|
|
2002
|
+
`pre-lock attempt ${attempt}: develop delta selects ${deltaSelection.selected.length}/${deltaSelection.total} gate steps — discarding and restarting Phase A against ${b1.slice(0, 9)}`,
|
|
2003
|
+
);
|
|
2004
|
+
return { kind: "restart" };
|
|
2005
|
+
}
|
|
2006
|
+
mode = "locked-delta";
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
// Under the lock the gate runs with FLOW_BASE_SHA = the recorded B0:
|
|
2010
|
+
// on the judged worktree the gate's own RFC-1582 selection runs over
|
|
2011
|
+
// ours ∪ delta — a superset of the delta selection + always rows,
|
|
2012
|
+
// never under-selected, always judged on the tree that will land.
|
|
2013
|
+
const gate = await measure(
|
|
2014
|
+
"repository-gate",
|
|
2015
|
+
() =>
|
|
2016
|
+
runFlowScript(io, "integration-gate", {
|
|
2017
|
+
primary,
|
|
2018
|
+
cwd: s.engine.root,
|
|
2019
|
+
env: {
|
|
2020
|
+
FLOW_PRIMARY: primary,
|
|
2021
|
+
FLOW_BRANCH: branch,
|
|
2022
|
+
FLOW_BASE_SHA: s.rebaseBase,
|
|
2023
|
+
FORGE_FLOW_TARGET: opts.target ?? "develop",
|
|
2024
|
+
FORGE_GATE_MODE: mode,
|
|
2025
|
+
...(mode === "locked-full" ? { FLOW_GATE_FULL: "1" } : {}),
|
|
2026
|
+
},
|
|
2027
|
+
}),
|
|
2028
|
+
(result) => result.status === "failed",
|
|
2029
|
+
);
|
|
2030
|
+
if (gate.status === "failed") {
|
|
2031
|
+
return out(
|
|
2032
|
+
mode,
|
|
2033
|
+
refuse(
|
|
2034
|
+
"FLOW-INT-05",
|
|
2035
|
+
`hooks/integration-gate.sh refused the ${mode} integration gate (exit ${gate.exitCode}): ${gate.stderrTail}`,
|
|
2036
|
+
`fix what ${primary}/hooks/integration-gate.sh demands, then re-run`,
|
|
2037
|
+
{ branch, developBefore: s.developBefore, rebased: true, gate },
|
|
2038
|
+
gate.reportPath ? { reportPath: gate.reportPath } : undefined,
|
|
2039
|
+
),
|
|
2040
|
+
);
|
|
2041
|
+
}
|
|
2042
|
+
s.gate = gate;
|
|
2043
|
+
const { runCorrectnessStep } = await import("../correctness-step.ts");
|
|
2044
|
+
const correctness = await measure(
|
|
2045
|
+
"correctness-gate",
|
|
2046
|
+
() =>
|
|
2047
|
+
runCorrectnessStep(io, {
|
|
2048
|
+
primary,
|
|
2049
|
+
worktree: s.branchWorktree,
|
|
2050
|
+
base: b1,
|
|
2051
|
+
...(opts.acceptWeakening ? { acceptWeakening: opts.acceptWeakening } : {}),
|
|
2052
|
+
}),
|
|
2053
|
+
(result) => Boolean(result.refusal),
|
|
2054
|
+
);
|
|
2055
|
+
if (correctness.refusal) {
|
|
2056
|
+
return out(
|
|
2057
|
+
mode,
|
|
2058
|
+
refuse(
|
|
2059
|
+
"FLOW-INT-18",
|
|
2060
|
+
correctness.refusal.message,
|
|
2061
|
+
correctness.refusal.fixHint,
|
|
2062
|
+
{ branch, developBefore: s.developBefore, rebased: true, gate },
|
|
2063
|
+
correctness.bundlePath ? { bundlePath: correctness.bundlePath } : undefined,
|
|
2064
|
+
),
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
if (correctness.warning) s.warnings.push(correctness.warning);
|
|
2068
|
+
opts.onProgress?.(
|
|
2069
|
+
`correctness gate (${mode}): ${correctness.status}${correctness.bundlePath ? ` (${correctness.bundlePath})` : ""}`,
|
|
2070
|
+
);
|
|
2071
|
+
s.correctness = {
|
|
2072
|
+
status: correctness.status,
|
|
2073
|
+
bundlePath: correctness.bundlePath,
|
|
2074
|
+
acceptedWeakening: correctness.acceptedWeakening,
|
|
2075
|
+
};
|
|
2076
|
+
s.branchTip = (await git(primary, io, ["rev-parse", branch])).stdout.trim();
|
|
2077
|
+
}
|
|
2078
|
+
const data = await measure(
|
|
2079
|
+
"finalization",
|
|
2080
|
+
() => integrateMergeTail(s),
|
|
2081
|
+
(result) => result.diagnostics.some((diagnostic) => diagnostic.severity === "error"),
|
|
2082
|
+
);
|
|
2083
|
+
return out(mode, data, deltaSelection);
|
|
2084
|
+
};
|
|
2085
|
+
|
|
2086
|
+
/** RFC-1589 Phase A→B attempts: the gate phase runs unlocked and records
|
|
2087
|
+
* a `pre-lock` verdict; the locked phase either lands it or discards the
|
|
2088
|
+
* attempt (bounded — the last attempt runs locked-full). */
|
|
2089
|
+
const integratePreLock = async (): Promise<FlowIntegrateData> => {
|
|
2090
|
+
for (let attempt = 1; attempt <= MAX_PRELOCK_ATTEMPTS; attempt++) {
|
|
2091
|
+
const phase = await integrateGatePhaseRidingFlux("pre-lock");
|
|
2092
|
+
if (!("state" in phase)) return phase;
|
|
2093
|
+
const s = phase.state;
|
|
2094
|
+
await recordPreLockVerdict(io, common, {
|
|
2095
|
+
branch,
|
|
2096
|
+
branchTip: s.branchTip,
|
|
2097
|
+
base: s.rebaseBase,
|
|
2098
|
+
steps: await gateReportSteps(io, primary, s.gate.reportPath),
|
|
2099
|
+
...(s.gate.reportPath ? { reportPath: s.gate.reportPath } : {}),
|
|
2100
|
+
});
|
|
2101
|
+
const locked = await withFlowLock(
|
|
2102
|
+
lockPath,
|
|
2103
|
+
lockOpts,
|
|
2104
|
+
() => integrateLockedPhase(s, attempt),
|
|
2105
|
+
io,
|
|
2106
|
+
);
|
|
2107
|
+
if (locked.kind === "restart") continue;
|
|
2108
|
+
return {
|
|
2109
|
+
...locked.data,
|
|
2110
|
+
gateMode: locked.mode,
|
|
2111
|
+
lockHeldMs: locked.lockHeldMs,
|
|
2112
|
+
preLockAttempts: attempt,
|
|
2113
|
+
...(locked.deltaSelection !== undefined ? { deltaSelection: locked.deltaSelection } : {}),
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
// Unreachable — the last attempt never returns "restart".
|
|
2117
|
+
throw new Error("pre-lock integrate exhausted attempts without a result");
|
|
2118
|
+
};
|
|
2119
|
+
|
|
2120
|
+
const lockOpts = {
|
|
2121
|
+
waitMs: opts.lockWaitMs ?? INTEGRATE_LOCK_WAIT_MS,
|
|
2122
|
+
staleMs: INTEGRATE_LOCK_STALE_MS,
|
|
2123
|
+
progressEveryMs: 60_000,
|
|
2124
|
+
onProgress: opts.onProgress,
|
|
2125
|
+
onStale: (l: { reason: string; pid?: number; host?: string; at: string; ageMs: number }) =>
|
|
2126
|
+
opts.onProgress?.(
|
|
2127
|
+
l.reason === "dead-holder"
|
|
2128
|
+
? `broke dead-holder integration lock (pid ${l.pid ?? "?"} on ${l.host ?? "?"}, held since ${l.at})`
|
|
2129
|
+
: `broke stale integration lock (held since ${l.at}, ${Math.round(l.ageMs / 60000)} min old)`,
|
|
2130
|
+
),
|
|
2131
|
+
};
|
|
2132
|
+
|
|
1355
2133
|
let inner: FlowIntegrateData;
|
|
1356
2134
|
try {
|
|
1357
|
-
|
|
1358
|
-
|
|
2135
|
+
const usePreLock = opts.preLock === true && entry.port === null && opts.lockHeld !== true;
|
|
2136
|
+
inner = usePreLock
|
|
2137
|
+
? await integratePreLock()
|
|
2138
|
+
: opts.lockHeld === true
|
|
1359
2139
|
? await integrateInner()
|
|
1360
|
-
: await withFlowLock(
|
|
1361
|
-
lockPath,
|
|
1362
|
-
{
|
|
1363
|
-
waitMs: opts.lockWaitMs ?? INTEGRATE_LOCK_WAIT_MS,
|
|
1364
|
-
staleMs: INTEGRATE_LOCK_STALE_MS,
|
|
1365
|
-
progressEveryMs: 60_000,
|
|
1366
|
-
onProgress: opts.onProgress,
|
|
1367
|
-
onStale: (l) =>
|
|
1368
|
-
opts.onProgress?.(
|
|
1369
|
-
l.reason === "dead-holder"
|
|
1370
|
-
? `broke dead-holder integration lock (pid ${l.pid ?? "?"} on ${l.host ?? "?"}, held since ${l.at})`
|
|
1371
|
-
: `broke stale integration lock (held since ${l.at}, ${Math.round(l.ageMs / 60000)} min old)`,
|
|
1372
|
-
),
|
|
1373
|
-
},
|
|
1374
|
-
integrateInner,
|
|
1375
|
-
io,
|
|
1376
|
-
);
|
|
2140
|
+
: await withFlowLock(lockPath, lockOpts, integrateInner, io);
|
|
1377
2141
|
} catch (error) {
|
|
1378
2142
|
if (error instanceof LockTimeoutError) {
|
|
1379
2143
|
// RFC-1515 AC-4: a refused attempt reports the holder on the first
|
|
@@ -1430,6 +2194,15 @@ async function integrateFlowBranchAttempt(
|
|
|
1430
2194
|
staleImporterCommitSha: inner.staleImporterCommitSha,
|
|
1431
2195
|
},
|
|
1432
2196
|
inner.gate?.reportPath ?? undefined,
|
|
2197
|
+
inner.gateMode !== undefined &&
|
|
2198
|
+
inner.lockHeldMs !== undefined &&
|
|
2199
|
+
inner.preLockAttempts !== undefined
|
|
2200
|
+
? {
|
|
2201
|
+
gateMode: inner.gateMode,
|
|
2202
|
+
lockHeldMs: inner.lockHeldMs,
|
|
2203
|
+
preLockAttempts: inner.preLockAttempts,
|
|
2204
|
+
}
|
|
2205
|
+
: undefined,
|
|
1433
2206
|
);
|
|
1434
2207
|
return {
|
|
1435
2208
|
...inner,
|
|
@@ -1476,6 +2249,11 @@ export async function runFlowIntegrate(
|
|
|
1476
2249
|
typeof input.flags["wait-foreign"] === "number"
|
|
1477
2250
|
? Number(input.flags["wait-foreign"])
|
|
1478
2251
|
: undefined,
|
|
2252
|
+
// RFC-1589: FORGE_INTEGRATE_PRELOCK=1 moves the gate outside the lock;
|
|
2253
|
+
// --gate-under-lock is the operator escape hatch back to the old
|
|
2254
|
+
// sequence while the comparison runs.
|
|
2255
|
+
preLock:
|
|
2256
|
+
input.flags["gate-under-lock"] === true ? false : process.env.FORGE_INTEGRATE_PRELOCK === "1",
|
|
1479
2257
|
});
|
|
1480
2258
|
|
|
1481
2259
|
const refused = data.diagnostics.find((d) => d.severity === "error");
|
|
@@ -1490,6 +2268,11 @@ export async function runFlowIntegrate(
|
|
|
1490
2268
|
` develop: ${data.developBefore?.slice(0, 9)} → ${data.developAfter?.slice(0, 9)}`,
|
|
1491
2269
|
);
|
|
1492
2270
|
logger.info(` cleanedUp: ${data.cleanedUp}`);
|
|
2271
|
+
if (data.gateMode !== undefined) {
|
|
2272
|
+
logger.info(
|
|
2273
|
+
` gate mode: ${data.gateMode}${data.lockHeldMs !== undefined ? ` (lock held ${Math.round(data.lockHeldMs / 1000)}s, attempt ${data.preLockAttempts ?? 1})` : ""}`,
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
1493
2276
|
if (data.toleratedDirt !== undefined && data.toleratedDirt.length > 0) {
|
|
1494
2277
|
logger.info(
|
|
1495
2278
|
` tolerated: ${data.toleratedDirt.map((t) => `${t.path} (${t.class})`).join(", ")}`,
|