@warpgogol/forge 9.5.0 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +30 -0
- package/README.uk.md +30 -0
- package/bin/cli.ts +19 -50
- package/dist/bin/cli.js +18 -43
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/codebase/codebase.module.d.ts +3 -0
- package/dist/os/codebase/codebase.module.d.ts.map +1 -0
- package/dist/os/codebase/codebase.module.js +53 -0
- package/dist/os/codebase/codebase.module.js.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts +15 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.js +97 -0
- package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure.d.ts +22 -0
- package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -0
- package/dist/os/codebase/handlers/codebase-measure.js +435 -0
- package/dist/os/codebase/handlers/codebase-measure.js.map +1 -0
- package/dist/os/codebase/index.d.ts +4 -0
- package/dist/os/codebase/index.d.ts.map +1 -0
- package/dist/os/codebase/index.js +13 -0
- package/dist/os/codebase/index.js.map +1 -0
- package/dist/os/codebase/types.d.ts +35 -0
- package/dist/os/codebase/types.d.ts.map +1 -0
- package/dist/os/codebase/types.js +17 -0
- package/dist/os/codebase/types.js.map +1 -0
- package/dist/os/core/handlers/package-health.d.ts +6 -4
- package/dist/os/core/handlers/package-health.d.ts.map +1 -1
- package/dist/os/core/handlers/package-health.js +15 -20
- package/dist/os/core/handlers/package-health.js.map +1 -1
- package/dist/os/correctness/anchors.d.ts +24 -0
- package/dist/os/correctness/anchors.d.ts.map +1 -0
- package/dist/os/correctness/anchors.js +156 -0
- package/dist/os/correctness/anchors.js.map +1 -0
- package/dist/os/correctness/audit/bindings-verify-substance.d.ts +7 -0
- package/dist/os/correctness/audit/bindings-verify-substance.d.ts.map +1 -0
- package/dist/os/correctness/audit/bindings-verify-substance.js +145 -0
- package/dist/os/correctness/audit/bindings-verify-substance.js.map +1 -0
- package/dist/os/correctness/audit/differential.d.ts +7 -0
- package/dist/os/correctness/audit/differential.d.ts.map +1 -0
- package/dist/os/correctness/audit/differential.js +105 -0
- package/dist/os/correctness/audit/differential.js.map +1 -0
- package/dist/os/correctness/audit/ledger-orphans.d.ts +6 -0
- package/dist/os/correctness/audit/ledger-orphans.d.ts.map +1 -0
- package/dist/os/correctness/audit/ledger-orphans.js +71 -0
- package/dist/os/correctness/audit/ledger-orphans.js.map +1 -0
- package/dist/os/correctness/audit/ledger.d.ts +29 -0
- package/dist/os/correctness/audit/ledger.d.ts.map +1 -0
- package/dist/os/correctness/audit/ledger.js +72 -0
- package/dist/os/correctness/audit/ledger.js.map +1 -0
- package/dist/os/correctness/audit/run.d.ts +27 -0
- package/dist/os/correctness/audit/run.d.ts.map +1 -0
- package/dist/os/correctness/audit/run.js +184 -0
- package/dist/os/correctness/audit/run.js.map +1 -0
- package/dist/os/correctness/audit/schema-db.d.ts +32 -0
- package/dist/os/correctness/audit/schema-db.d.ts.map +1 -0
- package/dist/os/correctness/audit/schema-db.js +166 -0
- package/dist/os/correctness/audit/schema-db.js.map +1 -0
- package/dist/os/correctness/audit/snapshot.d.ts +34 -0
- package/dist/os/correctness/audit/snapshot.d.ts.map +1 -0
- package/dist/os/correctness/audit/snapshot.js +190 -0
- package/dist/os/correctness/audit/snapshot.js.map +1 -0
- package/dist/os/correctness/audit/sql-scanner.d.ts +28 -0
- package/dist/os/correctness/audit/sql-scanner.d.ts.map +1 -0
- package/dist/os/correctness/audit/sql-scanner.js +279 -0
- package/dist/os/correctness/audit/sql-scanner.js.map +1 -0
- package/dist/os/correctness/audit/sql-schema-conform.d.ts +17 -0
- package/dist/os/correctness/audit/sql-schema-conform.d.ts.map +1 -0
- package/dist/os/correctness/audit/sql-schema-conform.js +163 -0
- package/dist/os/correctness/audit/sql-schema-conform.js.map +1 -0
- package/dist/os/correctness/audit/state-transitions-coverage.d.ts +19 -0
- package/dist/os/correctness/audit/state-transitions-coverage.d.ts.map +1 -0
- package/dist/os/correctness/audit/state-transitions-coverage.js +263 -0
- package/dist/os/correctness/audit/state-transitions-coverage.js.map +1 -0
- package/dist/os/correctness/audit/tests/git-fixture.d.ts +15 -0
- package/dist/os/correctness/audit/tests/git-fixture.d.ts.map +1 -0
- package/dist/os/correctness/audit/tests/git-fixture.js +85 -0
- package/dist/os/correctness/audit/tests/git-fixture.js.map +1 -0
- package/dist/os/correctness/audit/types.d.ts +58 -0
- package/dist/os/correctness/audit/types.d.ts.map +1 -0
- package/dist/os/correctness/audit/types.js +34 -0
- package/dist/os/correctness/audit/types.js.map +1 -0
- package/dist/os/correctness/correctness.module.d.ts +3 -0
- package/dist/os/correctness/correctness.module.d.ts.map +1 -0
- package/dist/os/correctness/correctness.module.js +173 -0
- package/dist/os/correctness/correctness.module.js.map +1 -0
- package/dist/os/correctness/gate/frozen.d.ts +52 -0
- package/dist/os/correctness/gate/frozen.d.ts.map +1 -0
- package/dist/os/correctness/gate/frozen.js +322 -0
- package/dist/os/correctness/gate/frozen.js.map +1 -0
- package/dist/os/correctness/gate/origin.d.ts +28 -0
- package/dist/os/correctness/gate/origin.d.ts.map +1 -0
- package/dist/os/correctness/gate/origin.js +139 -0
- package/dist/os/correctness/gate/origin.js.map +1 -0
- package/dist/os/correctness/gate/repo.d.ts +25 -0
- package/dist/os/correctness/gate/repo.d.ts.map +1 -0
- package/dist/os/correctness/gate/repo.js +88 -0
- package/dist/os/correctness/gate/repo.js.map +1 -0
- package/dist/os/correctness/gate/run.d.ts +22 -0
- package/dist/os/correctness/gate/run.d.ts.map +1 -0
- package/dist/os/correctness/gate/run.js +430 -0
- package/dist/os/correctness/gate/run.js.map +1 -0
- package/dist/os/correctness/gate/runner.d.ts +18 -0
- package/dist/os/correctness/gate/runner.d.ts.map +1 -0
- package/dist/os/correctness/gate/runner.js +123 -0
- package/dist/os/correctness/gate/runner.js.map +1 -0
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts +36 -0
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -0
- package/dist/os/correctness/gate/tests/gate-fixture.js +153 -0
- package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -0
- package/dist/os/correctness/gate/types.d.ts +102 -0
- package/dist/os/correctness/gate/types.d.ts.map +1 -0
- package/dist/os/correctness/gate/types.js +64 -0
- package/dist/os/correctness/gate/types.js.map +1 -0
- package/dist/os/correctness/handlers/audit.d.ts +4 -0
- package/dist/os/correctness/handlers/audit.d.ts.map +1 -0
- package/dist/os/correctness/handlers/audit.js +95 -0
- package/dist/os/correctness/handlers/audit.js.map +1 -0
- package/dist/os/correctness/handlers/gate.d.ts +4 -0
- package/dist/os/correctness/handlers/gate.d.ts.map +1 -0
- package/dist/os/correctness/handlers/gate.js +62 -0
- package/dist/os/correctness/handlers/gate.js.map +1 -0
- package/dist/os/correctness/handlers/validate.d.ts +19 -0
- package/dist/os/correctness/handlers/validate.d.ts.map +1 -0
- package/dist/os/correctness/handlers/validate.js +367 -0
- package/dist/os/correctness/handlers/validate.js.map +1 -0
- package/dist/os/correctness/index.d.ts +8 -0
- package/dist/os/correctness/index.d.ts.map +1 -0
- package/dist/os/correctness/index.js +23 -0
- package/dist/os/correctness/index.js.map +1 -0
- package/dist/os/correctness/manifest-schema.d.ts +155 -0
- package/dist/os/correctness/manifest-schema.d.ts.map +1 -0
- package/dist/os/correctness/manifest-schema.js +110 -0
- package/dist/os/correctness/manifest-schema.js.map +1 -0
- package/dist/os/correctness/references.d.ts +22 -0
- package/dist/os/correctness/references.d.ts.map +1 -0
- package/dist/os/correctness/references.js +129 -0
- package/dist/os/correctness/references.js.map +1 -0
- package/dist/os/correctness/tests/fixture-workspace.d.ts +23 -0
- package/dist/os/correctness/tests/fixture-workspace.d.ts.map +1 -0
- package/dist/os/correctness/tests/fixture-workspace.js +104 -0
- package/dist/os/correctness/tests/fixture-workspace.js.map +1 -0
- package/dist/os/correctness/workspace.d.ts +32 -0
- package/dist/os/correctness/workspace.d.ts.map +1 -0
- package/dist/os/correctness/workspace.js +147 -0
- package/dist/os/correctness/workspace.js.map +1 -0
- package/dist/os/flow/correctness-step.d.ts +19 -0
- package/dist/os/flow/correctness-step.d.ts.map +1 -0
- package/dist/os/flow/correctness-step.js +133 -0
- package/dist/os/flow/correctness-step.js.map +1 -0
- package/dist/os/flow/digest.d.ts +18 -0
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +28 -1
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +17 -3
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +11 -1
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +11 -0
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +90 -5
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/post-rebase-regen.d.ts +33 -0
- package/dist/os/flow/post-rebase-regen.d.ts.map +1 -0
- package/dist/os/flow/post-rebase-regen.js +120 -0
- package/dist/os/flow/post-rebase-regen.js.map +1 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +11 -15
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +23 -4
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +4 -4
- package/dist/os/flow/tests/helpers.d.ts +9 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +36 -2
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/friction/types.d.ts +2 -2
- package/dist/os/gate-run/status.d.ts +12 -0
- package/dist/os/gate-run/status.d.ts.map +1 -1
- package/dist/os/gate-run/status.js +24 -3
- package/dist/os/gate-run/status.js.map +1 -1
- package/dist/os/program/schemas.d.ts +3 -3
- package/dist/os/queue/types.d.ts +2 -2
- package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts +8 -0
- package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp-promotes.js +65 -0
- package/dist/os/rfc/handlers/implement-stamp-promotes.js.map +1 -0
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +15 -2
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +26 -5
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +18 -6
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +12 -3
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +5 -2
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verify-workspace.d.ts +12 -0
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
- package/dist/os/rfc/verify-workspace.js +155 -0
- package/dist/os/rfc/verify-workspace.js.map +1 -1
- package/dist/os/system/task-schemas.d.ts +1 -1
- package/dist/os/system/tests/helpers.d.ts.map +1 -1
- package/dist/os/system/tests/helpers.js +6 -1
- package/dist/os/system/tests/helpers.js.map +1 -1
- package/dist/os/werkstatt/handlers/schema.d.ts +1 -1
- package/dist/src/command-modules.d.ts +4 -0
- package/dist/src/command-modules.d.ts.map +1 -0
- package/dist/src/command-modules.js +42 -0
- package/dist/src/command-modules.js.map +1 -0
- package/dist/src/config/forge-config.d.ts +16 -1
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +27 -11
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/correctness/index.d.ts +32 -0
- package/dist/src/correctness/index.d.ts.map +1 -0
- package/dist/src/correctness/index.js +157 -0
- package/dist/src/correctness/index.js.map +1 -0
- package/dist/src/correctness/schema-hash.d.ts +15 -0
- package/dist/src/correctness/schema-hash.d.ts.map +1 -0
- package/dist/src/correctness/schema-hash.js +44 -0
- package/dist/src/correctness/schema-hash.js.map +1 -0
- package/dist/src/knowledge/schema.d.ts +1 -1
- package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
- package/dist/src/onboarding/agents-generate.js +20 -3
- package/dist/src/onboarding/agents-generate.js.map +1 -1
- package/dist/src/onboarding/create.d.ts +7 -0
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +62 -9
- package/dist/src/onboarding/create.js.map +1 -1
- package/docs/reference/correctness-audit.md +91 -0
- package/docs/reference/correctness-gate.md +102 -0
- package/docs/reference/correctness-manifest.md +142 -0
- package/docs/reference/forge-yaml.md +15 -0
- package/os/codebase/codebase.module.ts +57 -0
- package/os/codebase/handlers/codebase-measure-symbols.ts +131 -0
- package/os/codebase/handlers/codebase-measure.ts +503 -0
- package/os/codebase/index.ts +21 -0
- package/os/codebase/types.ts +55 -0
- package/os/core/handlers/package-health.test.ts +24 -2
- package/os/core/handlers/package-health.ts +16 -19
- package/os/correctness/anchors.ts +182 -0
- package/os/correctness/audit/bindings-verify-substance.test.ts +79 -0
- package/os/correctness/audit/bindings-verify-substance.ts +155 -0
- package/os/correctness/audit/differential.test.ts +113 -0
- package/os/correctness/audit/differential.ts +131 -0
- package/os/correctness/audit/ledger-orphans.test.ts +96 -0
- package/os/correctness/audit/ledger-orphans.ts +84 -0
- package/os/correctness/audit/ledger.test.ts +65 -0
- package/os/correctness/audit/ledger.ts +103 -0
- package/os/correctness/audit/run.ts +220 -0
- package/os/correctness/audit/schema-db.ts +208 -0
- package/os/correctness/audit/snapshot.ts +211 -0
- package/os/correctness/audit/sql-scanner.test.ts +84 -0
- package/os/correctness/audit/sql-scanner.ts +289 -0
- package/os/correctness/audit/sql-schema-conform.test.ts +170 -0
- package/os/correctness/audit/sql-schema-conform.ts +178 -0
- package/os/correctness/audit/state-transitions-coverage.test.ts +141 -0
- package/os/correctness/audit/state-transitions-coverage.ts +271 -0
- package/os/correctness/audit/tests/git-fixture.ts +98 -0
- package/os/correctness/audit/types.ts +91 -0
- package/os/correctness/correctness-capture.test.ts +107 -0
- package/os/correctness/correctness-chain.test.ts +232 -0
- package/os/correctness/correctness-coverage.test.ts +86 -0
- package/os/correctness/correctness-mode.test.ts +108 -0
- package/os/correctness/correctness-substrate.test.ts +64 -0
- package/os/correctness/correctness.module.ts +182 -0
- package/os/correctness/gate/anchor-events.test.ts +77 -0
- package/os/correctness/gate/freeze-coverage.test.ts +218 -0
- package/os/correctness/gate/freeze-diff.test.ts +110 -0
- package/os/correctness/gate/frozen.ts +399 -0
- package/os/correctness/gate/gate-mode.test.ts +76 -0
- package/os/correctness/gate/hardening.test.ts +175 -0
- package/os/correctness/gate/oracle-edit.test.ts +83 -0
- package/os/correctness/gate/oracle-origin.test.ts +142 -0
- package/os/correctness/gate/origin.ts +175 -0
- package/os/correctness/gate/repo.ts +102 -0
- package/os/correctness/gate/run.ts +547 -0
- package/os/correctness/gate/runner.ts +136 -0
- package/os/correctness/gate/substrate-attestation.test.ts +71 -0
- package/os/correctness/gate/tests/gate-fixture.ts +205 -0
- package/os/correctness/gate/tier-high.test.ts +92 -0
- package/os/correctness/gate/types.ts +144 -0
- package/os/correctness/handlers/audit.ts +107 -0
- package/os/correctness/handlers/gate.ts +75 -0
- package/os/correctness/handlers/validate.ts +514 -0
- package/os/correctness/index.ts +24 -0
- package/os/correctness/manifest-schema.ts +174 -0
- package/os/correctness/references.ts +143 -0
- package/os/correctness/tests/fixture-workspace.ts +119 -0
- package/os/correctness/workspace.ts +167 -0
- package/os/flow/correctness-step.ts +166 -0
- package/os/flow/digest.ts +40 -1
- package/os/flow/flow.module.ts +18 -3
- package/os/flow/handlers/flow-digest.ts +11 -1
- package/os/flow/handlers/flow-integrate.ts +117 -5
- package/os/flow/post-rebase-regen.ts +170 -0
- package/os/flow/preflight.ts +11 -19
- package/os/flow/publish.ts +23 -4
- package/os/flow/tests/flow-detachable.test.ts +31 -0
- package/os/flow/tests/flow-digest-correctness-trail.test.ts +55 -0
- package/os/flow/tests/flow-integrate-correctness-gate.test.ts +275 -0
- package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +234 -0
- package/os/flow/tests/flow-integrate.test.ts +10 -9
- package/os/flow/tests/helpers.ts +45 -24
- package/os/gate-run/status.ts +36 -3
- package/os/gate-run/tests/gate-run-status.test.ts +114 -0
- package/os/rfc/handlers/implement-stamp-promotes.test.ts +214 -0
- package/os/rfc/handlers/implement-stamp-promotes.ts +79 -0
- package/os/rfc/handlers/implement-stamp.ts +16 -2
- package/os/rfc/handlers/validate-rules.ts +43 -5
- package/os/rfc/rfc.module.ts +19 -6
- package/os/rfc/types.ts +16 -2
- package/os/rfc/verify-workspace-manifest.test.ts +55 -0
- package/os/rfc/verify-workspace.ts +167 -0
- package/os/system/tests/helpers.ts +6 -1
- package/package.json +41 -1
- package/profiles/typescript.yaml +16 -0
- package/skills/_shared/agent-operating-model.md +4 -0
- package/skills/fo/fo-idea-audit/SKILL.md +4 -0
- package/skills/fo/fo-idea-create-rfc/SKILL.md +6 -2
- package/skills/fo/fo-idea-implement/SKILL.md +8 -2
- package/skills/fo/fo-review/SKILL.md +16 -2
- package/src/command-modules.ts +62 -0
- package/src/config/forge-config.ts +37 -11
- package/src/correctness/index.ts +192 -0
- package/src/correctness/schema-hash.ts +59 -0
- package/src/onboarding/agents-generate.ts +20 -3
- package/src/onboarding/create.ts +59 -9
- package/src/tests/agents-generate-detach.test.ts +126 -0
- package/src/tests/codebase-measure-rfc-1581.test.ts +260 -0
- package/src/tests/command-modules.test.ts +34 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1574 — flow.integrate step (3b): after a successful rebase onto
|
|
4
|
+
develop, run every GENERATED_BASENAME_OWNERS owner command in the session
|
|
5
|
+
worktree and commit exactly the owned generated files that changed, with a
|
|
6
|
+
fixed subject, before the integration gate runs. Replaces RFC-1546's
|
|
7
|
+
pre-rebase in-place regeneration, which wrote the file but never committed
|
|
8
|
+
it (the rebase then refused FLOW-INT-02 on the dirty worktree, F-0168).</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>No conflict resolution — RFC-1538/1545 own generated rebase conflicts.</item>
|
|
11
|
+
<item>No port entries — flow.backmerge never rebases.</item>
|
|
12
|
+
<item>Never stages a non-owned path; any other dirt refuses.</item>
|
|
13
|
+
</non-goals>
|
|
14
|
+
</MODULE_CONTRACT>
|
|
15
|
+
*/
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
|
|
18
|
+
import type { ForgeInvokeCommand, WorkspaceIO } from "../../src/types.ts";
|
|
19
|
+
import { REGEN_FLAGS } from "../core/archive-regen.ts";
|
|
20
|
+
import { git, gitCommit } from "./git.ts";
|
|
21
|
+
import { GENERATED_BASENAME_OWNERS } from "./preflight.ts";
|
|
22
|
+
|
|
23
|
+
export const POST_REBASE_REGEN_SUBJECT = "chore(flow): regenerate derived manifests after rebase";
|
|
24
|
+
|
|
25
|
+
/** Generated manifests live under docs/ by convention (RFC-1538 owner map). */
|
|
26
|
+
const GENERATED_DIR = "docs";
|
|
27
|
+
|
|
28
|
+
export interface PostRebaseRegenResult {
|
|
29
|
+
/** owner commands invoked — GENERATED_BASENAME_OWNERS order with ecosystem.manifest.generate last (archive-regen ordering) */
|
|
30
|
+
ran: string[];
|
|
31
|
+
/** repo-relative generated paths that changed and were committed */
|
|
32
|
+
committed: string[];
|
|
33
|
+
/** sha of the regeneration commit; undefined when nothing changed */
|
|
34
|
+
sha?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PostRebaseRegenRefusal {
|
|
38
|
+
refused: true;
|
|
39
|
+
message: string;
|
|
40
|
+
fixHint: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Owner commands for the generated files present in the worktree. */
|
|
44
|
+
export async function postRebaseOwners(
|
|
45
|
+
branchWorktree: string,
|
|
46
|
+
io: WorkspaceIO,
|
|
47
|
+
): Promise<Array<{ path: string; command: string }>> {
|
|
48
|
+
const owners: Array<{ path: string; command: string }> = [];
|
|
49
|
+
for (const [basename, command] of Object.entries(GENERATED_BASENAME_OWNERS)) {
|
|
50
|
+
const path = `${GENERATED_DIR}/${basename}`;
|
|
51
|
+
if (await io.exists(join(branchWorktree, path))) owners.push({ path, command });
|
|
52
|
+
}
|
|
53
|
+
// archive-regen ordering contract: the ecosystem manifest hashes the other
|
|
54
|
+
// generated artifacts, so its generator always runs last.
|
|
55
|
+
return owners.sort(
|
|
56
|
+
(a, b) =>
|
|
57
|
+
Number(a.command === "ecosystem.manifest.generate") -
|
|
58
|
+
Number(b.command === "ecosystem.manifest.generate"),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Porcelain line → path→status map (rename targets resolved to the new path). */
|
|
63
|
+
async function porcelainSnapshot(
|
|
64
|
+
branchWorktree: string,
|
|
65
|
+
io: WorkspaceIO,
|
|
66
|
+
): Promise<Map<string, string>> {
|
|
67
|
+
const status = await git(branchWorktree, io, ["status", "--porcelain", "--untracked-files=all"]);
|
|
68
|
+
const map = new Map<string, string>();
|
|
69
|
+
for (const l of status.stdout.split("\n")) {
|
|
70
|
+
if (l.length <= 3) continue;
|
|
71
|
+
const p = l.slice(3);
|
|
72
|
+
const arrow = p.indexOf(" -> ");
|
|
73
|
+
map.set(arrow >= 0 ? p.slice(arrow + 4) : p, l.slice(0, 2));
|
|
74
|
+
}
|
|
75
|
+
return map;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function failed(r: { ok?: boolean; exitCode?: number }): boolean {
|
|
79
|
+
return r.ok === false || (r.exitCode !== undefined && r.exitCode !== 0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function regenerateAfterRebase(input: {
|
|
83
|
+
branchWorktree: string;
|
|
84
|
+
io: WorkspaceIO;
|
|
85
|
+
invoke: ForgeInvokeCommand;
|
|
86
|
+
owners: ReadonlyArray<{ path: string; command: string }>;
|
|
87
|
+
onProgress?: (line: string) => void;
|
|
88
|
+
/** Owner commands the invoker cannot run here — skipped with a progress line. */
|
|
89
|
+
notRunnable?: ReadonlySet<string>;
|
|
90
|
+
}): Promise<PostRebaseRegenResult | PostRebaseRegenRefusal> {
|
|
91
|
+
const { branchWorktree, io, invoke } = input;
|
|
92
|
+
const ran: string[] = [];
|
|
93
|
+
const owners = input.owners.filter((o) => {
|
|
94
|
+
if (!input.notRunnable?.has(o.command)) return true;
|
|
95
|
+
input.onProgress?.(`post-rebase regeneration: ${o.command} not runnable here — skipped`);
|
|
96
|
+
return false;
|
|
97
|
+
});
|
|
98
|
+
if (owners.length === 0) return { ran, committed: [] };
|
|
99
|
+
|
|
100
|
+
// Only paths the owner run changes are judged — pre-existing tolerated
|
|
101
|
+
// state (untracked forge files) is not the generators' doing.
|
|
102
|
+
const before = await porcelainSnapshot(branchWorktree, io);
|
|
103
|
+
for (const o of owners) {
|
|
104
|
+
const result = await invoke(o.command, REGEN_FLAGS[o.command] ?? {});
|
|
105
|
+
if (failed(result)) {
|
|
106
|
+
return {
|
|
107
|
+
refused: true,
|
|
108
|
+
message: `post-rebase regeneration: ${o.command} failed — ${result.summary ?? `exit ${result.exitCode}`}`,
|
|
109
|
+
fixHint: `run ${o.command} inside the session worktree, inspect and commit the diff, then re-run flow.integrate`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
ran.push(o.command);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const after = await porcelainSnapshot(branchWorktree, io);
|
|
116
|
+
const changed = [...after.entries()].filter(([p, st]) => before.get(p) !== st).map(([p]) => p);
|
|
117
|
+
const owned = new Set(owners.map((o) => o.path));
|
|
118
|
+
const foreign = changed.filter((p) => !owned.has(p));
|
|
119
|
+
if (foreign.length > 0) {
|
|
120
|
+
return {
|
|
121
|
+
refused: true,
|
|
122
|
+
message: `post-rebase regeneration dirtied non-owned path(s): ${foreign.join(", ")}`,
|
|
123
|
+
fixHint:
|
|
124
|
+
"an owner command wrote outside its generated file — inspect the worktree, commit or revert by hand, then re-run flow.integrate",
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const committed = changed.filter((p) => owned.has(p));
|
|
128
|
+
if (committed.length === 0) {
|
|
129
|
+
input.onProgress?.("post-rebase regeneration: no drift");
|
|
130
|
+
return { ran, committed };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// A generator bug must never be masked: validate the regenerated tree
|
|
134
|
+
// before anything is staged, so a red result leaves no commit behind.
|
|
135
|
+
if (ran.includes("ecosystem.manifest.generate")) {
|
|
136
|
+
const validate = await invoke("ecosystem.manifest.validate", {});
|
|
137
|
+
if (failed(validate)) {
|
|
138
|
+
return {
|
|
139
|
+
refused: true,
|
|
140
|
+
message: `post-rebase regeneration: ecosystem.manifest.validate still red — ${validate.summary ?? `exit ${validate.exitCode}`}`,
|
|
141
|
+
fixHint:
|
|
142
|
+
"the regenerated manifest is itself invalid — fix the generator input, regenerate, commit, re-run flow.integrate",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const add = await git(branchWorktree, io, ["add", "--", ...committed]);
|
|
148
|
+
const commit =
|
|
149
|
+
add.exitCode === 0
|
|
150
|
+
? await gitCommit(
|
|
151
|
+
branchWorktree,
|
|
152
|
+
io,
|
|
153
|
+
["commit", "-m", POST_REBASE_REGEN_SUBJECT],
|
|
154
|
+
"integrate",
|
|
155
|
+
)
|
|
156
|
+
: add;
|
|
157
|
+
if (commit.exitCode !== 0) {
|
|
158
|
+
return {
|
|
159
|
+
refused: true,
|
|
160
|
+
message: `post-rebase regeneration commit failed: ${commit.stderr.trim().split("\n").slice(-3).join(" | ")}`,
|
|
161
|
+
fixHint:
|
|
162
|
+
"commit the regenerated manifest(s) inside the session worktree, then re-run flow.integrate",
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const sha = (await git(branchWorktree, io, ["rev-parse", "HEAD"])).stdout.trim();
|
|
166
|
+
input.onProgress?.(
|
|
167
|
+
`post-rebase regeneration: committed ${committed.join(", ")} (${sha.slice(0, 9)})`,
|
|
168
|
+
);
|
|
169
|
+
return { ran, committed, sha };
|
|
170
|
+
}
|
package/os/flow/preflight.ts
CHANGED
|
@@ -14,12 +14,14 @@ closed by the RFC: adding a check requires an amendment.</purpose>
|
|
|
14
14
|
</non-goals>
|
|
15
15
|
</MODULE_CONTRACT>
|
|
16
16
|
<CHANGE_SUMMARY>
|
|
17
|
-
<item>RFC-1543: attribute shared-checkout dirt to live ops and expose peers (RFC-1543)</item>
|
|
18
17
|
<item>RFC-1544: attribute mission lockfile churn to owning checkout and auto-resolve foreign importer diffs (RFC-1544)</item>
|
|
19
18
|
<item>ADR-0130: induced-change lockfile classifiers — BFS reachability for optional-flag removals, collapse pairs, induced packages/snapshots additions</item>
|
|
20
19
|
<item>ADR-0129: F-0186/F-0187 — FLOW-INT-03 names paths + three-way remedy, FLOW-OPEN-01 same hint, forge CLI kernel-command hint</item>
|
|
21
20
|
<item>RFC-0000: skip rfc-0000 template in integrate preflight id extraction; regen ecosystem manifest; file F-0207</item>
|
|
22
|
-
<
|
|
21
|
+
<item>RFC-1574: regenerate derived manifests after the integrate rebase and commit them
|
|
22
|
+
|
|
23
|
+
flow.integrate step (3b) runs GENERATED_BASENAME_OWNERS owners on the rebased tree (opts.invoke ?? standaloneInvoke), commits only owned paths with the fixed subject before the gate, refuses FLOW-INT-12 on owner failure, non-owned dirt or a still-red validate; the preflight no longer writes and refuses only without a resolvable owner.</item>
|
|
24
|
+
<history>RFC-1528, RFC-1531, RFC-1537, RFC-1538, RFC-1543, RFC-1545, RFC-1546</history>
|
|
23
25
|
</CHANGE_SUMMARY>
|
|
24
26
|
*/
|
|
25
27
|
|
|
@@ -1198,25 +1200,15 @@ export async function runIntegratePreflight(
|
|
|
1198
1200
|
});
|
|
1199
1201
|
}
|
|
1200
1202
|
|
|
1201
|
-
// RFC-1546: every other check passed — the manifest
|
|
1202
|
-
//
|
|
1203
|
-
//
|
|
1204
|
-
//
|
|
1203
|
+
// RFC-1574 (amends RFC-1546): every other check passed — the manifest
|
|
1204
|
+
// drift is the sole violation. The preflight writes nothing: a resolvable
|
|
1205
|
+
// owner defers the regeneration to flow.integrate step (3b), which runs on
|
|
1206
|
+
// the rebased tree and commits the result. Without an owner the drift
|
|
1207
|
+
// still refuses here.
|
|
1205
1208
|
if (manifestDrift !== undefined) {
|
|
1206
1209
|
if (resolvable("ecosystem.manifest.generate")) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
REGEN_FLAGS["ecosystem.manifest.generate"] ?? {},
|
|
1210
|
-
);
|
|
1211
|
-
if (regen.ok !== false && (regen.exitCode === undefined || regen.exitCode === 0)) {
|
|
1212
|
-
checked.push("ecosystem.manifest.generate", "ecosystem.manifest.validate");
|
|
1213
|
-
const result = await opts.invoke!("ecosystem.manifest.validate", {});
|
|
1214
|
-
if (result.ok !== false && (result.exitCode === undefined || result.exitCode === 0)) {
|
|
1215
|
-
manifestDrift = undefined;
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
if (manifestDrift !== undefined) {
|
|
1210
|
+
opts.onProgress?.("preflight: ecosystem manifest drift — regenerating after the rebase");
|
|
1211
|
+
} else {
|
|
1220
1212
|
return {
|
|
1221
1213
|
ok: false,
|
|
1222
1214
|
checked,
|
package/os/flow/publish.ts
CHANGED
|
@@ -19,12 +19,16 @@ and return the RFC publications[] row for the journal.</purpose>
|
|
|
19
19
|
<item>RFC-1517 r1: the fixture scan enumerates `../` candidates AT `ref` via one `git grep -nI --full-name` — the extract materializes the ref's tree, so an untracked dist/ or a post-tag fix can't false-refuse or evade the way a working-tree walk did. Each candidate path is then judged by the same isShippedEntry/literalEscapesInLine core PKG-HEALTH-10 uses.</item>
|
|
20
20
|
</KEY_DECISIONS>
|
|
21
21
|
<CHANGE_SUMMARY>
|
|
22
|
-
<item>RFC-1499: step 2 — retire publish-forge/bump-forge scripts, add extract-verify hook</item>
|
|
23
|
-
<item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
|
|
24
22
|
<item>RFC-1502: step 7 — remediation entries, docs, deviations, generated indexes</item>
|
|
25
23
|
<item>RFC-1502: review r1 — fix-cut rollback on FLOW-CUT-12/13, populated steps[], hook validation, GIT_* env scrub</item>
|
|
26
24
|
<item>RFC-1517: add preflight-extract-gates — FLOW-PUB-01 changelog check at ref plus shared PKG-HEALTH-10 fixture-path scan for RFC-1517</item>
|
|
27
|
-
<
|
|
25
|
+
<item>ADR-0131: pkg-health-10 suppression on the line above the literal
|
|
26
|
+
|
|
27
|
+
literalEscapesInLine accepts a // pkg-health-10: comment directly above the literal (one-line reach); the publish at-ref scan fetches that line via git show only for candidate lines; bin/cli.ts drops its prettier-ignore lines.</item>
|
|
28
|
+
<item>RFC-1574: close review REVIEW-CODE-2026-11-12-05 findings
|
|
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
|
+
<history>RFC-1491, RFC-1499, RFC-1502</history>
|
|
28
32
|
</CHANGE_SUMMARY>
|
|
29
33
|
*/
|
|
30
34
|
|
|
@@ -200,6 +204,7 @@ async function preflightExtractGates(
|
|
|
200
204
|
projectDirRel,
|
|
201
205
|
]);
|
|
202
206
|
const escapes: FixtureEscape[] = [];
|
|
207
|
+
const atRefLines = new Map<string, string[]>();
|
|
203
208
|
if (grep.exitCode === 0) {
|
|
204
209
|
for (const row of grep.stdout.split("\n")) {
|
|
205
210
|
if (!row.startsWith(`${ref}:`)) continue;
|
|
@@ -216,13 +221,27 @@ async function preflightExtractGates(
|
|
|
216
221
|
) {
|
|
217
222
|
continue;
|
|
218
223
|
}
|
|
224
|
+
const fileDir = dirname(join(projectRoot, rel));
|
|
225
|
+
// Cheap pre-filter: most grep hits are suppressed or in-root on their own
|
|
226
|
+
// line — only real candidates pay for the at-ref previous-line fetch.
|
|
227
|
+
const sameLine = literalEscapesInLine(rel, text!, Number(lineNo), fileDir, projectRoot);
|
|
228
|
+
if (sameLine.length === 0) continue;
|
|
229
|
+
// ADR-0131: the suppression may sit on the line above — fetched from
|
|
230
|
+
// the ref only for candidate lines (rare), cached per file.
|
|
231
|
+
let lines = atRefLines.get(relPath!);
|
|
232
|
+
if (lines === undefined) {
|
|
233
|
+
const shown = await git(primary, io, ["show", `${ref}:${relPath}`]);
|
|
234
|
+
lines = shown.exitCode === 0 ? shown.stdout.split("\n") : [];
|
|
235
|
+
atRefLines.set(relPath!, lines);
|
|
236
|
+
}
|
|
219
237
|
escapes.push(
|
|
220
238
|
...literalEscapesInLine(
|
|
221
239
|
rel,
|
|
222
240
|
text!,
|
|
223
241
|
Number(lineNo),
|
|
224
|
-
|
|
242
|
+
fileDir,
|
|
225
243
|
projectRoot,
|
|
244
|
+
lines[Number(lineNo) - 2],
|
|
226
245
|
),
|
|
227
246
|
);
|
|
228
247
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1573 AC-1 — the forge flow commands that run the integration gate declare `detachable: true`, and the short flow commands stay attached-only.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>No --detach mechanics — RFC-1568's gate-run tests own spawning and records.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
*/
|
|
9
|
+
// Test-Reason: requirement AC-1 (RFC-1573)
|
|
10
|
+
import { describe, expect, it } from "vitest";
|
|
11
|
+
|
|
12
|
+
import { createForgeFlowModule } from "../flow.module.ts";
|
|
13
|
+
|
|
14
|
+
describe("RFC-1573: flow detachable declarations", () => {
|
|
15
|
+
it("declares detachable on each long-gate flow command", async () => {
|
|
16
|
+
const mod = await createForgeFlowModule();
|
|
17
|
+
for (const name of ["flow.cut", "flow.backmerge", "flow.integrate"]) {
|
|
18
|
+
const cmd = mod.commands.find((c) => c.name === name);
|
|
19
|
+
expect(cmd?.detachable, `${name} reaches integrateFlowBranch and must declare detachable: true`).toBe(true);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("keeps short flow commands attached-only", async () => {
|
|
24
|
+
const mod = await createForgeFlowModule();
|
|
25
|
+
for (const name of ["flow.open", "flow.fix", "flow.status", "flow.digest"]) {
|
|
26
|
+
const cmd = mod.commands.find((c) => c.name === name);
|
|
27
|
+
expect(cmd, `${name} must stay registered`).toBeDefined();
|
|
28
|
+
expect(cmd?.detachable, `${name} returns quickly and must not be detachable (RFC-1573 non-goal)`).toBeUndefined();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580: flow.digest lists every X-Correctness-Weakening trailer
|
|
4
|
+
and every verifier-trailer commit in the unpushed develop range, so the
|
|
5
|
+
operator sees both at the flow.push hard stop.</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a digest attribution test — flow-digest.test.ts owns items.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1580: initial suite.</item>
|
|
12
|
+
<item>RFC-1580: digest trail, manifest review export, operating model and skills
|
|
13
|
+
|
|
14
|
+
flow.digest lists X-Correctness-Weakening trailers and verifier-trailer commits (correctnessTrail, part of digestId); rfc.verify.workspace --manifest exports the oracle-review surface with MANIFEST-REVIEW-BUNDLE.md hashes; operating model §7 product tiers and §8 'a self oracle never covers an anchor of a product correctness manifest'; fo-review oracle review mode producing forge/oracle-review@1; fo-idea-implement step 4.4c; correctness-gate reference page; forge AGENTS.md gate rules.</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { rm } from "node:fs/promises";
|
|
19
|
+
|
|
20
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
21
|
+
|
|
22
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
23
|
+
import { collectDigest } from "../digest.ts";
|
|
24
|
+
import { gitExec, initRepoWithOrigin } from "./helpers.ts";
|
|
25
|
+
|
|
26
|
+
const dirs: string[] = [];
|
|
27
|
+
afterEach(async () => {
|
|
28
|
+
for (const d of dirs.splice(0)) await rm(d, { recursive: true, force: true });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe("flow.digest correctness trail", () => {
|
|
32
|
+
it("lists accepted weakenings and verifier-trailer commits in the unpushed range", async () => {
|
|
33
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "digest-trail-" });
|
|
34
|
+
await gitExec(repo, [
|
|
35
|
+
"commit",
|
|
36
|
+
"--allow-empty",
|
|
37
|
+
"-m",
|
|
38
|
+
"flow: accept correctness weakening\n\nX-Correctness-Weakening: entry retired with REQ-04",
|
|
39
|
+
]);
|
|
40
|
+
await gitExec(repo, [
|
|
41
|
+
"commit",
|
|
42
|
+
"--allow-empty",
|
|
43
|
+
"-m",
|
|
44
|
+
"test: verifier oracle\n\nX-Expectation-Origin: independent-verifier\nX-Verifier-Report: docs/correctness/reviews/r.yaml",
|
|
45
|
+
]);
|
|
46
|
+
await gitExec(repo, ["commit", "--allow-empty", "-m", "chore: plain"]);
|
|
47
|
+
const data = await collectDigest(repo, ambientIo, { fetch: false });
|
|
48
|
+
expect(data.correctnessTrail.weakenings.map((w) => w.reason)).toEqual([
|
|
49
|
+
"entry retired with REQ-04",
|
|
50
|
+
]);
|
|
51
|
+
expect(data.correctnessTrail.verifierCommits.map((v) => v.report)).toEqual([
|
|
52
|
+
"docs/correctness/reviews/r.yaml",
|
|
53
|
+
]);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580 AC-2: flow.integrate spawns the PRIMARY install's
|
|
4
|
+
correctness.gate after the integration gate — in enforce mode, an entry
|
|
5
|
+
whose only oracle exits non-zero refuses the integration with FLOW-INT-18;
|
|
6
|
+
a primary install that predates the command degrades to a FLOW-INT-18
|
|
7
|
+
warning; a missing primary binary refuses.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>Not a gate-logic test — os/correctness/gate owns the rules.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1580: initial suite.</item>
|
|
14
|
+
<item>RFC-1580: correctness.gate and the flow.integrate step
|
|
15
|
+
|
|
16
|
+
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>
|
|
17
|
+
<item>RFC-1580: close review REVIEW-CODE-2026-11-13-04 findings
|
|
18
|
+
|
|
19
|
+
F1 bootstrap degrade only on an exact unknown-command stderr line with no JSON; F2 review records count only from a verifier-trailer commit naming them; F3 any frozen substrate change or dropped capture is a weakening, declared L3 needs loaded captures; F4 requirement origin needs acceptance before --base; F5 anchor events only for L2+ runs; F6 proof oracles via proof.check only, non-self; F7 bundle naming; F8/F9 limitations; F10 every anchor copy; F11 base entry refs; F12 unreadable base manifest refuses; F13 dirty worktree warning; F14 source/statement diffs; F15 process-group kill; F16 run root cleanup; F20 review dir stripped, blob hashes. Regression tests for spoofing, plain-commit review, L3, requirement origin, rewording, timeout, formal tier, rebind, real-gate pass, accept-weakening. DEV-1..DEV-6 recorded in the RFC.</item>
|
|
20
|
+
<item>RFC-1580: close review REVIEW-CODE-2026-11-13-05 findings
|
|
21
|
+
|
|
22
|
+
N1 bootstrap degrade only while the base has not adopted the contour (a forge downgrade refuses); N2 L3 on data/lifecycle counts at its attested level; N3 anchor events bound to the attested handle; N4 new support-glob files are frozen additions; N5/N6 isolated sessions may touch anchor files and only frozen forge.yaml keys; N7 RFC body amended; N8 regression tests; N9 run root in finally and grandchildren reaped; N10 every declared capture loaded. DEV-7 recorded; DEV-5 narrowed pending operator confirmation.</item>
|
|
23
|
+
</CHANGE_SUMMARY>
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { chmod, mkdir, rm, writeFile } from "node:fs/promises";
|
|
27
|
+
import { dirname, join, resolve } from "node:path";
|
|
28
|
+
import { fileURLToPath } from "node:url";
|
|
29
|
+
|
|
30
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
31
|
+
|
|
32
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
33
|
+
import {
|
|
34
|
+
MIGRATION,
|
|
35
|
+
ORACLE_PATH,
|
|
36
|
+
manifestYaml,
|
|
37
|
+
reviewYaml,
|
|
38
|
+
} from "../../correctness/gate/tests/gate-fixture.ts";
|
|
39
|
+
import { integrateFlowBranch } from "../handlers/flow-integrate.ts";
|
|
40
|
+
import { openFlowBranch } from "../handlers/flow-open.ts";
|
|
41
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
42
|
+
|
|
43
|
+
const NOW = new Date("2026-11-13T12:00:00Z");
|
|
44
|
+
const FORGE_CLI = resolve(dirname(fileURLToPath(import.meta.url)), "../../../bin/cli.ts");
|
|
45
|
+
const MARK = "@ai-" + "invariant";
|
|
46
|
+
|
|
47
|
+
const dirs: string[] = [];
|
|
48
|
+
afterEach(async () => {
|
|
49
|
+
for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
|
|
50
|
+
}, 20_000);
|
|
51
|
+
|
|
52
|
+
async function write(root: string, rel: string, body: string): Promise<void> {
|
|
53
|
+
await mkdir(dirname(join(root, rel)), { recursive: true });
|
|
54
|
+
await writeFile(join(root, rel), body);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A primary on develop carrying an enforce-mode manifest whose only oracle fails. */
|
|
58
|
+
async function productRepo(oracle: string): Promise<string> {
|
|
59
|
+
const repo = await initRepo({ prefix: "flow-corrgate-" });
|
|
60
|
+
dirs.push(repo);
|
|
61
|
+
await write(
|
|
62
|
+
repo,
|
|
63
|
+
"forge.yaml",
|
|
64
|
+
`schema: forge/config@1\nproject:\n name: corrgate\npaths: {}\nbindings:\n schema: forge/bindings@1\n commands:\n checkRun: "node {file}"\n paths:\n compassDocs: [docs/requirements.xml]\n correctnessManifest: docs/correctness.yaml\ncorrectness:\n mode: enforce\n`,
|
|
65
|
+
);
|
|
66
|
+
await write(
|
|
67
|
+
repo,
|
|
68
|
+
"docs/requirements.xml",
|
|
69
|
+
'<requirements>\n <meta><document-id>requirements</document-id></meta>\n <requirement id="REQ-01">x</requirement>\n</requirements>\n',
|
|
70
|
+
);
|
|
71
|
+
await write(
|
|
72
|
+
repo,
|
|
73
|
+
"apps/api/wrangler.jsonc",
|
|
74
|
+
'{ "d1_databases": [{ "binding": "DB", "database_name": "main", "database_id": "x" }] }\n',
|
|
75
|
+
);
|
|
76
|
+
await write(repo, "apps/api/migrations/0001_init.sql", MIGRATION);
|
|
77
|
+
await write(
|
|
78
|
+
repo,
|
|
79
|
+
"apps/api/src/dispatch.ts",
|
|
80
|
+
`export function dispatch(): void {\n // ${MARK}[INV-dispatch-01]: dispatch moves an approved candidate to queued exactly once\n // (checked-by: test:${ORACLE_PATH})\n}\n`,
|
|
81
|
+
);
|
|
82
|
+
await write(repo, ORACLE_PATH, oracle);
|
|
83
|
+
await write(repo, "docs/correctness.yaml", manifestYaml({}));
|
|
84
|
+
await gitExec(repo, ["add", "-A"]);
|
|
85
|
+
await gitExec(repo, ["commit", "-m", "product with manifest"]);
|
|
86
|
+
const review = "docs/correctness/reviews/2026-11-13-base.yaml";
|
|
87
|
+
await write(repo, review, reviewYaml([{ check: `test:${ORACLE_PATH}`, content: oracle }]));
|
|
88
|
+
await gitExec(repo, ["add", "-A"]);
|
|
89
|
+
await gitExec(repo, [
|
|
90
|
+
"commit",
|
|
91
|
+
"-m",
|
|
92
|
+
`review: oracle review\n\nX-Expectation-Origin: independent-verifier\nX-Verifier-Report: ${review}`,
|
|
93
|
+
]);
|
|
94
|
+
await gitExec(repo, ["branch", "develop", "HEAD"]);
|
|
95
|
+
await gitExec(repo, ["switch", "develop"]);
|
|
96
|
+
return repo;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Point the primary's forge binary at the real forge CLI of this checkout. */
|
|
100
|
+
async function realPrimaryForge(repo: string): Promise<void> {
|
|
101
|
+
const bin = join(repo, "node_modules", ".bin", "forge");
|
|
102
|
+
await writeFile(bin, `#!/bin/sh\nexec node ${JSON.stringify(FORGE_CLI)} "$@"\n`);
|
|
103
|
+
await chmod(bin, 0o755);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function sessionWithCommit(repo: string): Promise<{ branch: string; worktree: string }> {
|
|
107
|
+
const data = await openFlowBranch(repo, ambientIo, {
|
|
108
|
+
kind: "session",
|
|
109
|
+
slug: "corr",
|
|
110
|
+
brief: null,
|
|
111
|
+
owner: null,
|
|
112
|
+
dryRun: false,
|
|
113
|
+
now: NOW,
|
|
114
|
+
});
|
|
115
|
+
expect(data.diagnostics).toEqual([]);
|
|
116
|
+
dirs.push(data.worktree!);
|
|
117
|
+
await writeFile(join(data.worktree!, "notes.txt"), "unrelated\n");
|
|
118
|
+
await gitExec(data.worktree!, ["add", "notes.txt"]);
|
|
119
|
+
await gitExec(data.worktree!, ["commit", "-m", "add notes"]);
|
|
120
|
+
return { branch: data.branch!, worktree: data.worktree! };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
describe("flow.integrate — correctness gate (RFC-1580)", () => {
|
|
124
|
+
it("AC-2: an enforce-mode entry whose only oracle exits non-zero refuses with FLOW-INT-18", async () => {
|
|
125
|
+
const repo = await productRepo("process.exit(3);\n");
|
|
126
|
+
await realPrimaryForge(repo);
|
|
127
|
+
const session = await sessionWithCommit(repo);
|
|
128
|
+
const data = await integrateFlowBranch(repo, ambientIo, {
|
|
129
|
+
branch: session.branch,
|
|
130
|
+
dryRun: false,
|
|
131
|
+
now: NOW,
|
|
132
|
+
});
|
|
133
|
+
expect(data.integrated).toBe(false);
|
|
134
|
+
const refusal = data.diagnostics.find((d) => d.ruleId === "FLOW-INT-18");
|
|
135
|
+
expect(refusal?.severity).toBe("error");
|
|
136
|
+
expect(refusal?.message, "the failing oracle must be named").toMatch(/CORR-GATE-07/);
|
|
137
|
+
}, 120_000);
|
|
138
|
+
|
|
139
|
+
it("a primary forge without correctness.gate degrades to a FLOW-INT-18 warning only before adoption", async () => {
|
|
140
|
+
const plain = await initRepo({ prefix: "flow-corrgate-boot-" });
|
|
141
|
+
dirs.push(plain);
|
|
142
|
+
await writeFile(join(plain, "forge.yaml"), 'schema: "forge/workspace@1"\n');
|
|
143
|
+
await gitExec(plain, ["add", "forge.yaml"]);
|
|
144
|
+
await gitExec(plain, ["commit", "-m", "governed"]);
|
|
145
|
+
await gitExec(plain, ["branch", "develop", "HEAD"]);
|
|
146
|
+
await gitExec(plain, ["switch", "develop"]);
|
|
147
|
+
const unknown = "#!/bin/sh\necho ' ✖ Unknown command: correctness.gate' >&2\nexit 1\n";
|
|
148
|
+
await writeFile(join(plain, "node_modules", ".bin", "forge"), unknown);
|
|
149
|
+
const s1 = await sessionWithCommit(plain);
|
|
150
|
+
const boot = await integrateFlowBranch(plain, ambientIo, {
|
|
151
|
+
branch: s1.branch,
|
|
152
|
+
dryRun: false,
|
|
153
|
+
now: NOW,
|
|
154
|
+
});
|
|
155
|
+
expect(boot.integrated).toBe(true);
|
|
156
|
+
expect(boot.diagnostics.find((d) => d.ruleId === "FLOW-INT-18")?.severity).toBe("warning");
|
|
157
|
+
|
|
158
|
+
const adopted = await productRepo("process.exit(0);\n");
|
|
159
|
+
await writeFile(join(adopted, "node_modules", ".bin", "forge"), unknown);
|
|
160
|
+
const s2 = await sessionWithCommit(adopted);
|
|
161
|
+
const downgrade = await integrateFlowBranch(adopted, ambientIo, {
|
|
162
|
+
branch: s2.branch,
|
|
163
|
+
dryRun: false,
|
|
164
|
+
now: NOW,
|
|
165
|
+
});
|
|
166
|
+
expect(downgrade.integrated, "a forge downgrade must not drop an adopted gate").toBe(false);
|
|
167
|
+
expect(downgrade.diagnostics.find((d) => d.ruleId === "FLOW-INT-18")?.message).toMatch(
|
|
168
|
+
/already adopted/,
|
|
169
|
+
);
|
|
170
|
+
}, 90_000);
|
|
171
|
+
|
|
172
|
+
it("a missing primary forge binary refuses", async () => {
|
|
173
|
+
const repo = await productRepo("process.exit(0);\n");
|
|
174
|
+
await rm(join(repo, "node_modules"), { recursive: true, force: true });
|
|
175
|
+
const session = await sessionWithCommit(repo);
|
|
176
|
+
const data = await integrateFlowBranch(repo, ambientIo, {
|
|
177
|
+
branch: session.branch,
|
|
178
|
+
dryRun: false,
|
|
179
|
+
now: NOW,
|
|
180
|
+
});
|
|
181
|
+
expect(data.integrated).toBe(false);
|
|
182
|
+
expect(data.diagnostics.find((d) => d.ruleId === "FLOW-INT-18")?.message).toMatch(
|
|
183
|
+
/binary is missing/,
|
|
184
|
+
);
|
|
185
|
+
}, 60_000);
|
|
186
|
+
|
|
187
|
+
it("a reviewed, attested oracle lets the integration through the real gate", async () => {
|
|
188
|
+
const { L1_ORACLE } = await import("../../correctness/gate/tests/gate-fixture.ts");
|
|
189
|
+
const repo = await productRepo(L1_ORACLE);
|
|
190
|
+
await realPrimaryForge(repo);
|
|
191
|
+
const session = await sessionWithCommit(repo);
|
|
192
|
+
const data = await integrateFlowBranch(repo, ambientIo, {
|
|
193
|
+
branch: session.branch,
|
|
194
|
+
dryRun: false,
|
|
195
|
+
now: NOW,
|
|
196
|
+
});
|
|
197
|
+
expect(data.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
|
|
198
|
+
expect(data.integrated).toBe(true);
|
|
199
|
+
expect(data.correctnessGate?.status).toBe("pass");
|
|
200
|
+
}, 120_000);
|
|
201
|
+
|
|
202
|
+
it("--accept-weakening lands an isolated weakening with an X-Correctness-Weakening trailer", async () => {
|
|
203
|
+
const repo = await productRepo("process.exit(0);\n");
|
|
204
|
+
await realPrimaryForge(repo);
|
|
205
|
+
const data0 = await openFlowBranch(repo, ambientIo, {
|
|
206
|
+
kind: "session",
|
|
207
|
+
slug: "weak",
|
|
208
|
+
brief: null,
|
|
209
|
+
owner: null,
|
|
210
|
+
dryRun: false,
|
|
211
|
+
now: NOW,
|
|
212
|
+
});
|
|
213
|
+
dirs.push(data0.worktree!);
|
|
214
|
+
const wt = data0.worktree!;
|
|
215
|
+
await writeFile(
|
|
216
|
+
join(wt, "docs/correctness.yaml"),
|
|
217
|
+
'schema: forge/correctness-manifest@1\nentries: []\nsupport: []\nexemptions:\n - ref: REQ-01\n kind: deferred\n task: "verbund:T-0001"\n',
|
|
218
|
+
);
|
|
219
|
+
await gitExec(wt, ["add", "-A"]);
|
|
220
|
+
await gitExec(wt, ["commit", "-m", "retire the entry"]);
|
|
221
|
+
const refused = await integrateFlowBranch(repo, ambientIo, {
|
|
222
|
+
branch: data0.branch!,
|
|
223
|
+
dryRun: false,
|
|
224
|
+
now: NOW,
|
|
225
|
+
});
|
|
226
|
+
expect(refused.diagnostics.find((d) => d.ruleId === "FLOW-INT-18")?.message).toMatch(
|
|
227
|
+
/CORR-GATE-02/,
|
|
228
|
+
);
|
|
229
|
+
const accepted = await integrateFlowBranch(repo, ambientIo, {
|
|
230
|
+
branch: data0.branch!,
|
|
231
|
+
dryRun: false,
|
|
232
|
+
now: NOW,
|
|
233
|
+
acceptWeakening: "operator: REQ-01 retired",
|
|
234
|
+
});
|
|
235
|
+
expect(
|
|
236
|
+
accepted.diagnostics.filter((d) => d.severity === "error"),
|
|
237
|
+
JSON.stringify(accepted.diagnostics),
|
|
238
|
+
).toEqual([]);
|
|
239
|
+
expect(accepted.integrated).toBe(true);
|
|
240
|
+
const log = await gitExec(repo, ["log", "-1", "--format=%B", "develop"]);
|
|
241
|
+
expect(log.stdout).toMatch(/X-Correctness-Weakening: operator: REQ-01 retired/);
|
|
242
|
+
}, 180_000);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
describe("correctness step output parsing", () => {
|
|
246
|
+
it("the unknown-command phrase inside gate JSON never degrades the refusal (spoof guard)", async () => {
|
|
247
|
+
const { runCorrectnessStep } = await import("../correctness-step.ts");
|
|
248
|
+
const repo = await initRepo({ prefix: "corrstep-" });
|
|
249
|
+
dirs.push(repo);
|
|
250
|
+
const json = JSON.stringify({
|
|
251
|
+
status: "fail",
|
|
252
|
+
bundlePath: null,
|
|
253
|
+
violations: [
|
|
254
|
+
{
|
|
255
|
+
rule: "CORR-GATE-02",
|
|
256
|
+
severity: "error",
|
|
257
|
+
message:
|
|
258
|
+
"weakening (exemption): unverifiable exemption added for Unknown command: correctness.gate",
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
});
|
|
262
|
+
await writeFile(
|
|
263
|
+
join(repo, "node_modules", ".bin", "forge"),
|
|
264
|
+
`#!/bin/sh\necho '${json}'\necho 'Unknown command: correctness.gate' >&2\nexit 1\n`,
|
|
265
|
+
);
|
|
266
|
+
await chmod(join(repo, "node_modules", ".bin", "forge"), 0o755);
|
|
267
|
+
const res = await runCorrectnessStep(ambientIo, {
|
|
268
|
+
primary: repo,
|
|
269
|
+
worktree: repo,
|
|
270
|
+
base: "HEAD",
|
|
271
|
+
});
|
|
272
|
+
expect(res.warning).toBeUndefined();
|
|
273
|
+
expect(res.refusal?.message).toMatch(/CORR-GATE-02/);
|
|
274
|
+
});
|
|
275
|
+
});
|