@warpgogol/forge 9.6.3 → 9.7.1
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 +59 -0
- package/README.md +12 -0
- package/bin/cli.ts +40 -2
- package/dist/bin/cli.js +39 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/archive.d.ts.map +1 -1
- package/dist/os/adr/handlers/archive.js +3 -7
- package/dist/os/adr/handlers/archive.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +55 -19
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
- package/dist/os/adr/handlers/list-create.js +8 -6
- package/dist/os/adr/handlers/list-create.js.map +1 -1
- package/dist/os/adr/handlers/validate.d.ts.map +1 -1
- package/dist/os/adr/handlers/validate.js +55 -21
- package/dist/os/adr/handlers/validate.js.map +1 -1
- package/dist/os/adversarial/adversarial.module.d.ts +3 -0
- package/dist/os/adversarial/adversarial.module.d.ts.map +1 -0
- package/dist/os/adversarial/adversarial.module.js +128 -0
- package/dist/os/adversarial/adversarial.module.js.map +1 -0
- package/dist/os/adversarial/catalog.d.ts +11 -0
- package/dist/os/adversarial/catalog.d.ts.map +1 -0
- package/dist/os/adversarial/catalog.js +72 -0
- package/dist/os/adversarial/catalog.js.map +1 -0
- package/dist/os/adversarial/runner.d.ts +17 -0
- package/dist/os/adversarial/runner.d.ts.map +1 -0
- package/dist/os/adversarial/runner.js +479 -0
- package/dist/os/adversarial/runner.js.map +1 -0
- package/dist/os/agent/handlers/agent-tiers-validate.d.ts.map +1 -1
- package/dist/os/agent/handlers/agent-tiers-validate.js +21 -7
- package/dist/os/agent/handlers/agent-tiers-validate.js.map +1 -1
- package/dist/os/agent/index.js +1 -1
- package/dist/os/agent-tools/agent-tools.module.d.ts +3 -0
- package/dist/os/agent-tools/agent-tools.module.d.ts.map +1 -0
- package/dist/os/agent-tools/agent-tools.module.js +80 -0
- package/dist/os/agent-tools/agent-tools.module.js.map +1 -0
- package/dist/os/agent-tools/generate.d.ts +18 -0
- package/dist/os/agent-tools/generate.d.ts.map +1 -0
- package/dist/os/agent-tools/generate.js +79 -0
- package/dist/os/agent-tools/generate.js.map +1 -0
- package/dist/os/agent-tools/handlers/tools-generate.d.ts +16 -0
- package/dist/os/agent-tools/handlers/tools-generate.d.ts.map +1 -0
- package/dist/os/agent-tools/handlers/tools-generate.js +108 -0
- package/dist/os/agent-tools/handlers/tools-generate.js.map +1 -0
- package/dist/os/agent-tools/index.d.ts +7 -0
- package/dist/os/agent-tools/index.d.ts.map +1 -0
- package/dist/os/agent-tools/index.js +16 -0
- package/dist/os/agent-tools/index.js.map +1 -0
- package/dist/os/agent-tools/manifest.d.ts +26 -0
- package/dist/os/agent-tools/manifest.d.ts.map +1 -0
- package/dist/os/agent-tools/manifest.js +70 -0
- package/dist/os/agent-tools/manifest.js.map +1 -0
- package/dist/os/agent-tools/serve.d.ts +21 -0
- package/dist/os/agent-tools/serve.d.ts.map +1 -0
- package/dist/os/agent-tools/serve.js +99 -0
- package/dist/os/agent-tools/serve.js.map +1 -0
- package/dist/os/agent-tools/server.d.ts +53 -0
- package/dist/os/agent-tools/server.d.ts.map +1 -0
- package/dist/os/agent-tools/server.js +381 -0
- package/dist/os/agent-tools/server.js.map +1 -0
- package/dist/os/agent-tools/types.d.ts +72 -0
- package/dist/os/agent-tools/types.d.ts.map +1 -0
- package/dist/os/agent-tools/types.js +74 -0
- package/dist/os/agent-tools/types.js.map +1 -0
- package/dist/os/audit/handlers/archive.d.ts.map +1 -1
- package/dist/os/audit/handlers/archive.js +3 -7
- package/dist/os/audit/handlers/archive.js.map +1 -1
- package/dist/os/authority/authority.module.d.ts.map +1 -1
- package/dist/os/authority/authority.module.js +17 -2
- package/dist/os/authority/authority.module.js.map +1 -1
- package/dist/os/checks/checks.module.d.ts.map +1 -1
- package/dist/os/checks/checks.module.js +44 -11
- package/dist/os/checks/checks.module.js.map +1 -1
- package/dist/os/checks/handlers/contribution-report.d.ts +3 -0
- package/dist/os/checks/handlers/contribution-report.d.ts.map +1 -1
- package/dist/os/checks/handlers/contribution-report.js +142 -23
- package/dist/os/checks/handlers/contribution-report.js.map +1 -1
- package/dist/os/checks/handlers/counters-export.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-export.js +75 -8
- package/dist/os/checks/handlers/counters-export.js.map +1 -1
- package/dist/os/checks/handlers/counters-validate.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-validate.js +1 -1
- package/dist/os/checks/handlers/counters-validate.js.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure.js +15 -18
- package/dist/os/codebase/handlers/codebase-measure.js.map +1 -1
- package/dist/os/codebase/index.d.ts.map +1 -1
- package/dist/os/codebase/index.js +4 -1
- package/dist/os/codebase/index.js.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.d.ts +4 -2
- package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.js +229 -37
- package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +45 -2
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +44 -4
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +31 -5
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +153 -55
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +44 -9
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/context/context.module.d.ts.map +1 -1
- package/dist/os/context/context.module.js +23 -4
- package/dist/os/context/context.module.js.map +1 -1
- package/dist/os/context/handlers/context-assemble.d.ts.map +1 -1
- package/dist/os/context/handlers/context-assemble.js +109 -16
- package/dist/os/context/handlers/context-assemble.js.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.d.ts.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.js +34 -9
- package/dist/os/context/handlers/context-slate-eval.js.map +1 -1
- package/dist/os/context/handlers/index-build.d.ts.map +1 -1
- package/dist/os/context/handlers/index-build.js +119 -26
- package/dist/os/context/handlers/index-build.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +56 -4
- package/dist/os/core/archive-regen.d.ts.map +1 -1
- package/dist/os/core/archive-regen.js +173 -15
- package/dist/os/core/archive-regen.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +187 -50
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts +9 -2
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +81 -0
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
- package/dist/os/core/handlers/package-health.js +6 -6
- package/dist/os/core/handlers/pinned-check.d.ts +13 -0
- package/dist/os/core/handlers/pinned-check.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-check.js +25 -0
- package/dist/os/core/handlers/pinned-check.js.map +1 -1
- package/dist/os/core/handlers/pinned-types.d.ts +7 -0
- package/dist/os/core/handlers/pinned-types.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/pinned-validate.js +24 -1
- package/dist/os/core/handlers/pinned-validate.js.map +1 -1
- package/dist/os/core/handlers/policy-digest.d.ts +11 -0
- package/dist/os/core/handlers/policy-digest.d.ts.map +1 -0
- package/dist/os/core/handlers/policy-digest.js +421 -0
- package/dist/os/core/handlers/policy-digest.js.map +1 -0
- package/dist/os/correctness/audit/snapshot.d.ts.map +1 -1
- package/dist/os/correctness/audit/snapshot.js +46 -15
- package/dist/os/correctness/audit/snapshot.js.map +1 -1
- package/dist/os/correctness/correctness.module.d.ts.map +1 -1
- package/dist/os/correctness/correctness.module.js +5 -3
- package/dist/os/correctness/correctness.module.js.map +1 -1
- package/dist/os/correctness/gate/frozen.d.ts +84 -9
- package/dist/os/correctness/gate/frozen.d.ts.map +1 -1
- package/dist/os/correctness/gate/frozen.js +573 -53
- package/dist/os/correctness/gate/frozen.js.map +1 -1
- package/dist/os/correctness/gate/origin.d.ts +2 -0
- package/dist/os/correctness/gate/origin.d.ts.map +1 -1
- package/dist/os/correctness/gate/origin.js +68 -35
- package/dist/os/correctness/gate/origin.js.map +1 -1
- package/dist/os/correctness/gate/repo.d.ts +58 -2
- package/dist/os/correctness/gate/repo.d.ts.map +1 -1
- package/dist/os/correctness/gate/repo.js +177 -15
- package/dist/os/correctness/gate/repo.js.map +1 -1
- package/dist/os/correctness/gate/run.d.ts +6 -0
- package/dist/os/correctness/gate/run.d.ts.map +1 -1
- package/dist/os/correctness/gate/run.js +394 -62
- package/dist/os/correctness/gate/run.js.map +1 -1
- package/dist/os/correctness/gate/runner.d.ts.map +1 -1
- package/dist/os/correctness/gate/runner.js +42 -8
- package/dist/os/correctness/gate/runner.js.map +1 -1
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts +5 -1
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -1
- package/dist/os/correctness/gate/tests/gate-fixture.js +23 -1
- package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -1
- package/dist/os/correctness/gate/types.d.ts +3 -0
- package/dist/os/correctness/gate/types.d.ts.map +1 -1
- package/dist/os/correctness/gate/types.js +1 -0
- package/dist/os/correctness/gate/types.js.map +1 -1
- package/dist/os/correctness/handlers/gate.d.ts.map +1 -1
- package/dist/os/correctness/handlers/gate.js +2 -0
- package/dist/os/correctness/handlers/gate.js.map +1 -1
- package/dist/os/correctness/handlers/validate.d.ts +30 -0
- package/dist/os/correctness/handlers/validate.d.ts.map +1 -1
- package/dist/os/correctness/handlers/validate.js +20 -7
- package/dist/os/correctness/handlers/validate.js.map +1 -1
- package/dist/os/correctness/manifest-schema.d.ts +2 -2
- package/dist/os/correctness/references.d.ts +19 -0
- package/dist/os/correctness/references.d.ts.map +1 -1
- package/dist/os/correctness/references.js +57 -22
- package/dist/os/correctness/references.js.map +1 -1
- package/dist/os/correctness/workspace.d.ts +22 -2
- package/dist/os/correctness/workspace.d.ts.map +1 -1
- package/dist/os/correctness/workspace.js +194 -18
- package/dist/os/correctness/workspace.js.map +1 -1
- package/dist/os/flow/branch-name.d.ts.map +1 -1
- package/dist/os/flow/branch-name.js +2 -4
- package/dist/os/flow/branch-name.js.map +1 -1
- package/dist/os/flow/correctness-step.d.ts.map +1 -1
- package/dist/os/flow/correctness-step.js +83 -17
- package/dist/os/flow/correctness-step.js.map +1 -1
- package/dist/os/flow/digest.d.ts +98 -9
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +802 -185
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/dup-id-scan.d.ts +23 -0
- package/dist/os/flow/dup-id-scan.d.ts.map +1 -0
- package/dist/os/flow/dup-id-scan.js +171 -0
- package/dist/os/flow/dup-id-scan.js.map +1 -0
- package/dist/os/flow/evidence-lock.d.ts +36 -0
- package/dist/os/flow/evidence-lock.d.ts.map +1 -0
- package/dist/os/flow/evidence-lock.js +156 -0
- package/dist/os/flow/evidence-lock.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +155 -19
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/git.d.ts +124 -11
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +793 -84
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/guard-files.d.ts.map +1 -1
- package/dist/os/flow/guard-files.js +3 -5
- package/dist/os/flow/guard-files.js.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.js +2 -2
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +2 -2
- package/dist/os/flow/handlers/flow-cut.d.ts +38 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +325 -186
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +5 -6
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +6 -6
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +34 -12
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-hold.js +12 -21
- package/dist/os/flow/handlers/flow-hold.js.map +1 -1
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-install.js +19 -18
- package/dist/os/flow/handlers/flow-install.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +50 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +624 -135
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts +11 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +82 -12
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +2 -2
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.js +36 -16
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -1
- package/dist/os/flow/handlers/flow-push.d.ts +91 -2
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +806 -52
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/handlers/flow-status.d.ts +6 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-status.js +13 -10
- package/dist/os/flow/handlers/flow-status.js.map +1 -1
- package/dist/os/flow/handlers/flow-swept.d.ts +30 -0
- package/dist/os/flow/handlers/flow-swept.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-swept.js +135 -0
- package/dist/os/flow/handlers/flow-swept.js.map +1 -0
- package/dist/os/flow/handlers/flow-version.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-version.js +3 -5
- package/dist/os/flow/handlers/flow-version.js.map +1 -1
- package/dist/os/flow/index.d.ts +2 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +7 -4
- package/dist/os/flow/index.js.map +1 -1
- package/dist/os/flow/line-version.d.ts.map +1 -1
- package/dist/os/flow/line-version.js +20 -3
- package/dist/os/flow/line-version.js.map +1 -1
- package/dist/os/flow/locks.d.ts +15 -0
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +20 -7
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/markers.d.ts +1 -1
- package/dist/os/flow/markers.d.ts.map +1 -1
- package/dist/os/flow/markers.js +14 -5
- package/dist/os/flow/markers.js.map +1 -1
- package/dist/os/flow/ops-registry.d.ts.map +1 -1
- package/dist/os/flow/ops-registry.js +19 -6
- package/dist/os/flow/ops-registry.js.map +1 -1
- package/dist/os/flow/post-rebase-regen.d.ts +30 -8
- package/dist/os/flow/post-rebase-regen.d.ts.map +1 -1
- package/dist/os/flow/post-rebase-regen.js +172 -20
- package/dist/os/flow/post-rebase-regen.js.map +1 -1
- package/dist/os/flow/pre-lock.d.ts +61 -0
- package/dist/os/flow/pre-lock.d.ts.map +1 -0
- package/dist/os/flow/pre-lock.js +265 -0
- package/dist/os/flow/pre-lock.js.map +1 -0
- package/dist/os/flow/preflight.d.ts +6 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +87 -13
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/primary-dirt.d.ts +63 -0
- package/dist/os/flow/primary-dirt.d.ts.map +1 -0
- package/dist/os/flow/primary-dirt.js +259 -0
- package/dist/os/flow/primary-dirt.js.map +1 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +32 -10
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +21 -9
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +16 -9
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/release-level.d.ts +2 -0
- package/dist/os/flow/release-level.d.ts.map +1 -1
- package/dist/os/flow/release-level.js +23 -5
- package/dist/os/flow/release-level.js.map +1 -1
- package/dist/os/flow/release-lines.js +1 -1
- package/dist/os/flow/release-tags.d.ts +1 -1
- package/dist/os/flow/release-tags.d.ts.map +1 -1
- package/dist/os/flow/release-tags.js +43 -19
- package/dist/os/flow/release-tags.js.map +1 -1
- package/dist/os/flow/repo-kind.d.ts.map +1 -1
- package/dist/os/flow/repo-kind.js +6 -3
- package/dist/os/flow/repo-kind.js.map +1 -1
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +40 -7
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/semver.js +1 -1
- package/dist/os/flow/session-checkout.js +3 -3
- package/dist/os/flow/standalone-invoke.js +2 -2
- package/dist/os/flow/tests/helpers.d.ts +28 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +159 -19
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/flow/version-files.d.ts.map +1 -1
- package/dist/os/flow/version-files.js +3 -2
- package/dist/os/flow/version-files.js.map +1 -1
- package/dist/os/flow/worktree-path.d.ts.map +1 -1
- package/dist/os/flow/worktree-path.js +1 -1
- package/dist/os/flow/worktree-path.js.map +1 -1
- package/dist/os/friction/friction.module.d.ts.map +1 -1
- package/dist/os/friction/friction.module.js +160 -31
- package/dist/os/friction/friction.module.js.map +1 -1
- package/dist/os/friction/handlers/friction-add.d.ts +13 -0
- package/dist/os/friction/handlers/friction-add.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-add.js +189 -0
- package/dist/os/friction/handlers/friction-add.js.map +1 -0
- package/dist/os/friction/handlers/friction-migrate.d.ts +23 -0
- package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-migrate.js +354 -0
- package/dist/os/friction/handlers/friction-migrate.js.map +1 -0
- package/dist/os/friction/handlers/friction-validate.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-validate.js +144 -106
- package/dist/os/friction/handlers/friction-validate.js.map +1 -1
- package/dist/os/friction/index.d.ts +2 -0
- package/dist/os/friction/index.d.ts.map +1 -1
- package/dist/os/friction/index.js +3 -1
- package/dist/os/friction/index.js.map +1 -1
- package/dist/os/friction/store.d.ts +72 -0
- package/dist/os/friction/store.d.ts.map +1 -0
- package/dist/os/friction/store.js +251 -0
- package/dist/os/friction/store.js.map +1 -0
- package/dist/os/friction/types.d.ts +13 -1
- package/dist/os/friction/types.d.ts.map +1 -1
- package/dist/os/friction/types.js +19 -13
- package/dist/os/friction/types.js.map +1 -1
- package/dist/os/gate/gate.module.d.ts.map +1 -1
- package/dist/os/gate/gate.module.js +47 -6
- package/dist/os/gate/gate.module.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts +17 -2
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +376 -44
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe.js +90 -10
- package/dist/os/gate/handlers/gate-probe.js.map +1 -1
- package/dist/os/gate/handlers/liveness.d.ts +30 -0
- package/dist/os/gate/handlers/liveness.d.ts.map +1 -0
- package/dist/os/gate/handlers/liveness.js +94 -0
- package/dist/os/gate/handlers/liveness.js.map +1 -0
- package/dist/os/gate/handlers/probe-runs-journal.d.ts +44 -0
- package/dist/os/gate/handlers/probe-runs-journal.d.ts.map +1 -0
- package/dist/os/gate/handlers/probe-runs-journal.js +157 -0
- package/dist/os/gate/handlers/probe-runs-journal.js.map +1 -0
- package/dist/os/gate-run/gate-run.module.d.ts.map +1 -1
- package/dist/os/gate-run/gate-run.module.js +3 -0
- package/dist/os/gate-run/gate-run.module.js.map +1 -1
- package/dist/os/gate-run/index.d.ts.map +1 -1
- package/dist/os/gate-run/index.js +10 -0
- package/dist/os/gate-run/index.js.map +1 -1
- package/dist/os/gate-run/record.d.ts +1 -0
- package/dist/os/gate-run/record.d.ts.map +1 -1
- package/dist/os/gate-run/record.js +2 -0
- package/dist/os/gate-run/record.js.map +1 -1
- package/dist/os/gate-run/status.d.ts.map +1 -1
- package/dist/os/gate-run/status.js +4 -1
- package/dist/os/gate-run/status.js.map +1 -1
- package/dist/os/gate-run/types.d.ts +7 -0
- package/dist/os/gate-run/types.d.ts.map +1 -1
- package/dist/os/gate-run/types.js +1 -0
- package/dist/os/gate-run/types.js.map +1 -1
- package/dist/os/instructions/handlers/scar-migrate.d.ts +3 -0
- package/dist/os/instructions/handlers/scar-migrate.d.ts.map +1 -1
- package/dist/os/instructions/handlers/scar-migrate.js +23 -66
- package/dist/os/instructions/handlers/scar-migrate.js.map +1 -1
- package/dist/os/instructions/instructions.module.d.ts.map +1 -1
- package/dist/os/instructions/instructions.module.js +32 -5
- package/dist/os/instructions/instructions.module.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js +31 -10
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.js +24 -12
- package/dist/os/knowledge/handlers/knowledge-rebuild.js.map +1 -1
- package/dist/os/knowledge/knowledge.module.d.ts.map +1 -1
- package/dist/os/knowledge/knowledge.module.js +20 -4
- package/dist/os/knowledge/knowledge.module.js.map +1 -1
- package/dist/os/mission/handlers/archive.d.ts.map +1 -1
- package/dist/os/mission/handlers/archive.js +3 -7
- package/dist/os/mission/handlers/archive.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts.map +1 -1
- package/dist/os/mission/lockfile.js +44 -20
- package/dist/os/mission/lockfile.js.map +1 -1
- package/dist/os/naming/naming-convention.js +2 -2
- package/dist/os/naming/naming-convention.js.map +1 -1
- package/dist/os/plan/handlers/archive.d.ts.map +1 -1
- package/dist/os/plan/handlers/archive.js +3 -7
- package/dist/os/plan/handlers/archive.js.map +1 -1
- package/dist/os/program/discovery.d.ts +14 -5
- package/dist/os/program/discovery.d.ts.map +1 -1
- package/dist/os/program/discovery.js +64 -46
- package/dist/os/program/discovery.js.map +1 -1
- package/dist/os/program/handlers/complete.d.ts.map +1 -1
- package/dist/os/program/handlers/complete.js +28 -10
- package/dist/os/program/handlers/complete.js.map +1 -1
- package/dist/os/program/handlers/lease.js +12 -2
- package/dist/os/program/handlers/lease.js.map +1 -1
- package/dist/os/program/handlers/seal.js +3 -3
- package/dist/os/program/handlers/seal.js.map +1 -1
- package/dist/os/program/handlers/validate.js +3 -3
- package/dist/os/program/handlers/validate.js.map +1 -1
- package/dist/os/queue/handlers/queue-decision.d.ts +10 -0
- package/dist/os/queue/handlers/queue-decision.d.ts.map +1 -0
- package/dist/os/queue/handlers/queue-decision.js +177 -0
- package/dist/os/queue/handlers/queue-decision.js.map +1 -0
- package/dist/os/queue/handlers/queue-validate.d.ts.map +1 -1
- package/dist/os/queue/handlers/queue-validate.js +18 -22
- package/dist/os/queue/handlers/queue-validate.js.map +1 -1
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +1 -2
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/queue/queue.module.d.ts.map +1 -1
- package/dist/os/queue/queue.module.js +89 -4
- package/dist/os/queue/queue.module.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +4 -3
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/archive.d.ts.map +1 -1
- package/dist/os/rfc/handlers/archive.js +3 -7
- package/dist/os/rfc/handlers/archive.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.js +6 -3
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +65 -29
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
- package/dist/os/rfc/handlers/index-graph.js +13 -0
- package/dist/os/rfc/handlers/index-graph.js.map +1 -1
- package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
- package/dist/os/rfc/handlers/list-create.js +15 -7
- package/dist/os/rfc/handlers/list-create.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +52 -10
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +1 -0
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +172 -50
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +0 -3
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/next-id.d.ts +7 -1
- package/dist/os/rfc/next-id.d.ts.map +1 -1
- package/dist/os/rfc/next-id.js +122 -5
- package/dist/os/rfc/next-id.js.map +1 -1
- package/dist/os/rfc/outcome-probe.d.ts.map +1 -1
- package/dist/os/rfc/outcome-probe.js +5 -2
- package/dist/os/rfc/outcome-probe.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -1
- package/dist/os/rfc/reachable-symbol.js +61 -19
- package/dist/os/rfc/reachable-symbol.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +26 -4
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +28 -3
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +13 -3
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +72 -24
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +41 -3
- package/dist/os/rfc/verification-origin.d.ts.map +1 -1
- package/dist/os/rfc/verification-origin.js +314 -50
- package/dist/os/rfc/verification-origin.js.map +1 -1
- package/dist/os/rfc/verifier/rfc-1391/support.js +1 -1
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
- package/dist/os/rfc/verify-workspace.js +148 -48
- package/dist/os/rfc/verify-workspace.js.map +1 -1
- package/dist/os/session/handlers/archive.d.ts.map +1 -1
- package/dist/os/session/handlers/archive.js +3 -7
- package/dist/os/session/handlers/archive.js.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +42 -11
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +50 -24
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/session/handlers/session-audit-report.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit-report.js +21 -6
- package/dist/os/session/handlers/session-audit-report.js.map +1 -1
- package/dist/os/session/handlers/session-audit.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit.js +22 -9
- package/dist/os/session/handlers/session-audit.js.map +1 -1
- package/dist/os/session/session.module.d.ts.map +1 -1
- package/dist/os/session/session.module.js +29 -9
- package/dist/os/session/session.module.js.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.js +36 -18
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
- package/dist/os/system/handlers/system-product-register.d.ts +24 -0
- package/dist/os/system/handlers/system-product-register.d.ts.map +1 -0
- package/dist/os/system/handlers/system-product-register.js +322 -0
- package/dist/os/system/handlers/system-product-register.js.map +1 -0
- package/dist/os/system/handlers/system-products-status.d.ts +23 -0
- package/dist/os/system/handlers/system-products-status.d.ts.map +1 -0
- package/dist/os/system/handlers/system-products-status.js +235 -0
- package/dist/os/system/handlers/system-products-status.js.map +1 -0
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-dispatch.js +14 -16
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.js +3 -3
- package/dist/os/system/scenario-schemas.js +1 -1
- package/dist/os/system/schemas.d.ts +13 -0
- package/dist/os/system/schemas.d.ts.map +1 -1
- package/dist/os/system/schemas.js +15 -0
- package/dist/os/system/schemas.js.map +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +126 -11
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/os/system/task-schemas.d.ts +3 -3
- package/dist/os/trajectory/handlers/journal-io.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/journal-io.js +2 -2
- package/dist/os/trajectory/handlers/journal-io.js.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.js +49 -9
- package/dist/os/trajectory/handlers/outcome-record.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.js +75 -21
- package/dist/os/trajectory/handlers/trajectory-index.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.js +38 -10
- package/dist/os/trajectory/handlers/trajectory-recall.js.map +1 -1
- package/dist/os/trajectory/trajectory.module.d.ts.map +1 -1
- package/dist/os/trajectory/trajectory.module.js +35 -7
- package/dist/os/trajectory/trajectory.module.js.map +1 -1
- package/dist/src/adversarial/types.d.ts +44 -0
- package/dist/src/adversarial/types.d.ts.map +1 -0
- package/dist/src/adversarial/types.js +82 -0
- package/dist/src/adversarial/types.js.map +1 -0
- package/dist/src/authority/delegations.d.ts +1 -1
- package/dist/src/authority/delegations.d.ts.map +1 -1
- package/dist/src/authority/delegations.js +9 -2
- package/dist/src/authority/delegations.js.map +1 -1
- package/dist/src/command-modules.d.ts.map +1 -1
- package/dist/src/command-modules.js +2 -0
- package/dist/src/command-modules.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +67 -1
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +116 -13
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/correctness/policy-bundle.d.ts +72 -0
- package/dist/src/correctness/policy-bundle.d.ts.map +1 -0
- package/dist/src/correctness/policy-bundle.js +170 -0
- package/dist/src/correctness/policy-bundle.js.map +1 -0
- package/dist/src/knowledge/paths.d.ts +21 -0
- package/dist/src/knowledge/paths.d.ts.map +1 -0
- package/dist/src/knowledge/paths.js +57 -0
- package/dist/src/knowledge/paths.js.map +1 -0
- package/dist/src/knowledge/sync.d.ts +7 -0
- package/dist/src/knowledge/sync.d.ts.map +1 -1
- package/dist/src/knowledge/sync.js +41 -13
- package/dist/src/knowledge/sync.js.map +1 -1
- package/dist/src/onboarding/create.d.ts.map +1 -1
- package/dist/src/onboarding/create.js +27 -2
- package/dist/src/onboarding/create.js.map +1 -1
- package/dist/src/onboarding/init.d.ts.map +1 -1
- package/dist/src/onboarding/init.js +19 -5
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
- package/dist/src/onboarding/npm-token-check.js +9 -1
- package/dist/src/onboarding/npm-token-check.js.map +1 -1
- package/dist/src/onboarding/scaffold-project.d.ts.map +1 -1
- package/dist/src/onboarding/scaffold-project.js +17 -5
- package/dist/src/onboarding/scaffold-project.js.map +1 -1
- package/dist/src/onboarding/trust-boundary.d.ts +16 -0
- package/dist/src/onboarding/trust-boundary.d.ts.map +1 -0
- package/dist/src/onboarding/trust-boundary.js +806 -0
- package/dist/src/onboarding/trust-boundary.js.map +1 -0
- package/dist/src/onboarding/upgrade.d.ts +4 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +120 -9
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/profiles/stack-profile.js +2 -2
- package/dist/src/types.d.ts +6 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +4 -4
- package/dist/src/utils/verifier-git.d.ts +1329 -0
- package/dist/src/utils/verifier-git.d.ts.map +1 -0
- package/dist/src/utils/verifier-git.js +7827 -0
- package/dist/src/utils/verifier-git.js.map +1 -0
- package/dist/src/validators/skill-validate.d.ts.map +1 -1
- package/dist/src/validators/skill-validate.js +17 -5
- package/dist/src/validators/skill-validate.js.map +1 -1
- package/docs/adversarial/downgrade-forge/scenario.yaml +22 -0
- package/docs/adversarial/drop-manifest-entry/scenario.yaml +25 -0
- package/docs/adversarial/edit-frozen-file/scenario.yaml +24 -0
- package/docs/adversarial/edit-policy-key/scenario.yaml +41 -0
- package/docs/adversarial/forge-review-record/scenario.yaml +34 -0
- package/docs/adversarial/grow-allow/scenario.yaml +46 -0
- package/docs/adversarial/mixed-weakening/scenario.yaml +26 -0
- package/docs/adversarial/rebind-checkrun/scenario.yaml +41 -0
- package/docs/adversarial/self-exempt/scenario.yaml +41 -0
- package/docs/adversarial/shrink-policy-decl/scenario.yaml +41 -0
- package/docs/adversarial/spoof-verifier-trailer/scenario.yaml +26 -0
- package/docs/adversarial/weaken-oracle/scenario.yaml +22 -0
- package/docs/maintainers/publishing.md +1 -1
- package/docs/reference/correctness-gate.md +35 -5
- package/docs/reference/forge-yaml.md +16 -0
- package/docs/reference/system-hub.md +104 -0
- package/docs/reference/trust-boundary.md +36 -0
- package/os/adr/handlers/archive.ts +3 -11
- package/os/adr/handlers/implement-stamp.ts +56 -26
- package/os/adr/handlers/list-create.test.ts +174 -0
- package/os/adr/handlers/list-create.ts +16 -8
- package/os/adr/handlers/validate.ts +66 -28
- package/os/adversarial/adversarial.module.ts +147 -0
- package/os/adversarial/catalog.test.ts +96 -0
- package/os/adversarial/catalog.ts +79 -0
- package/os/adversarial/runner.ts +533 -0
- package/os/agent/handlers/agent-tiers-validate.ts +39 -10
- package/os/agent/index.ts +1 -1
- package/os/agent-tools/agent-tools.module.ts +84 -0
- package/os/agent-tools/generate.ts +104 -0
- package/os/agent-tools/handlers/tools-generate.ts +137 -0
- package/os/agent-tools/index.ts +23 -0
- package/os/agent-tools/manifest.ts +95 -0
- package/os/agent-tools/serve.ts +127 -0
- package/os/agent-tools/server.ts +460 -0
- package/os/agent-tools/tool-server.test.ts +226 -0
- package/os/agent-tools/tools-generate.test.ts +204 -0
- package/os/agent-tools/types.ts +139 -0
- package/os/audit/handlers/archive.ts +3 -11
- package/os/authority/authority.module.ts +17 -2
- package/os/checks/checks.module.ts +46 -11
- package/os/checks/handlers/contribution-liveness.test.ts +142 -0
- package/os/checks/handlers/contribution-report.test.ts +46 -11
- package/os/checks/handlers/contribution-report.ts +222 -44
- package/os/checks/handlers/counters-export.test.ts +179 -8
- package/os/checks/handlers/counters-export.ts +77 -9
- package/os/checks/handlers/counters-journal.test.ts +25 -5
- package/os/checks/handlers/counters-validate.test.ts +21 -6
- package/os/checks/handlers/counters-validate.ts +4 -2
- package/os/checks/handlers/variant-candidates.test.ts +6 -2
- package/os/codebase/handlers/codebase-measure.ts +17 -20
- package/os/codebase/index.ts +4 -1
- package/os/compass/handlers/compass-audit-handler.ts +236 -38
- package/os/compass/handlers/compass-header-scaffold-handler.ts +47 -2
- package/os/compass/handlers/compass-migrate-handler.ts +46 -4
- package/os/compass/handlers/git-revision.ts +183 -63
- package/os/compass/handlers/summary-record.ts +48 -10
- package/os/context/context.module.ts +23 -4
- package/os/context/handlers/context-assemble.test.ts +5 -2
- package/os/context/handlers/context-assemble.ts +144 -28
- package/os/context/handlers/context-slate-eval.test.ts +11 -5
- package/os/context/handlers/context-slate-eval.ts +36 -10
- package/os/context/handlers/index-build.ts +179 -40
- package/os/context/handlers/no-model-deps.test.ts +8 -3
- package/os/context/handlers/slate-fill.test.ts +7 -2
- package/os/core/archive-regen.ts +209 -18
- package/os/core/core.module.ts +215 -51
- package/os/core/docs-archive.test.ts +159 -37
- package/os/core/handlers/forge-autonomy-validate.ts +104 -2
- package/os/core/handlers/package-health.ts +6 -6
- package/os/core/handlers/pinned-check.ts +30 -0
- package/os/core/handlers/pinned-types.ts +7 -0
- package/os/core/handlers/pinned-validate.ts +28 -3
- package/os/core/handlers/policy-digest.test.ts +143 -0
- package/os/core/handlers/policy-digest.ts +470 -0
- package/os/correctness/audit/snapshot.ts +46 -22
- package/os/correctness/correctness-chain.test.ts +6 -2
- package/os/correctness/correctness.module.ts +6 -3
- package/os/correctness/gate/anchor-events.test.ts +5 -1
- package/os/correctness/gate/freeze-coverage.test.ts +1 -1
- package/os/correctness/gate/freeze-diff.test.ts +1 -1
- package/os/correctness/gate/frozen.ts +691 -58
- package/os/correctness/gate/gate-mode.test.ts +5 -1
- package/os/correctness/gate/hardening.test.ts +5 -2
- package/os/correctness/gate/origin.ts +77 -37
- package/os/correctness/gate/policy-freeze-cx.test.ts +174 -0
- package/os/correctness/gate/policy-freeze-cx10.test.ts +873 -0
- package/os/correctness/gate/policy-freeze-cx11.test.ts +534 -0
- package/os/correctness/gate/policy-freeze-cx12.test.ts +488 -0
- package/os/correctness/gate/policy-freeze-cx13.test.ts +734 -0
- package/os/correctness/gate/policy-freeze-cx14.test.ts +533 -0
- package/os/correctness/gate/policy-freeze-cx15.test.ts +830 -0
- package/os/correctness/gate/policy-freeze-cx16.test.ts +652 -0
- package/os/correctness/gate/policy-freeze-cx17.test.ts +717 -0
- package/os/correctness/gate/policy-freeze-cx18.test.ts +705 -0
- package/os/correctness/gate/policy-freeze-cx19.test.ts +376 -0
- package/os/correctness/gate/policy-freeze-cx2.test.ts +691 -0
- package/os/correctness/gate/policy-freeze-cx20.test.ts +572 -0
- package/os/correctness/gate/policy-freeze-cx21.test.ts +423 -0
- package/os/correctness/gate/policy-freeze-cx22.test.ts +978 -0
- package/os/correctness/gate/policy-freeze-cx23.test.ts +431 -0
- package/os/correctness/gate/policy-freeze-cx24.test.ts +509 -0
- package/os/correctness/gate/policy-freeze-cx25.test.ts +1064 -0
- package/os/correctness/gate/policy-freeze-cx3.test.ts +569 -0
- package/os/correctness/gate/policy-freeze-cx4.test.ts +731 -0
- package/os/correctness/gate/policy-freeze-cx5.test.ts +577 -0
- package/os/correctness/gate/policy-freeze-cx6.test.ts +944 -0
- package/os/correctness/gate/policy-freeze-cx7.test.ts +622 -0
- package/os/correctness/gate/policy-freeze-cx8.test.ts +638 -0
- package/os/correctness/gate/policy-freeze-cx9.test.ts +959 -0
- package/os/correctness/gate/policy-freeze.test.ts +249 -0
- package/os/correctness/gate/repo.ts +194 -15
- package/os/correctness/gate/run.ts +444 -65
- package/os/correctness/gate/runner.ts +41 -8
- package/os/correctness/gate/tests/gate-fixture.ts +27 -2
- package/os/correctness/gate/tier-high.test.ts +5 -1
- package/os/correctness/gate/trust-boundary-cx1.test.ts +1020 -0
- package/os/correctness/gate/trust-boundary-cx10.test.ts +755 -0
- package/os/correctness/gate/trust-boundary-cx11.test.ts +515 -0
- package/os/correctness/gate/trust-boundary-cx12.test.ts +552 -0
- package/os/correctness/gate/trust-boundary-cx13.test.ts +446 -0
- package/os/correctness/gate/trust-boundary-cx14.test.ts +375 -0
- package/os/correctness/gate/trust-boundary-cx15.test.ts +421 -0
- package/os/correctness/gate/trust-boundary-cx16.test.ts +487 -0
- package/os/correctness/gate/trust-boundary-cx17.test.ts +319 -0
- package/os/correctness/gate/trust-boundary-cx18.test.ts +516 -0
- package/os/correctness/gate/trust-boundary-cx19.test.ts +514 -0
- package/os/correctness/gate/trust-boundary-cx2.test.ts +979 -0
- package/os/correctness/gate/trust-boundary-cx20.test.ts +216 -0
- package/os/correctness/gate/trust-boundary-cx22.test.ts +193 -0
- package/os/correctness/gate/trust-boundary-cx23.test.ts +283 -0
- package/os/correctness/gate/trust-boundary-cx24.test.ts +180 -0
- package/os/correctness/gate/trust-boundary-cx25.test.ts +482 -0
- package/os/correctness/gate/trust-boundary-cx26.test.ts +408 -0
- package/os/correctness/gate/trust-boundary-cx27.test.ts +983 -0
- package/os/correctness/gate/trust-boundary-cx28.test.ts +587 -0
- package/os/correctness/gate/trust-boundary-cx29a.test.ts +226 -0
- package/os/correctness/gate/trust-boundary-cx29b.test.ts +271 -0
- package/os/correctness/gate/trust-boundary-cx29c.test.ts +217 -0
- package/os/correctness/gate/trust-boundary-cx29d.test.ts +544 -0
- package/os/correctness/gate/trust-boundary-cx29e.test.ts +207 -0
- package/os/correctness/gate/trust-boundary-cx29f.test.ts +226 -0
- package/os/correctness/gate/trust-boundary-cx29g.test.ts +74 -0
- package/os/correctness/gate/trust-boundary-cx3.test.ts +929 -0
- package/os/correctness/gate/trust-boundary-cx30a.test.ts +195 -0
- package/os/correctness/gate/trust-boundary-cx30b.test.ts +296 -0
- package/os/correctness/gate/trust-boundary-cx31a.test.ts +129 -0
- package/os/correctness/gate/trust-boundary-cx31b.test.ts +333 -0
- package/os/correctness/gate/trust-boundary-cx31c.test.ts +259 -0
- package/os/correctness/gate/trust-boundary-cx31d.test.ts +132 -0
- package/os/correctness/gate/trust-boundary-cx32a.test.ts +275 -0
- package/os/correctness/gate/trust-boundary-cx32b.test.ts +509 -0
- package/os/correctness/gate/trust-boundary-cx32c.test.ts +211 -0
- package/os/correctness/gate/trust-boundary-cx32d.test.ts +184 -0
- package/os/correctness/gate/trust-boundary-cx33a.test.ts +250 -0
- package/os/correctness/gate/trust-boundary-cx33b.test.ts +287 -0
- package/os/correctness/gate/trust-boundary-cx33c.test.ts +122 -0
- package/os/correctness/gate/trust-boundary-cx33d.test.ts +357 -0
- package/os/correctness/gate/trust-boundary-cx33e.test.ts +96 -0
- package/os/correctness/gate/trust-boundary-cx34a.test.ts +283 -0
- package/os/correctness/gate/trust-boundary-cx34b.test.ts +228 -0
- package/os/correctness/gate/trust-boundary-cx34d.test.ts +282 -0
- package/os/correctness/gate/trust-boundary-cx34e.test.ts +224 -0
- package/os/correctness/gate/trust-boundary-cx34f.test.ts +250 -0
- package/os/correctness/gate/trust-boundary-cx34g.test.ts +179 -0
- package/os/correctness/gate/trust-boundary-cx34h.test.ts +293 -0
- package/os/correctness/gate/trust-boundary-cx34i.test.ts +245 -0
- package/os/correctness/gate/trust-boundary-cx35a.test.ts +181 -0
- package/os/correctness/gate/trust-boundary-cx35b.test.ts +137 -0
- package/os/correctness/gate/trust-boundary-cx35c.test.ts +149 -0
- package/os/correctness/gate/trust-boundary-cx35d.test.ts +121 -0
- package/os/correctness/gate/trust-boundary-cx35e.test.ts +108 -0
- package/os/correctness/gate/trust-boundary-cx36.test.ts +120 -0
- package/os/correctness/gate/trust-boundary-cx37.test.ts +430 -0
- package/os/correctness/gate/trust-boundary-cx38.test.ts +436 -0
- package/os/correctness/gate/trust-boundary-cx39.test.ts +432 -0
- package/os/correctness/gate/trust-boundary-cx4.test.ts +764 -0
- package/os/correctness/gate/trust-boundary-cx40.test.ts +264 -0
- package/os/correctness/gate/trust-boundary-cx41.test.ts +460 -0
- package/os/correctness/gate/trust-boundary-cx42.test.ts +432 -0
- package/os/correctness/gate/trust-boundary-cx43.test.ts +257 -0
- package/os/correctness/gate/trust-boundary-cx5.test.ts +998 -0
- package/os/correctness/gate/trust-boundary-cx6.test.ts +701 -0
- package/os/correctness/gate/trust-boundary-cx7.test.ts +1007 -0
- package/os/correctness/gate/trust-boundary-cx8.test.ts +929 -0
- package/os/correctness/gate/trust-boundary-cx9.test.ts +993 -0
- package/os/correctness/gate/types.ts +4 -0
- package/os/correctness/handlers/gate.ts +2 -0
- package/os/correctness/handlers/validate.ts +63 -12
- package/os/correctness/references.ts +63 -20
- package/os/correctness/workspace.ts +203 -22
- package/os/flow/branch-name.ts +3 -6
- package/os/flow/correctness-step.ts +91 -17
- package/os/flow/digest.ts +962 -201
- package/os/flow/dup-id-scan.ts +187 -0
- package/os/flow/evidence-lock.ts +184 -0
- package/os/flow/flow.module.ts +162 -19
- package/os/flow/git.ts +952 -86
- package/os/flow/guard-files.ts +5 -14
- package/os/flow/handlers/flow-backmerge.ts +11 -22
- package/os/flow/handlers/flow-check.ts +2 -2
- package/os/flow/handlers/flow-cut.ts +459 -252
- package/os/flow/handlers/flow-digest.ts +14 -9
- package/os/flow/handlers/flow-discard.ts +6 -6
- package/os/flow/handlers/flow-fix.ts +104 -29
- package/os/flow/handlers/flow-hold.ts +24 -37
- package/os/flow/handlers/flow-install.ts +61 -33
- package/os/flow/handlers/flow-integrate.ts +992 -209
- package/os/flow/handlers/flow-open.ts +104 -12
- package/os/flow/handlers/flow-publication-retire.ts +38 -17
- package/os/flow/handlers/flow-push.ts +925 -73
- package/os/flow/handlers/flow-status.ts +32 -13
- package/os/flow/handlers/flow-swept.ts +185 -0
- package/os/flow/handlers/flow-version.ts +5 -18
- package/os/flow/index.ts +8 -4
- package/os/flow/line-version.ts +21 -8
- package/os/flow/locks.ts +44 -16
- package/os/flow/markers.ts +16 -5
- package/os/flow/ops-registry.ts +25 -7
- package/os/flow/post-rebase-regen.ts +218 -25
- package/os/flow/pre-lock.ts +334 -0
- package/os/flow/preflight.ts +110 -17
- package/os/flow/primary-dirt.ts +319 -0
- package/os/flow/publish.ts +35 -17
- package/os/flow/registry.ts +29 -15
- package/os/flow/release-level.ts +25 -12
- package/os/flow/release-lines.ts +4 -5
- package/os/flow/release-tags.ts +47 -19
- package/os/flow/repo-kind.ts +6 -3
- package/os/flow/scripts.ts +40 -7
- package/os/flow/semver.ts +1 -1
- package/os/flow/session-checkout.ts +3 -3
- package/os/flow/standalone-invoke.ts +2 -2
- package/os/flow/tests/branch-name.test.ts +15 -7
- package/os/flow/tests/digest-id-inputs.test.ts +106 -0
- package/os/flow/tests/digest-persist.test.ts +243 -0
- package/os/flow/tests/evidence-preflight-surface-skip.test.ts +218 -0
- package/os/flow/tests/flow-backmerge.test.ts +8 -6
- package/os/flow/tests/flow-check.test.ts +6 -11
- package/os/flow/tests/flow-cut-prepare.test.ts +64 -15
- package/os/flow/tests/flow-cut.rerun.test.ts +1 -1
- package/os/flow/tests/flow-cut.test.ts +230 -11
- package/os/flow/tests/flow-detachable.test.ts +10 -2
- package/os/flow/tests/flow-digest.test.ts +109 -29
- package/os/flow/tests/flow-fix.test.ts +96 -20
- package/os/flow/tests/flow-guard-parity.test.ts +55 -53
- package/os/flow/tests/flow-guard-push.test.ts +39 -2
- package/os/flow/tests/flow-guard.test.ts +5 -10
- package/os/flow/tests/flow-hold.test.ts +43 -10
- package/os/flow/tests/flow-install-markers.test.ts +47 -20
- package/os/flow/tests/flow-install.rerun.test.ts +18 -9
- package/os/flow/tests/flow-install.test.ts +19 -19
- package/os/flow/tests/flow-integrate-correctness-gate.test.ts +3 -4
- package/os/flow/tests/flow-integrate-prelock.test.ts +392 -0
- package/os/flow/tests/flow-integrate.gate-report.test.ts +2 -4
- package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +33 -0
- package/os/flow/tests/flow-integrate.preflight.test.ts +36 -1
- package/os/flow/tests/flow-integrate.test.ts +375 -21
- package/os/flow/tests/flow-open.test.ts +123 -9
- package/os/flow/tests/flow-publication-retire.test.ts +13 -6
- package/os/flow/tests/flow-push-attest.test.ts +137 -0
- package/os/flow/tests/flow-push-publish.test.ts +45 -19
- package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
- package/os/flow/tests/flow-push-supersede.test.ts +37 -34
- package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
- package/os/flow/tests/flow-push-verifier-review.test.ts +190 -0
- package/os/flow/tests/flow-push.test.ts +15 -7
- package/os/flow/tests/flow-status.test.ts +54 -1
- package/os/flow/tests/flow-swept.test.ts +105 -0
- package/os/flow/tests/flow-task-files.test.ts +18 -4
- package/os/flow/tests/helpers.test.ts +91 -0
- package/os/flow/tests/helpers.ts +188 -19
- package/os/flow/tests/locks.test.ts +5 -4
- package/os/flow/tests/post-rebase-regen.test.ts +315 -0
- package/os/flow/tests/scripts.test.ts +8 -4
- package/os/flow/tests/state-roots.test.ts +8 -11
- package/os/flow/version-files.ts +4 -2
- package/os/flow/worktree-path.ts +3 -9
- package/os/friction/friction-add.test.ts +183 -0
- package/os/friction/friction-migrate.test.ts +203 -0
- package/os/friction/friction-store.test.ts +184 -0
- package/os/friction/friction-validate.test.ts +133 -21
- package/os/friction/friction.module.ts +169 -31
- package/os/friction/handlers/friction-add.ts +263 -0
- package/os/friction/handlers/friction-migrate.ts +425 -0
- package/os/friction/handlers/friction-validate.ts +238 -176
- package/os/friction/index.ts +14 -1
- package/os/friction/qa-log-shards.test.ts +111 -0
- package/os/friction/store.ts +303 -0
- package/os/friction/types.ts +19 -13
- package/os/gate/gate.module.ts +47 -6
- package/os/gate/handlers/gate-probe-catalog.test.ts +1 -1
- package/os/gate/handlers/gate-probe-catalog.ts +445 -42
- package/os/gate/handlers/gate-probe-ratchet.test.ts +364 -0
- package/os/gate/handlers/gate-probe.test.ts +27 -5
- package/os/gate/handlers/gate-probe.ts +110 -12
- package/os/gate/handlers/liveness.ts +113 -0
- package/os/gate/handlers/probe-runs-journal.ts +167 -0
- package/os/gate-run/gate-run.module.ts +3 -0
- package/os/gate-run/index.ts +11 -0
- package/os/gate-run/record.ts +8 -1
- package/os/gate-run/status.ts +9 -1
- package/os/gate-run/tests/gate-run-record.test.ts +11 -1
- package/os/gate-run/tests/gate-run-status.test.ts +2 -0
- package/os/gate-run/types.ts +8 -0
- package/os/instructions/budget.test.ts +32 -7
- package/os/instructions/handlers/scar-migrate.ts +55 -66
- package/os/instructions/instructions.module.ts +32 -5
- package/os/knowledge/handlers/knowledge-authz-probe.ts +38 -12
- package/os/knowledge/handlers/knowledge-rebuild.test.ts +5 -2
- package/os/knowledge/handlers/knowledge-rebuild.ts +39 -16
- package/os/knowledge/knowledge.module.ts +21 -4
- package/os/mission/handlers/archive.test.ts +47 -30
- package/os/mission/handlers/archive.ts +3 -11
- package/os/mission/lockfile.ts +47 -20
- package/os/naming/naming-convention.test.ts +1 -0
- package/os/naming/naming-convention.ts +2 -2
- package/os/plan/handlers/archive.ts +3 -11
- package/os/program/discovery.ts +70 -44
- package/os/program/handlers/complete.ts +28 -10
- package/os/program/handlers/lease.ts +11 -2
- package/os/program/handlers/seal.ts +3 -3
- package/os/program/handlers/validate.ts +3 -3
- package/os/queue/handlers/queue-decision.ts +253 -0
- package/os/queue/handlers/queue-validate.ts +24 -23
- package/os/queue/manifest.ts +1 -2
- package/os/queue/queue-decision.test.ts +262 -0
- package/os/queue/queue.module.ts +93 -4
- package/os/rfc/frontmatter-io.ts +6 -3
- package/os/rfc/handlers/archive.ts +3 -11
- package/os/rfc/handlers/implement-stamp-origin.ts +6 -3
- package/os/rfc/handlers/implement-stamp.ts +65 -46
- package/os/rfc/handlers/index-graph.ts +14 -0
- package/os/rfc/handlers/list-create.ts +22 -17
- package/os/rfc/handlers/rfc-evidence-sync.ts +62 -22
- package/os/rfc/handlers/validate-moves.test.ts +221 -0
- package/os/rfc/handlers/validate-probe-meta.test.ts +21 -1
- package/os/rfc/handlers/validate-rules.ts +216 -60
- package/os/rfc/handlers/validate.ts +1 -5
- package/os/rfc/next-id.ts +155 -21
- package/os/rfc/outcome-probe.ts +13 -4
- package/os/rfc/reachable-symbol.ts +65 -43
- package/os/rfc/rfc-0000-template.md +10 -0
- package/os/rfc/rfc.module.ts +26 -4
- package/os/rfc/types.ts +31 -3
- package/os/rfc/verification-evidence.ts +74 -25
- package/os/rfc/verification-origin.ts +358 -62
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/fixtures/no-report.proof.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/fixtures/small-domain.proof.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/support.ts +1 -1
- package/os/rfc/verify-workspace.ts +147 -53
- package/os/session/handlers/archive.ts +3 -11
- package/os/session/handlers/metrics-rfc.ts +42 -11
- package/os/session/handlers/save.ts +52 -28
- package/os/session/handlers/session-audit-detectors.test.ts +16 -6
- package/os/session/handlers/session-audit-report.test.ts +9 -3
- package/os/session/handlers/session-audit-report.ts +34 -8
- package/os/session/handlers/session-audit.test.ts +25 -7
- package/os/session/handlers/session-audit.ts +49 -23
- package/os/session/session.module.ts +31 -9
- package/os/system/handlers/system-outbox-scan.ts +45 -17
- package/os/system/handlers/system-product-register.ts +492 -0
- package/os/system/handlers/system-products-status.ts +395 -0
- package/os/system/handlers/system-task-dispatch.ts +17 -21
- package/os/system/handlers/system-versionset-record.ts +3 -3
- package/os/system/scenario-schemas.ts +1 -1
- package/os/system/schemas.ts +17 -0
- package/os/system/system.module.ts +130 -11
- package/os/system/tests/scenario-pin-drift-check.test.ts +2 -0
- package/os/system/tests/scenario-validator-check.test.ts +2 -0
- package/os/system/tests/system-product-register.test.ts +304 -0
- package/os/system/tests/system-products-status.test.ts +154 -0
- package/os/system/tests/system-task-collect.test.ts +25 -15
- package/os/system/tests/system-task-dispatch.test.ts +18 -7
- package/os/system/tests/system-task-status.test.ts +7 -1
- package/os/system/tests/system-task.test.ts +15 -4
- package/os/system/tests/version-set-v2.test.ts +2 -0
- package/os/trajectory/handlers/extract-units.test.ts +11 -6
- package/os/trajectory/handlers/journal-io.ts +21 -7
- package/os/trajectory/handlers/outcome-record.test.ts +28 -8
- package/os/trajectory/handlers/outcome-record.ts +65 -18
- package/os/trajectory/handlers/producer-trust.test.ts +22 -8
- package/os/trajectory/handlers/trajectory-index.test.ts +75 -29
- package/os/trajectory/handlers/trajectory-index.ts +116 -38
- package/os/trajectory/handlers/trajectory-recall.test.ts +67 -19
- package/os/trajectory/handlers/trajectory-recall.ts +115 -41
- package/os/trajectory/handlers/trajectory.test.ts +19 -7
- package/os/trajectory/handlers/verdict-binding.test.ts +138 -33
- package/os/trajectory/trajectory.module.ts +35 -7
- package/os/yaml/scalars.test.ts +1 -1
- package/package.json +30 -1
- package/profiles/godot-game.yaml +4 -4
- package/profiles/root-agents-system.md +82 -0
- package/profiles/system.yaml +1 -0
- package/skills/_shared/fo-pipeline-conventions.md +15 -13
- package/skills/fo/fo-handoff/SKILL.md +10 -2
- package/skills/fo/fo-idea-audit/SKILL.md +4 -0
- package/skills/fo/fo-idea-create-rfc/SKILL.md +21 -10
- package/skills/fo/fo-idea-implement/SKILL.md +2 -10
- package/skills/fo/fo-idea-plan/SKILL.md +7 -5
- package/skills/fo/fo-knowledge-distill/SKILL.md +15 -4
- package/skills/fo/fo-memory-sync/SKILL.md +7 -6
- package/skills/fo/fo-reproduce/SKILL.md +2 -1
- package/skills/fo/fo-session-retro/SKILL.md +87 -44
- package/skills/fo/fo-session-save/SKILL.md +4 -3
- package/skills/fo/fo-system-dispatch/SKILL.md +9 -0
- package/skills/shared/grilling/SKILL.md +17 -9
- package/skills/shared/knowledge/learned-principles.md +1 -1
- package/skills/shared/writing-great-skills/SKILL.md +4 -3
- package/src/adversarial/types.ts +100 -0
- package/src/authority/delegations.ts +9 -2
- package/src/command-modules.ts +6 -0
- package/src/config/forge-config.ts +151 -13
- package/src/correctness/policy-bundle.ts +187 -0
- package/src/knowledge/paths.ts +75 -0
- package/src/knowledge/sync.ts +42 -18
- package/src/onboarding/create-superfolder-guard.test.ts +73 -0
- package/src/onboarding/create.ts +28 -2
- package/src/onboarding/init.ts +20 -5
- package/src/onboarding/npm-token-check.ts +9 -1
- package/src/onboarding/scaffold-project.ts +16 -5
- package/src/onboarding/trust-boundary.test.ts +179 -0
- package/src/onboarding/trust-boundary.ts +825 -0
- package/src/onboarding/upgrade.ts +149 -9
- package/src/profiles/stack-profile.ts +2 -2
- package/src/scaffold/github/CODEOWNERS.template +14 -0
- package/src/scaffold/github/forge-policy.template.yml +40 -0
- package/src/tests/bindings-schema.test.ts +5 -1
- package/src/tests/create.test.ts +74 -20
- package/src/tests/evidence-consult-serialization.test.ts +202 -0
- package/src/tests/forge-config.test.ts +5 -2
- package/src/tests/knowledge-paths.test.ts +80 -0
- package/src/tests/pinned-validate.test.ts +194 -0
- package/src/tests/profile-flow-hooks.test.ts +1 -0
- package/src/tests/profile-schema.test.ts +1 -0
- package/src/tests/skill-validate.test.ts +76 -0
- package/src/tests/stack-profile.test.ts +1 -0
- package/src/types.ts +11 -6
- package/src/utils/verifier-git.ts +8732 -0
- package/src/validators/skill-validate.ts +17 -5
- /package/skills/fo/fo-memory-sync/{qa-log.md → qa-log/legacy.md} +0 -0
- /package/skills/fo/fo-session-save/{qa-log.md → qa-log/legacy.md} +0 -0
- /package/skills/shared/grilling/{qa-log.md → qa-log/legacy.md} +0 -0
|
@@ -0,0 +1,979 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1616 acceptance probes — independent round-2 verification of the external
|
|
5
|
+
verification trust boundary after the r1 fixes (e9add1cd5 + 8c9e1688a).
|
|
6
|
+
R2-CX* probes re-run the previously-failing behaviours (exit-code refusal
|
|
7
|
+
semantics, digest coverage, inert-file scaffold, project.owner carve). CX-33+
|
|
8
|
+
probes attack the REPAIRED surfaces: observedVerdict JSON slicing, spawn env
|
|
9
|
+
inheritance, \x1e git-record framing in the trailer scans, the additive/mutable
|
|
10
|
+
grant asymmetries between the in-repo gate and the digest, CODEOWNERS merge
|
|
11
|
+
precedence, marker spoofing, and owner-string injection. PASS = contour held,
|
|
12
|
+
FAIL = live counterexample.
|
|
13
|
+
</purpose>
|
|
14
|
+
<non-goals>
|
|
15
|
+
<item>Not a contract source of truth — os/adversarial, os/core/handlers/policy-digest.ts, os/flow/handlers/flow-push.ts own behaviour.</item>
|
|
16
|
+
</non-goals>
|
|
17
|
+
</MODULE_CONTRACT>
|
|
18
|
+
<CHANGE_SUMMARY>
|
|
19
|
+
<item>RFC-1616: independent acceptance verification r2 — 26 probes, 13 counterexamples.</item>
|
|
20
|
+
<item>RFC-1616: port RFC-1616 round-2 independent verifier probes
|
|
21
|
+
|
|
22
|
+
Port the clean-context verifier's 27-probe suite verbatim as
|
|
23
|
+
trust-boundary-cx2.test.ts and persist its acceptance report
|
|
24
|
+
(verdict: refuted, isolation: subagent) - 13 counterexamples landed and
|
|
25
|
+
were closed in 7c8049616.</item>
|
|
26
|
+
</CHANGE_SUMMARY>
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { execFileSync } from "node:child_process";
|
|
30
|
+
import {
|
|
31
|
+
chmodSync,
|
|
32
|
+
existsSync,
|
|
33
|
+
mkdirSync,
|
|
34
|
+
mkdtempSync,
|
|
35
|
+
readdirSync,
|
|
36
|
+
readFileSync,
|
|
37
|
+
rmSync,
|
|
38
|
+
writeFileSync,
|
|
39
|
+
} from "node:fs";
|
|
40
|
+
import os from "node:os";
|
|
41
|
+
import path from "node:path";
|
|
42
|
+
import { fileURLToPath } from "node:url";
|
|
43
|
+
|
|
44
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
45
|
+
|
|
46
|
+
import type { AdversarialScenario } from "../../../src/adversarial/types.ts";
|
|
47
|
+
import type { ForgeRuntimeContext } from "../../../src/types.ts";
|
|
48
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
49
|
+
import {
|
|
50
|
+
codeownersTemplate,
|
|
51
|
+
scaffoldTrustBoundary,
|
|
52
|
+
} from "../../../src/onboarding/trust-boundary.ts";
|
|
53
|
+
import { loadForgeConfig } from "../../../src/config/forge-config.ts";
|
|
54
|
+
import { runScenario } from "../../adversarial/runner.ts";
|
|
55
|
+
import { loadCatalog } from "../../adversarial/catalog.ts";
|
|
56
|
+
import { runPolicyDigest } from "../../core/handlers/policy-digest.ts";
|
|
57
|
+
import { collectDigest } from "../../flow/digest.ts";
|
|
58
|
+
import { pushFlow } from "../../flow/handlers/flow-push.ts";
|
|
59
|
+
import { gitExec, initRepoWithOrigin } from "../../flow/tests/helpers.ts";
|
|
60
|
+
import { runCorrectnessGate } from "./run.ts";
|
|
61
|
+
|
|
62
|
+
const MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
63
|
+
const PKG_ROOT = path.resolve(MODULE_DIR, "../../..");
|
|
64
|
+
const FORGE_BIN = path.join(PKG_ROOT, "bin", "cli.js");
|
|
65
|
+
const FORGE_ARGV = [process.execPath, FORGE_BIN];
|
|
66
|
+
|
|
67
|
+
const dirs: string[] = [];
|
|
68
|
+
afterEach(() => {
|
|
69
|
+
for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// fixtures (self-contained copies of the cx1 helpers)
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
function fixtureRepo(): string {
|
|
77
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-adv-base-"));
|
|
78
|
+
dirs.push(root);
|
|
79
|
+
const g = (args: string[]) =>
|
|
80
|
+
execFileSync("git", args, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
81
|
+
g(["init", "-q"]);
|
|
82
|
+
g(["config", "user.email", "t@t"]);
|
|
83
|
+
g(["config", "user.name", "t"]);
|
|
84
|
+
writeFileSync(path.join(root, "seed.txt"), "seed\n");
|
|
85
|
+
g(["add", "-A"]);
|
|
86
|
+
g(["commit", "-qm", "seed"]);
|
|
87
|
+
return root;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const NOOP_LOGGER = {
|
|
91
|
+
section() {},
|
|
92
|
+
info() {},
|
|
93
|
+
warn() {},
|
|
94
|
+
error() {},
|
|
95
|
+
success() {},
|
|
96
|
+
} as unknown as ForgeRuntimeContext["logger"];
|
|
97
|
+
|
|
98
|
+
function ctx(root: string): ForgeRuntimeContext {
|
|
99
|
+
return {
|
|
100
|
+
workspaceRoot: root,
|
|
101
|
+
logger: NOOP_LOGGER,
|
|
102
|
+
dryRun: false,
|
|
103
|
+
outputFormat: "json",
|
|
104
|
+
} as ForgeRuntimeContext;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function digest(root: string, flags: Record<string, boolean | string>) {
|
|
108
|
+
return runPolicyDigest({ argv: [], flags }, ctx(root));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function initPolicyRepo(opts: {
|
|
112
|
+
mutable?: string;
|
|
113
|
+
additive?: string;
|
|
114
|
+
freezeFiles?: string;
|
|
115
|
+
extraForgeYaml?: string;
|
|
116
|
+
files?: Record<string, string>;
|
|
117
|
+
policyBlock?: boolean;
|
|
118
|
+
}): { root: string; base: string } {
|
|
119
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-pd-"));
|
|
120
|
+
dirs.push(root);
|
|
121
|
+
const g = (args: string[]) =>
|
|
122
|
+
execFileSync("git", args, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
123
|
+
g(["init", "-q"]);
|
|
124
|
+
g(["config", "user.email", "t@t"]);
|
|
125
|
+
g(["config", "user.name", "t"]);
|
|
126
|
+
const policy =
|
|
127
|
+
opts.policyBlock === false
|
|
128
|
+
? ""
|
|
129
|
+
: `policy:
|
|
130
|
+
mutable: ${opts.mutable ?? "[project]"}
|
|
131
|
+
additive: ${opts.additive ?? "[]"}
|
|
132
|
+
freezeFiles: ${opts.freezeFiles ?? '["hooks/**"]'}
|
|
133
|
+
`;
|
|
134
|
+
writeFileSync(
|
|
135
|
+
path.join(root, "forge.yaml"),
|
|
136
|
+
`schema: forge/config@1
|
|
137
|
+
project:
|
|
138
|
+
name: pd-probe
|
|
139
|
+
paths: {}
|
|
140
|
+
${policy}${opts.extraForgeYaml ?? ""}`,
|
|
141
|
+
);
|
|
142
|
+
for (const [rel, body] of Object.entries(opts.files ?? {})) {
|
|
143
|
+
mkdirSync(path.dirname(path.join(root, rel)), { recursive: true });
|
|
144
|
+
writeFileSync(path.join(root, rel), body);
|
|
145
|
+
}
|
|
146
|
+
g(["add", "-A"]);
|
|
147
|
+
g(["commit", "-qm", "base"]);
|
|
148
|
+
return { root, base: g(["rev-parse", "HEAD"]).trim() };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const gitIn = (root: string, args: string[]) =>
|
|
152
|
+
execFileSync("git", args, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
153
|
+
|
|
154
|
+
const fyPath = (root: string) => path.join(root, "forge.yaml");
|
|
155
|
+
const fyEdit = (root: string, from: string, to: string) => {
|
|
156
|
+
const body = readFileSync(fyPath(root), "utf8");
|
|
157
|
+
if (!body.includes(from)) throw new Error(`fyEdit: ${from} not present`);
|
|
158
|
+
writeFileSync(fyPath(root), body.replace(from, to));
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
function scenario(partial: Partial<AdversarialScenario> & Pick<AdversarialScenario, "expect">) {
|
|
162
|
+
return {
|
|
163
|
+
schema: "forge/adversarial-scenario@1",
|
|
164
|
+
name: partial.name ?? "cx-probe",
|
|
165
|
+
setup: partial.setup ?? [
|
|
166
|
+
{
|
|
167
|
+
contour: {
|
|
168
|
+
extraFiles: {
|
|
169
|
+
"hooks/integration-gate.sh": "#!/bin/sh\nexit 0\n",
|
|
170
|
+
".forge/pinned.yaml": "pinned: []\n",
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
attack: partial.attack ?? {
|
|
176
|
+
files: { "src/innocent.ts": "export const ok = 1;\n" },
|
|
177
|
+
commitMessage: "benign session diff",
|
|
178
|
+
},
|
|
179
|
+
invoke: partial.invoke ?? "correctness.gate --base {base} --json",
|
|
180
|
+
expect: partial.expect,
|
|
181
|
+
} as AdversarialScenario;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function catalogScenario(name: string): AdversarialScenario {
|
|
185
|
+
const e = loadCatalog().find((x) => x.name === name);
|
|
186
|
+
if (!e?.scenario) throw new Error(`catalog scenario ${name} missing/invalid: ${e?.error}`);
|
|
187
|
+
return e.scenario;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function trailerCommit(repo: string, file: string, trailerLine: string): Promise<string> {
|
|
191
|
+
const { writeFile } = await import("node:fs/promises");
|
|
192
|
+
await writeFile(path.join(repo, file), "x\n");
|
|
193
|
+
await gitExec(repo, ["add", file]);
|
|
194
|
+
await gitExec(repo, ["commit", "-qm", `session work\n\n${trailerLine}`]);
|
|
195
|
+
return (await gitExec(repo, ["rev-parse", "HEAD"])).stdout.trim();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ===========================================================================
|
|
199
|
+
// A. re-verification of the r1 fixes
|
|
200
|
+
// ===========================================================================
|
|
201
|
+
|
|
202
|
+
describe("RFC-1616 r2 — r1 fix re-verification: adversarial.run", () => {
|
|
203
|
+
it(
|
|
204
|
+
"R2-CX1: echo-argv no longer fabricates a refusal — the spawned process's exit code, not its printed tokens, is the refusal signal",
|
|
205
|
+
{ timeout: 120_000 },
|
|
206
|
+
async () => {
|
|
207
|
+
const r = await runScenario(catalogScenario("weaken-oracle"), {
|
|
208
|
+
repoRoot: fixtureRepo(),
|
|
209
|
+
forgeArgv: ["/bin/echo", "CORR-GATE-02 CORR-GATE-03 CORR-GATE-04 FLOW-INT-18"],
|
|
210
|
+
});
|
|
211
|
+
expect(r.ok).toBe(false);
|
|
212
|
+
},
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
it(
|
|
216
|
+
"R2-CX2: manifest-entry id echo — the true CORR-GATE-03 refusal is observed; the echoed CORR-GATE-02 token is not credited",
|
|
217
|
+
{ timeout: 240_000 },
|
|
218
|
+
async () => {
|
|
219
|
+
const planted = scenario({
|
|
220
|
+
name: "token-echo",
|
|
221
|
+
setup: [
|
|
222
|
+
{
|
|
223
|
+
contour: {
|
|
224
|
+
manifestExtra: ` - id: CORR-GATE-02
|
|
225
|
+
source: req
|
|
226
|
+
ref: REQ-01
|
|
227
|
+
seam: data
|
|
228
|
+
anchors: [INV-dispatch-01]
|
|
229
|
+
oracles:
|
|
230
|
+
- check: test:no-such-oracle.ts
|
|
231
|
+
substrate: L1
|
|
232
|
+
`,
|
|
233
|
+
extraFiles: {
|
|
234
|
+
"hooks/integration-gate.sh": "#!/bin/sh\nexit 0\n",
|
|
235
|
+
".forge/pinned.yaml": "pinned: []\n",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
expect: { status: "refused", rule: "CORR-GATE-02" },
|
|
241
|
+
});
|
|
242
|
+
const paired = await runScenario(
|
|
243
|
+
{
|
|
244
|
+
...planted,
|
|
245
|
+
name: "token-echo-pair",
|
|
246
|
+
expect: { status: "refused", rule: "CORR-GATE-03" },
|
|
247
|
+
},
|
|
248
|
+
{ repoRoot: fixtureRepo(), forgeArgv: FORGE_ARGV },
|
|
249
|
+
);
|
|
250
|
+
expect(paired.observed).toBe("CORR-GATE-03");
|
|
251
|
+
const r = await runScenario(planted, {
|
|
252
|
+
repoRoot: fixtureRepo(),
|
|
253
|
+
forgeArgv: FORGE_ARGV,
|
|
254
|
+
});
|
|
255
|
+
expect(r.ok).toBe(false);
|
|
256
|
+
},
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
it(
|
|
260
|
+
"R2-CX3: warn-mode gate exits 0 — a warning-severity expected rule is not a refusal",
|
|
261
|
+
{ timeout: 120_000 },
|
|
262
|
+
async () => {
|
|
263
|
+
const warnForgeYaml = `schema: forge/config@1
|
|
264
|
+
project:
|
|
265
|
+
name: adversarial-demo
|
|
266
|
+
paths: {}
|
|
267
|
+
bindings:
|
|
268
|
+
schema: forge/bindings@1
|
|
269
|
+
commands:
|
|
270
|
+
checkRun: "node {file}"
|
|
271
|
+
paths:
|
|
272
|
+
compassDocs: [docs/requirements.xml]
|
|
273
|
+
correctnessManifest: docs/correctness.yaml
|
|
274
|
+
correctness:
|
|
275
|
+
mode: warn
|
|
276
|
+
tier: standard
|
|
277
|
+
policy:
|
|
278
|
+
mutable: ["project"]
|
|
279
|
+
additive: []
|
|
280
|
+
freezeFiles: ["hooks/**", ".forge/pinned.yaml"]
|
|
281
|
+
agentTools:
|
|
282
|
+
deny: ["deploy"]
|
|
283
|
+
`;
|
|
284
|
+
const warnContour = scenario({
|
|
285
|
+
name: "warn-mode-pass",
|
|
286
|
+
setup: [
|
|
287
|
+
{
|
|
288
|
+
contour: {
|
|
289
|
+
manifestExtra: ` - id: CM-self-oracle
|
|
290
|
+
source: req
|
|
291
|
+
ref: REQ-01
|
|
292
|
+
seam: data
|
|
293
|
+
anchors: [INV-dispatch-01]
|
|
294
|
+
oracles:
|
|
295
|
+
- check: test:no-such-oracle.ts
|
|
296
|
+
substrate: L1
|
|
297
|
+
`,
|
|
298
|
+
extraFiles: {
|
|
299
|
+
"forge.yaml": warnForgeYaml,
|
|
300
|
+
"hooks/integration-gate.sh": "#!/bin/sh\nexit 0\n",
|
|
301
|
+
".forge/pinned.yaml": "pinned: []\n",
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
expect: { status: "refused", rule: "CORR-GATE-03" },
|
|
307
|
+
});
|
|
308
|
+
const r = await runScenario(warnContour, {
|
|
309
|
+
repoRoot: fixtureRepo(),
|
|
310
|
+
forgeArgv: FORGE_ARGV,
|
|
311
|
+
});
|
|
312
|
+
expect(r.ok).toBe(false);
|
|
313
|
+
},
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
describe("RFC-1616 r2 — r1 fix re-verification: policy.digest coverage", () => {
|
|
318
|
+
it(
|
|
319
|
+
"R2-CX11: mutable:[policy] can no longer drop the policy: declaration out of the digest (ALWAYS_JUDGED)",
|
|
320
|
+
{ timeout: 30_000 },
|
|
321
|
+
async () => {
|
|
322
|
+
const hole = initPolicyRepo({
|
|
323
|
+
mutable: "[project, policy]",
|
|
324
|
+
files: { "hooks/h.sh": "#!/bin/sh\nexit 0\n", ".forge/pinned.yaml": "pinned: []\n" },
|
|
325
|
+
});
|
|
326
|
+
await digest(hole.root, { write: true });
|
|
327
|
+
fyEdit(hole.root, 'freezeFiles: ["hooks/**"]', "freezeFiles: []");
|
|
328
|
+
const v = await digest(hole.root, { verify: true });
|
|
329
|
+
expect(v.exitCode).toBe(1);
|
|
330
|
+
},
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
it(
|
|
334
|
+
"R2-CX12: .github/CODEOWNERS is inside the digested surface — editing the ownership anchor fails --verify",
|
|
335
|
+
{ timeout: 30_000 },
|
|
336
|
+
async () => {
|
|
337
|
+
const r = initPolicyRepo({
|
|
338
|
+
files: {
|
|
339
|
+
"hooks/h.sh": "#!/bin/sh\nexit 0\n",
|
|
340
|
+
".forge/pinned.yaml": "pinned: []\n",
|
|
341
|
+
".github/workflows/forge-policy.yml": "on: push\n",
|
|
342
|
+
".github/CODEOWNERS": "forge.yaml @owner\n",
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
await digest(r.root, { write: true });
|
|
346
|
+
writeFileSync(path.join(r.root, ".github/CODEOWNERS"), "# boundary removed\n");
|
|
347
|
+
const v = await digest(r.root, { verify: true });
|
|
348
|
+
expect(v.exitCode).toBe(1);
|
|
349
|
+
},
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
it(
|
|
353
|
+
"R2-CX13: a committed exec-bit flip on a frozen file advances the digest (--verify --base refuses)",
|
|
354
|
+
{ timeout: 30_000 },
|
|
355
|
+
async () => {
|
|
356
|
+
const r = initPolicyRepo({
|
|
357
|
+
files: { "hooks/h.sh": "#!/bin/sh\nexit 0\n", ".forge/pinned.yaml": "pinned: []\n" },
|
|
358
|
+
});
|
|
359
|
+
await digest(r.root, { write: true });
|
|
360
|
+
gitIn(r.root, ["add", "-A"]);
|
|
361
|
+
gitIn(r.root, ["commit", "-qm", "attest"]);
|
|
362
|
+
const base = gitIn(r.root, ["rev-parse", "HEAD"]).trim();
|
|
363
|
+
chmodSync(path.join(r.root, "hooks", "h.sh"), 0o755);
|
|
364
|
+
gitIn(r.root, ["add", "-A"]);
|
|
365
|
+
gitIn(r.root, ["commit", "-qm", "chmod the frozen hook"]);
|
|
366
|
+
const v = await digest(r.root, { verify: true, base });
|
|
367
|
+
expect(v.exitCode).toBe(1);
|
|
368
|
+
},
|
|
369
|
+
);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
describe("RFC-1616 r2 — r1 fix re-verification: scaffold + owner carve", () => {
|
|
373
|
+
it(
|
|
374
|
+
"R2-CX28: session-planted inert files are replaced, not silently adopted — marker-missing CODEOWNERS is merged, workflow backed up + rewritten",
|
|
375
|
+
{ timeout: 30_000 },
|
|
376
|
+
() => {
|
|
377
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-scaffold-"));
|
|
378
|
+
dirs.push(root);
|
|
379
|
+
mkdirSync(path.join(root, ".github", "workflows"), { recursive: true });
|
|
380
|
+
writeFileSync(path.join(root, ".github", "CODEOWNERS"), "# agent's own file\n");
|
|
381
|
+
writeFileSync(
|
|
382
|
+
path.join(root, ".github", "workflows", "forge-policy.yml"),
|
|
383
|
+
"# inert workflow — no jobs\n",
|
|
384
|
+
);
|
|
385
|
+
const r = scaffoldTrustBoundary(root, "@operator");
|
|
386
|
+
expect(r.replaced).toContain(".github/CODEOWNERS");
|
|
387
|
+
expect(r.replaced).toContain(".github/workflows/forge-policy.yml");
|
|
388
|
+
const wf = readFileSync(path.join(root, ".github", "workflows", "forge-policy.yml"), "utf8");
|
|
389
|
+
expect(wf).toContain("correctness.gate");
|
|
390
|
+
expect(
|
|
391
|
+
readFileSync(
|
|
392
|
+
path.join(root, ".github", "workflows", "forge-policy.yml.pre-scaffold"),
|
|
393
|
+
"utf8",
|
|
394
|
+
),
|
|
395
|
+
).toContain("inert workflow");
|
|
396
|
+
},
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
it("R2-CX29: the shipped CODEOWNERS template owns .github/CODEOWNERS itself", () => {
|
|
400
|
+
const tpl = readFileSync(
|
|
401
|
+
path.join(PKG_ROOT, "src", "scaffold", "github", "CODEOWNERS.template"),
|
|
402
|
+
"utf8",
|
|
403
|
+
);
|
|
404
|
+
expect(tpl).toMatch(/\.github\/CODEOWNERS/);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it(
|
|
408
|
+
"R2-CX32: project.owner flip/add/remove under the default mutable:[project] all refuse (the trust-anchor carve)",
|
|
409
|
+
{ timeout: 60_000 },
|
|
410
|
+
async () => {
|
|
411
|
+
const mk = async (baseOwner: string | null, headOwner: string | null) => {
|
|
412
|
+
const r = initPolicyRepo({ mutable: "[project]" });
|
|
413
|
+
if (baseOwner !== null) {
|
|
414
|
+
fyEdit(r.root, "name: pd-probe", `name: pd-probe\n owner: '${baseOwner}'`);
|
|
415
|
+
}
|
|
416
|
+
gitIn(r.root, ["add", "forge.yaml"]);
|
|
417
|
+
gitIn(r.root, ["commit", "-qm", "adopt", "--allow-empty"]);
|
|
418
|
+
const base = gitIn(r.root, ["rev-parse", "HEAD"]).trim();
|
|
419
|
+
const fy = readFileSync(fyPath(r.root), "utf8");
|
|
420
|
+
const now =
|
|
421
|
+
baseOwner !== null && headOwner === null
|
|
422
|
+
? fy.replace(`\n owner: '${baseOwner}'`, "")
|
|
423
|
+
: baseOwner !== null
|
|
424
|
+
? fy.replace(`'${baseOwner}'`, `'${headOwner}'`)
|
|
425
|
+
: fy.replace("name: pd-probe", `name: pd-probe\n owner: '${headOwner}'`);
|
|
426
|
+
writeFileSync(fyPath(r.root), now);
|
|
427
|
+
gitIn(r.root, ["add", "forge.yaml"]);
|
|
428
|
+
gitIn(r.root, ["commit", "-qm", "owner change"]);
|
|
429
|
+
return runCorrectnessGate(r.root, { base, policyOnly: true });
|
|
430
|
+
};
|
|
431
|
+
for (const [b, h, label] of [
|
|
432
|
+
["@operator", "@agent-self", "flip"],
|
|
433
|
+
[null, "@agent-self", "add"],
|
|
434
|
+
["@operator", null, "remove"],
|
|
435
|
+
] as const) {
|
|
436
|
+
const out = await mk(b, h);
|
|
437
|
+
expect(out.ok).toBe(true);
|
|
438
|
+
if (out.ok) {
|
|
439
|
+
expect(
|
|
440
|
+
out.result.status,
|
|
441
|
+
`project.owner ${label} under mutable:[project] must refuse`,
|
|
442
|
+
).toBe("fail");
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
it(
|
|
449
|
+
"R2-CX32b: combined micro-weakening — owner rebind + inert CODEOWNERS + mode downgrade in ONE diff still refuses",
|
|
450
|
+
{ timeout: 60_000 },
|
|
451
|
+
async () => {
|
|
452
|
+
const r = initPolicyRepo({
|
|
453
|
+
mutable: "[project]",
|
|
454
|
+
freezeFiles: '["hooks/**", ".github/CODEOWNERS", ".forge/pinned.yaml"]',
|
|
455
|
+
files: {
|
|
456
|
+
".github/CODEOWNERS": "forge.yaml @operator\n",
|
|
457
|
+
"hooks/h.sh": "#!/bin/sh\nexit 0\n",
|
|
458
|
+
".forge/pinned.yaml": "pinned: []\n",
|
|
459
|
+
},
|
|
460
|
+
extraForgeYaml: "correctness:\n mode: enforce\n",
|
|
461
|
+
});
|
|
462
|
+
fyEdit(r.root, "name: pd-probe", "name: pd-probe\n owner: '@operator'");
|
|
463
|
+
gitIn(r.root, ["add", "-A"]);
|
|
464
|
+
gitIn(r.root, ["commit", "-qm", "adopt"]);
|
|
465
|
+
const base = gitIn(r.root, ["rev-parse", "HEAD"]).trim();
|
|
466
|
+
// one session diff combining three small weakenings.
|
|
467
|
+
fyEdit(r.root, "'@operator'", "'@agent-self'");
|
|
468
|
+
fyEdit(r.root, "mode: enforce", "mode: warn");
|
|
469
|
+
writeFileSync(path.join(r.root, ".github", "CODEOWNERS"), "# nothing owned\n");
|
|
470
|
+
gitIn(r.root, ["add", "-A"]);
|
|
471
|
+
gitIn(r.root, ["commit", "-qm", "routine tidy-up"]);
|
|
472
|
+
const out = await runCorrectnessGate(r.root, { base, policyOnly: true });
|
|
473
|
+
expect(out.ok).toBe(true);
|
|
474
|
+
if (out.ok) expect(out.result.status).toBe("fail");
|
|
475
|
+
},
|
|
476
|
+
);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// ===========================================================================
|
|
480
|
+
// B. new counterexample probes — repaired surfaces under adversarial input
|
|
481
|
+
// ===========================================================================
|
|
482
|
+
|
|
483
|
+
describe("RFC-1616 r2 — adversarial.run integrity", () => {
|
|
484
|
+
it(
|
|
485
|
+
"CX-33: \\x1e in a commit message splits the git record — a verifier trailer hidden behind the record separator pushes unflagged (scanVerifierTrailers + correctnessTrailOf share the framing bug)",
|
|
486
|
+
{ timeout: 120_000 },
|
|
487
|
+
async () => {
|
|
488
|
+
const { repo, origin } = await initRepoWithOrigin(dirs, { prefix: "cx2-push-" });
|
|
489
|
+
const { writeFile } = await import("node:fs/promises");
|
|
490
|
+
await writeFile(path.join(repo, "inj.txt"), "x\n");
|
|
491
|
+
await gitExec(repo, ["add", "inj.txt"]);
|
|
492
|
+
// \x1e inside %B: `git log --format=%H\x1f%B\x1e` emits the body verbatim —
|
|
493
|
+
// the record splits mid-message and the trailer tail is dropped.
|
|
494
|
+
await gitExec(repo, ["commit", "-qm", "session work\x1e\n\nX-Verifier-Report: r.yaml"]);
|
|
495
|
+
const sha = (await gitExec(repo, ["rev-parse", "HEAD"])).stdout.trim();
|
|
496
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
497
|
+
const data = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
498
|
+
expect
|
|
499
|
+
.soft(
|
|
500
|
+
data.diagnostics[0]?.ruleId,
|
|
501
|
+
`the \\x1e-framed trailer scan missed a verifier commit — push outcome ${JSON.stringify({ pushed: data.pushed })}`,
|
|
502
|
+
)
|
|
503
|
+
.toBe("FLOW-PUSH-08");
|
|
504
|
+
// the digest's own correctness trail is blind to the same commit:
|
|
505
|
+
expect(
|
|
506
|
+
digest.correctnessTrail?.verifierCommits.some((c) => c.sha === sha),
|
|
507
|
+
"flow.digest's verifierCommits listing is blind to the \\x1e-split commit too",
|
|
508
|
+
).toBe(true);
|
|
509
|
+
void origin;
|
|
510
|
+
},
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
it(
|
|
514
|
+
"CX-34: the 'policy:-frozen' review switch honors the UNCOMMITTED forge.yaml — a dirty `push.requireVerifierReview: false` skips the hard stop while the judged (committed) surface still requires it",
|
|
515
|
+
{ timeout: 120_000 },
|
|
516
|
+
async () => {
|
|
517
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "cx2-push-" });
|
|
518
|
+
await trailerCommit(repo, "t.txt", "X-Verifier-Report: r.yaml");
|
|
519
|
+
// valid config opting out — left dirty in the worktree, never committed.
|
|
520
|
+
const { writeFile } = await import("node:fs/promises");
|
|
521
|
+
await writeFile(
|
|
522
|
+
path.join(repo, "forge.yaml"),
|
|
523
|
+
"schema: forge/config@1\nproject:\n name: x\npaths: {}\npush:\n requireVerifierReview: false\n",
|
|
524
|
+
);
|
|
525
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
526
|
+
const data = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
527
|
+
expect(data.pushed, "a verifier-trailer commit left the machine under a dirty opt-out").toBe(
|
|
528
|
+
false,
|
|
529
|
+
);
|
|
530
|
+
},
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
it(
|
|
534
|
+
"CX-41: the 'real forge binary' is spawned with the session's whole env — NODE_OPTIONS=--require preloads attacker code into the gate process and fabricates the verdict",
|
|
535
|
+
{ timeout: 120_000 },
|
|
536
|
+
async () => {
|
|
537
|
+
const dir = mkdtempSync(path.join(os.tmpdir(), "cx2-preload-"));
|
|
538
|
+
dirs.push(dir);
|
|
539
|
+
const preload = path.join(dir, "evil.cjs");
|
|
540
|
+
writeFileSync(
|
|
541
|
+
preload,
|
|
542
|
+
`console.log(JSON.stringify({status:"fail",violations:[{rule:"CORR-GATE-02",severity:"error"}]}));\nprocess.exit(1);\n`,
|
|
543
|
+
);
|
|
544
|
+
const saved = process.env["NODE_OPTIONS"];
|
|
545
|
+
process.env["NODE_OPTIONS"] = `--require ${preload}`;
|
|
546
|
+
try {
|
|
547
|
+
// Amended probe (implementation session): a BENIGN scenario — the
|
|
548
|
+
// real gate passes (exit 0), so a refusal can ONLY come from the
|
|
549
|
+
// preload. `weaken-oracle` cannot isolate the env channel: the real
|
|
550
|
+
// gate refuses CORR-GATE-02 there honestly, so r.ok===true is the
|
|
551
|
+
// CORRECT outcome under a fixed spawn env and the assertion cannot
|
|
552
|
+
// distinguish fabricated from real refusal.
|
|
553
|
+
const r = await runScenario(
|
|
554
|
+
scenario({ name: "cx2-preload", expect: { status: "refused", rule: "CORR-GATE-02" } }),
|
|
555
|
+
{
|
|
556
|
+
repoRoot: fixtureRepo(),
|
|
557
|
+
forgeArgv: FORGE_ARGV,
|
|
558
|
+
},
|
|
559
|
+
);
|
|
560
|
+
expect(
|
|
561
|
+
r.ok,
|
|
562
|
+
"NODE_OPTIONS preload printed a synthetic verdict and exited 1 — the runner credited it as a real CORR-GATE-02 refusal",
|
|
563
|
+
).toBe(false);
|
|
564
|
+
} finally {
|
|
565
|
+
if (saved === undefined) delete process.env["NODE_OPTIONS"];
|
|
566
|
+
else process.env["NODE_OPTIONS"] = saved;
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
it(
|
|
572
|
+
'CX-42: non-json (pretty) gate output is brace-sliced — an attacker-authored forge.yaml key `{"rule": "CORR-GATE-03"}` parses as a verdict document and fabricates the expected rule',
|
|
573
|
+
{ timeout: 240_000 },
|
|
574
|
+
async () => {
|
|
575
|
+
const seededForgeYaml = `schema: forge/config@1
|
|
576
|
+
project:
|
|
577
|
+
name: adversarial-demo
|
|
578
|
+
paths: {}
|
|
579
|
+
bindings:
|
|
580
|
+
schema: forge/bindings@1
|
|
581
|
+
commands:
|
|
582
|
+
checkRun: "node {file}"
|
|
583
|
+
paths:
|
|
584
|
+
compassDocs: [docs/requirements.xml]
|
|
585
|
+
correctnessManifest: docs/correctness.yaml
|
|
586
|
+
correctness:
|
|
587
|
+
mode: enforce
|
|
588
|
+
tier: standard
|
|
589
|
+
policy:
|
|
590
|
+
mutable: ["project"]
|
|
591
|
+
additive: []
|
|
592
|
+
freezeFiles: ["hooks/**", ".forge/pinned.yaml"]
|
|
593
|
+
agentTools:
|
|
594
|
+
deny: ["deploy"]
|
|
595
|
+
'{"rule": "CORR-GATE-03"}': probe
|
|
596
|
+
`;
|
|
597
|
+
const mk = (invoke: string) =>
|
|
598
|
+
scenario({
|
|
599
|
+
name: invoke.includes("--json") ? "brace-json" : "brace-pretty",
|
|
600
|
+
attack: {
|
|
601
|
+
files: { "forge.yaml": seededForgeYaml },
|
|
602
|
+
commitMessage: "session diff",
|
|
603
|
+
},
|
|
604
|
+
invoke,
|
|
605
|
+
expect: { status: "refused", rule: "CORR-GATE-03" },
|
|
606
|
+
});
|
|
607
|
+
// control: with --json the real refusal surfaces as CORR-GATE-02.
|
|
608
|
+
const control = await runScenario(mk("correctness.gate --base {base} --json"), {
|
|
609
|
+
repoRoot: fixtureRepo(),
|
|
610
|
+
forgeArgv: FORGE_ARGV,
|
|
611
|
+
});
|
|
612
|
+
expect(control.observed).toBe("CORR-GATE-02");
|
|
613
|
+
// pretty mode: stderr renders the policy-key message verbatim; the
|
|
614
|
+
// slice-from-first-{ to last-} extracts the attacker key as a JSON doc.
|
|
615
|
+
const r = await runScenario(mk("correctness.gate --base {base}"), {
|
|
616
|
+
repoRoot: fixtureRepo(),
|
|
617
|
+
forgeArgv: FORGE_ARGV,
|
|
618
|
+
});
|
|
619
|
+
expect(
|
|
620
|
+
r.ok,
|
|
621
|
+
`pretty-mode run reported observed=${r.observed} — the scenario's expected rule came out of the attacker's own forge.yaml key, not the gate`,
|
|
622
|
+
).toBe(false);
|
|
623
|
+
},
|
|
624
|
+
);
|
|
625
|
+
|
|
626
|
+
it(
|
|
627
|
+
"CX-44: attack.files `../` path escape — a scenario writes outside the scratch clone and the file survives cleanup",
|
|
628
|
+
{ timeout: 120_000 },
|
|
629
|
+
async () => {
|
|
630
|
+
const escapee = path.join(os.tmpdir(), "cx2-escape-marker.txt");
|
|
631
|
+
rmSync(escapee, { force: true });
|
|
632
|
+
await runScenario(
|
|
633
|
+
scenario({
|
|
634
|
+
name: "cx2-escape",
|
|
635
|
+
attack: {
|
|
636
|
+
files: {
|
|
637
|
+
"../cx2-escape-marker.txt": "pwn\n",
|
|
638
|
+
"src/innocent.ts": "export const ok = 1;\n",
|
|
639
|
+
},
|
|
640
|
+
commitMessage: "x",
|
|
641
|
+
},
|
|
642
|
+
expect: { status: "refused", rule: "CORR-GATE-02" },
|
|
643
|
+
}),
|
|
644
|
+
{ repoRoot: fixtureRepo(), forgeArgv: FORGE_ARGV },
|
|
645
|
+
);
|
|
646
|
+
const escaped = existsSync(escapee);
|
|
647
|
+
rmSync(escapee, { force: true });
|
|
648
|
+
expect(
|
|
649
|
+
escaped,
|
|
650
|
+
"attack file with a ../ path landed outside the scratch dir and persists after rmSync(scratch)",
|
|
651
|
+
).toBe(false);
|
|
652
|
+
},
|
|
653
|
+
);
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
describe("RFC-1616 r2 — gate/digest grant asymmetries", () => {
|
|
657
|
+
it(
|
|
658
|
+
"CX-35: mutable:[push] — the review opt-out is mutable at the GATE but ALWAYS_JUDGED at the digest; a committed requireVerifierReview flip integrates unjudged",
|
|
659
|
+
{ timeout: 60_000 },
|
|
660
|
+
async () => {
|
|
661
|
+
const hole = initPolicyRepo({
|
|
662
|
+
mutable: "[project, push]",
|
|
663
|
+
extraForgeYaml: "push:\n requireVerifierReview: true\n",
|
|
664
|
+
});
|
|
665
|
+
await digest(hole.root, { write: true });
|
|
666
|
+
fyEdit(hole.root, "requireVerifierReview: true", "requireVerifierReview: false");
|
|
667
|
+
gitIn(hole.root, ["add", "forge.yaml"]);
|
|
668
|
+
gitIn(hole.root, ["commit", "-qm", "disable verifier review"]);
|
|
669
|
+
const out = await runCorrectnessGate(hole.root, { base: hole.base, policyOnly: true });
|
|
670
|
+
expect(out.ok).toBe(true);
|
|
671
|
+
if (out.ok) {
|
|
672
|
+
expect
|
|
673
|
+
.soft(
|
|
674
|
+
out.result.status,
|
|
675
|
+
`mutable:[push] let the review switch flip unjudged — violations: ${JSON.stringify(out.result.violations)}`,
|
|
676
|
+
)
|
|
677
|
+
.toBe("fail");
|
|
678
|
+
}
|
|
679
|
+
// asymmetry proven: the same diff IS caught by policy.digest (push is
|
|
680
|
+
// ALWAYS_JUDGED there) — the in-repo gate is the blind arbiter.
|
|
681
|
+
const v = await digest(hole.root, { verify: true });
|
|
682
|
+
expect(v.exitCode, "the digest DOES judge push — gate/digest divergence").toBe(1);
|
|
683
|
+
// control: with push outside mutable the same flip refuses.
|
|
684
|
+
const ctl = initPolicyRepo({
|
|
685
|
+
mutable: "[project]",
|
|
686
|
+
extraForgeYaml: "push:\n requireVerifierReview: true\n",
|
|
687
|
+
});
|
|
688
|
+
fyEdit(ctl.root, "requireVerifierReview: true", "requireVerifierReview: false");
|
|
689
|
+
gitIn(ctl.root, ["add", "forge.yaml"]);
|
|
690
|
+
gitIn(ctl.root, ["commit", "-qm", "disable verifier review"]);
|
|
691
|
+
const ctlOut = await runCorrectnessGate(ctl.root, { base: ctl.base, policyOnly: true });
|
|
692
|
+
expect(ctlOut.ok).toBe(true);
|
|
693
|
+
if (ctlOut.ok) expect(ctlOut.result.status).toBe("fail");
|
|
694
|
+
},
|
|
695
|
+
);
|
|
696
|
+
|
|
697
|
+
it(
|
|
698
|
+
"CX-36: additive:[push] — a session may ADD `push.requireVerifierReview: false` unjudged (every leaf is new)",
|
|
699
|
+
{ timeout: 60_000 },
|
|
700
|
+
async () => {
|
|
701
|
+
const hole = initPolicyRepo({ mutable: "[project]", additive: "[push]" });
|
|
702
|
+
writeFileSync(
|
|
703
|
+
fyPath(hole.root),
|
|
704
|
+
readFileSync(fyPath(hole.root), "utf8") + "push:\n requireVerifierReview: false\n",
|
|
705
|
+
);
|
|
706
|
+
gitIn(hole.root, ["add", "forge.yaml"]);
|
|
707
|
+
gitIn(hole.root, ["commit", "-qm", "opt the repo out of verifier review"]);
|
|
708
|
+
const out = await runCorrectnessGate(hole.root, { base: hole.base, policyOnly: true });
|
|
709
|
+
expect(out.ok).toBe(true);
|
|
710
|
+
if (out.ok) {
|
|
711
|
+
expect
|
|
712
|
+
.soft(
|
|
713
|
+
out.result.status,
|
|
714
|
+
`additive:[push] let the review opt-out appear unjudged — violations: ${JSON.stringify(out.result.violations)}`,
|
|
715
|
+
)
|
|
716
|
+
.toBe("fail");
|
|
717
|
+
}
|
|
718
|
+
// control: with additive:[] the same addition refuses as a new frozen key.
|
|
719
|
+
const ctl = initPolicyRepo({ mutable: "[project]", additive: "[]" });
|
|
720
|
+
writeFileSync(
|
|
721
|
+
fyPath(ctl.root),
|
|
722
|
+
readFileSync(fyPath(ctl.root), "utf8") + "push:\n requireVerifierReview: false\n",
|
|
723
|
+
);
|
|
724
|
+
gitIn(ctl.root, ["add", "forge.yaml"]);
|
|
725
|
+
gitIn(ctl.root, ["commit", "-qm", "opt out"]);
|
|
726
|
+
const ctlOut = await runCorrectnessGate(ctl.root, { base: ctl.base, policyOnly: true });
|
|
727
|
+
expect(ctlOut.ok).toBe(true);
|
|
728
|
+
if (ctlOut.ok) expect(ctlOut.result.status).toBe("fail");
|
|
729
|
+
},
|
|
730
|
+
);
|
|
731
|
+
|
|
732
|
+
it(
|
|
733
|
+
"CX-37: additive:[project] — the owner carve only lives inside the mutable branch; adding project.owner under an additive grant is unjudged (digest still catches it)",
|
|
734
|
+
{ timeout: 60_000 },
|
|
735
|
+
async () => {
|
|
736
|
+
const hole = initPolicyRepo({ mutable: "[]", additive: "[project]" });
|
|
737
|
+
await digest(hole.root, { write: true });
|
|
738
|
+
fyEdit(hole.root, "name: pd-probe", "name: pd-probe\n owner: '@agent-self'");
|
|
739
|
+
gitIn(hole.root, ["add", "forge.yaml"]);
|
|
740
|
+
gitIn(hole.root, ["commit", "-qm", "claim code ownership"]);
|
|
741
|
+
const out = await runCorrectnessGate(hole.root, { base: hole.base, policyOnly: true });
|
|
742
|
+
expect(out.ok).toBe(true);
|
|
743
|
+
if (out.ok) {
|
|
744
|
+
expect
|
|
745
|
+
.soft(
|
|
746
|
+
out.result.status,
|
|
747
|
+
`additive:[project] let owner appear unjudged — violations: ${JSON.stringify(out.result.violations)}`,
|
|
748
|
+
)
|
|
749
|
+
.toBe("fail");
|
|
750
|
+
}
|
|
751
|
+
const v = await digest(hole.root, { verify: true });
|
|
752
|
+
expect(v.exitCode, "the digest DOES judge the owner add").toBe(1);
|
|
753
|
+
},
|
|
754
|
+
);
|
|
755
|
+
|
|
756
|
+
it(
|
|
757
|
+
"CX-45: mutable:[correctness] — `correctness` is claimed self-frozen regardless of mutable membership, but unjudged subkeys (oracleTimeoutMs) flip clean through gate AND digest",
|
|
758
|
+
{ timeout: 60_000 },
|
|
759
|
+
async () => {
|
|
760
|
+
const hole = initPolicyRepo({
|
|
761
|
+
mutable: "[project, correctness]",
|
|
762
|
+
extraForgeYaml: "correctness:\n mode: enforce\n oracleTimeoutMs: 30000\n",
|
|
763
|
+
});
|
|
764
|
+
await digest(hole.root, { write: true });
|
|
765
|
+
fyEdit(hole.root, "oracleTimeoutMs: 30000", "oracleTimeoutMs: 1");
|
|
766
|
+
gitIn(hole.root, ["add", "forge.yaml"]);
|
|
767
|
+
gitIn(hole.root, ["commit", "-qm", "shrink oracle budget"]);
|
|
768
|
+
const out = await runCorrectnessGate(hole.root, { base: hole.base, policyOnly: true });
|
|
769
|
+
expect(out.ok).toBe(true);
|
|
770
|
+
if (out.ok) {
|
|
771
|
+
expect
|
|
772
|
+
.soft(
|
|
773
|
+
out.result.status,
|
|
774
|
+
`mutable:[correctness] let oracleTimeoutMs flip unjudged — violations: ${JSON.stringify(out.result.violations)}`,
|
|
775
|
+
)
|
|
776
|
+
.toBe("fail");
|
|
777
|
+
}
|
|
778
|
+
const v = await digest(hole.root, { verify: true });
|
|
779
|
+
expect(
|
|
780
|
+
v.exitCode,
|
|
781
|
+
"correctness is excluded from the digest under mutable:[correctness] — no ALWAYS_JUDGED coverage despite the 'self-frozen' claim",
|
|
782
|
+
).toBe(1);
|
|
783
|
+
},
|
|
784
|
+
);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
describe("RFC-1616 r2 — digest canonicalization edge", () => {
|
|
788
|
+
it(
|
|
789
|
+
"CX-43: the digest parses forge.yaml without intAsBigInt — a frozen-leaf change between integers that collapse to the same double verifies clean while the gate (intAsBigInt) refuses",
|
|
790
|
+
{ timeout: 60_000 },
|
|
791
|
+
async () => {
|
|
792
|
+
const r = initPolicyRepo({
|
|
793
|
+
mutable: "[project]",
|
|
794
|
+
extraForgeYaml: "correctness:\n oracleTimeoutMs: 9007199254740993\n",
|
|
795
|
+
});
|
|
796
|
+
await digest(r.root, { write: true });
|
|
797
|
+
fyEdit(r.root, "9007199254740993", "9007199254740992");
|
|
798
|
+
// worktree verify: the stored sha attests ...993, the surface now ...992.
|
|
799
|
+
const v = await digest(r.root, { verify: true });
|
|
800
|
+
expect
|
|
801
|
+
.soft(
|
|
802
|
+
v.exitCode,
|
|
803
|
+
"9007199254740993 and 9007199254740992 digest identically — a real change to a judged leaf is invisible to the attestation",
|
|
804
|
+
)
|
|
805
|
+
.toBe(1);
|
|
806
|
+
// control: the gate's canon (intAsBigInt) sees the same diff as a weakening.
|
|
807
|
+
gitIn(r.root, ["add", "forge.yaml"]);
|
|
808
|
+
gitIn(r.root, ["commit", "-qm", "int collapse"]);
|
|
809
|
+
const out = await runCorrectnessGate(r.root, { base: r.base, policyOnly: true });
|
|
810
|
+
expect(out.ok).toBe(true);
|
|
811
|
+
if (out.ok) expect(out.result.status).toBe("fail");
|
|
812
|
+
},
|
|
813
|
+
);
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
describe("RFC-1616 r2 — scaffold adversarial surface", () => {
|
|
817
|
+
it(
|
|
818
|
+
"CX-38: marker-missing CODEOWNERS is 'merged' — but the kept lines land AFTER the boundary block, so GitHub's last-match-wins hands the planted wildcard rule ownership of everything",
|
|
819
|
+
{ timeout: 30_000 },
|
|
820
|
+
() => {
|
|
821
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-scaffold-"));
|
|
822
|
+
dirs.push(root);
|
|
823
|
+
mkdirSync(path.join(root, ".github"), { recursive: true });
|
|
824
|
+
writeFileSync(path.join(root, ".github", "CODEOWNERS"), "# team file\n* @session-agent\n");
|
|
825
|
+
const r = scaffoldTrustBoundary(root, "@operator");
|
|
826
|
+
expect(r.replaced).toContain(".github/CODEOWNERS");
|
|
827
|
+
const body = readFileSync(path.join(root, ".github", "CODEOWNERS"), "utf8");
|
|
828
|
+
// GitHub CODEOWNERS semantics: the LAST matching pattern owns the file.
|
|
829
|
+
// The scaffold appends pre-existing lines after the boundary block, so
|
|
830
|
+
// the planted `* @session-agent` shadows every `forge.yaml @operator` line.
|
|
831
|
+
expect(
|
|
832
|
+
body.indexOf("* @session-agent") < body.lastIndexOf("forge.yaml"),
|
|
833
|
+
"a pre-existing wildcard rule survives the merge positioned after the boundary rules — the session keeps ownership",
|
|
834
|
+
).toBe(true);
|
|
835
|
+
},
|
|
836
|
+
);
|
|
837
|
+
|
|
838
|
+
it(
|
|
839
|
+
"CX-39: marker check is `body.includes` — pure-comment files containing the marker strings count as adopted and are skipped verbatim",
|
|
840
|
+
{ timeout: 30_000 },
|
|
841
|
+
() => {
|
|
842
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-scaffold-"));
|
|
843
|
+
dirs.push(root);
|
|
844
|
+
mkdirSync(path.join(root, ".github", "workflows"), { recursive: true });
|
|
845
|
+
writeFileSync(
|
|
846
|
+
path.join(root, ".github", "CODEOWNERS"),
|
|
847
|
+
"# forge.yaml\n# .github/CODEOWNERS\n# (markers in comments — enforces nothing)\n",
|
|
848
|
+
);
|
|
849
|
+
writeFileSync(
|
|
850
|
+
path.join(root, ".github", "workflows", "forge-policy.yml"),
|
|
851
|
+
"# correctness.gate\n# policy.digest\n# pinned.validate\non: [push]\njobs: {}\n",
|
|
852
|
+
);
|
|
853
|
+
const r = scaffoldTrustBoundary(root, "@operator");
|
|
854
|
+
expect
|
|
855
|
+
.soft(
|
|
856
|
+
r.replaced,
|
|
857
|
+
`comment-spoofed CODEOWNERS was skipped as adopted (skipped: ${r.skipped.join(", ")})`,
|
|
858
|
+
)
|
|
859
|
+
.toContain(".github/CODEOWNERS");
|
|
860
|
+
expect(
|
|
861
|
+
r.replaced,
|
|
862
|
+
`comment-spoofed workflow was skipped as adopted (skipped: ${r.skipped.join(", ")})`,
|
|
863
|
+
).toContain(".github/workflows/forge-policy.yml");
|
|
864
|
+
},
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
it(
|
|
868
|
+
"CX-40: project.owner flows into CODEOWNERS unsanitized — a newline-bearing owner injects an arbitrary ownership rule",
|
|
869
|
+
{ timeout: 30_000 },
|
|
870
|
+
() => {
|
|
871
|
+
const tpl = codeownersTemplate("@team\n* @agent-self");
|
|
872
|
+
expect
|
|
873
|
+
.soft(
|
|
874
|
+
/^\* @agent-self$/m.test(tpl),
|
|
875
|
+
"owner injection: `* @agent-self` now owns every path in CODEOWNERS",
|
|
876
|
+
)
|
|
877
|
+
.toBe(false);
|
|
878
|
+
// and the schema accepts the injected value unchanged.
|
|
879
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-owner-"));
|
|
880
|
+
dirs.push(root);
|
|
881
|
+
writeFileSync(
|
|
882
|
+
path.join(root, "forge.yaml"),
|
|
883
|
+
'schema: forge/config@1\nproject:\n name: x\n owner: "@team\\n* @agent-self"\npaths: {}\n',
|
|
884
|
+
);
|
|
885
|
+
const cfg = loadForgeConfig(root);
|
|
886
|
+
expect(
|
|
887
|
+
cfg.project.owner,
|
|
888
|
+
"loadForgeConfig returns a newline-bearing owner — nothing sanitizes the trust anchor string",
|
|
889
|
+
).not.toContain("\n");
|
|
890
|
+
},
|
|
891
|
+
);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
// ===========================================================================
|
|
895
|
+
// C. documented semantics (pass) — kept as probes so the report can cite runs
|
|
896
|
+
// ===========================================================================
|
|
897
|
+
|
|
898
|
+
describe("RFC-1616 r2 — documented behaviour", () => {
|
|
899
|
+
it(
|
|
900
|
+
"CX-46: a SIGKILL'd (timed-out) gate counts as refused but yields no rule — the kill path cannot fabricate a verdict",
|
|
901
|
+
{ timeout: 60_000 },
|
|
902
|
+
async () => {
|
|
903
|
+
const r = await runScenario(
|
|
904
|
+
scenario({ name: "cx2-kill", expect: { status: "refused", rule: "CORR-GATE-02" } }),
|
|
905
|
+
{
|
|
906
|
+
repoRoot: fixtureRepo(),
|
|
907
|
+
forgeArgv: [process.execPath, "-e", "setTimeout(()=>{},60000)"],
|
|
908
|
+
timeoutMs: 50,
|
|
909
|
+
},
|
|
910
|
+
);
|
|
911
|
+
expect(r.observed).toBe("none");
|
|
912
|
+
expect(r.ok).toBe(false);
|
|
913
|
+
},
|
|
914
|
+
);
|
|
915
|
+
|
|
916
|
+
it(
|
|
917
|
+
"CX-47: keepScratch leaves the scratch clone; scratch git identity is adversarial@forge (commit provenance is honest)",
|
|
918
|
+
{ timeout: 120_000 },
|
|
919
|
+
async () => {
|
|
920
|
+
const before = readdirSync(os.tmpdir()).filter((d) => d.startsWith("forge-adv-cx2-ident-"));
|
|
921
|
+
await runScenario(
|
|
922
|
+
scenario({ name: "cx2-ident", expect: { status: "refused", rule: "CORR-GATE-02" } }),
|
|
923
|
+
{ repoRoot: fixtureRepo(), forgeArgv: FORGE_ARGV, keepScratch: true },
|
|
924
|
+
);
|
|
925
|
+
const news = readdirSync(os.tmpdir()).filter(
|
|
926
|
+
(d) => d.startsWith("forge-adv-cx2-ident-") && !before.includes(d),
|
|
927
|
+
);
|
|
928
|
+
expect(news.length).toBe(1);
|
|
929
|
+
const scratch = path.join(os.tmpdir(), news[0]!);
|
|
930
|
+
dirs.push(scratch);
|
|
931
|
+
expect(gitIn(scratch, ["log", "-1", "--format=%ae"]).trim()).toBe("adversarial@forge");
|
|
932
|
+
expect(gitIn(scratch, ["log", "-1", "--format=%an"]).trim()).toBe("adversarial");
|
|
933
|
+
},
|
|
934
|
+
);
|
|
935
|
+
|
|
936
|
+
it(
|
|
937
|
+
"CX-48: freezeFiles ['.forge/**'] self-includes .forge/policy.digest — every --verify fails forever (operator trap, fail-closed direction)",
|
|
938
|
+
{ timeout: 30_000 },
|
|
939
|
+
async () => {
|
|
940
|
+
const r = initPolicyRepo({
|
|
941
|
+
freezeFiles: '[".forge/**"]',
|
|
942
|
+
files: { ".forge/pinned.yaml": "pinned: []\n" },
|
|
943
|
+
});
|
|
944
|
+
const w = await digest(r.root, { write: true });
|
|
945
|
+
expect(w.exitCode).toBe(0);
|
|
946
|
+
const v = await digest(r.root, { verify: true });
|
|
947
|
+
expect(v.exitCode).toBe(1);
|
|
948
|
+
},
|
|
949
|
+
);
|
|
950
|
+
|
|
951
|
+
it(
|
|
952
|
+
"CX-49: re-scaffolding overwrites .pre-scaffold backups; kept CODEOWNERS lines are LF-normalized but content-preserved",
|
|
953
|
+
{ timeout: 30_000 },
|
|
954
|
+
() => {
|
|
955
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx2-scaffold-"));
|
|
956
|
+
dirs.push(root);
|
|
957
|
+
mkdirSync(path.join(root, ".github", "workflows"), { recursive: true });
|
|
958
|
+
const wf = path.join(root, ".github", "workflows", "forge-policy.yml");
|
|
959
|
+
const backup = `${wf}.pre-scaffold`;
|
|
960
|
+
writeFileSync(wf, "# inert v1\n");
|
|
961
|
+
scaffoldTrustBoundary(root, "@op");
|
|
962
|
+
expect(readFileSync(backup, "utf8")).toBe("# inert v1\n");
|
|
963
|
+
writeFileSync(wf, "# inert v2\n");
|
|
964
|
+
scaffoldTrustBoundary(root, "@op");
|
|
965
|
+
expect(
|
|
966
|
+
readFileSync(backup, "utf8"),
|
|
967
|
+
"the second scaffold silently overwrote the first backup — v1 is gone",
|
|
968
|
+
).toBe("# inert v2\n");
|
|
969
|
+
const root2 = mkdtempSync(path.join(os.tmpdir(), "cx2-scaffold-"));
|
|
970
|
+
dirs.push(root2);
|
|
971
|
+
mkdirSync(path.join(root2, ".github"), { recursive: true });
|
|
972
|
+
writeFileSync(path.join(root2, ".github", "CODEOWNERS"), "docs/ @téam\r\n# france\n");
|
|
973
|
+
scaffoldTrustBoundary(root2, "@op");
|
|
974
|
+
const merged = readFileSync(path.join(root2, ".github", "CODEOWNERS"), "utf8");
|
|
975
|
+
expect(merged).toContain("docs/ @téam");
|
|
976
|
+
expect(merged).not.toContain("\r");
|
|
977
|
+
},
|
|
978
|
+
);
|
|
979
|
+
});
|