@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,200 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1568 gate-run record lifecycle tests (AC-2, AC-3): attached-mode
|
|
4
|
+
finish writes endedAt + exit code; a `running` record whose pid is dead
|
|
5
|
+
classifies `lost`; retention deletes beyond 50 per command but never
|
|
6
|
+
touches running records; corrupt records are skipped, not thrown.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No real git repo — records live under a temp common dir.</item>
|
|
9
|
+
</non-goals>
|
|
10
|
+
</MODULE_CONTRACT>
|
|
11
|
+
<CHANGE_SUMMARY>
|
|
12
|
+
<item>RFC-1568: step 2 — record lifecycle tests</item>
|
|
13
|
+
<item>RFC-1568: durable gate-run records, --detach mechanics, and forge CLI wiring</item>
|
|
14
|
+
</CHANGE_SUMMARY>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { spawnSync } from "node:child_process";
|
|
18
|
+
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
19
|
+
import { hostname, tmpdir } from "node:os";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
|
|
22
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
23
|
+
|
|
24
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
25
|
+
import {
|
|
26
|
+
GATE_RUN_RETENTION,
|
|
27
|
+
classifyGateRun,
|
|
28
|
+
finishGateRun,
|
|
29
|
+
gateRunsDir,
|
|
30
|
+
listGateRuns,
|
|
31
|
+
saveGateRun,
|
|
32
|
+
startGateRun,
|
|
33
|
+
} from "../record.ts";
|
|
34
|
+
import { GATE_RUN_SCHEMA, type GateRunRecord } from "../types.ts";
|
|
35
|
+
|
|
36
|
+
const dirs: string[] = [];
|
|
37
|
+
afterEach(async () => {
|
|
38
|
+
for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
|
|
39
|
+
}, 20_000);
|
|
40
|
+
|
|
41
|
+
async function tempCommon(): Promise<string> {
|
|
42
|
+
const dir = await mkdtemp(join(tmpdir(), "gate-run-"));
|
|
43
|
+
dirs.push(dir);
|
|
44
|
+
return dir;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const deadPid = (): number => {
|
|
48
|
+
const pid = spawnSync(process.execPath, ["-e", ""]).pid;
|
|
49
|
+
if (pid === undefined) throw new Error("spawn failed — cannot produce a dead pid");
|
|
50
|
+
return pid;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function fixtureRecord(over: Partial<GateRunRecord> = {}): GateRunRecord {
|
|
54
|
+
return {
|
|
55
|
+
schema: GATE_RUN_SCHEMA,
|
|
56
|
+
runId: over.runId ?? `gr-test-${Math.random().toString(36).slice(2, 8)}`,
|
|
57
|
+
command: "flow.integrate",
|
|
58
|
+
argv: [],
|
|
59
|
+
cwd: ".",
|
|
60
|
+
detached: false,
|
|
61
|
+
pid: process.pid,
|
|
62
|
+
host: hostname(),
|
|
63
|
+
startedAt: new Date().toISOString(),
|
|
64
|
+
status: "running",
|
|
65
|
+
...over,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const io = resolveIo(undefined);
|
|
70
|
+
|
|
71
|
+
describe("startGateRun / finishGateRun", () => {
|
|
72
|
+
it("AC-2: finish writes endedAt, exit code, and succeeded status", async () => {
|
|
73
|
+
const common = await tempCommon();
|
|
74
|
+
const record = await startGateRun({
|
|
75
|
+
commonGitDir: common,
|
|
76
|
+
command: "flow.integrate",
|
|
77
|
+
argv: ["--dry-run"],
|
|
78
|
+
cwd: ".",
|
|
79
|
+
detached: false,
|
|
80
|
+
io,
|
|
81
|
+
});
|
|
82
|
+
expect(record.status).toBe("running");
|
|
83
|
+
expect(record.pid).toBe(process.pid);
|
|
84
|
+
|
|
85
|
+
await finishGateRun(common, record, { exitCode: 0, summary: "[flow.integrate] done" }, io);
|
|
86
|
+
|
|
87
|
+
const raw = JSON.parse(
|
|
88
|
+
await readFile(join(gateRunsDir(common), `${record.runId}.json`), "utf8"),
|
|
89
|
+
) as GateRunRecord;
|
|
90
|
+
expect(raw.status).toBe("succeeded");
|
|
91
|
+
expect(raw.exitCode).toBe(0);
|
|
92
|
+
expect(raw.endedAt).toBeDefined();
|
|
93
|
+
expect(raw.summary).toBe("[flow.integrate] done");
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("AC-2: a non-zero exit records failed", async () => {
|
|
97
|
+
const common = await tempCommon();
|
|
98
|
+
const record = await startGateRun({
|
|
99
|
+
commonGitDir: common,
|
|
100
|
+
command: "ecosystem.commit",
|
|
101
|
+
argv: [],
|
|
102
|
+
cwd: ".",
|
|
103
|
+
detached: false,
|
|
104
|
+
io,
|
|
105
|
+
});
|
|
106
|
+
await finishGateRun(common, record, { exitCode: 1 }, io);
|
|
107
|
+
const [read] = await listGateRuns(common, io);
|
|
108
|
+
expect(read?.status).toBe("failed");
|
|
109
|
+
expect(read?.exitCode).toBe(1);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
describe("classifyGateRun", () => {
|
|
114
|
+
it("AC-3: running record with a dead pid classifies lost", () => {
|
|
115
|
+
const record = fixtureRecord({ pid: deadPid(), host: hostname() });
|
|
116
|
+
expect(classifyGateRun(record)).toBe("lost");
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("running record with a live pid stays running", () => {
|
|
120
|
+
const record = fixtureRecord({ pid: process.pid, host: hostname() });
|
|
121
|
+
expect(classifyGateRun(record)).toBe("running");
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("terminal statuses pass through unchanged", () => {
|
|
125
|
+
expect(classifyGateRun(fixtureRecord({ status: "succeeded" }))).toBe("succeeded");
|
|
126
|
+
expect(classifyGateRun(fixtureRecord({ status: "failed" }))).toBe("failed");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe("listGateRuns", () => {
|
|
131
|
+
it("skips corrupt records and returns newest first", async () => {
|
|
132
|
+
const common = await tempCommon();
|
|
133
|
+
const older = fixtureRecord({ runId: "gr-older", startedAt: "2026-01-01T00:00:00.000Z" });
|
|
134
|
+
const newer = fixtureRecord({ runId: "gr-newer", startedAt: "2026-01-02T00:00:00.000Z" });
|
|
135
|
+
await saveGateRun(common, older, io);
|
|
136
|
+
await saveGateRun(common, newer, io);
|
|
137
|
+
await writeFile(join(gateRunsDir(common), "gr-corrupt.json"), "{not json");
|
|
138
|
+
|
|
139
|
+
const runs = await listGateRuns(common, io);
|
|
140
|
+
expect(runs.map((r) => r.runId)).toEqual(["gr-newer", "gr-older"]);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("filters by command and limit", async () => {
|
|
144
|
+
const common = await tempCommon();
|
|
145
|
+
await saveGateRun(common, fixtureRecord({ runId: "gr-a", command: "flow.integrate" }), io);
|
|
146
|
+
await saveGateRun(common, fixtureRecord({ runId: "gr-b", command: "ecosystem.commit" }), io);
|
|
147
|
+
|
|
148
|
+
const filtered = await listGateRuns(common, io, { command: "flow.integrate" });
|
|
149
|
+
expect(filtered).toHaveLength(1);
|
|
150
|
+
expect(filtered[0]?.runId).toBe("gr-a");
|
|
151
|
+
|
|
152
|
+
const limited = await listGateRuns(common, io, { limit: 1 });
|
|
153
|
+
expect(limited).toHaveLength(1);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe("retention", () => {
|
|
158
|
+
it("deletes finished records beyond the per-command cap but never running ones", async () => {
|
|
159
|
+
const common = await tempCommon();
|
|
160
|
+
const dir = gateRunsDir(common);
|
|
161
|
+
// 51 finished + 1 running → after the next start, finished are trimmed
|
|
162
|
+
// to 50 and the running record survives.
|
|
163
|
+
for (let i = 0; i < GATE_RUN_RETENTION + 1; i++) {
|
|
164
|
+
await saveGateRun(
|
|
165
|
+
common,
|
|
166
|
+
fixtureRecord({
|
|
167
|
+
runId: `gr-old-${String(i).padStart(3, "0")}`,
|
|
168
|
+
status: "succeeded",
|
|
169
|
+
startedAt: new Date(2026, 0, i + 1).toISOString(),
|
|
170
|
+
}),
|
|
171
|
+
io,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
await saveGateRun(
|
|
175
|
+
common,
|
|
176
|
+
fixtureRecord({
|
|
177
|
+
runId: "gr-alive",
|
|
178
|
+
status: "running",
|
|
179
|
+
startedAt: "2026-06-01T00:00:00.000Z",
|
|
180
|
+
}),
|
|
181
|
+
io,
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
await startGateRun({
|
|
185
|
+
commonGitDir: common,
|
|
186
|
+
command: "flow.integrate",
|
|
187
|
+
argv: [],
|
|
188
|
+
cwd: ".",
|
|
189
|
+
detached: false,
|
|
190
|
+
io,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const runs = await listGateRuns(common, io, { command: "flow.integrate" });
|
|
194
|
+
expect(runs.some((r) => r.runId === "gr-alive")).toBe(true);
|
|
195
|
+
expect(runs.filter((r) => r.status === "succeeded")).toHaveLength(GATE_RUN_RETENTION);
|
|
196
|
+
// oldest finished record was pruned, its file gone from disk.
|
|
197
|
+
const files = await readFile(join(dir, "gr-alive.json"), "utf8").then(() => true);
|
|
198
|
+
expect(files).toBe(true);
|
|
199
|
+
});
|
|
200
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1575 AC-1..AC-3 — gate.run.status is excluded from the kernel result cache, and `--id --wait` ends with a verdict: `completed` when the run leaves `running`, `budget-expired` when the deadline passes first.</purpose>
|
|
4
|
+
<non-goals>
|
|
5
|
+
<item>No detached child — records are written by hand under a temp repo's common dir.</item>
|
|
6
|
+
</non-goals>
|
|
7
|
+
</MODULE_CONTRACT>
|
|
8
|
+
*/
|
|
9
|
+
// Test-Reason: requirement AC-1, AC-2, AC-3 (RFC-1575)
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
|
|
12
|
+
import { mkdtemp, realpath, rm } from "node:fs/promises";
|
|
13
|
+
import { hostname, tmpdir } from "node:os";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
16
|
+
import { resolveIo } from "../../../src/utils/io.ts";
|
|
17
|
+
import { saveGateRun } from "../record.ts";
|
|
18
|
+
import { WAIT_EXPIRED_SUFFIX, gateRunStatusCommand, runGateRunStatus } from "../status.ts";
|
|
19
|
+
import { GATE_RUN_SCHEMA, type GateRunRecord } from "../types.ts";
|
|
20
|
+
|
|
21
|
+
const dirs: string[] = [];
|
|
22
|
+
afterEach(async () => {
|
|
23
|
+
for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
async function repo(): Promise<string> {
|
|
27
|
+
const dir = await realpath(await mkdtemp(join(tmpdir(), "gate-run-status-")));
|
|
28
|
+
dirs.push(dir);
|
|
29
|
+
const init = spawnSync("git", ["init", "-q", dir]);
|
|
30
|
+
if (init.status !== 0) throw new Error(`git init failed: ${init.stderr}`);
|
|
31
|
+
return dir;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function record(runId: string, over: Partial<GateRunRecord> = {}): GateRunRecord {
|
|
35
|
+
return {
|
|
36
|
+
schema: GATE_RUN_SCHEMA,
|
|
37
|
+
runId,
|
|
38
|
+
command: "flow.integrate",
|
|
39
|
+
argv: [],
|
|
40
|
+
cwd: ".",
|
|
41
|
+
detached: true,
|
|
42
|
+
pid: process.pid,
|
|
43
|
+
host: hostname(),
|
|
44
|
+
startedAt: new Date().toISOString(),
|
|
45
|
+
status: "running",
|
|
46
|
+
...over,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const silent = { section() {}, info() {}, warn() {}, error() {}, success() {} };
|
|
51
|
+
const ctx = (root: string) =>
|
|
52
|
+
({ workspaceRoot: root, logger: silent, dryRun: false, outputFormat: "json" }) as never;
|
|
53
|
+
|
|
54
|
+
describe("gate.run.status (RFC-1575)", () => {
|
|
55
|
+
it("AC-1: declares cacheable: false", () => {
|
|
56
|
+
expect(gateRunStatusCommand.cacheable, "live state must never come from the result cache").toBe(
|
|
57
|
+
false,
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("AC-2: --wait reports completed when the run leaves running", async () => {
|
|
62
|
+
const root = await repo();
|
|
63
|
+
const io = resolveIo(undefined);
|
|
64
|
+
const common = join(root, ".git");
|
|
65
|
+
await saveGateRun(common, record("gr-a"), io);
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
void saveGateRun(
|
|
68
|
+
common,
|
|
69
|
+
record("gr-a", { status: "succeeded", exitCode: 0, endedAt: new Date().toISOString() }),
|
|
70
|
+
io,
|
|
71
|
+
);
|
|
72
|
+
}, 300);
|
|
73
|
+
const result = await runGateRunStatus(
|
|
74
|
+
{ argv: [], flags: { id: "gr-a", wait: "10" } },
|
|
75
|
+
ctx(root),
|
|
76
|
+
);
|
|
77
|
+
expect(result.data?.runs[0]?.status).toBe("succeeded");
|
|
78
|
+
expect(result.data?.wait?.outcome).toBe("completed");
|
|
79
|
+
expect(result.summary).toContain("left running after");
|
|
80
|
+
}, 20_000);
|
|
81
|
+
|
|
82
|
+
it("AC-3: --wait reports budget-expired when the run is still running at the deadline", async () => {
|
|
83
|
+
const root = await repo();
|
|
84
|
+
const io = resolveIo(undefined);
|
|
85
|
+
await saveGateRun(join(root, ".git"), record("gr-b"), io);
|
|
86
|
+
const result = await runGateRunStatus(
|
|
87
|
+
{ argv: [], flags: { id: "gr-b", wait: "1" } },
|
|
88
|
+
ctx(root),
|
|
89
|
+
);
|
|
90
|
+
expect(result.data?.runs[0]?.status).toBe("running");
|
|
91
|
+
expect(result.data?.wait?.outcome).toBe("budget-expired");
|
|
92
|
+
expect(result.summary).toContain(WAIT_EXPIRED_SUFFIX);
|
|
93
|
+
}, 20_000);
|
|
94
|
+
|
|
95
|
+
it("no --wait means no verdict field", async () => {
|
|
96
|
+
const root = await repo();
|
|
97
|
+
await saveGateRun(join(root, ".git"), record("gr-c"), resolveIo(undefined));
|
|
98
|
+
const result = await runGateRunStatus({ argv: [], flags: { id: "gr-c" } }, ctx(root));
|
|
99
|
+
expect(result.data?.wait).toBeUndefined();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Test-Reason: regression lost-run wait mapping (REVIEW-CODE-2026-11-12-05 E-2)
|
|
103
|
+
it("a dead-holder (lost) run ends the wait as completed — it left running", async () => {
|
|
104
|
+
const root = await repo();
|
|
105
|
+
const dead = spawnSync(process.execPath, ["-e", ""]).pid!;
|
|
106
|
+
await saveGateRun(join(root, ".git"), record("gr-d", { pid: dead }), resolveIo(undefined));
|
|
107
|
+
const result = await runGateRunStatus(
|
|
108
|
+
{ argv: [], flags: { id: "gr-d", wait: "5" } },
|
|
109
|
+
ctx(root),
|
|
110
|
+
);
|
|
111
|
+
expect(result.data?.runs[0]?.status).toBe("lost");
|
|
112
|
+
expect(result.data?.wait?.outcome).toBe("completed");
|
|
113
|
+
}, 20_000);
|
|
114
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1568 — durable gate-run record contract: one JSON record per
|
|
4
|
+
detachable-command execution under `<git common dir>/forge/gate-runs/`,
|
|
5
|
+
carrying lifecycle (running → succeeded|failed, `lost` derived), pid liveness
|
|
6
|
+
inputs, and pointers at the run's log/gate-report artifacts.</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No liveness rules of its own — classify delegates to os/core/lock-holder.</item>
|
|
9
|
+
<item>No remote/queued execution — records are written by the runner itself.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1568: step 1 — gate-run record contract + refusal ids</item>
|
|
14
|
+
<item>RFC-1568: durable gate-run records, --detach mechanics, and forge CLI wiring</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type GateRunStatus = "running" | "succeeded" | "failed" | "lost";
|
|
19
|
+
|
|
20
|
+
export const GATE_RUN_SCHEMA = "forge:gate-run/v1" as const;
|
|
21
|
+
|
|
22
|
+
export interface GateRunRecord {
|
|
23
|
+
schema: typeof GATE_RUN_SCHEMA;
|
|
24
|
+
/** gr-<UTC yyyymmddThhmmssZ>-<command>-<4 hex> */
|
|
25
|
+
runId: string;
|
|
26
|
+
command: string;
|
|
27
|
+
/** argv as invoked, without --detach. */
|
|
28
|
+
argv: string[];
|
|
29
|
+
/** repo-relative to the common-dir parent when possible. */
|
|
30
|
+
cwd: string;
|
|
31
|
+
detached: boolean;
|
|
32
|
+
pid: number;
|
|
33
|
+
host: string;
|
|
34
|
+
bootId?: string;
|
|
35
|
+
startedAt: string;
|
|
36
|
+
endedAt?: string;
|
|
37
|
+
exitCode?: number;
|
|
38
|
+
/** "running" on disk until the end write; "lost" is derived, never written. */
|
|
39
|
+
status: GateRunStatus;
|
|
40
|
+
/** the command result summary line. */
|
|
41
|
+
summary?: string;
|
|
42
|
+
/** detached runs: <common>/forge/gate-runs/<runId>.log */
|
|
43
|
+
logPath?: string;
|
|
44
|
+
/** RFC-1532 gate report, when the command produced one. */
|
|
45
|
+
reportPath?: string;
|
|
46
|
+
/** mission.validate */
|
|
47
|
+
missionId?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Minimal spawn surface detach.ts needs — injectable for tests. */
|
|
51
|
+
export interface SpawnLikeChild {
|
|
52
|
+
pid?: number;
|
|
53
|
+
unref(): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SpawnLike {
|
|
57
|
+
(
|
|
58
|
+
file: string,
|
|
59
|
+
args: string[],
|
|
60
|
+
opts: {
|
|
61
|
+
detached?: boolean;
|
|
62
|
+
stdio?: unknown[];
|
|
63
|
+
env?: Record<string, string | undefined>;
|
|
64
|
+
},
|
|
65
|
+
): SpawnLikeChild;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** GATE-RUN-01..03 — command-level refusal ids declared on gate.run.status. */
|
|
69
|
+
export const GATE_RUN_RULES = [
|
|
70
|
+
{ id: "GATE-RUN-01", severity: "error" as const },
|
|
71
|
+
{ id: "GATE-RUN-02", severity: "error" as const },
|
|
72
|
+
{ id: "GATE-RUN-03", severity: "error" as const },
|
|
73
|
+
];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1569 — the single evidence-annotation grammar shared by
|
|
4
|
+
rfc.implement.stamp (resolution) and rfc.validate V-53 (shape lint). Pure —
|
|
5
|
+
no IO; the stamp decides resolution, V-53 only asks "is this a form the
|
|
6
|
+
stamp can resolve".</purpose>
|
|
7
|
+
<non-goals>
|
|
8
|
+
<item>No file existence or probe-envelope checks — resolution stays the
|
|
9
|
+
stamp's job (RFC-1322).</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<CHANGE_SUMMARY>
|
|
13
|
+
<item>RFC-1569: step 1 — extract the annotation grammar into a pure parser</item>
|
|
14
|
+
<item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
|
|
15
|
+
</CHANGE_SUMMARY>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type EvidenceAnnotation =
|
|
19
|
+
| { kind: "probe"; criterion: string }
|
|
20
|
+
| { kind: "test" | "file"; path: string; lines?: string }
|
|
21
|
+
| { kind: "path-line"; path: string; lines: string }
|
|
22
|
+
| { kind: "invalid"; raw: string; reason: string };
|
|
23
|
+
|
|
24
|
+
const PROBE_RE = /^probe:\s*([A-Za-z][\w.:-]*)$/;
|
|
25
|
+
const TEST_FILE_RE = /^(test|file):\s*(\S+?)(?::(\d+(?:-\d+)?))?$/;
|
|
26
|
+
const PATH_LINE_RE = /^([^\s:]+):(\d+(?:-\d+)?)$/;
|
|
27
|
+
|
|
28
|
+
export const EVIDENCE_FORMS = "probe:AC-N | test:<path> | file:<path> | <path>:<line>";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parse the `(evidence: …)` payload. Whitespace after the prefix colon is
|
|
32
|
+
* tolerated; paths carry no whitespace. The probe arm accepts the full
|
|
33
|
+
* criterion-id alphabet (`AC-N`, `design:<heading>`) — whether the named
|
|
34
|
+
* criterion exists and binds a passing probe is the caller's arbitration,
|
|
35
|
+
* not the regex's.
|
|
36
|
+
*/
|
|
37
|
+
export function parseEvidenceAnnotation(raw: string): EvidenceAnnotation {
|
|
38
|
+
const annotation = raw.trim();
|
|
39
|
+
if (annotation === "") return { kind: "invalid", raw, reason: "empty annotation" };
|
|
40
|
+
|
|
41
|
+
const probe = PROBE_RE.exec(annotation);
|
|
42
|
+
if (probe) return { kind: "probe", criterion: probe[1]! };
|
|
43
|
+
|
|
44
|
+
const testFile = TEST_FILE_RE.exec(annotation);
|
|
45
|
+
if (testFile) {
|
|
46
|
+
return {
|
|
47
|
+
kind: testFile[1] === "test" ? "test" : "file",
|
|
48
|
+
path: testFile[2]!,
|
|
49
|
+
...(testFile[3] !== undefined ? { lines: testFile[3] } : {}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const pathLine = PATH_LINE_RE.exec(annotation);
|
|
54
|
+
if (pathLine) return { kind: "path-line", path: pathLine[1]!, lines: pathLine[2]! };
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
kind: "invalid",
|
|
58
|
+
raw,
|
|
59
|
+
reason: `not a resolvable form (expected ${EVIDENCE_FORMS})`,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1569 — V-50 containment compares each fixed-input literal
|
|
4
|
+
against the regex-UNESCAPED probe pattern (escaped metachar literals keep
|
|
5
|
+
coverage).</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1569: V-50 unescape-before-containment tests (AC-9)</item>
|
|
12
|
+
<item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
|
|
13
|
+
</CHANGE_SUMMARY>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { test, expect, describe } from "vitest";
|
|
17
|
+
import { evaluateFixedInputs } from "./fixed-inputs.ts";
|
|
18
|
+
|
|
19
|
+
const body = (value: string): string =>
|
|
20
|
+
`## Fixed inputs\n\n| ID | Value | Source | Checked by |\n| --- | --- | --- | --- |\n| FI-1 | ${value} | decision | AC-1 |\n`;
|
|
21
|
+
|
|
22
|
+
describe("V-50: regex-unescaped containment (RFC-1569)", () => {
|
|
23
|
+
test("AC-9: escaped \\$\\{WORKSPACE_ROOT\\} pattern covers the literal", () => {
|
|
24
|
+
const diags = evaluateFixedInputs(
|
|
25
|
+
body("`${WORKSPACE_ROOT}`"),
|
|
26
|
+
["AC-1"],
|
|
27
|
+
[
|
|
28
|
+
{
|
|
29
|
+
probe: "file-contains",
|
|
30
|
+
criterion: "AC-1",
|
|
31
|
+
path: "x",
|
|
32
|
+
pattern: "\\$\\{WORKSPACE_ROOT\\}",
|
|
33
|
+
} as never,
|
|
34
|
+
],
|
|
35
|
+
);
|
|
36
|
+
expect(diags.filter((d) => d.message.includes("not contained"))).toEqual([]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("unescaped metachars in a literal still report uncovered", () => {
|
|
40
|
+
const diags = evaluateFixedInputs(
|
|
41
|
+
body("`${WORKSPACE_ROOT}`"),
|
|
42
|
+
["AC-1"],
|
|
43
|
+
[
|
|
44
|
+
{
|
|
45
|
+
probe: "file-contains",
|
|
46
|
+
criterion: "AC-1",
|
|
47
|
+
path: "x",
|
|
48
|
+
pattern: "literal plain text",
|
|
49
|
+
} as never,
|
|
50
|
+
],
|
|
51
|
+
);
|
|
52
|
+
expect(diags.some((d) => d.message.includes("not contained"))).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("dotted literal covered by escaped a\\.b pattern", () => {
|
|
56
|
+
const diags = evaluateFixedInputs(
|
|
57
|
+
body("`a.b`"),
|
|
58
|
+
["AC-1"],
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
probe: "file-contains",
|
|
62
|
+
criterion: "AC-1",
|
|
63
|
+
path: "x",
|
|
64
|
+
pattern: "a\\.b",
|
|
65
|
+
} as never,
|
|
66
|
+
],
|
|
67
|
+
);
|
|
68
|
+
expect(diags.filter((d) => d.message.includes("not contained"))).toEqual([]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -17,6 +17,7 @@ warning nudge. All functions are pure — no I/O.
|
|
|
17
17
|
<CHANGE_SUMMARY>
|
|
18
18
|
<item>RFC-1455: fixed-inputs section parser + V-50/V-51 evaluator for rfc.validate.</item>
|
|
19
19
|
<item>RFC-1455: fixed inputs bound to outcome probes — V-50/V-51 + skills</item>
|
|
20
|
+
<item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
|
|
20
21
|
</CHANGE_SUMMARY>
|
|
21
22
|
*/
|
|
22
23
|
|
|
@@ -235,8 +236,17 @@ export function evaluateFixedInputs(
|
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
const literals = fixedInputLiterals(row.value);
|
|
239
|
+
// RFC-1569: compare against the regex-UNESCAPED pattern too — a literal
|
|
240
|
+
// carrying metacharacters (${WORKSPACE_ROOT}) cannot be both escaped in
|
|
241
|
+
// the pattern and contained verbatim; `\d`/`\w` shorthand keeps its
|
|
242
|
+
// backslash (unescaping it would fake coverage for single-char literals).
|
|
243
|
+
const unescapePattern = (field: string): string =>
|
|
244
|
+
field.replace(/\\([.*+?^${}()|[\]\\])/g, "$1");
|
|
238
245
|
const uncovered = literals.filter(
|
|
239
|
-
(literal) =>
|
|
246
|
+
(literal) =>
|
|
247
|
+
!outcomeFields.some(
|
|
248
|
+
(field) => field.includes(literal) || unescapePattern(field).includes(literal),
|
|
249
|
+
),
|
|
240
250
|
);
|
|
241
251
|
if (uncovered.length > 0) {
|
|
242
252
|
diagnostics.push({
|