@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,98 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1579: temp git repositories for correctness.audit tests — a D1
|
|
4
|
+
consumer shape (apps/api/wrangler.jsonc + migrations + src), a base commit,
|
|
5
|
+
and helpers to edit the working tree or the index afterwards.</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not production code — imported by *.test.ts only.</item>
|
|
8
|
+
<item>Never exports GIT_DIR — every git call passes cwd explicitly.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1579: initial fixture.</item>
|
|
13
|
+
<item>RFC-1579: correctness.audit auditors and differential attribution
|
|
14
|
+
|
|
15
|
+
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>
|
|
16
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
// test-adjacency: exempt — no test reason: test support module, exercised by every audit test
|
|
19
|
+
|
|
20
|
+
import { execFileSync } from "node:child_process";
|
|
21
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
22
|
+
import os from "node:os";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
|
|
25
|
+
export const WRANGLER = `{
|
|
26
|
+
// D1 consumer
|
|
27
|
+
"name": "api",
|
|
28
|
+
"d1_databases": [
|
|
29
|
+
{ "binding": "DB", "database_name": "steward", "database_id": "x", "migrations_dir": "migrations", },
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export const MIGRATION = `CREATE TABLE openers (id TEXT PRIMARY KEY, target TEXT NOT NULL, sent_at TEXT);
|
|
35
|
+
CREATE TABLE candidates (id TEXT PRIMARY KEY, state TEXT NOT NULL);
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
export const FORGE_YAML = `schema: forge/config@1
|
|
39
|
+
project:
|
|
40
|
+
name: fixture
|
|
41
|
+
bindings:
|
|
42
|
+
schema: forge/bindings@1
|
|
43
|
+
commands:
|
|
44
|
+
test: pnpm test
|
|
45
|
+
verify: pnpm exec tsx scripts/verify-dispatch.ts
|
|
46
|
+
paths: {}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
/** Code that reads and writes both tables, so ledger.orphans stays quiet. */
|
|
50
|
+
export const BASE_CODE = `export async function dispatch(db: D1) {
|
|
51
|
+
await db.prepare("INSERT INTO openers (id, target) VALUES (?, ?)").bind("a", "b").run();
|
|
52
|
+
await db.prepare("SELECT id, target FROM openers WHERE target = ?").bind("b").all();
|
|
53
|
+
await db.prepare("UPDATE candidates SET state = ? WHERE id = ?").bind("queued", "c").run();
|
|
54
|
+
return db.prepare("SELECT id, state FROM candidates").all();
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
export interface GitFixture {
|
|
59
|
+
root: string;
|
|
60
|
+
base: string;
|
|
61
|
+
write(rel: string, body: string): void;
|
|
62
|
+
git(args: string[]): string;
|
|
63
|
+
commit(message: string): string;
|
|
64
|
+
cleanup(): void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function makeGitFixture(files: Record<string, string> = {}): GitFixture {
|
|
68
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "forge-audit-"));
|
|
69
|
+
const write = (rel: string, body: string) => {
|
|
70
|
+
mkdirSync(path.dirname(path.join(root, rel)), { recursive: true });
|
|
71
|
+
writeFileSync(path.join(root, rel), body);
|
|
72
|
+
};
|
|
73
|
+
const git = (args: string[]) => execFileSync("git", args, { cwd: root, encoding: "utf8" }).trim();
|
|
74
|
+
const commit = (message: string) => {
|
|
75
|
+
git(["add", "-A"]);
|
|
76
|
+
git(["commit", "-qm", message, "--allow-empty"]);
|
|
77
|
+
return git(["rev-parse", "HEAD"]);
|
|
78
|
+
};
|
|
79
|
+
git(["init", "-q", "-b", "develop"]);
|
|
80
|
+
git(["config", "user.email", "t@t.t"]);
|
|
81
|
+
git(["config", "user.name", "t"]);
|
|
82
|
+
const defaults: Record<string, string> = {
|
|
83
|
+
"forge.yaml": FORGE_YAML,
|
|
84
|
+
"apps/api/wrangler.jsonc": WRANGLER,
|
|
85
|
+
"apps/api/migrations/0001_init.sql": MIGRATION,
|
|
86
|
+
"apps/api/src/dispatch.ts": BASE_CODE,
|
|
87
|
+
};
|
|
88
|
+
for (const [rel, body] of Object.entries({ ...defaults, ...files })) write(rel, body);
|
|
89
|
+
const base = commit("base");
|
|
90
|
+
return {
|
|
91
|
+
root,
|
|
92
|
+
base,
|
|
93
|
+
write,
|
|
94
|
+
git,
|
|
95
|
+
commit,
|
|
96
|
+
cleanup: () => rmSync(root, { recursive: true, force: true }),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1579: contracts of `correctness.audit` — check ids, rule ids,
|
|
4
|
+
findings, attribution, and the command result.</purpose>
|
|
5
|
+
<non-goals>
|
|
6
|
+
<item>No logic — types and constants only.</item>
|
|
7
|
+
</non-goals>
|
|
8
|
+
</MODULE_CONTRACT>
|
|
9
|
+
<CHANGE_SUMMARY>
|
|
10
|
+
<item>RFC-1579: initial audit contracts.</item>
|
|
11
|
+
<item>RFC-1579: correctness.audit auditors and differential attribution
|
|
12
|
+
|
|
13
|
+
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>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export type AuditCheckId =
|
|
18
|
+
| "sql.schema.conform"
|
|
19
|
+
| "ledger.orphans"
|
|
20
|
+
| "state.transitions.coverage"
|
|
21
|
+
| "bindings.verify.substance";
|
|
22
|
+
|
|
23
|
+
export type AuditRuleId = "CORR-AUDIT-01" | "CORR-AUDIT-02" | "CORR-AUDIT-03" | "CORR-AUDIT-04";
|
|
24
|
+
|
|
25
|
+
export const AUDIT_RULE_OF: Record<AuditCheckId, AuditRuleId> = {
|
|
26
|
+
"sql.schema.conform": "CORR-AUDIT-01",
|
|
27
|
+
"ledger.orphans": "CORR-AUDIT-02",
|
|
28
|
+
"state.transitions.coverage": "CORR-AUDIT-03",
|
|
29
|
+
"bindings.verify.substance": "CORR-AUDIT-04",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const AUDIT_CHECK_IDS: readonly AuditCheckId[] = [
|
|
33
|
+
"sql.schema.conform",
|
|
34
|
+
"ledger.orphans",
|
|
35
|
+
"state.transitions.coverage",
|
|
36
|
+
"bindings.verify.substance",
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/** Code auditors are differential; the configuration auditor always blocks when present. */
|
|
40
|
+
export const CODE_CHECKS: ReadonlySet<AuditCheckId> = new Set([
|
|
41
|
+
"sql.schema.conform",
|
|
42
|
+
"ledger.orphans",
|
|
43
|
+
"state.transitions.coverage",
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
export type AuditSeverity = "error" | "warning" | "info";
|
|
47
|
+
export type AuditAttribution = "introduced" | "legacy" | "resolved" | "accepted";
|
|
48
|
+
|
|
49
|
+
/** One auditor result before attribution. */
|
|
50
|
+
export interface RawFinding {
|
|
51
|
+
check: AuditCheckId;
|
|
52
|
+
subject: string;
|
|
53
|
+
severity: AuditSeverity;
|
|
54
|
+
message: string;
|
|
55
|
+
location?: { file: string; line: number };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AuditFinding {
|
|
59
|
+
rule: AuditRuleId;
|
|
60
|
+
check: AuditCheckId;
|
|
61
|
+
key: string;
|
|
62
|
+
subject: string;
|
|
63
|
+
occurrences: number;
|
|
64
|
+
severity: AuditSeverity;
|
|
65
|
+
attribution: AuditAttribution;
|
|
66
|
+
location?: { file: string; line: number };
|
|
67
|
+
message: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** One auditor pass over a snapshot. */
|
|
71
|
+
export interface AuditorOutput {
|
|
72
|
+
findings: RawFinding[];
|
|
73
|
+
unverifiable: number;
|
|
74
|
+
skipped: string[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface AuditResult {
|
|
78
|
+
command: "correctness.audit";
|
|
79
|
+
base: string;
|
|
80
|
+
status: "pass" | "fail";
|
|
81
|
+
findings: AuditFinding[];
|
|
82
|
+
unverifiable: number;
|
|
83
|
+
skipped: string[];
|
|
84
|
+
ledger?: { path: string; written: boolean; rows: number };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface AllowEntry {
|
|
88
|
+
check: string;
|
|
89
|
+
subject: string;
|
|
90
|
+
reason: string;
|
|
91
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1578 AC-5: CORR-07 capture provenance — an expired, incomplete, or missing sidecar is an error; near expiry is a warning; a fresh capture lets L1 stand in for L3.</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
|
+
</CHANGE_SUMMARY>
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
20
|
+
|
|
21
|
+
import { validateCorrectnessManifest } from "./handlers/validate.ts";
|
|
22
|
+
import { BASE_MANIFEST, makeWorkspace } from "./tests/fixture-workspace.ts";
|
|
23
|
+
|
|
24
|
+
const DAY = 24 * 60 * 60 * 1000;
|
|
25
|
+
const NOW = Date.parse("2026-11-12T12:00:00Z");
|
|
26
|
+
const CAPTURE = "test/captures/draft.json";
|
|
27
|
+
|
|
28
|
+
const PROVIDER_MANIFEST = BASE_MANIFEST.replace("seam: data", "seam: provider").replace(
|
|
29
|
+
"substrate: L1",
|
|
30
|
+
`substrate: L1\n captures: [${CAPTURE}]`,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const sidecar = (recordedAt: string, ttlDays = 30, extra = "") =>
|
|
34
|
+
`schema: forge/correctness-capture@1\nrecordedAt: ${recordedAt}\nprovider: workers-ai\nmodel: "@cf/meta/llama"\nttlDays: ${ttlDays}\norigin: "L3 run"\n${extra}`;
|
|
35
|
+
|
|
36
|
+
const cleanups: (() => void)[] = [];
|
|
37
|
+
afterEach(() => cleanups.splice(0).forEach((c) => c()));
|
|
38
|
+
const run = async (files: Record<string, string>) => {
|
|
39
|
+
const w = makeWorkspace({ manifest: PROVIDER_MANIFEST, files });
|
|
40
|
+
cleanups.push(w.cleanup);
|
|
41
|
+
return validateCorrectnessManifest(w.root, { now: NOW });
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
describe("CORR-07 capture provenance", () => {
|
|
45
|
+
it("AC-5: a sidecar recordedAt older than ttlDays is a CORR-07 error", async () => {
|
|
46
|
+
const res = await run({
|
|
47
|
+
[CAPTURE]: "{}",
|
|
48
|
+
[`${CAPTURE}.capture.yaml`]: sidecar(new Date(NOW - 45 * DAY).toISOString()),
|
|
49
|
+
});
|
|
50
|
+
const v = res.violations.find((x) => x.rule === "CORR-07");
|
|
51
|
+
expect(v, "a 45-day-old capture with ttlDays 30 must be refused").toBeDefined();
|
|
52
|
+
expect(v!.severity).toBe("error");
|
|
53
|
+
expect(v!.message).toMatch(/past its ttlDays 30/);
|
|
54
|
+
// The stale capture no longer lets the L1 oracle stand in for L3.
|
|
55
|
+
expect(res.violations.some((x) => x.rule === "CORR-06")).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("a fresh capture passes and satisfies the provider minimum", async () => {
|
|
59
|
+
const res = await run({
|
|
60
|
+
[CAPTURE]: "{}",
|
|
61
|
+
[`${CAPTURE}.capture.yaml`]: sidecar(new Date(NOW - 2 * DAY).toISOString()),
|
|
62
|
+
});
|
|
63
|
+
expect(res.violations.filter((x) => x.rule === "CORR-07" || x.rule === "CORR-06")).toEqual([]);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("a capture within 7 days of expiry warns", async () => {
|
|
67
|
+
const res = await run({
|
|
68
|
+
[CAPTURE]: "{}",
|
|
69
|
+
[`${CAPTURE}.capture.yaml`]: sidecar(new Date(NOW - 25 * DAY).toISOString()),
|
|
70
|
+
});
|
|
71
|
+
const v = res.violations.find((x) => x.rule === "CORR-07");
|
|
72
|
+
expect(v?.severity).toBe("warning");
|
|
73
|
+
expect(res.violations.some((x) => x.rule === "CORR-06")).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("a missing sidecar and a sidecar without model are errors", async () => {
|
|
77
|
+
const missing = await run({ [CAPTURE]: "{}" });
|
|
78
|
+
expect(missing.violations.find((x) => x.rule === "CORR-07")?.message).toMatch(/no sidecar/);
|
|
79
|
+
const noModel = await run({
|
|
80
|
+
[CAPTURE]: "{}",
|
|
81
|
+
[`${CAPTURE}.capture.yaml`]: sidecar(new Date(NOW).toISOString()).replace(/model: .*\n/, ""),
|
|
82
|
+
});
|
|
83
|
+
expect(noModel.violations.find((x) => x.rule === "CORR-07")?.message).toMatch(/model/);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("only <capture>.capture.yaml counts as the sidecar", async () => {
|
|
87
|
+
const res = await run({
|
|
88
|
+
[CAPTURE]: "{}",
|
|
89
|
+
"test/captures/draft.capture.yaml": sidecar(new Date(NOW - DAY).toISOString()),
|
|
90
|
+
});
|
|
91
|
+
expect(res.violations.find((x) => x.rule === "CORR-07")?.message).toMatch(/no sidecar/);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("a recordedAt in the future and a capture outside the workspace are errors", async () => {
|
|
95
|
+
const future = await run({
|
|
96
|
+
[CAPTURE]: "{}",
|
|
97
|
+
[`${CAPTURE}.capture.yaml`]: sidecar(new Date(NOW + 10 * DAY).toISOString()),
|
|
98
|
+
});
|
|
99
|
+
expect(future.violations.find((x) => x.rule === "CORR-07")?.message).toMatch(/in the future/);
|
|
100
|
+
const w = makeWorkspace({ manifest: PROVIDER_MANIFEST.replace(CAPTURE, "../outside.json") });
|
|
101
|
+
cleanups.push(w.cleanup);
|
|
102
|
+
const escaped = await validateCorrectnessManifest(w.root, { now: NOW });
|
|
103
|
+
expect(escaped.violations.find((x) => x.rule === "CORR-07")?.message).toMatch(
|
|
104
|
+
/escapes the workspace/,
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1578 AC-7: the anchor chain — CORR-05 oracle must be named by an anchor's checked-by; CORR-04 anchors must exist and be bound; CORR-03 refs resolve; CORR-02 shape.</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 { execFileSync } from "node:child_process";
|
|
25
|
+
import { rmSync, writeFileSync } from "node:fs";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
|
|
28
|
+
import { buildAnchorIndex } from "./anchors.ts";
|
|
29
|
+
import { validateCorrectnessManifest } from "./handlers/validate.ts";
|
|
30
|
+
import { listWorkspaceFiles } from "./workspace.ts";
|
|
31
|
+
import {
|
|
32
|
+
ANCHORED_SOURCE,
|
|
33
|
+
BASE_MANIFEST,
|
|
34
|
+
MARKER,
|
|
35
|
+
makeWorkspace,
|
|
36
|
+
} from "./tests/fixture-workspace.ts";
|
|
37
|
+
|
|
38
|
+
const cleanups: (() => void)[] = [];
|
|
39
|
+
afterEach(() => cleanups.splice(0).forEach((c) => c()));
|
|
40
|
+
const run = async (opts: Parameters<typeof makeWorkspace>[0]) => {
|
|
41
|
+
const w = makeWorkspace(opts);
|
|
42
|
+
cleanups.push(w.cleanup);
|
|
43
|
+
return validateCorrectnessManifest(w.root);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const RFC = `---
|
|
47
|
+
id: RFC-0005
|
|
48
|
+
status: accepted
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# RFC-0005
|
|
52
|
+
|
|
53
|
+
## Fixed inputs
|
|
54
|
+
|
|
55
|
+
| ID | Value | Source | Checked by |
|
|
56
|
+
| --- | --- | --- | --- |
|
|
57
|
+
| FI-1 | \`x\` | grilling | AC-1 |
|
|
58
|
+
|
|
59
|
+
## Acceptance criteria
|
|
60
|
+
|
|
61
|
+
- [ ] AC-3: THE dispatch SHALL write send_ready (evidence: probe:AC-3)
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
describe("anchor chain", () => {
|
|
65
|
+
it("AC-7: an oracle absent from every anchor's checked-by is a CORR-05 error", async () => {
|
|
66
|
+
const res = await run({
|
|
67
|
+
manifest: BASE_MANIFEST.replace(
|
|
68
|
+
"check: test:src/dispatch.schema.test.ts",
|
|
69
|
+
"check: test:src/other.test.ts",
|
|
70
|
+
),
|
|
71
|
+
});
|
|
72
|
+
const v = res.violations.find((x) => x.rule === "CORR-05");
|
|
73
|
+
expect(v, "the manifest must not name a check the invariant does not bind").toBeDefined();
|
|
74
|
+
expect(v!.severity).toBe("error");
|
|
75
|
+
expect(v!.message).toMatch(/src\/other.test.ts/);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("path spellings normalize before comparison", async () => {
|
|
79
|
+
const res = await run({
|
|
80
|
+
manifest: BASE_MANIFEST.replace(
|
|
81
|
+
"check: test:src/dispatch.schema.test.ts",
|
|
82
|
+
"check: test:./src/dispatch.schema.test.ts",
|
|
83
|
+
),
|
|
84
|
+
});
|
|
85
|
+
expect(res.violations.filter((x) => x.rule === "CORR-05")).toEqual([]);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("a check kind outside the RFC-1390 set fails CORR-05", async () => {
|
|
89
|
+
const res = await run({
|
|
90
|
+
manifest: BASE_MANIFEST.replace(
|
|
91
|
+
"check: test:src/dispatch.schema.test.ts",
|
|
92
|
+
"check: script:run.sh",
|
|
93
|
+
),
|
|
94
|
+
});
|
|
95
|
+
expect(res.violations.find((x) => x.rule === "CORR-05")?.message).toMatch(
|
|
96
|
+
/not an RFC-1390 binding/,
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("CORR-04: an undeclared anchor and an unbound anchor are errors", async () => {
|
|
101
|
+
const undeclared = await run({
|
|
102
|
+
manifest: BASE_MANIFEST.replace("anchors: [INV-dispatch-01]", "anchors: [INV-missing-01]"),
|
|
103
|
+
});
|
|
104
|
+
expect(undeclared.violations.find((x) => x.rule === "CORR-04")?.message).toMatch(
|
|
105
|
+
/INV-missing-01 is declared by no/,
|
|
106
|
+
);
|
|
107
|
+
const unbound = await run({
|
|
108
|
+
manifest: BASE_MANIFEST.replace("anchors: [INV-dispatch-01]", "anchors: [INV-dispatch-02]"),
|
|
109
|
+
files: {
|
|
110
|
+
"src/extra.ts": `// ${MARKER}[INV-dispatch-02]: dispatch never sends two openers to one target\nexport {};\n`,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
expect(unbound.violations.find((x) => x.rule === "CORR-04")?.message).toMatch(
|
|
114
|
+
/no checked-by binding/,
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("CORR-03: unresolved requirement, DNA, and RFC refs are errors; resolved ones pass", async () => {
|
|
119
|
+
const bad = await run({ manifest: BASE_MANIFEST.replace("ref: REQ-01", "ref: REQ-99") });
|
|
120
|
+
expect(bad.violations.find((x) => x.rule === "CORR-03")?.message).toMatch(
|
|
121
|
+
/REQ-99 is not declared/,
|
|
122
|
+
);
|
|
123
|
+
const rfcAc = await run({
|
|
124
|
+
manifest: BASE_MANIFEST.replace(
|
|
125
|
+
"source: req\n ref: REQ-01",
|
|
126
|
+
"source: rfc-ac\n ref: RFC-0005/AC-3",
|
|
127
|
+
),
|
|
128
|
+
files: { "docs/rfcs/archive/rfc-0005-dispatch.md": RFC },
|
|
129
|
+
});
|
|
130
|
+
expect(rfcAc.violations.filter((x) => x.rule === "CORR-03")).toEqual([]);
|
|
131
|
+
const fi = await run({
|
|
132
|
+
manifest: BASE_MANIFEST.replace(
|
|
133
|
+
"source: req\n ref: REQ-01",
|
|
134
|
+
"source: fixed-input\n ref: RFC-0005/FI-2",
|
|
135
|
+
),
|
|
136
|
+
files: { "docs/rfcs/rfc-0005-dispatch.md": RFC },
|
|
137
|
+
});
|
|
138
|
+
expect(fi.violations.find((x) => x.rule === "CORR-03")?.message).toMatch(/declares no FI-2/);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("CORR-02: bad entry ids, duplicates, a domain entry without statement, and dead support globs", async () => {
|
|
142
|
+
const manifest = BASE_MANIFEST.replace("id: CM-dispatch-01", "id: CORR-dispatch-1")
|
|
143
|
+
.replace("source: req\n ref: REQ-01", "source: domain")
|
|
144
|
+
.replace("support: []", "support: [harness/**]");
|
|
145
|
+
const res = await run({ manifest });
|
|
146
|
+
const msgs = res.violations.filter((x) => x.rule === "CORR-02").map((x) => x.message);
|
|
147
|
+
expect(msgs.some((m) => /does not match CM-/.test(m))).toBe(true);
|
|
148
|
+
expect(msgs.some((m) => /domain entry needs a statement/.test(m))).toBe(true);
|
|
149
|
+
expect(msgs.some((m) => /support glob "harness\/\*\*" matches no file/.test(m))).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it("an unparseable manifest is CORR-01; a schema violation is CORR-02", async () => {
|
|
153
|
+
const yaml = await run({ mode: "enforce", manifest: "schema: [unclosed\n" });
|
|
154
|
+
expect(yaml.violations.find((x) => x.rule === "CORR-01")?.severity).toBe("error");
|
|
155
|
+
const schema = await run({ manifest: "schema: forge/correctness-manifest@2\nentries: []\n" });
|
|
156
|
+
expect(schema.violations.some((x) => x.rule === "CORR-02")).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("a documentation code fence never declares a code anchor (CORR-04 fires)", async () => {
|
|
160
|
+
const fence =
|
|
161
|
+
"```ts\n// " +
|
|
162
|
+
MARKER +
|
|
163
|
+
"[INV-doc-01]: dispatch never sends two openers to one target (checked-by: test:src/dispatch.schema.test.ts)\n```\n";
|
|
164
|
+
const res = await run({
|
|
165
|
+
manifest: BASE_MANIFEST.replace("anchors: [INV-dispatch-01]", "anchors: [INV-doc-01]"),
|
|
166
|
+
files: { "docs/guide.md": fence },
|
|
167
|
+
});
|
|
168
|
+
expect(res.violations.find((x) => x.rule === "CORR-04")?.message).toMatch(
|
|
169
|
+
/INV-doc-01 is declared by no/,
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe("anchor index hint", () => {
|
|
175
|
+
const indexYaml = (file: string) =>
|
|
176
|
+
`schema: forge/invariant-index@1\ninvariants:\n - id: INV-dispatch-01\n file: ${file}\n line: 2\n statement: x\n bindings:\n - kind: test\n target: src/dispatch.schema.test.ts\n resolved: true\nretiredIds: []\n`;
|
|
177
|
+
|
|
178
|
+
it("uses the index when every named anchor re-parses from its recorded file", () => {
|
|
179
|
+
const w = makeWorkspace({
|
|
180
|
+
files: { "docs/invariants.generated.yaml": indexYaml("src/dispatch.ts") },
|
|
181
|
+
});
|
|
182
|
+
cleanups.push(w.cleanup);
|
|
183
|
+
const idx = buildAnchorIndex(w.root, ["src/dispatch.ts"], ["INV-dispatch-01"]);
|
|
184
|
+
expect(idx.source).toBe("index");
|
|
185
|
+
expect(idx.anchors.get("INV-dispatch-01")![0]!.checkedBy).toEqual([
|
|
186
|
+
"test:src/dispatch.schema.test.ts",
|
|
187
|
+
]);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it("ignores an index row whose file the workspace listing does not include", () => {
|
|
191
|
+
const w = makeWorkspace({
|
|
192
|
+
files: {
|
|
193
|
+
"docs/invariants.generated.yaml": indexYaml("dist/dispatch.ts"),
|
|
194
|
+
"dist/dispatch.ts": ANCHORED_SOURCE,
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
cleanups.push(w.cleanup);
|
|
198
|
+
writeFileSync(path.join(w.root, "src/dispatch.ts"), "export {};\n");
|
|
199
|
+
const idx = buildAnchorIndex(w.root, ["src/dispatch.ts"], ["INV-dispatch-01"]);
|
|
200
|
+
expect(idx.source).toBe("scan");
|
|
201
|
+
expect(idx.anchors.has("INV-dispatch-01")).toBe(false);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("falls back to the scan when the recorded file no longer declares the anchor", () => {
|
|
205
|
+
const w = makeWorkspace({
|
|
206
|
+
files: { "docs/invariants.generated.yaml": indexYaml("src/deleted.ts") },
|
|
207
|
+
});
|
|
208
|
+
cleanups.push(w.cleanup);
|
|
209
|
+
rmSync(path.join(w.root, "src/dispatch.ts"));
|
|
210
|
+
const idx = buildAnchorIndex(w.root, [], ["INV-dispatch-01"]);
|
|
211
|
+
expect(idx.source).toBe("scan");
|
|
212
|
+
expect(
|
|
213
|
+
idx.anchors.has("INV-dispatch-01"),
|
|
214
|
+
"a deleted anchor must not survive through a stale index",
|
|
215
|
+
).toBe(false);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe("workspace file listing", () => {
|
|
220
|
+
it("lists tracked and untracked files and honours .gitignore in a git repository", async () => {
|
|
221
|
+
const w = makeWorkspace({});
|
|
222
|
+
cleanups.push(w.cleanup);
|
|
223
|
+
execFileSync("git", ["init", "-q"], { cwd: w.root });
|
|
224
|
+
execFileSync("git", ["add", "src/dispatch.ts"], { cwd: w.root });
|
|
225
|
+
writeFileSync(path.join(w.root, ".gitignore"), "ignored.ts\n");
|
|
226
|
+
writeFileSync(path.join(w.root, "ignored.ts"), "x");
|
|
227
|
+
const files = await listWorkspaceFiles(w.root);
|
|
228
|
+
expect(files).toContain("src/dispatch.ts"); // tracked (--cached)
|
|
229
|
+
expect(files).toContain("src/dispatch.schema.test.ts"); // untracked (--others)
|
|
230
|
+
expect(files).not.toContain("ignored.ts");
|
|
231
|
+
});
|
|
232
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1578 AC-3: CORR-08 requirement/DNA coverage — a silent requirement id is an error in enforce and a warning in warn; anchored and exempted ids count separately.</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 ws = (opts: Parameters<typeof makeWorkspace>[0]) => {
|
|
24
|
+
const w = makeWorkspace(opts);
|
|
25
|
+
cleanups.push(w.cleanup);
|
|
26
|
+
return w.root;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe("CORR-08 coverage", () => {
|
|
30
|
+
it("AC-3: enforce mode reports a silent requirement id as a CORR-08 error", async () => {
|
|
31
|
+
const root = ws({ mode: "enforce", requirements: ["REQ-01", "REQ-05"] });
|
|
32
|
+
const res = await validateCorrectnessManifest(root);
|
|
33
|
+
const v = res.violations.find((x) => x.rule === "CORR-08" && x.ref === "REQ-05");
|
|
34
|
+
expect(v, "REQ-05 has no entry and no exemption — CORR-08 must name it").toBeDefined();
|
|
35
|
+
expect(v!.severity).toBe("error");
|
|
36
|
+
expect(res.status).toBe("fail");
|
|
37
|
+
expect(res.coverage.req).toEqual({ total: 2, anchored: 1, exempt: 0, silent: 1 });
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("warn mode reports the same silence as a warning and passes", async () => {
|
|
41
|
+
const root = ws({ mode: "warn", requirements: ["REQ-01", "REQ-05"] });
|
|
42
|
+
const res = await validateCorrectnessManifest(root);
|
|
43
|
+
expect(res.violations.find((x) => x.ref === "REQ-05")!.severity).toBe("warning");
|
|
44
|
+
expect(res.status).toBe("pass");
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("exemptions cover requirement and DNA ids", async () => {
|
|
48
|
+
const manifest = `${BASE_MANIFEST.replace("exemptions: []\n", "")}exemptions:
|
|
49
|
+
- ref: REQ-05
|
|
50
|
+
kind: deferred
|
|
51
|
+
task: "verbund:T-0001"
|
|
52
|
+
- ref: DNA-3
|
|
53
|
+
kind: unverifiable
|
|
54
|
+
reason: "platform-side"
|
|
55
|
+
`;
|
|
56
|
+
const root = ws({ mode: "enforce", requirements: ["REQ-01", "REQ-05"], dna: [3], manifest });
|
|
57
|
+
const res = await validateCorrectnessManifest(root);
|
|
58
|
+
expect(res.violations.filter((x) => x.rule === "CORR-08")).toEqual([]);
|
|
59
|
+
expect(res.coverage.req.exempt).toBe(1);
|
|
60
|
+
expect(res.coverage.dna).toEqual({ total: 1, anchored: 0, exempt: 1, silent: 0 });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("a missing requirements document reports req.total 0 and a CORR-08 warning", async () => {
|
|
64
|
+
const root = ws({ mode: "enforce", files: { "docs/requirements.xml": "<other/>\n" } });
|
|
65
|
+
const res = await validateCorrectnessManifest(root);
|
|
66
|
+
expect(res.coverage.req.total).toBe(0);
|
|
67
|
+
const v = res.violations.find(
|
|
68
|
+
(x) => x.rule === "CORR-08" && /requirements document/.test(x.message),
|
|
69
|
+
);
|
|
70
|
+
expect(v?.severity).toBe("warning");
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("CORR-09: malformed exemptions are errors", async () => {
|
|
74
|
+
const manifest = `${BASE_MANIFEST.replace("exemptions: []\n", "")}exemptions:
|
|
75
|
+
- ref: REQ-01
|
|
76
|
+
kind: deferred
|
|
77
|
+
- ref: NOPE-1
|
|
78
|
+
kind: unverifiable
|
|
79
|
+
`;
|
|
80
|
+
const res = await validateCorrectnessManifest(ws({ manifest }));
|
|
81
|
+
const rules = res.violations.filter((x) => x.rule === "CORR-09").map((x) => x.message);
|
|
82
|
+
expect(rules.some((m) => /deferred needs a task/.test(m))).toBe(true);
|
|
83
|
+
expect(rules.some((m) => /unverifiable needs a reason/.test(m))).toBe(true);
|
|
84
|
+
expect(rules.some((m) => /NOPE-1 resolves to no/.test(m))).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
});
|