@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,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580 AC-5: an oracle declaring L1 whose run leaves no attestation matching the repository migrations' normalized schema hash is CORR-GATE-04.</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];
|
|
48
|
+
|
|
49
|
+
describe("substrate attestation", () => {
|
|
50
|
+
it("AC-5: an L1 oracle that attests a schemaless double is CORR-GATE-04", async () => {
|
|
51
|
+
const r = await gate(fx({ oracle: MOCK_ORACLE }));
|
|
52
|
+
const v = r.violations.find((x) => x.rule === "CORR-GATE-04");
|
|
53
|
+
expect(v?.message, "MockD1-style handles must not count as L1").toMatch(
|
|
54
|
+
/does not match the repository migrations/,
|
|
55
|
+
);
|
|
56
|
+
expect(rules(r)).toContain("CORR-GATE-08");
|
|
57
|
+
expect(r.status).toBe("fail");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("an L1 oracle that attests nothing is CORR-GATE-04", async () => {
|
|
61
|
+
const r = await gate(fx({ oracle: "// passes without attesting\n" }));
|
|
62
|
+
expect(r.violations.find((x) => x.rule === "CORR-GATE-04")?.message).toMatch(
|
|
63
|
+
/left no attestation/,
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("an attestation of the real migrations covers the entry", async () => {
|
|
68
|
+
const r = await gate(fx({ oracle: L1_ORACLE }));
|
|
69
|
+
expect(rules(r)).not.toContain("CORR-GATE-04");
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580: temp git repositories for correctness.gate tests — a D1
|
|
4
|
+
product with a manifest, a code anchor, real node oracles (checkRun
|
|
5
|
+
`node {file}`) that attest through the forge test-side helpers, and an
|
|
6
|
+
optional committed oracle review record.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>Not production code — imported by *.test.ts only.</item>
|
|
9
|
+
<item>Never exports GIT_DIR — every git call passes cwd explicitly.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1580: initial fixture.</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
|
+
</CHANGE_SUMMARY>
|
|
21
|
+
*/
|
|
22
|
+
// test-adjacency: exempt — no test reason: test support module, exercised by every gate test
|
|
23
|
+
|
|
24
|
+
import { createHash } from "node:crypto";
|
|
25
|
+
import { execFileSync } from "node:child_process";
|
|
26
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
27
|
+
import os from "node:os";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import { fileURLToPath } from "node:url";
|
|
30
|
+
|
|
31
|
+
/** Absolute path of the forge test-side helpers, importable by node oracles (type stripping). */
|
|
32
|
+
export const HELPERS = path.resolve(
|
|
33
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
34
|
+
"../../../../src/correctness/index.ts",
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const MARK = "@ai-" + "invariant";
|
|
38
|
+
|
|
39
|
+
export const MIGRATION = "CREATE TABLE candidates (id TEXT PRIMARY KEY, state TEXT NOT NULL);\n";
|
|
40
|
+
|
|
41
|
+
/** An oracle body: builds the real schema on node:sqlite and attests it. */
|
|
42
|
+
export const L1_ORACLE = `import { DatabaseSync } from "node:sqlite";
|
|
43
|
+
import { readFileSync } from "node:fs";
|
|
44
|
+
import { attestSubstrate } from ${JSON.stringify(HELPERS)};
|
|
45
|
+
const db = new DatabaseSync(":memory:");
|
|
46
|
+
db.exec(readFileSync("apps/api/migrations/0001_init.sql", "utf8"));
|
|
47
|
+
attestSubstrate(db, { level: "L1", engine: "node:sqlite" });
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
/** Attests a schemaless double — must not count as L1. */
|
|
51
|
+
export const MOCK_ORACLE = `import { DatabaseSync } from "node:sqlite";
|
|
52
|
+
import { attestSubstrate } from ${JSON.stringify(HELPERS)};
|
|
53
|
+
const db = new DatabaseSync(":memory:");
|
|
54
|
+
db.exec("CREATE TABLE anything (x)");
|
|
55
|
+
attestSubstrate(db, { level: "L1", engine: "mock" });
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
/** L2 lifecycle oracle: writes a row, then verifies the production log line's claim. */
|
|
59
|
+
export const lifecycleOracle = (claimed: string) => `import { DatabaseSync } from "node:sqlite";
|
|
60
|
+
import { readFileSync } from "node:fs";
|
|
61
|
+
import { attestSubstrate, verifyAnchorEvents } from ${JSON.stringify(HELPERS)};
|
|
62
|
+
const db = new DatabaseSync(":memory:");
|
|
63
|
+
db.exec(readFileSync("apps/api/migrations/0001_init.sql", "utf8"));
|
|
64
|
+
db.prepare("INSERT INTO candidates (id, state) VALUES (?, ?)").run("c_1", "queued");
|
|
65
|
+
attestSubstrate(db, { level: "L2", engine: "node:sqlite" });
|
|
66
|
+
const line = JSON.stringify({ "forge.anchor": "INV-dispatch-01", ref: { table: "candidates", key: { id: "c_1" }, column: "state", value: ${JSON.stringify(claimed)} } });
|
|
67
|
+
verifyAnchorEvents([line], db);
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export interface GateFixtureOptions {
|
|
71
|
+
mode?: "warn" | "enforce";
|
|
72
|
+
tier?: "standard" | "high";
|
|
73
|
+
seam?: "data" | "lifecycle";
|
|
74
|
+
substrate?: "L1" | "L2";
|
|
75
|
+
oracle?: string;
|
|
76
|
+
review?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface GateFixture {
|
|
80
|
+
root: string;
|
|
81
|
+
base: string;
|
|
82
|
+
write(rel: string, body: string): void;
|
|
83
|
+
read(rel: string): string;
|
|
84
|
+
git(args: string[]): string;
|
|
85
|
+
commit(message: string): string;
|
|
86
|
+
cleanup(): void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const ORACLE_PATH = "test/dispatch.oracle.ts";
|
|
90
|
+
|
|
91
|
+
export function manifestYaml(opts: GateFixtureOptions, extraEntries = ""): string {
|
|
92
|
+
return `schema: forge/correctness-manifest@1
|
|
93
|
+
entries:
|
|
94
|
+
- id: CM-dispatch-01
|
|
95
|
+
source: req
|
|
96
|
+
ref: REQ-01
|
|
97
|
+
seam: ${opts.seam ?? "data"}
|
|
98
|
+
anchors: [INV-dispatch-01]
|
|
99
|
+
oracles:
|
|
100
|
+
- check: test:${ORACLE_PATH}
|
|
101
|
+
substrate: ${opts.substrate ?? "L1"}
|
|
102
|
+
${extraEntries}support: []
|
|
103
|
+
exemptions: []
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function reviewYaml(entries: { check: string; content: string }[]): string {
|
|
108
|
+
return `schema: forge/oracle-review@1
|
|
109
|
+
reviewedAt: 2026-11-13T10:00:00Z
|
|
110
|
+
isolation: subagent
|
|
111
|
+
candidate: deadbeef
|
|
112
|
+
export: "rfc.verify.workspace --manifest"
|
|
113
|
+
verdict: pass
|
|
114
|
+
oracles:
|
|
115
|
+
${entries
|
|
116
|
+
.map(
|
|
117
|
+
(e) =>
|
|
118
|
+
` - check: ${e.check}\n sha256: "${createHash("sha256").update(e.content).digest("hex")}"\n verdict: pass\n attestedHandleIsUnderTest: true`,
|
|
119
|
+
)
|
|
120
|
+
.join("\n")}
|
|
121
|
+
`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Commit `rel` the way the clean-context verifier workflow does (trailer pair naming the record). */
|
|
125
|
+
export function verifierCommit(
|
|
126
|
+
git: (args: string[]) => string,
|
|
127
|
+
rel: string,
|
|
128
|
+
message = "review: oracle review",
|
|
129
|
+
): string {
|
|
130
|
+
git(["add", "-A"]);
|
|
131
|
+
git([
|
|
132
|
+
"commit",
|
|
133
|
+
"-qm",
|
|
134
|
+
`${message}\n\nX-Expectation-Origin: independent-verifier\nX-Verifier-Report: ${rel}`,
|
|
135
|
+
]);
|
|
136
|
+
return git(["rev-parse", "HEAD"]);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function makeGateFixture(opts: GateFixtureOptions = {}): GateFixture {
|
|
140
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "forge-gate-"));
|
|
141
|
+
const write = (rel: string, body: string) => {
|
|
142
|
+
mkdirSync(path.dirname(path.join(root, rel)), { recursive: true });
|
|
143
|
+
writeFileSync(path.join(root, rel), body);
|
|
144
|
+
};
|
|
145
|
+
const git = (args: string[]) => execFileSync("git", args, { cwd: root, encoding: "utf8" }).trim();
|
|
146
|
+
const commit = (message: string) => {
|
|
147
|
+
git(["add", "-A"]);
|
|
148
|
+
git(["commit", "-qm", message, "--allow-empty"]);
|
|
149
|
+
return git(["rev-parse", "HEAD"]);
|
|
150
|
+
};
|
|
151
|
+
git(["init", "-q", "-b", "develop"]);
|
|
152
|
+
git(["config", "user.email", "t@t.t"]);
|
|
153
|
+
git(["config", "user.name", "t"]);
|
|
154
|
+
const oracle = opts.oracle ?? L1_ORACLE;
|
|
155
|
+
write(
|
|
156
|
+
"forge.yaml",
|
|
157
|
+
`schema: forge/config@1
|
|
158
|
+
project:
|
|
159
|
+
name: gate-fixture
|
|
160
|
+
paths: {}
|
|
161
|
+
bindings:
|
|
162
|
+
schema: forge/bindings@1
|
|
163
|
+
commands:
|
|
164
|
+
checkRun: "node {file}"
|
|
165
|
+
verify: "node scripts/verify.mjs"
|
|
166
|
+
paths:
|
|
167
|
+
compassDocs: [docs/requirements.xml]
|
|
168
|
+
correctnessManifest: docs/correctness.yaml
|
|
169
|
+
correctness:
|
|
170
|
+
mode: ${opts.mode ?? "enforce"}
|
|
171
|
+
tier: ${opts.tier ?? "standard"}
|
|
172
|
+
`,
|
|
173
|
+
);
|
|
174
|
+
write(
|
|
175
|
+
"docs/requirements.xml",
|
|
176
|
+
'<requirements>\n <meta><document-id>requirements</document-id></meta>\n <requirement id="REQ-01">Never two openers</requirement>\n</requirements>\n',
|
|
177
|
+
);
|
|
178
|
+
write(
|
|
179
|
+
"apps/api/wrangler.jsonc",
|
|
180
|
+
'{ "d1_databases": [{ "binding": "DB", "database_name": "main", "database_id": "x" }] }\n',
|
|
181
|
+
);
|
|
182
|
+
write("apps/api/migrations/0001_init.sql", MIGRATION);
|
|
183
|
+
write(
|
|
184
|
+
"apps/api/src/dispatch.ts",
|
|
185
|
+
`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`,
|
|
186
|
+
);
|
|
187
|
+
write(ORACLE_PATH, oracle);
|
|
188
|
+
write("docs/correctness.yaml", manifestYaml(opts));
|
|
189
|
+
commit("product");
|
|
190
|
+
if (opts.review !== false) {
|
|
191
|
+
const rel = "docs/correctness/reviews/2026-11-13-base.yaml";
|
|
192
|
+
write(rel, reviewYaml([{ check: `test:${ORACLE_PATH}`, content: oracle }]));
|
|
193
|
+
verifierCommit(git, rel);
|
|
194
|
+
}
|
|
195
|
+
const base = git(["rev-parse", "HEAD"]);
|
|
196
|
+
return {
|
|
197
|
+
root,
|
|
198
|
+
base,
|
|
199
|
+
write,
|
|
200
|
+
read: (rel) => readFileSync(path.join(root, rel), "utf8"),
|
|
201
|
+
git,
|
|
202
|
+
commit,
|
|
203
|
+
cleanup: () => rmSync(root, { recursive: true, force: true }),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580 AC-7: in a tier high repository an oracle last changed by a commit without the verifier trailer pair is CORR-GATE-06, even when a review record covers it.</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
|
+
<item>RFC-1580: close review REVIEW-CODE-2026-11-13-04 findings
|
|
14
|
+
|
|
15
|
+
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>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
20
|
+
|
|
21
|
+
import { runCorrectnessGate } from "./run.ts";
|
|
22
|
+
import {
|
|
23
|
+
L1_ORACLE,
|
|
24
|
+
MOCK_ORACLE,
|
|
25
|
+
ORACLE_PATH,
|
|
26
|
+
lifecycleOracle,
|
|
27
|
+
makeGateFixture,
|
|
28
|
+
manifestYaml,
|
|
29
|
+
reviewYaml,
|
|
30
|
+
type GateFixture,
|
|
31
|
+
} from "./tests/gate-fixture.ts";
|
|
32
|
+
|
|
33
|
+
const fixtures: GateFixture[] = [];
|
|
34
|
+
afterEach(() => fixtures.splice(0).forEach((f) => f.cleanup()));
|
|
35
|
+
const fx = (o: Parameters<typeof makeGateFixture>[0] = {}) => {
|
|
36
|
+
const f = makeGateFixture(o);
|
|
37
|
+
fixtures.push(f);
|
|
38
|
+
return f;
|
|
39
|
+
};
|
|
40
|
+
const gate = async (f: GateFixture, acceptWeakening?: string) => {
|
|
41
|
+
const out = await runCorrectnessGate(f.root, {
|
|
42
|
+
base: f.base,
|
|
43
|
+
bundleDir: `${f.root}/.bundles`,
|
|
44
|
+
acceptWeakening,
|
|
45
|
+
});
|
|
46
|
+
if (!out.ok) throw new Error(out.usageError);
|
|
47
|
+
return out.result;
|
|
48
|
+
};
|
|
49
|
+
const rules = (r: { violations: { rule: string }[] }) => r.violations.map((v) => v.rule);
|
|
50
|
+
void [L1_ORACLE, MOCK_ORACLE, ORACLE_PATH, lifecycleOracle, manifestYaml, reviewYaml, rules];
|
|
51
|
+
|
|
52
|
+
describe("tier high", () => {
|
|
53
|
+
it("AC-7: a review-record-only oracle does not cover at tier high (CORR-GATE-06)", async () => {
|
|
54
|
+
const r = await gate(fx({ tier: "high" }));
|
|
55
|
+
const v = r.violations.find((x) => x.rule === "CORR-GATE-06");
|
|
56
|
+
expect(v?.message, "tier high needs oracle bytes from the verifier").toMatch(
|
|
57
|
+
/verifier-trailer commit/,
|
|
58
|
+
);
|
|
59
|
+
expect(r.status).toBe("fail");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("a verifier-trailer oracle covers at tier high", async () => {
|
|
63
|
+
const f = fx({ tier: "high" });
|
|
64
|
+
f.write(ORACLE_PATH, `${L1_ORACLE}// from the verifier\n`);
|
|
65
|
+
f.git(["add", "-A"]);
|
|
66
|
+
f.git([
|
|
67
|
+
"commit",
|
|
68
|
+
"-qm",
|
|
69
|
+
"test: verifier oracle\n\nX-Expectation-Origin: independent-verifier\nX-Verifier-Report: docs/correctness/reviews/r.yaml",
|
|
70
|
+
]);
|
|
71
|
+
const r = await gate(f);
|
|
72
|
+
expect(r.violations, JSON.stringify(r.violations)).toEqual([]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("tier formal without a non-self proof: oracle is CORR-GATE-06 and never runs a proof through checkRun", async () => {
|
|
76
|
+
const f = fx({ tier: "high" });
|
|
77
|
+
f.write("forge.yaml", f.read("forge.yaml").replace("tier: high", "tier: formal"));
|
|
78
|
+
f.git(["add", "-A"]);
|
|
79
|
+
f.git(["commit", "-qm", "formal"]);
|
|
80
|
+
const out = await runCorrectnessGate(f.root, {
|
|
81
|
+
base: f.git(["rev-parse", "HEAD"]),
|
|
82
|
+
bundleDir: `${f.root}/.bundles`,
|
|
83
|
+
proveSpec: async () => "proved",
|
|
84
|
+
});
|
|
85
|
+
if (!out.ok) throw new Error(out.usageError);
|
|
86
|
+
expect(
|
|
87
|
+
out.result.violations.some(
|
|
88
|
+
(v) => v.rule === "CORR-GATE-06" && /non-self proof: oracle/.test(v.message),
|
|
89
|
+
),
|
|
90
|
+
).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1580: contracts of `correctness.gate` — rule ids, violations,
|
|
4
|
+
oracle origins, the `forge/oracle-review@1` record schema, and the
|
|
5
|
+
`forge/correctness-bundle@1` evidence bundle.</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>No logic — types, schemas, constants.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1580: initial gate contracts.</item>
|
|
12
|
+
<item>RFC-1580: correctness.gate and the flow.integrate step
|
|
13
|
+
|
|
14
|
+
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>
|
|
15
|
+
<item>RFC-1580: close review REVIEW-CODE-2026-11-13-04 findings
|
|
16
|
+
|
|
17
|
+
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>
|
|
18
|
+
<item>RFC-1580: close review REVIEW-CODE-2026-11-13-05 findings
|
|
19
|
+
|
|
20
|
+
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>
|
|
21
|
+
</CHANGE_SUMMARY>
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { z } from "zod";
|
|
25
|
+
|
|
26
|
+
export type GateRuleId =
|
|
27
|
+
| "CORR-GATE-01"
|
|
28
|
+
| "CORR-GATE-02"
|
|
29
|
+
| "CORR-GATE-03"
|
|
30
|
+
| "CORR-GATE-04"
|
|
31
|
+
| "CORR-GATE-05"
|
|
32
|
+
| "CORR-GATE-06"
|
|
33
|
+
| "CORR-GATE-07"
|
|
34
|
+
| "CORR-GATE-08";
|
|
35
|
+
|
|
36
|
+
export const GATE_RULE_IDS: readonly GateRuleId[] = [
|
|
37
|
+
"CORR-GATE-01",
|
|
38
|
+
"CORR-GATE-02",
|
|
39
|
+
"CORR-GATE-03",
|
|
40
|
+
"CORR-GATE-04",
|
|
41
|
+
"CORR-GATE-05",
|
|
42
|
+
"CORR-GATE-06",
|
|
43
|
+
"CORR-GATE-07",
|
|
44
|
+
"CORR-GATE-08",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export type OracleOrigin = "verified" | "requirement" | "self";
|
|
48
|
+
|
|
49
|
+
export interface GateViolation {
|
|
50
|
+
rule: GateRuleId;
|
|
51
|
+
severity: "error" | "warning";
|
|
52
|
+
entry?: string;
|
|
53
|
+
check?: string;
|
|
54
|
+
message: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface Weakening {
|
|
58
|
+
kind: string;
|
|
59
|
+
subject: string;
|
|
60
|
+
message: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const ORACLE_REVIEW_SCHEMA = "forge/oracle-review@1" as const;
|
|
64
|
+
export const CORRECTNESS_BUNDLE_SCHEMA = "forge/correctness-bundle@1" as const;
|
|
65
|
+
export const DEFAULT_ORACLE_REVIEWS_DIR = "docs/correctness/reviews";
|
|
66
|
+
export const DEFAULT_ORACLE_TIMEOUT_MS = 300_000;
|
|
67
|
+
|
|
68
|
+
export const oracleReviewSchema = z
|
|
69
|
+
.object({
|
|
70
|
+
schema: z.literal(ORACLE_REVIEW_SCHEMA),
|
|
71
|
+
reviewedAt: z.string().min(1),
|
|
72
|
+
isolation: z.string().min(1),
|
|
73
|
+
candidate: z.string().min(1),
|
|
74
|
+
export: z.string().optional(),
|
|
75
|
+
verdict: z.enum(["pass", "fail"]),
|
|
76
|
+
oracles: z
|
|
77
|
+
.array(
|
|
78
|
+
z
|
|
79
|
+
.object({
|
|
80
|
+
check: z.string().min(1),
|
|
81
|
+
sha256: z.string().regex(/^[0-9a-f]{64}$/),
|
|
82
|
+
verdict: z.enum(["pass", "fail"]),
|
|
83
|
+
attestedHandleIsUnderTest: z.boolean().optional(),
|
|
84
|
+
notes: z.string().optional(),
|
|
85
|
+
})
|
|
86
|
+
.passthrough(),
|
|
87
|
+
)
|
|
88
|
+
.min(1),
|
|
89
|
+
})
|
|
90
|
+
.passthrough();
|
|
91
|
+
|
|
92
|
+
export type OracleReview = z.infer<typeof oracleReviewSchema>;
|
|
93
|
+
|
|
94
|
+
export interface BundleOracle {
|
|
95
|
+
check: string;
|
|
96
|
+
origin: OracleOrigin;
|
|
97
|
+
originDetail: string;
|
|
98
|
+
declaredSubstrate: string;
|
|
99
|
+
attestation: { level: string; engine: string; schemaHash: string; matches: boolean } | null;
|
|
100
|
+
command: string | null;
|
|
101
|
+
exitCode: number | null;
|
|
102
|
+
timedOut: boolean;
|
|
103
|
+
durationMs: number;
|
|
104
|
+
anchorEvents: { anchor: string; ok: boolean; reason?: string }[];
|
|
105
|
+
covers: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface BundleEntry {
|
|
109
|
+
id: string;
|
|
110
|
+
ref: string | null;
|
|
111
|
+
seam: string;
|
|
112
|
+
covered: boolean;
|
|
113
|
+
oracles: BundleOracle[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface CorrectnessBundle {
|
|
117
|
+
schema: typeof CORRECTNESS_BUNDLE_SCHEMA;
|
|
118
|
+
repository: string;
|
|
119
|
+
base: string;
|
|
120
|
+
head: string;
|
|
121
|
+
mode: string;
|
|
122
|
+
tier: string;
|
|
123
|
+
gateBuild: { forge: string; path: string };
|
|
124
|
+
entries: BundleEntry[];
|
|
125
|
+
weakenings: (Weakening & { accepted: boolean })[];
|
|
126
|
+
violations: GateViolation[];
|
|
127
|
+
limitations: string[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const BUNDLE_LIMITATIONS = [
|
|
131
|
+
"git trailers are agent-writable; the verifier trailer raises the cost of mislabeling, it does not prove authorship",
|
|
132
|
+
"a schema-hash attestation proves the handle reported a schema matching the migrations, not that every assertion used it",
|
|
133
|
+
"imports of oracle files outside the declared support globs are not frozen, and neither are runner configs outside them nor dependency patches or lockfile pins of the test-side helpers",
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
export interface CorrectnessGateResult {
|
|
137
|
+
command: "correctness.gate";
|
|
138
|
+
mode: "warn" | "enforce" | "exempt";
|
|
139
|
+
status: "pass" | "fail" | "exempt";
|
|
140
|
+
bundlePath: string;
|
|
141
|
+
violations: GateViolation[];
|
|
142
|
+
weakenings: (Weakening & { accepted: boolean })[];
|
|
143
|
+
acceptedWeakening: string | null;
|
|
144
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1579: `correctness.audit` command handler — flags, exit codes
|
|
4
|
+
(1 only for introduced errors, 2 for usage errors), pretty output, and the
|
|
5
|
+
`--write-ledger` mode (the only mutating mode; dry-run from context.dryRun,
|
|
6
|
+
DNA-110).</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No auditor logic — audit/run.ts.</item>
|
|
9
|
+
<item>Never writes the ledger from a gate path — only with --write-ledger.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1579: initial handler.</item>
|
|
14
|
+
<item>RFC-1579: correctness.audit auditors and differential attribution
|
|
15
|
+
|
|
16
|
+
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>
|
|
17
|
+
</CHANGE_SUMMARY>
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
|
|
23
|
+
import { loadForgeConfig } from "../../../src/config/forge-config.ts";
|
|
24
|
+
import type {
|
|
25
|
+
ForgeCommandInput,
|
|
26
|
+
ForgeCommandResult,
|
|
27
|
+
ForgeRuntimeContext,
|
|
28
|
+
} from "../../../src/types.ts";
|
|
29
|
+
import { createOriginGit } from "../../rfc/verification-origin.ts";
|
|
30
|
+
import { DEFAULT_LEDGER_PATH, mergeLedger, parseLedger, serializeLedger } from "../audit/ledger.ts";
|
|
31
|
+
import { runCorrectnessAudit } from "../audit/run.ts";
|
|
32
|
+
import type { AuditCheckId, AuditResult } from "../audit/types.ts";
|
|
33
|
+
|
|
34
|
+
function flagString(input: ForgeCommandInput, name: string): string | undefined {
|
|
35
|
+
const v = input.flags[name];
|
|
36
|
+
return typeof v === "string" && v.length > 0 ? v : undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function ledgerPath(workspaceRoot: string): string {
|
|
40
|
+
try {
|
|
41
|
+
return loadForgeConfig(workspaceRoot).bindings?.paths?.correctnessLedger ?? DEFAULT_LEDGER_PATH;
|
|
42
|
+
} catch {
|
|
43
|
+
return DEFAULT_LEDGER_PATH;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function runCorrectnessAuditCommand(
|
|
48
|
+
input: ForgeCommandInput,
|
|
49
|
+
context: ForgeRuntimeContext,
|
|
50
|
+
): Promise<ForgeCommandResult<AuditResult>> {
|
|
51
|
+
const writeLedger = input.flags["write-ledger"] === true;
|
|
52
|
+
const outcome = await runCorrectnessAudit(context.workspaceRoot, {
|
|
53
|
+
base: flagString(input, "base"),
|
|
54
|
+
staged: input.flags["staged"] === true,
|
|
55
|
+
check: flagString(input, "check") as AuditCheckId | undefined,
|
|
56
|
+
});
|
|
57
|
+
if (!outcome.ok) {
|
|
58
|
+
return { exitCode: 2, summary: `[correctness.audit] usage error: ${outcome.usageError}` };
|
|
59
|
+
}
|
|
60
|
+
const data = outcome.result;
|
|
61
|
+
|
|
62
|
+
if (writeLedger) {
|
|
63
|
+
const rel = ledgerPath(context.workspaceRoot);
|
|
64
|
+
const abs = path.join(context.workspaceRoot, rel);
|
|
65
|
+
let previous: string | null = null;
|
|
66
|
+
try {
|
|
67
|
+
previous = readFileSync(abs, "utf8");
|
|
68
|
+
} catch {
|
|
69
|
+
previous = null;
|
|
70
|
+
}
|
|
71
|
+
const head =
|
|
72
|
+
(await createOriginGit(context.workspaceRoot).run(["rev-parse", "HEAD"]))?.trim() ??
|
|
73
|
+
"unknown";
|
|
74
|
+
const merged = mergeLedger(parseLedger(previous), data.findings, {
|
|
75
|
+
sha: head,
|
|
76
|
+
date: new Date().toISOString().slice(0, 10),
|
|
77
|
+
});
|
|
78
|
+
const dryRun = context.dryRun === true;
|
|
79
|
+
if (!dryRun) {
|
|
80
|
+
mkdirSync(path.dirname(abs), { recursive: true });
|
|
81
|
+
writeFileSync(abs, serializeLedger(merged));
|
|
82
|
+
}
|
|
83
|
+
data.ledger = { path: rel, written: !dryRun, rows: merged.rows.length };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const introduced = data.findings.filter((f) => f.attribution === "introduced");
|
|
87
|
+
if (context.outputFormat === "pretty") {
|
|
88
|
+
for (const f of data.findings) {
|
|
89
|
+
if (f.attribution === "resolved") continue;
|
|
90
|
+
const where = f.location ? ` (${f.location.file}:${f.location.line})` : "";
|
|
91
|
+
const line = `${f.rule} ${f.check} [${f.attribution}] ${f.subject}: ${f.message}${where}`;
|
|
92
|
+
if (f.attribution === "introduced" && f.severity === "error") context.logger.error(line);
|
|
93
|
+
else context.logger.warn(line);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const summary =
|
|
97
|
+
`correctness.audit: ${data.status} against ${data.base.slice(0, 12)} — ` +
|
|
98
|
+
`${introduced.length} introduced, ${data.findings.filter((f) => f.attribution === "legacy").length} legacy, ` +
|
|
99
|
+
`${data.findings.filter((f) => f.attribution === "accepted").length} accepted, ` +
|
|
100
|
+
`${data.findings.filter((f) => f.attribution === "resolved").length} resolved; ` +
|
|
101
|
+
`${data.unverifiable} unverifiable statement(s)` +
|
|
102
|
+
(data.skipped.length > 0 ? `; skipped: ${data.skipped.join(", ")}` : "") +
|
|
103
|
+
(data.ledger
|
|
104
|
+
? `; ledger ${data.ledger.written ? "written" : "planned (dry-run)"}: ${data.ledger.path} (${data.ledger.rows} rows)`
|
|
105
|
+
: "");
|
|
106
|
+
return { data, summary, exitCode: data.status === "fail" ? 1 : 0 };
|
|
107
|
+
}
|