@warpgogol/forge 9.4.1 → 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 +33 -0
- package/README.md +30 -0
- package/README.uk.md +30 -0
- package/bin/cli.ts +163 -53
- package/dist/bin/cli.js +137 -42
- 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/dirty-classify.d.ts +7 -0
- package/dist/os/flow/dirty-classify.d.ts.map +1 -1
- package/dist/os/flow/dirty-classify.js +11 -0
- package/dist/os/flow/dirty-classify.js.map +1 -1
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +19 -4
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +9 -9
- package/dist/os/flow/handlers/flow-check.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 +148 -30
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +14 -19
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/index.d.ts +1 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +5 -3
- package/dist/os/flow/index.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 +24 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +364 -24
- 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 +6 -6
- 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/detach.d.ts +27 -0
- package/dist/os/gate-run/detach.d.ts.map +1 -0
- package/dist/os/gate-run/detach.js +85 -0
- package/dist/os/gate-run/detach.js.map +1 -0
- package/dist/os/gate-run/gate-run.module.d.ts +3 -0
- package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
- package/dist/os/gate-run/gate-run.module.js +23 -0
- package/dist/os/gate-run/gate-run.module.js.map +1 -0
- package/dist/os/gate-run/index.d.ts +7 -0
- package/dist/os/gate-run/index.d.ts.map +1 -0
- package/dist/os/gate-run/index.js +5 -0
- package/dist/os/gate-run/index.js.map +1 -0
- package/dist/os/gate-run/record.d.ts +47 -0
- package/dist/os/gate-run/record.d.ts.map +1 -0
- package/dist/os/gate-run/record.js +157 -0
- package/dist/os/gate-run/record.js.map +1 -0
- package/dist/os/gate-run/status.d.ts +53 -0
- package/dist/os/gate-run/status.d.ts.map +1 -0
- package/dist/os/gate-run/status.js +163 -0
- package/dist/os/gate-run/status.js.map +1 -0
- package/dist/os/gate-run/types.d.ts +47 -0
- package/dist/os/gate-run/types.d.ts.map +1 -0
- package/dist/os/gate-run/types.js +24 -0
- package/dist/os/gate-run/types.js.map +1 -0
- package/dist/os/program/schemas.d.ts +3 -3
- package/dist/os/queue/types.d.ts +2 -2
- package/dist/os/rfc/evidence-annotation.d.ts +26 -0
- package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
- package/dist/os/rfc/evidence-annotation.js +52 -0
- package/dist/os/rfc/evidence-annotation.js.map +1 -0
- package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
- package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
- package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
- 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 +35 -29
- 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 +152 -11
- 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 +20 -7
- 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/cli-flags.d.ts.map +1 -1
- package/dist/src/cli-flags.js +6 -0
- package/dist/src/cli-flags.js.map +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/dist/src/types.d.ts +7 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -8
- package/dist/src/types.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/dirty-classify.ts +13 -0
- package/os/flow/flow.module.ts +20 -4
- package/os/flow/handlers/flow-check.ts +17 -18
- package/os/flow/handlers/flow-digest.ts +11 -1
- package/os/flow/handlers/flow-integrate.ts +191 -39
- package/os/flow/handlers/flow-open.ts +24 -31
- package/os/flow/index.ts +5 -7
- package/os/flow/post-rebase-regen.ts +170 -0
- package/os/flow/preflight.ts +361 -27
- 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.preflight.test.ts +26 -5
- package/os/flow/tests/flow-integrate.test.ts +77 -10
- package/os/flow/tests/helpers.ts +45 -24
- package/os/flow/tests/lockfile-induced.test.ts +328 -0
- package/os/gate-run/detach.ts +106 -0
- package/os/gate-run/gate-run.module.ts +25 -0
- package/os/gate-run/index.ts +16 -0
- package/os/gate-run/record.ts +194 -0
- package/os/gate-run/status.ts +201 -0
- package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
- package/os/gate-run/tests/gate-run-record.test.ts +200 -0
- package/os/gate-run/tests/gate-run-status.test.ts +114 -0
- package/os/gate-run/types.ts +73 -0
- package/os/rfc/evidence-annotation.ts +61 -0
- package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
- package/os/rfc/handlers/fixed-inputs.ts +11 -1
- 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 +40 -29
- package/os/rfc/handlers/list-create.test.ts +14 -5
- package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
- package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
- package/os/rfc/handlers/validate-rules.ts +211 -21
- package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
- package/os/rfc/rfc-0000-template.md +10 -10
- package/os/rfc/rfc.module.ts +21 -7
- 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 +57 -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/skills/fo/fo-session-retro/SKILL.md +4 -2
- package/src/cli-flags.ts +7 -0
- 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
- package/src/types.ts +9 -8
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1578 AC-6: correctness.mode — exempt reports status exempt with no findings; exempt plus a manifest binding, and invalid mode/tier values, are CORR-02; enforce requires checkRun (CORR-01).</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Not a contract source of truth — the handler owns behaviour; fixtures are minimal.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1578: initial suite.</item>
|
|
10
|
+
<item>RFC-1578: correctness manifest, validator, promotes gate
|
|
11
|
+
|
|
12
|
+
Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
|
|
13
|
+
<item>RFC-1578: close review REVIEW-CODE-2026-11-12-08 findings
|
|
14
|
+
|
|
15
|
+
F1 code-only anchor scan (markdown fences never declare anchors); F2 generated index as a re-verified hint, scan on any miss; F3 RFC-IMP-16 asserted through rfc.implement.stamp; F4 forge create patches only absent/null keys; F5 type: refs normalized; F6/F10/F11 capture existence via existsSync, future recordedAt and workspace-escaping paths are CORR-07; F7 V-55 reuses criteriaEval; F8 validator inventory regenerated; F9 binding-driven reads; F12 git listing, index hint, create patch tests; DEV-1 single sidecar spelling; DEV-2 output field dropped.</item>
|
|
16
|
+
<item>RFC-1578: close review REVIEW-CODE-2026-11-12-09 findings
|
|
17
|
+
|
|
18
|
+
N1 index-hint rows count only for files in the workspace listing; N2 forge create leaves exempt repositories unbound; N3 listing test stages a file. Record DEV-3/DEV-4 amendments (CORR-07 future/escaping captures, index as re-verified hint) in the RFC Deviations section.</item>
|
|
19
|
+
</CHANGE_SUMMARY>
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { runCorrectnessManifestValidate } from "./handlers/validate.ts";
|
|
25
|
+
import { validateCorrectnessManifest } from "./handlers/validate.ts";
|
|
26
|
+
import { makeWorkspace } from "./tests/fixture-workspace.ts";
|
|
27
|
+
import type { ForgeRuntimeContext } from "../../src/types.ts";
|
|
28
|
+
import { correctnessBindingPatch } from "../../src/onboarding/create.ts";
|
|
29
|
+
|
|
30
|
+
const cleanups: (() => void)[] = [];
|
|
31
|
+
afterEach(() => cleanups.splice(0).forEach((c) => c()));
|
|
32
|
+
const ws = (opts: Parameters<typeof makeWorkspace>[0]) => {
|
|
33
|
+
const w = makeWorkspace(opts);
|
|
34
|
+
cleanups.push(w.cleanup);
|
|
35
|
+
return w.root;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const context = (root: string): ForgeRuntimeContext => ({
|
|
39
|
+
workspaceRoot: root,
|
|
40
|
+
dryRun: false,
|
|
41
|
+
outputFormat: "json",
|
|
42
|
+
logger: { section() {}, info() {}, warn() {}, error() {}, success() {} },
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("correctness.mode", () => {
|
|
46
|
+
it("AC-6: mode exempt reports status exempt and exits 0 without findings", async () => {
|
|
47
|
+
const root = ws({
|
|
48
|
+
mode: "exempt",
|
|
49
|
+
manifestBinding: null,
|
|
50
|
+
manifest: null,
|
|
51
|
+
requirements: ["REQ-01", "REQ-02"],
|
|
52
|
+
});
|
|
53
|
+
const res = await runCorrectnessManifestValidate({ argv: [], flags: {} }, context(root));
|
|
54
|
+
expect(res.data!.status).toBe("exempt");
|
|
55
|
+
expect(res.data!.violations).toEqual([]);
|
|
56
|
+
expect(res.exitCode).toBe(0);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("exempt together with a manifest binding is CORR-02", async () => {
|
|
60
|
+
const res = await validateCorrectnessManifest(ws({ mode: "exempt" }));
|
|
61
|
+
expect(res.status).toBe("fail");
|
|
62
|
+
expect(res.violations.map((v) => v.rule)).toEqual(["CORR-02"]);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("invalid mode and tier values are CORR-02 errors", async () => {
|
|
66
|
+
const res = await validateCorrectnessManifest(ws({ mode: "strict", tier: "ultra" }));
|
|
67
|
+
const msgs = res.violations.filter((v) => v.rule === "CORR-02").map((v) => v.message);
|
|
68
|
+
expect(msgs.some((m) => /correctness.mode "strict"/.test(m))).toBe(true);
|
|
69
|
+
expect(msgs.some((m) => /correctness.tier "ultra"/.test(m))).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("enforce without checkRun is a CORR-01 error; warn without a binding is a CORR-01 warning", async () => {
|
|
73
|
+
const enforce = await validateCorrectnessManifest(ws({ mode: "enforce", checkRun: null }));
|
|
74
|
+
expect(enforce.violations.find((v) => v.rule === "CORR-01")?.severity).toBe("error");
|
|
75
|
+
const warn = await validateCorrectnessManifest(ws({ manifestBinding: null, manifest: null }));
|
|
76
|
+
expect(warn.mode).toBe("warn");
|
|
77
|
+
expect(warn.violations.find((v) => v.rule === "CORR-01")?.severity).toBe("warning");
|
|
78
|
+
expect(warn.status).toBe("pass");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("an absent mode defaults to warn and tier to standard", async () => {
|
|
82
|
+
const res = await validateCorrectnessManifest(ws({}));
|
|
83
|
+
expect(res.mode).toBe("warn");
|
|
84
|
+
expect(res.tier).toBe("standard");
|
|
85
|
+
expect(res.status).toBe("pass");
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe("forge create binds the profile manifest", () => {
|
|
90
|
+
it("writes absent or null keys and keeps operator-set ones", () => {
|
|
91
|
+
const fresh = correctnessBindingPatch(
|
|
92
|
+
"schema: forge/config@1\nbindings:\n paths:\n correctnessManifest: null\n",
|
|
93
|
+
"docs/correctness.yaml",
|
|
94
|
+
);
|
|
95
|
+
expect(fresh).toMatch(/correctnessManifest: docs\/correctness.yaml/);
|
|
96
|
+
expect(fresh).toMatch(/mode: warn/);
|
|
97
|
+
const kept = correctnessBindingPatch(
|
|
98
|
+
"schema: forge/config@1\nbindings:\n paths:\n correctnessManifest: quality/manifest.yaml\ncorrectness:\n mode: enforce\n tier: high\n",
|
|
99
|
+
"docs/correctness.yaml",
|
|
100
|
+
);
|
|
101
|
+
expect(kept, "operator-set values must survive forge create").toBeNull();
|
|
102
|
+
const exempt = correctnessBindingPatch(
|
|
103
|
+
"schema: forge/config@1\ncorrectness:\n mode: exempt\n",
|
|
104
|
+
"docs/correctness.yaml",
|
|
105
|
+
);
|
|
106
|
+
expect(exempt, "an exempt repository must not gain a manifest binding (CORR-02)").toBeNull();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1578 AC-4: CORR-06 seam substrate minimums — L0 never satisfies data/lifecycle/provider; lifecycle needs L2.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Not a contract source of truth — the handler owns behaviour; fixtures are minimal.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1578: initial suite.</item>
|
|
10
|
+
<item>RFC-1578: correctness manifest, validator, promotes gate
|
|
11
|
+
|
|
12
|
+
Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
17
|
+
|
|
18
|
+
import { validateCorrectnessManifest } from "./handlers/validate.ts";
|
|
19
|
+
import { BASE_MANIFEST, makeWorkspace } from "./tests/fixture-workspace.ts";
|
|
20
|
+
|
|
21
|
+
const cleanups: (() => void)[] = [];
|
|
22
|
+
afterEach(() => cleanups.splice(0).forEach((c) => c()));
|
|
23
|
+
const run = async (manifest: string) => {
|
|
24
|
+
const w = makeWorkspace({ manifest });
|
|
25
|
+
cleanups.push(w.cleanup);
|
|
26
|
+
return validateCorrectnessManifest(w.root);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe("CORR-06 substrate minimums", () => {
|
|
30
|
+
it("AC-4: a data entry whose only oracle is L0 is a CORR-06 error", async () => {
|
|
31
|
+
const res = await run(BASE_MANIFEST.replace("substrate: L1", "substrate: L0"));
|
|
32
|
+
const v = res.violations.find((x) => x.rule === "CORR-06");
|
|
33
|
+
expect(v, "seam data requires L1 — an L0 double must never satisfy it").toBeDefined();
|
|
34
|
+
expect(v!.severity).toBe("error");
|
|
35
|
+
expect(v!.entry).toBe("CM-dispatch-01");
|
|
36
|
+
expect(res.status).toBe("fail");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("a data entry with an L1 oracle passes CORR-06", async () => {
|
|
40
|
+
const res = await run(BASE_MANIFEST);
|
|
41
|
+
expect(res.violations.filter((x) => x.rule === "CORR-06")).toEqual([]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("a lifecycle entry needs L2 — L1 is not enough", async () => {
|
|
45
|
+
const res = await run(BASE_MANIFEST.replace("seam: data", "seam: lifecycle"));
|
|
46
|
+
expect(res.violations.find((x) => x.rule === "CORR-06")?.message).toMatch(
|
|
47
|
+
/requires L2; best oracle is L1/,
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("a provider entry with an L1 oracle and no capture fails", async () => {
|
|
52
|
+
const res = await run(BASE_MANIFEST.replace("seam: data", "seam: provider"));
|
|
53
|
+
expect(res.violations.find((x) => x.rule === "CORR-06")?.message).toMatch(
|
|
54
|
+
/provider requires L3/,
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("seam other accepts L0", async () => {
|
|
59
|
+
const res = await run(
|
|
60
|
+
BASE_MANIFEST.replace("seam: data", "seam: other").replace("substrate: L1", "substrate: L0"),
|
|
61
|
+
);
|
|
62
|
+
expect(res.violations.filter((x) => x.rule === "CORR-06")).toEqual([]);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>Register the correctness contour commands (contract `correctness`)
|
|
4
|
+
with the forge registry — RFC-1578 `correctness.manifest.validate`, RFC-1579
|
|
5
|
+
`correctness.audit`, RFC-1580 `correctness.gate`.</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Do not implement handler logic here — delegate to handlers/.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1578: correctness manifest, validator, promotes gate
|
|
12
|
+
|
|
13
|
+
Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
|
|
14
|
+
<item>RFC-1578: close review REVIEW-CODE-2026-11-12-08 findings
|
|
15
|
+
|
|
16
|
+
F1 code-only anchor scan (markdown fences never declare anchors); F2 generated index as a re-verified hint, scan on any miss; F3 RFC-IMP-16 asserted through rfc.implement.stamp; F4 forge create patches only absent/null keys; F5 type: refs normalized; F6/F10/F11 capture existence via existsSync, future recordedAt and workspace-escaping paths are CORR-07; F7 V-55 reuses criteriaEval; F8 validator inventory regenerated; F9 binding-driven reads; F12 git listing, index hint, create patch tests; DEV-1 single sidecar spelling; DEV-2 output field dropped.</item>
|
|
17
|
+
<item>RFC-1579: correctness.audit auditors and differential attribution
|
|
18
|
+
|
|
19
|
+
Add os/correctness/audit: tree snapshots (working tree, index, base via one cat-file batch with git-grep prefilter), literal scanner + SQL classifier, wrangler D1 schema builder on node:sqlite, the four auditors (sql.schema.conform, ledger.orphans, state.transitions.coverage, bindings.verify.substance), subject-keyed differential attribution with allow-list, survival ledger, the correctness.audit handler and registration, and bindings.paths.correctnessLedger.</item>
|
|
20
|
+
<item>RFC-1579: gate line, ecosystem.commit early run, reference page
|
|
21
|
+
|
|
22
|
+
typescript profile integration-gate.sh runs the primary install's correctness.audit against FLOW_BASE_SHA; werkstatt ecosystem.commit gains EC-34 (correctness.audit --staged, refuses introduced CORR-AUDIT-01..03, warns on CORR-AUDIT-04); in-code CREATE TABLE tables (Durable Object storage) are unverifiable instead of D1 findings; correctness.audit declares generates: []; reference page and agent guides.
|
|
23
|
+
|
|
24
|
+
Measured on werkstatt (rollout step 3): 7 wrangler D1 configs, ~10 s per run, 3 legacy sql.schema.conform findings (packages/warpgogol-billing-cloudflare against schemas outside the repo), 127 unverifiable statements, no state machines; CORR-AUDIT-04 present (verify equals test) — fixed by the werkstatt gate-wiring queue task.</item>
|
|
25
|
+
<item>RFC-1580: correctness.gate and the flow.integrate step
|
|
26
|
+
|
|
27
|
+
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>
|
|
28
|
+
<history>RFC-1578</history>
|
|
29
|
+
</CHANGE_SUMMARY>
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import type { ForgeModule } from "../../src/forge-module.ts";
|
|
33
|
+
|
|
34
|
+
export async function createForgeCorrectnessModule(): Promise<ForgeModule> {
|
|
35
|
+
const { runCorrectnessManifestValidate } = await import("./handlers/validate.ts");
|
|
36
|
+
const { runCorrectnessAuditCommand } = await import("./handlers/audit.ts");
|
|
37
|
+
const { runCorrectnessGateCommand } = await import("./handlers/gate.ts");
|
|
38
|
+
return {
|
|
39
|
+
name: "forge-correctness",
|
|
40
|
+
version: "0.1.0",
|
|
41
|
+
runtime: "autonomous",
|
|
42
|
+
declarations: [],
|
|
43
|
+
commands: [
|
|
44
|
+
{
|
|
45
|
+
name: "correctness.manifest.validate",
|
|
46
|
+
description:
|
|
47
|
+
"Validate the product correctness manifest (forge/correctness-manifest@1, " +
|
|
48
|
+
"bindings.paths.correctnessManifest) and the forge.yaml correctness section " +
|
|
49
|
+
"(RFC-1578). CORR-01 manifest/checkRun presence (error in enforce, warning in " +
|
|
50
|
+
"warn); CORR-02 schema, ids, support globs, mode/tier values; CORR-03 requirement, " +
|
|
51
|
+
"DNA, RFC AC/FI refs resolve; CORR-04 anchors are tagged @ai-invariant ids with a " +
|
|
52
|
+
"checked-by binding; CORR-05 each oracle check is named by an anchor's checked-by; " +
|
|
53
|
+
"CORR-06 seam substrate minimums (data L1, lifecycle L2, provider L3 or a fresh " +
|
|
54
|
+
"capture); CORR-07 capture sidecar provenance and ttl (warning within 7 days of " +
|
|
55
|
+
"expiry); CORR-08 every requirement id and DNA id is anchored or exempted; CORR-09 " +
|
|
56
|
+
"exemption shape. correctness.mode exempt evaluates no rule. Read-only.",
|
|
57
|
+
scope: "workspace",
|
|
58
|
+
contract: "correctness",
|
|
59
|
+
rules: [
|
|
60
|
+
{ id: "CORR-01", severity: "error" },
|
|
61
|
+
{ id: "CORR-02", severity: "error" },
|
|
62
|
+
{ id: "CORR-03", severity: "error" },
|
|
63
|
+
{ id: "CORR-04", severity: "error" },
|
|
64
|
+
{ id: "CORR-05", severity: "error" },
|
|
65
|
+
{ id: "CORR-06", severity: "error" },
|
|
66
|
+
{ id: "CORR-07", severity: "error" },
|
|
67
|
+
{ id: "CORR-08", severity: "error" },
|
|
68
|
+
{ id: "CORR-09", severity: "error" },
|
|
69
|
+
],
|
|
70
|
+
mutatesState: false,
|
|
71
|
+
execOnReadOnly: true,
|
|
72
|
+
// The manifest path is binding-driven (bindings.paths.correctnessManifest).
|
|
73
|
+
reads: ["forge.yaml"],
|
|
74
|
+
cacheable: false,
|
|
75
|
+
flags: {},
|
|
76
|
+
execute: runCorrectnessManifestValidate,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "correctness.audit",
|
|
80
|
+
description:
|
|
81
|
+
"Audit cross-artifact correctness defects (RFC-1579). CORR-AUDIT-01 " +
|
|
82
|
+
"sql.schema.conform — SQL literals in non-test TypeScript must prepare against " +
|
|
83
|
+
"the D1 schema their package's wrangler.json/jsonc migrations build (node:sqlite); " +
|
|
84
|
+
"CORR-AUDIT-02 ledger.orphans — every declared table needs a writer and a reader; " +
|
|
85
|
+
"CORR-AUDIT-03 state.transitions.coverage — every target of a " +
|
|
86
|
+
"@state-machine[<name>] (writers: …) table needs a writer; CORR-AUDIT-04 " +
|
|
87
|
+
"bindings.verify.substance — bindings.commands.verify must prove more than " +
|
|
88
|
+
"tests/types. Code findings block only when introduced relative to --base " +
|
|
89
|
+
"(default: merge-base with develop; HEAD with --staged); the configuration " +
|
|
90
|
+
"finding blocks whenever present. correctness.audit.allow[] entries report as " +
|
|
91
|
+
"accepted. --write-ledger refreshes the survival ledger " +
|
|
92
|
+
"(bindings.paths.correctnessLedger) — the only mutating mode.",
|
|
93
|
+
scope: "workspace",
|
|
94
|
+
contract: "correctness",
|
|
95
|
+
rules: [
|
|
96
|
+
{ id: "CORR-AUDIT-01", severity: "error" },
|
|
97
|
+
{ id: "CORR-AUDIT-02", severity: "error" },
|
|
98
|
+
{ id: "CORR-AUDIT-03", severity: "error" },
|
|
99
|
+
{ id: "CORR-AUDIT-04", severity: "error" },
|
|
100
|
+
],
|
|
101
|
+
mutatesState: true,
|
|
102
|
+
execOnReadOnly: true,
|
|
103
|
+
reads: ["forge.yaml"],
|
|
104
|
+
writes: ["docs/maintenance-debt/correctness.ledger.yaml"],
|
|
105
|
+
// The survival ledger is dated state, not a deterministic projection.
|
|
106
|
+
generates: [],
|
|
107
|
+
cacheable: false,
|
|
108
|
+
flags: {
|
|
109
|
+
base: {
|
|
110
|
+
kind: "string",
|
|
111
|
+
description:
|
|
112
|
+
"Revision findings are compared against (default: merge-base with develop; HEAD with --staged).",
|
|
113
|
+
},
|
|
114
|
+
staged: {
|
|
115
|
+
kind: "boolean",
|
|
116
|
+
description: "Judge the staged index instead of the working tree.",
|
|
117
|
+
},
|
|
118
|
+
check: {
|
|
119
|
+
kind: "string",
|
|
120
|
+
description:
|
|
121
|
+
"Run one auditor: sql.schema.conform | ledger.orphans | state.transitions.coverage | bindings.verify.substance.",
|
|
122
|
+
},
|
|
123
|
+
"write-ledger": {
|
|
124
|
+
kind: "boolean",
|
|
125
|
+
description:
|
|
126
|
+
"Refresh the survival ledger at bindings.paths.correctnessLedger (honours --dry-run).",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
execute: runCorrectnessAuditCommand,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "correctness.gate",
|
|
133
|
+
description:
|
|
134
|
+
"Enforce the product correctness manifest at integration (RFC-1580). Spawned by " +
|
|
135
|
+
"flow.integrate from the primary checkout's forge install. CORR-GATE-01 manifest " +
|
|
136
|
+
"invalid at HEAD; CORR-GATE-02 weakening against the frozen set at --base (entries, " +
|
|
137
|
+
"oracles, substrates, exemptions, allow-list, bindings, mode/tier, anchor statements, " +
|
|
138
|
+
"any byte change of a frozen oracle/capture/support file not made by a verifier-trailer " +
|
|
139
|
+
"commit) — refuses in warn mode too; CORR-GATE-03 only self oracles (no committed " +
|
|
140
|
+
"forge/oracle-review@1 record, no verifier trailer, not unchanged since acceptance); " +
|
|
141
|
+
"CORR-GATE-04 L1/L2 without a matching schema-hash attestation; CORR-GATE-05 lifecycle " +
|
|
142
|
+
"anchor without a verified forge.anchor event; CORR-GATE-06 tier high/formal origin or " +
|
|
143
|
+
"proof requirements; CORR-GATE-07 oracle run failed or timed out; CORR-GATE-08 entry " +
|
|
144
|
+
"uncovered. warn mode downgrades 03..08 to warnings. Writes a forge/correctness-bundle@1 " +
|
|
145
|
+
"under <git-common-dir>/forge/gate-reports/.",
|
|
146
|
+
scope: "workspace",
|
|
147
|
+
contract: "correctness",
|
|
148
|
+
rules: [
|
|
149
|
+
{ id: "CORR-GATE-01", severity: "error" },
|
|
150
|
+
{ id: "CORR-GATE-02", severity: "error" },
|
|
151
|
+
{ id: "CORR-GATE-03", severity: "error" },
|
|
152
|
+
{ id: "CORR-GATE-04", severity: "error" },
|
|
153
|
+
{ id: "CORR-GATE-05", severity: "error" },
|
|
154
|
+
{ id: "CORR-GATE-06", severity: "error" },
|
|
155
|
+
{ id: "CORR-GATE-07", severity: "error" },
|
|
156
|
+
{ id: "CORR-GATE-08", severity: "error" },
|
|
157
|
+
],
|
|
158
|
+
// Writes its forge/correctness-bundle@1 and spawns the oracles (checkRun).
|
|
159
|
+
mutatesState: true,
|
|
160
|
+
writes: [".git/forge/gate-reports/**"],
|
|
161
|
+
generates: [],
|
|
162
|
+
execOnReadOnly: true,
|
|
163
|
+
reads: ["forge.yaml"],
|
|
164
|
+
cacheable: false,
|
|
165
|
+
flags: {
|
|
166
|
+
base: {
|
|
167
|
+
kind: "string",
|
|
168
|
+
required: true,
|
|
169
|
+
description: "Develop tip the session integrates into — the frozen set is read here.",
|
|
170
|
+
},
|
|
171
|
+
"accept-weakening": {
|
|
172
|
+
kind: "string",
|
|
173
|
+
description:
|
|
174
|
+
"Operator decision: accept the weakening of an isolated session whose diff touches frozen-set paths only.",
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
execute: runCorrectnessGateCommand,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
pipelines: [],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580 AC-6: a lifecycle oracle whose forge.anchor event references a row value the attested database does not hold is CORR-GATE-05; a matching event covers.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>Not a contract source of truth — gate/run.ts owns behaviour.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
<CHANGE_SUMMARY>
|
|
9
|
+
<item>RFC-1580: initial suite.</item>
|
|
10
|
+
<item>RFC-1580: correctness.gate and the flow.integrate step
|
|
11
|
+
|
|
12
|
+
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>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
17
|
+
|
|
18
|
+
import { runCorrectnessGate } from "./run.ts";
|
|
19
|
+
import {
|
|
20
|
+
L1_ORACLE,
|
|
21
|
+
MOCK_ORACLE,
|
|
22
|
+
ORACLE_PATH,
|
|
23
|
+
lifecycleOracle,
|
|
24
|
+
makeGateFixture,
|
|
25
|
+
manifestYaml,
|
|
26
|
+
reviewYaml,
|
|
27
|
+
type GateFixture,
|
|
28
|
+
} from "./tests/gate-fixture.ts";
|
|
29
|
+
|
|
30
|
+
const fixtures: GateFixture[] = [];
|
|
31
|
+
afterEach(() => fixtures.splice(0).forEach((f) => f.cleanup()));
|
|
32
|
+
const fx = (o: Parameters<typeof makeGateFixture>[0] = {}) => {
|
|
33
|
+
const f = makeGateFixture(o);
|
|
34
|
+
fixtures.push(f);
|
|
35
|
+
return f;
|
|
36
|
+
};
|
|
37
|
+
const gate = async (f: GateFixture, acceptWeakening?: string) => {
|
|
38
|
+
const out = await runCorrectnessGate(f.root, {
|
|
39
|
+
base: f.base,
|
|
40
|
+
bundleDir: `${f.root}/.bundles`,
|
|
41
|
+
acceptWeakening,
|
|
42
|
+
});
|
|
43
|
+
if (!out.ok) throw new Error(out.usageError);
|
|
44
|
+
return out.result;
|
|
45
|
+
};
|
|
46
|
+
const rules = (r: { violations: { rule: string }[] }) => r.violations.map((v) => v.rule);
|
|
47
|
+
void [L1_ORACLE, MOCK_ORACLE, ORACLE_PATH, lifecycleOracle, manifestYaml, reviewYaml, rules];
|
|
48
|
+
|
|
49
|
+
describe("anchor events", () => {
|
|
50
|
+
it("AC-6: an event claiming a state the database does not hold is CORR-GATE-05", async () => {
|
|
51
|
+
const r = await gate(
|
|
52
|
+
fx({ seam: "lifecycle", substrate: "L2", oracle: lifecycleOracle("send_ready") }),
|
|
53
|
+
);
|
|
54
|
+
const v = r.violations.find((x) => x.rule === "CORR-GATE-05");
|
|
55
|
+
expect(
|
|
56
|
+
v?.message,
|
|
57
|
+
"a log line must not claim a transition that never reached the database",
|
|
58
|
+
).toMatch(/candidates.state is "queued", event claims "send_ready"/);
|
|
59
|
+
expect(r.status).toBe("fail");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("a verified event covers the lifecycle entry", async () => {
|
|
63
|
+
const r = await gate(
|
|
64
|
+
fx({ seam: "lifecycle", substrate: "L2", oracle: lifecycleOracle("queued") }),
|
|
65
|
+
);
|
|
66
|
+
expect(r.violations, JSON.stringify(r.violations)).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("an L2 run without any anchor event is CORR-GATE-05", async () => {
|
|
70
|
+
const r = await gate(
|
|
71
|
+
fx({ seam: "lifecycle", substrate: "L2", oracle: L1_ORACLE.replace('"L1"', '"L2"') }),
|
|
72
|
+
);
|
|
73
|
+
expect(r.violations.find((x) => x.rule === "CORR-GATE-05")?.message).toMatch(
|
|
74
|
+
/no verified forge.anchor event for INV-dispatch-01/,
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580 review REVIEW-CODE-2026-11-13-05 regressions — every frozen
|
|
4
|
+
item has a weakening test (captures, unreadable base manifest, source and
|
|
5
|
+
statement, mode, allow-list, tier, deferred exemptions, new support files);
|
|
6
|
+
L3 on data seams needs an attestation; anchor events must be verified on the
|
|
7
|
+
attested handle; isolated sessions may touch anchor files but not unrelated
|
|
8
|
+
forge.yaml keys; a dirty worktree warns.</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Not a contract source of truth — gate/run.ts owns behaviour.</item>
|
|
11
|
+
</non-goals>
|
|
12
|
+
</MODULE_CONTRACT>
|
|
13
|
+
<CHANGE_SUMMARY>
|
|
14
|
+
<item>RFC-1580: review regressions.</item>
|
|
15
|
+
<item>RFC-1580: close review REVIEW-CODE-2026-11-13-05 findings
|
|
16
|
+
|
|
17
|
+
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>
|
|
18
|
+
</CHANGE_SUMMARY>
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
22
|
+
|
|
23
|
+
import { runCorrectnessGate } from "./run.ts";
|
|
24
|
+
import {
|
|
25
|
+
HELPERS,
|
|
26
|
+
L1_ORACLE,
|
|
27
|
+
ORACLE_PATH,
|
|
28
|
+
makeGateFixture,
|
|
29
|
+
manifestYaml,
|
|
30
|
+
reviewYaml,
|
|
31
|
+
verifierCommit,
|
|
32
|
+
type GateFixture,
|
|
33
|
+
} from "./tests/gate-fixture.ts";
|
|
34
|
+
|
|
35
|
+
const fixtures: GateFixture[] = [];
|
|
36
|
+
afterEach(() => fixtures.splice(0).forEach((f) => f.cleanup()));
|
|
37
|
+
const fx = (o: Parameters<typeof makeGateFixture>[0] = {}) => {
|
|
38
|
+
const f = makeGateFixture(o);
|
|
39
|
+
fixtures.push(f);
|
|
40
|
+
return f;
|
|
41
|
+
};
|
|
42
|
+
const gate = async (f: GateFixture, base = f.base, acceptWeakening?: string) => {
|
|
43
|
+
const out = await runCorrectnessGate(f.root, {
|
|
44
|
+
base,
|
|
45
|
+
bundleDir: `${f.root}/.bundles`,
|
|
46
|
+
acceptWeakening,
|
|
47
|
+
});
|
|
48
|
+
if (!out.ok) throw new Error(out.usageError);
|
|
49
|
+
return out.result;
|
|
50
|
+
};
|
|
51
|
+
const weak = (r: { violations: { rule: string; message: string }[] }) =>
|
|
52
|
+
r.violations.filter((v) => v.rule === "CORR-GATE-02").map((v) => v.message);
|
|
53
|
+
const head = (f: GateFixture) => f.git(["rev-parse", "HEAD"]);
|
|
54
|
+
|
|
55
|
+
describe("frozen-set coverage", () => {
|
|
56
|
+
it("each frozen config item is a weakening when weakened", async () => {
|
|
57
|
+
const f = fx({ mode: "enforce", tier: "high" });
|
|
58
|
+
f.write(
|
|
59
|
+
"forge.yaml",
|
|
60
|
+
f
|
|
61
|
+
.read("forge.yaml")
|
|
62
|
+
.replace("mode: enforce", "mode: warn")
|
|
63
|
+
.replace("tier: high", "tier: standard") +
|
|
64
|
+
" audit:\n allow:\n - check: ledger.orphans\n subject: events\n reason: x\n",
|
|
65
|
+
);
|
|
66
|
+
f.write(
|
|
67
|
+
"docs/correctness.yaml",
|
|
68
|
+
manifestYaml({})
|
|
69
|
+
.replace("source: req\n ref: REQ-01", 'source: domain\n statement: "x"')
|
|
70
|
+
.replace(
|
|
71
|
+
"exemptions: []",
|
|
72
|
+
'exemptions:\n - ref: REQ-01\n kind: deferred\n task: "verbund:T-1"',
|
|
73
|
+
),
|
|
74
|
+
);
|
|
75
|
+
f.commit("weaken many things");
|
|
76
|
+
const m = weak(await gate(f));
|
|
77
|
+
for (const re of [
|
|
78
|
+
/mode changed from enforce to warn/,
|
|
79
|
+
/tier lowered from high to standard/,
|
|
80
|
+
/allow\[\] gained/,
|
|
81
|
+
/source changed from req to domain/,
|
|
82
|
+
/ref changed/,
|
|
83
|
+
/deferred exemption added for REQ-01/,
|
|
84
|
+
]) {
|
|
85
|
+
expect(
|
|
86
|
+
m.some((x) => re.test(x)),
|
|
87
|
+
`missing ${re}`,
|
|
88
|
+
).toBe(true);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("a dropped capture is a weakening", async () => {
|
|
93
|
+
const cap = "test/captures/a.json";
|
|
94
|
+
const g = fx({ review: false });
|
|
95
|
+
g.write(cap, "{}");
|
|
96
|
+
g.write(
|
|
97
|
+
`${cap}.capture.yaml`,
|
|
98
|
+
`schema: forge/correctness-capture@1\nrecordedAt: ${new Date().toISOString()}\nprovider: p\nmodel: m\nttlDays: 30\norigin: o\n`,
|
|
99
|
+
);
|
|
100
|
+
g.write(
|
|
101
|
+
"docs/correctness.yaml",
|
|
102
|
+
manifestYaml({}).replace("substrate: L1", `substrate: L1\n captures: [${cap}]`),
|
|
103
|
+
);
|
|
104
|
+
g.commit("with capture");
|
|
105
|
+
const base = head(g);
|
|
106
|
+
g.write("docs/correctness.yaml", manifestYaml({}));
|
|
107
|
+
g.commit("drop capture");
|
|
108
|
+
expect(weak(await gate(g, base)).some((x) => /dropped capture/.test(x))).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("an unreadable base manifest refuses instead of freezing nothing", async () => {
|
|
112
|
+
const f = fx();
|
|
113
|
+
f.write("docs/correctness.yaml", "schema: forge/correctness-manifest@9\nentries: []\n");
|
|
114
|
+
f.commit("break the manifest");
|
|
115
|
+
const base = head(f);
|
|
116
|
+
f.write("docs/correctness.yaml", manifestYaml({}));
|
|
117
|
+
f.commit("repair");
|
|
118
|
+
expect(weak(await gate(f, base)).some((x) => /does not parse/.test(x))).toBe(true);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("a new file matching a frozen support glob is a weakening", async () => {
|
|
122
|
+
const g = fx({ review: false });
|
|
123
|
+
g.write("test/harness/setup.ts", "// harness\n");
|
|
124
|
+
g.write(
|
|
125
|
+
"docs/correctness.yaml",
|
|
126
|
+
manifestYaml({}).replace("support: []", "support: [test/harness/**]"),
|
|
127
|
+
);
|
|
128
|
+
g.commit("support glob");
|
|
129
|
+
const base = head(g);
|
|
130
|
+
g.write("test/harness/extra.ts", "// passWithNoTests\n");
|
|
131
|
+
g.commit("add harness file");
|
|
132
|
+
expect(
|
|
133
|
+
weak(await gate(g, base)).some((x) =>
|
|
134
|
+
/new file test\/harness\/extra.ts matches a frozen support glob/.test(x),
|
|
135
|
+
),
|
|
136
|
+
).toBe(true);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it("a dirty worktree is a CORR-GATE-01 warning", async () => {
|
|
140
|
+
const f = fx();
|
|
141
|
+
f.write("apps/api/src/dispatch.ts", `${f.read("apps/api/src/dispatch.ts")}// local edit\n`);
|
|
142
|
+
const r = await gate(f);
|
|
143
|
+
expect(
|
|
144
|
+
r.violations.some(
|
|
145
|
+
(v) =>
|
|
146
|
+
v.rule === "CORR-GATE-01" && v.severity === "warning" && /uncommitted/.test(v.message),
|
|
147
|
+
),
|
|
148
|
+
).toBe(true);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
describe("evidence binding", () => {
|
|
153
|
+
it("L3 with honest captures on a data seam still needs a matching schema attestation", async () => {
|
|
154
|
+
const cap = "test/captures/a.json";
|
|
155
|
+
const oracle = `import { loadCapture } from ${JSON.stringify(HELPERS)};\nloadCapture(${JSON.stringify(cap)});\n`;
|
|
156
|
+
const g = fx({ review: false, oracle });
|
|
157
|
+
g.write(cap, "{}");
|
|
158
|
+
g.write(
|
|
159
|
+
`${cap}.capture.yaml`,
|
|
160
|
+
`schema: forge/correctness-capture@1\nrecordedAt: ${new Date().toISOString()}\nprovider: p\nmodel: m\nttlDays: 30\norigin: o\n`,
|
|
161
|
+
);
|
|
162
|
+
g.write(
|
|
163
|
+
"docs/correctness.yaml",
|
|
164
|
+
manifestYaml({}).replace("substrate: L1", `substrate: L3\n captures: [${cap}]`),
|
|
165
|
+
);
|
|
166
|
+
g.commit("declare L3 with a capture");
|
|
167
|
+
const rel = "docs/correctness/reviews/r.yaml";
|
|
168
|
+
g.write(rel, reviewYaml([{ check: `test:${ORACLE_PATH}`, content: oracle }]));
|
|
169
|
+
verifierCommit(g.git, rel);
|
|
170
|
+
const r = await gate(g, head(g));
|
|
171
|
+
expect(
|
|
172
|
+
r.violations.some(
|
|
173
|
+
(v) => v.rule === "CORR-GATE-04" && /declares L3 on a data seam/.test(v.message),
|
|
174
|
+
),
|
|
175
|
+
JSON.stringify(r.violations),
|
|
176
|
+
).toBe(true);
|
|
177
|
+
expect(r.violations.map((v) => v.rule)).toContain("CORR-GATE-08");
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("anchor events verified against a second database do not count", async () => {
|
|
181
|
+
const oracle = `import { DatabaseSync } from "node:sqlite";
|
|
182
|
+
import { readFileSync } from "node:fs";
|
|
183
|
+
import { attestSubstrate, verifyAnchorEvents } from ${JSON.stringify(HELPERS)};
|
|
184
|
+
const real = new DatabaseSync(":memory:");
|
|
185
|
+
real.exec(readFileSync("apps/api/migrations/0001_init.sql", "utf8"));
|
|
186
|
+
attestSubstrate(real, { level: "L2", engine: "node:sqlite" });
|
|
187
|
+
const seeded = new DatabaseSync(":memory:");
|
|
188
|
+
seeded.exec("CREATE TABLE candidates (id TEXT PRIMARY KEY, state TEXT NOT NULL, extra TEXT)");
|
|
189
|
+
seeded.prepare("INSERT INTO candidates (id, state) VALUES (?, ?)").run("c_1", "queued");
|
|
190
|
+
verifyAnchorEvents([JSON.stringify({ "forge.anchor": "INV-dispatch-01", ref: { table: "candidates", key: { id: "c_1" }, column: "state", value: "queued" } })], seeded);
|
|
191
|
+
`;
|
|
192
|
+
const r = await gate(fx({ seam: "lifecycle", substrate: "L2", oracle }));
|
|
193
|
+
expect(
|
|
194
|
+
r.violations.some(
|
|
195
|
+
(v) => v.rule === "CORR-GATE-05" && /other than the attested handle/.test(v.message),
|
|
196
|
+
),
|
|
197
|
+
).toBe(true);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe("isolated weakening sessions", () => {
|
|
202
|
+
it("an anchor rewording alone can be accepted; an unrelated forge.yaml key makes it mixed", async () => {
|
|
203
|
+
const f = fx();
|
|
204
|
+
f.write(
|
|
205
|
+
"apps/api/src/dispatch.ts",
|
|
206
|
+
f.read("apps/api/src/dispatch.ts").replace("exactly once", "once per target"),
|
|
207
|
+
);
|
|
208
|
+
f.commit("reword the anchor");
|
|
209
|
+
const ok = await gate(f, f.base, "operator: requirement rephrased");
|
|
210
|
+
expect(ok.acceptedWeakening).toBe("operator: requirement rephrased");
|
|
211
|
+
f.write("forge.yaml", f.read("forge.yaml").replace("name: gate-fixture", "name: renamed"));
|
|
212
|
+
f.commit("rename project");
|
|
213
|
+
const mixed = await gate(f, f.base, "operator: requirement rephrased");
|
|
214
|
+
expect(weak(mixed).some((x) => /mixed-weakening/.test(x))).toBe(true);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
void L1_ORACLE;
|