@warpgogol/forge 9.7.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +50 -27
- package/CHANGELOG.md +52 -0
- package/bin/cli.js +0 -0
- 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/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/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/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure-symbols.js +35 -4
- package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +1 -0
- package/dist/os/core/archive-regen.d.ts.map +1 -1
- package/dist/os/core/archive-regen.js +31 -6
- 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 +6 -69
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
- package/dist/os/core/handlers/assets-helpers.js +2 -3
- package/dist/os/core/handlers/assets-helpers.js.map +1 -1
- package/dist/os/core/handlers/determinism-check.d.ts.map +1 -1
- package/dist/os/core/handlers/determinism-check.js +2 -3
- package/dist/os/core/handlers/determinism-check.js.map +1 -1
- 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/release-prepare.d.ts.map +1 -1
- package/dist/os/core/handlers/release-prepare.js +2 -4
- package/dist/os/core/handlers/release-prepare.js.map +1 -1
- package/dist/os/flow/digest.d.ts +73 -1
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +344 -92
- package/dist/os/flow/digest.js.map +1 -1
- 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 +36 -14
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/git.d.ts +50 -3
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +144 -12
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +3 -5
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-peers.js +1 -1
- package/dist/os/flow/handlers/flow-peers.js.map +1 -1
- package/dist/os/flow/handlers/flow-push.d.ts +81 -0
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +642 -138
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/locks.d.ts +8 -0
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +6 -3
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/{mission → flow}/open-missions.d.ts +1 -2
- package/dist/os/flow/open-missions.d.ts.map +1 -0
- package/dist/os/flow/open-missions.js +37 -0
- package/dist/os/flow/open-missions.js.map +1 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +5 -3
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/registry.d.ts +9 -5
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +2 -2
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/friction/friction.module.d.ts.map +1 -1
- package/dist/os/friction/friction.module.js +30 -5
- package/dist/os/friction/friction.module.js.map +1 -1
- package/dist/os/friction/handlers/friction-add.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-add.js +10 -17
- package/dist/os/friction/handlers/friction-add.js.map +1 -1
- package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-migrate.js +188 -2
- package/dist/os/friction/handlers/friction-migrate.js.map +1 -1
- package/dist/os/friction/store.d.ts +4 -0
- package/dist/os/friction/store.d.ts.map +1 -1
- package/dist/os/friction/store.js +20 -0
- package/dist/os/friction/store.js.map +1 -1
- package/dist/os/friction/types.d.ts +12 -0
- package/dist/os/friction/types.d.ts.map +1 -1
- package/dist/os/friction/types.js +8 -0
- package/dist/os/friction/types.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +38 -5
- package/dist/os/gate/handlers/gate-probe-catalog.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/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/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/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/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/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 +113 -3
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/src/command-modules.d.ts.map +1 -1
- package/dist/src/command-modules.js +0 -2
- package/dist/src/command-modules.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +2 -0
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +11 -10
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -2
- package/dist/src/index.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/doctor.d.ts +0 -5
- package/dist/src/onboarding/doctor.d.ts.map +1 -1
- package/dist/src/onboarding/doctor.js +6 -79
- package/dist/src/onboarding/doctor.js.map +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
- package/dist/src/onboarding/npm-token-check.js +2 -2
- package/dist/src/onboarding/npm-token-check.js.map +1 -1
- package/dist/src/profiles/stack-profile.js +2 -2
- package/dist/src/types.js +2 -2
- package/dist/src/utils/hash.d.ts +1 -0
- package/dist/src/utils/hash.d.ts.map +1 -1
- package/dist/src/utils/hash.js +4 -0
- package/dist/src/utils/hash.js.map +1 -1
- package/dist/{os/mission → src/utils}/lockfile.d.ts +1 -18
- package/dist/src/utils/lockfile.d.ts.map +1 -0
- package/dist/src/utils/lockfile.js +70 -0
- package/dist/src/utils/lockfile.js.map +1 -0
- package/dist/src/utils/verifier-git.d.ts +27 -1
- package/dist/src/utils/verifier-git.d.ts.map +1 -1
- package/dist/src/utils/verifier-git.js +36 -6
- package/dist/src/utils/verifier-git.js.map +1 -1
- package/docs/reference/system-hub.md +104 -0
- package/os/adr/handlers/archive.ts +3 -11
- package/os/adr/handlers/list-create.test.ts +174 -0
- package/os/adr/handlers/list-create.ts +16 -8
- package/os/audit/handlers/archive.ts +3 -11
- package/os/codebase/handlers/codebase-measure-symbols.ts +32 -4
- package/os/core/archive-regen.ts +33 -7
- package/os/core/core.module.ts +10 -76
- package/os/core/docs-archive.test.ts +25 -0
- package/os/core/handlers/assets-helpers.ts +2 -4
- package/os/core/handlers/determinism-check.ts +2 -3
- package/os/core/handlers/lifecycle-handlers.test.ts +529 -0
- 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/release-prepare.ts +2 -4
- package/os/correctness/gate/trust-boundary-cx18.test.ts +1 -1
- package/os/flow/digest.ts +436 -95
- package/os/flow/evidence-lock.ts +184 -0
- package/os/flow/flow.module.ts +37 -14
- package/os/flow/git.ts +206 -11
- package/os/flow/handlers/flow-digest.ts +12 -8
- package/os/flow/handlers/flow-peers.ts +1 -1
- package/os/flow/handlers/flow-push.ts +725 -137
- package/os/flow/locks.ts +24 -7
- package/os/flow/open-missions.ts +45 -0
- package/os/flow/preflight.ts +5 -3
- package/os/flow/registry.ts +7 -3
- 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-push-attest.test.ts +137 -0
- package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
- package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
- package/os/flow/tests/release-lines.test.ts +136 -0
- package/os/flow/tests/state-roots.test.ts +1 -48
- package/os/friction/friction-add.test.ts +42 -0
- package/os/friction/friction-migrate.test.ts +67 -2
- package/os/friction/friction.module.ts +33 -5
- package/os/friction/handlers/friction-add.ts +10 -15
- package/os/friction/handlers/friction-migrate.ts +220 -1
- package/os/friction/store.ts +19 -0
- package/os/friction/types.ts +8 -0
- package/os/gate/handlers/gate-probe-catalog.ts +39 -7
- package/os/gate/handlers/gate-probe-ratchet.test.ts +57 -22
- package/os/plan/handlers/archive.ts +3 -11
- package/os/rfc/handlers/archive.ts +3 -11
- package/os/rfc/handlers/list-create.ts +22 -17
- package/os/rfc/handlers/validate-corpus.test.ts +149 -0
- package/os/rfc/probe-batch.test.ts +253 -0
- package/os/rfc/verifier/rfc-1391/ac10-operating-model-policy.acceptance.test.ts +63 -0
- package/os/session/handlers/archive.ts +3 -11
- package/os/system/handlers/system-product-register.ts +492 -0
- package/os/system/handlers/system-products-status.ts +395 -0
- package/os/system/schemas.ts +17 -0
- package/os/system/system.module.ts +117 -3
- package/os/system/tests/system-product-register.test.ts +304 -0
- package/os/system/tests/system-products-status.test.ts +154 -0
- package/package.json +161 -506
- package/profiles/root-agents-system.md +82 -0
- package/profiles/system.yaml +1 -0
- package/src/command-modules.ts +0 -2
- package/src/config/forge-config.ts +16 -11
- package/src/index.ts +0 -2
- package/src/onboarding/create-superfolder-guard.test.ts +73 -0
- package/src/onboarding/create.ts +28 -2
- package/src/onboarding/doctor.ts +9 -96
- package/src/onboarding/npm-token-check.ts +3 -3
- package/src/profiles/stack-profile.ts +2 -2
- package/src/tests/evidence-consult-serialization.test.ts +202 -0
- package/src/tests/pinned-validate.test.ts +194 -0
- package/src/tests/pkg-health-self-scan.test.ts +29 -0
- package/src/tests/profile-flow-hooks.test.ts +1 -0
- package/src/tests/profile-schema.test.ts +1 -0
- package/src/tests/rfc-evidence-sync.test.ts +369 -0
- package/src/tests/skill-agents-sync.test.ts +192 -0
- package/src/tests/stack-profile.test.ts +1 -0
- package/src/types.ts +2 -2
- package/src/utils/hash.ts +5 -0
- package/src/utils/lockfile.ts +78 -0
- package/src/utils/verifier-git.ts +53 -5
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts +0 -25
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +0 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +0 -208
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +0 -1
- package/dist/os/mission/handlers/archive.d.ts +0 -4
- package/dist/os/mission/handlers/archive.d.ts.map +0 -1
- package/dist/os/mission/handlers/archive.js +0 -587
- package/dist/os/mission/handlers/archive.js.map +0 -1
- package/dist/os/mission/importer-block.d.ts +0 -19
- package/dist/os/mission/importer-block.d.ts.map +0 -1
- package/dist/os/mission/importer-block.js +0 -124
- package/dist/os/mission/importer-block.js.map +0 -1
- package/dist/os/mission/index.d.ts +0 -2
- package/dist/os/mission/index.d.ts.map +0 -1
- package/dist/os/mission/index.js +0 -15
- package/dist/os/mission/index.js.map +0 -1
- package/dist/os/mission/lockfile.d.ts.map +0 -1
- package/dist/os/mission/lockfile.js +0 -138
- package/dist/os/mission/lockfile.js.map +0 -1
- package/dist/os/mission/mission.module.d.ts +0 -3
- package/dist/os/mission/mission.module.d.ts.map +0 -1
- package/dist/os/mission/mission.module.js +0 -63
- package/dist/os/mission/mission.module.js.map +0 -1
- package/dist/os/mission/open-missions.d.ts.map +0 -1
- package/dist/os/mission/open-missions.js +0 -42
- package/dist/os/mission/open-missions.js.map +0 -1
- package/dist/os/mission/types.d.ts +0 -23
- package/dist/os/mission/types.d.ts.map +0 -1
- package/dist/os/mission/types.js +0 -19
- package/dist/os/mission/types.js.map +0 -1
- package/dist/os/werkstatt/handlers/lock.d.ts +0 -10
- package/dist/os/werkstatt/handlers/lock.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/lock.js +0 -153
- package/dist/os/werkstatt/handlers/lock.js.map +0 -1
- package/dist/os/werkstatt/handlers/schema.d.ts +0 -33
- package/dist/os/werkstatt/handlers/schema.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/schema.js +0 -42
- package/dist/os/werkstatt/handlers/schema.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +0 -15
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +0 -171
- package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +0 -18
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +0 -51
- package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +0 -11
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +0 -86
- package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +0 -1
- package/dist/os/werkstatt/handlers/workspace-deps.d.ts +0 -12
- package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +0 -1
- package/dist/os/werkstatt/handlers/workspace-deps.js +0 -42
- package/dist/os/werkstatt/handlers/workspace-deps.js.map +0 -1
- package/dist/os/werkstatt/index.d.ts +0 -7
- package/dist/os/werkstatt/index.d.ts.map +0 -1
- package/dist/os/werkstatt/index.js +0 -18
- package/dist/os/werkstatt/index.js.map +0 -1
- package/dist/os/werkstatt/werkstatt.module.d.ts +0 -3
- package/dist/os/werkstatt/werkstatt.module.d.ts.map +0 -1
- package/dist/os/werkstatt/werkstatt.module.js +0 -91
- package/dist/os/werkstatt/werkstatt.module.js.map +0 -1
- package/os/core/handlers/forge-autonomy-validate.ts +0 -276
- package/os/correctness/gate/trust-boundary-cx19.test.ts +0 -514
- package/os/mission/handlers/archive.test.ts +0 -764
- package/os/mission/handlers/archive.ts +0 -719
- package/os/mission/handlers/ship-inflight-degraded.test.ts +0 -105
- package/os/mission/importer-block.ts +0 -119
- package/os/mission/index.ts +0 -15
- package/os/mission/lockfile.ts +0 -152
- package/os/mission/mission.module.ts +0 -68
- package/os/mission/open-missions.ts +0 -50
- package/os/mission/types.ts +0 -42
- package/os/werkstatt/handlers/lock.ts +0 -168
- package/os/werkstatt/handlers/schema.ts +0 -47
- package/os/werkstatt/handlers/werkstatt-lock-recover.ts +0 -206
- package/os/werkstatt/handlers/werkstatt-lock-status.ts +0 -82
- package/os/werkstatt/handlers/werkstatt-operation-validate.ts +0 -112
- package/os/werkstatt/handlers/workspace-deps.ts +0 -56
- package/os/werkstatt/index.ts +0 -39
- package/os/werkstatt/werkstatt.module.ts +0 -95
- package/src/tests/doctor-autonomy.test.ts +0 -246
- package/src/tests/forge-autonomy-validate.test.ts +0 -159
- package/src/tests/werkstatt-lock.test.ts +0 -357
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1644: the per-spawn evidence preflight skips the CX-r38-W1
|
|
4
|
+
worktree-surface capture exactly when `consultReadsWorktreeSurface(args)`
|
|
5
|
+
is false — the same predicate `resolveWorktreeArm` branches on — so the
|
|
6
|
+
skip can never weaken an arm: object-only argv arm `wtPlan: null` with or
|
|
7
|
+
without a surface, and a worktree-consulting argv armed against a skipped
|
|
8
|
+
preflight refuses (null). Default/cached preflights still capture.</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Never touches the enclosing repository — all fixtures are mkdtemp repos.</item>
|
|
11
|
+
<item>No CX-r38..r42 drift coverage — those suites live in os/correctness/gate/trust-boundary-cx3*.test.ts and stay unchanged.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
17
|
+
import { rm, writeFile } from "node:fs/promises";
|
|
18
|
+
import { dirname, join, relative } from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
|
|
21
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
closeEvidenceIndex,
|
|
25
|
+
consultReadsWorktreeSurface,
|
|
26
|
+
evidenceRepoPreflight,
|
|
27
|
+
resolveWorktreeArm,
|
|
28
|
+
type EvidencePreflight,
|
|
29
|
+
} from "../../../src/utils/verifier-git.ts";
|
|
30
|
+
import { evidencePreflight, gitEvidence, preflightProbe } from "../git.ts";
|
|
31
|
+
import { gitExec, initRepo } from "./helpers.ts";
|
|
32
|
+
|
|
33
|
+
const dirs: string[] = [];
|
|
34
|
+
const held: Array<EvidencePreflight | null> = [];
|
|
35
|
+
afterEach(async () => {
|
|
36
|
+
preflightProbe.current = null;
|
|
37
|
+
for (const p of held.splice(0)) closeEvidenceIndex(p);
|
|
38
|
+
for (const dir of dirs.splice(0)) {
|
|
39
|
+
await rm(dir, { recursive: true, force: true });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
async function fixture(): Promise<string> {
|
|
44
|
+
const repo = await initRepo({ prefix: "rfc1644-" });
|
|
45
|
+
dirs.push(repo);
|
|
46
|
+
await writeFile(join(repo, ".gitignore"), "ignored/\n");
|
|
47
|
+
await gitExec(repo, ["add", ".gitignore"]);
|
|
48
|
+
await gitExec(repo, ["commit", "-m", "ignore"]);
|
|
49
|
+
return repo;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Object-only argv: their worktree arm consumes no surface. */
|
|
53
|
+
const OBJECT_ONLY: string[][] = [
|
|
54
|
+
["log", "-1", "--format=%s", "HEAD"],
|
|
55
|
+
["log", "--format=%x1e%H%x00%s", "main"],
|
|
56
|
+
["rev-list", "main"],
|
|
57
|
+
["rev-parse", "--verify", "--quiet", "main"],
|
|
58
|
+
["show", "HEAD:seed.txt"],
|
|
59
|
+
["cat-file", "-t", "HEAD"],
|
|
60
|
+
["merge-base", "--is-ancestor", "HEAD", "main"],
|
|
61
|
+
["for-each-ref", "--format=%(refname)"],
|
|
62
|
+
["ls-tree", "HEAD"],
|
|
63
|
+
["config", "--local", "--list"],
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/** Worktree-consulting argv: their arm consumes the surface. */
|
|
67
|
+
const WORKTREE: string[][] = [
|
|
68
|
+
["status", "--porcelain"],
|
|
69
|
+
["status", "--porcelain", "--untracked-files=no"],
|
|
70
|
+
["diff", "--quiet"],
|
|
71
|
+
["ls-files", "-o"],
|
|
72
|
+
["check-ignore", "-q", "ignored/x"],
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
/** Resolver-only worktree argv (`add` is not an evidence-channel query). */
|
|
76
|
+
const WORKTREE_ARM: string[][] = [...WORKTREE, ["add", "-n", "seed.txt"]];
|
|
77
|
+
|
|
78
|
+
async function preflightWith(repo: string, skip: boolean): Promise<EvidencePreflight> {
|
|
79
|
+
const p = await evidencePreflight(
|
|
80
|
+
repo,
|
|
81
|
+
undefined,
|
|
82
|
+
skip ? { worktreeSurface: "skip" } : undefined,
|
|
83
|
+
);
|
|
84
|
+
held.push(p);
|
|
85
|
+
expect(p).not.toBeNull();
|
|
86
|
+
return p!;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
describe("RFC-1644 worktree-surface skip", () => {
|
|
90
|
+
it("AC-1: an object-only judged consult skips the capture and still answers", async () => {
|
|
91
|
+
const repo = await fixture();
|
|
92
|
+
const seen: Array<EvidencePreflight | null> = [];
|
|
93
|
+
preflightProbe.current = (p) => seen.push(p);
|
|
94
|
+
const r = await gitEvidence(repo, ["log", "-1", "--format=%s", "HEAD"]);
|
|
95
|
+
expect(r.exitCode).toBe(0);
|
|
96
|
+
expect(r.stdout.trim()).toBe("ignore");
|
|
97
|
+
// The consult's own preflight (the internal enumeration reads run
|
|
98
|
+
// with preflight:false and never reach evidencePreflight).
|
|
99
|
+
expect(seen.length).toBeGreaterThan(0);
|
|
100
|
+
for (const p of seen) {
|
|
101
|
+
expect(p?.worktreeSurfaceSkipped).toBe(true);
|
|
102
|
+
expect(p?.worktreeSurface).toBeUndefined();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("AC-3: worktree-consulting judged consults still capture the surface", async () => {
|
|
107
|
+
const repo = await fixture();
|
|
108
|
+
for (const args of WORKTREE) {
|
|
109
|
+
const seen: Array<EvidencePreflight | null> = [];
|
|
110
|
+
preflightProbe.current = (p) => seen.push(p);
|
|
111
|
+
const r = await gitEvidence(repo, args);
|
|
112
|
+
expect(r.stderr, args.join(" ")).not.toContain("EVIDENCE-REFUSED");
|
|
113
|
+
expect(seen.length, args.join(" ")).toBeGreaterThan(0);
|
|
114
|
+
for (const p of seen) {
|
|
115
|
+
expect(p?.worktreeSurfaceSkipped, args.join(" ")).toBeUndefined();
|
|
116
|
+
expect(p?.worktreeSurface, args.join(" ")).toBeDefined();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("AC-2: every object-only corpus argv classifies false and arms wtPlan: null without a surface", async () => {
|
|
122
|
+
const repo = await fixture();
|
|
123
|
+
const skipped = await preflightWith(repo, true);
|
|
124
|
+
const captured = await preflightWith(repo, false);
|
|
125
|
+
for (const args of OBJECT_ONLY) {
|
|
126
|
+
expect(consultReadsWorktreeSurface(args), args.join(" ")).toBe(false);
|
|
127
|
+
const onSkipped = resolveWorktreeArm(args, skipped, undefined);
|
|
128
|
+
const onCaptured = resolveWorktreeArm(args, captured, undefined);
|
|
129
|
+
expect(onSkipped, args.join(" ")).not.toBeNull();
|
|
130
|
+
expect(onSkipped!.wtPlan, args.join(" ")).toBeNull();
|
|
131
|
+
// Equivalence: the captured surface changes nothing for these argv.
|
|
132
|
+
expect(onSkipped, args.join(" ")).toEqual(onCaptured);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("AC-4: a worktree-consulting argv armed against a skipped preflight refuses", async () => {
|
|
137
|
+
const repo = await fixture();
|
|
138
|
+
const skipped = await preflightWith(repo, true);
|
|
139
|
+
const captured = await preflightWith(repo, false);
|
|
140
|
+
for (const args of WORKTREE_ARM) {
|
|
141
|
+
expect(consultReadsWorktreeSurface(args), args.join(" ")).toBe(true);
|
|
142
|
+
expect(resolveWorktreeArm(args, skipped, undefined), args.join(" ")).toBeNull();
|
|
143
|
+
const ok = resolveWorktreeArm(args, captured, undefined);
|
|
144
|
+
expect(ok?.wtPlan, args.join(" ")).not.toBeNull();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("AC-5: both preflights capture the surface when called without options", async () => {
|
|
149
|
+
const repo = await fixture();
|
|
150
|
+
const a = await evidencePreflight(repo);
|
|
151
|
+
const b = await evidenceRepoPreflight(repo);
|
|
152
|
+
held.push(a, b);
|
|
153
|
+
for (const p of [a, b]) {
|
|
154
|
+
expect(p?.worktreeSurfaceSkipped).toBeUndefined();
|
|
155
|
+
expect(p?.worktreeSurface?.dirs.size).toBeGreaterThan(0);
|
|
156
|
+
}
|
|
157
|
+
const c = await evidenceRepoPreflight(repo, undefined, { worktreeSurface: "skip" });
|
|
158
|
+
held.push(c);
|
|
159
|
+
expect(c?.worktreeSurfaceSkipped).toBe(true);
|
|
160
|
+
expect(c?.worktreeSurface).toBeUndefined();
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("AC-8: worktreeArmPlan is the sole reader of worktreeSurface, from the pinned caller set", () => {
|
|
164
|
+
const forgeRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
|
|
165
|
+
const files: string[] = [];
|
|
166
|
+
const walk = (d: string): void => {
|
|
167
|
+
for (const name of readdirSync(d)) {
|
|
168
|
+
if (name === "node_modules" || name === "dist" || name.startsWith(".")) continue;
|
|
169
|
+
const abs = join(d, name);
|
|
170
|
+
if (statSync(abs).isDirectory()) walk(abs);
|
|
171
|
+
else if (name.endsWith(".ts") && !name.endsWith(".test.ts") && !abs.includes("/tests/")) {
|
|
172
|
+
files.push(abs);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
for (const top of ["src", "os", "bin"]) walk(join(forgeRoot, top));
|
|
177
|
+
const readers: string[] = [];
|
|
178
|
+
const callers: string[] = [];
|
|
179
|
+
for (const f of files) {
|
|
180
|
+
const lines = readFileSync(f, "utf8").split("\n");
|
|
181
|
+
lines.forEach((line, i) => {
|
|
182
|
+
const code = line.replace(/\/\/.*$/, "");
|
|
183
|
+
if (/^\s*\*/.test(line)) return; // doc-comment line
|
|
184
|
+
const where = `${relative(forgeRoot, f)}:${i + 1}`;
|
|
185
|
+
// Reads: any `.worktreeSurface` access that is not the producer's assignment.
|
|
186
|
+
// (`options?.worktreeSurface` is the RFC-1644 option, not the surface.)
|
|
187
|
+
if (
|
|
188
|
+
/(?<!options\?)\.worktreeSurface\b(?!Skipped)/.test(code) &&
|
|
189
|
+
!/\.worktreeSurface\s*=[^=]/.test(code)
|
|
190
|
+
) {
|
|
191
|
+
readers.push(`${where} ${code.trim()}`);
|
|
192
|
+
}
|
|
193
|
+
// Destructuring / bracket reads would dodge the property regex.
|
|
194
|
+
if (
|
|
195
|
+
/\{[^}]*\bworktreeSurface\b[^}]*\}\s*=|\[\s*["'`]worktreeSurface["'`]\s*\]/.test(code)
|
|
196
|
+
) {
|
|
197
|
+
readers.push(`${where} ${code.trim()}`);
|
|
198
|
+
}
|
|
199
|
+
if (/\bworktreeArmPlan\(/.test(code) && !/function worktreeArmPlan\(/.test(code)) {
|
|
200
|
+
callers.push(relative(forgeRoot, f));
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
expect(readers).toHaveLength(1);
|
|
205
|
+
expect(readers[0]).toMatch(
|
|
206
|
+
/src\/utils\/verifier-git\.ts:\d+ const baseline = preflight\.worktreeSurface;/,
|
|
207
|
+
);
|
|
208
|
+
// resolveWorktreeArm (2 calls, behind consultReadsWorktreeSurface), the
|
|
209
|
+
// anchored `add` path and `unprovenIgnoredPaths` (both on cached
|
|
210
|
+
// "capture" preflights). A new caller must be classified first.
|
|
211
|
+
expect(callers.sort()).toEqual([
|
|
212
|
+
"src/utils/verifier-git.ts",
|
|
213
|
+
"src/utils/verifier-git.ts",
|
|
214
|
+
"src/utils/verifier-git.ts",
|
|
215
|
+
"src/utils/verifier-git.ts",
|
|
216
|
+
]);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>RFC-1638 AC-2/AC-3/AC-5 evidence: flow.push attests a persisted
|
|
4
|
+
digest by inputHash — equal inputs push without a recount, drifted inputs
|
|
5
|
+
fall back to a fresh recount (FLOW-PUSH-02 on a quoted-stale digestId), a
|
|
6
|
+
missing or unknown persisted record refuses FLOW-PUSH-15 naming
|
|
7
|
+
flow.digest, and --recount bypasses the file on demand.</purpose>
|
|
8
|
+
<non-goals>
|
|
9
|
+
<item>No remote-side ref verification — the daemon fixture only proves the push accepted.</item>
|
|
10
|
+
</non-goals>
|
|
11
|
+
</MODULE_CONTRACT>
|
|
12
|
+
<KEY_DECISIONS>
|
|
13
|
+
<item>Every test goes through the real git-daemon origin + real collectDigest — the attested artifact is the one the digest command itself persisted, never a fabricated file.</item>
|
|
14
|
+
</KEY_DECISIONS>
|
|
15
|
+
<CHANGE_SUMMARY>
|
|
16
|
+
<item>RFC-1638: attestation-path push tests (attest / drift-recount / FLOW-PUSH-15 / --recount)</item>
|
|
17
|
+
<item>RFC-1638: persist reviewed digests + attest pushed state by input hash</item>
|
|
18
|
+
</CHANGE_SUMMARY>
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
|
|
24
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
25
|
+
|
|
26
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
27
|
+
import { collectDigest, PERSISTED_DIGESTS_DIR } from "../digest.ts";
|
|
28
|
+
import { pushFlow } from "../handlers/flow-push.ts";
|
|
29
|
+
import { gitExec, initRepoWithOrigin } from "./helpers.ts";
|
|
30
|
+
|
|
31
|
+
const dirs: string[] = [];
|
|
32
|
+
afterEach(async () => {
|
|
33
|
+
for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
|
|
34
|
+
}, 20_000);
|
|
35
|
+
|
|
36
|
+
async function unpushedCommit(repo: string, file: string, content: string): Promise<void> {
|
|
37
|
+
await writeFile(join(repo, file), content);
|
|
38
|
+
await gitExec(repo, ["add", file]);
|
|
39
|
+
await gitExec(repo, ["commit", "-m", `add ${file}`]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function digestFilePath(repo: string, digestId: string): string {
|
|
43
|
+
return join(repo, ".git", PERSISTED_DIGESTS_DIR, `${digestId}.json`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
describe("flow.push attestation by persisted digest (RFC-1638)", () => {
|
|
47
|
+
it("AC-2: equal inputHash attests the persisted digest — push lands with no recount", async () => {
|
|
48
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "push-attest-" });
|
|
49
|
+
await unpushedCommit(repo, "work.txt", "w\n");
|
|
50
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
51
|
+
|
|
52
|
+
const result = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
53
|
+
expect(result.pushed).toBe(true);
|
|
54
|
+
expect(result.attestation).toBe("input-hash");
|
|
55
|
+
const persisted = JSON.parse(await readFile(digestFilePath(repo, digest.digestId), "utf8")) as {
|
|
56
|
+
computedAt: string;
|
|
57
|
+
};
|
|
58
|
+
expect(result.digestComputedAt).toBe(persisted.computedAt);
|
|
59
|
+
expect(result.diagnostics.some((d) => d.ruleId === "FLOW-PUSH-02")).toBe(false);
|
|
60
|
+
}, 120_000);
|
|
61
|
+
|
|
62
|
+
it("AC-3: drifted inputs fall back to a recount — a quoted-stale digestId still refuses FLOW-PUSH-02", async () => {
|
|
63
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "push-drift-" });
|
|
64
|
+
await unpushedCommit(repo, "work.txt", "w\n");
|
|
65
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
66
|
+
await unpushedCommit(repo, "drift.txt", "d\n"); // local tip drift → inputHash mismatch
|
|
67
|
+
|
|
68
|
+
const result = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
69
|
+
expect(result.pushed).toBe(false);
|
|
70
|
+
expect(result.attestation).toBe("recount");
|
|
71
|
+
expect(
|
|
72
|
+
result.diagnostics.some((d) => d.ruleId === "FLOW-PUSH-02" && d.severity === "error"),
|
|
73
|
+
).toBe(true);
|
|
74
|
+
}, 120_000);
|
|
75
|
+
|
|
76
|
+
it("AC-5: missing persisted record refuses FLOW-PUSH-15 naming flow.digest", async () => {
|
|
77
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "push-missing-" });
|
|
78
|
+
await unpushedCommit(repo, "work.txt", "w\n");
|
|
79
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
80
|
+
await rm(digestFilePath(repo, digest.digestId), { force: true });
|
|
81
|
+
|
|
82
|
+
const result = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
83
|
+
expect(result.pushed).toBe(false);
|
|
84
|
+
const d = result.diagnostics.find((x) => x.ruleId === "FLOW-PUSH-15");
|
|
85
|
+
expect(d).toBeDefined();
|
|
86
|
+
expect(d!.severity).toBe("error");
|
|
87
|
+
expect(d!.message).toContain("flow.digest");
|
|
88
|
+
}, 120_000);
|
|
89
|
+
|
|
90
|
+
it("AC-5: an unknown-schema persisted record refuses FLOW-PUSH-15", async () => {
|
|
91
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "push-unknown-" });
|
|
92
|
+
await unpushedCommit(repo, "work.txt", "w\n");
|
|
93
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
94
|
+
await writeFile(digestFilePath(repo, digest.digestId), JSON.stringify({ schema: "nope" }));
|
|
95
|
+
|
|
96
|
+
const result = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
97
|
+
expect(result.pushed).toBe(false);
|
|
98
|
+
expect(result.diagnostics.some((x) => x.ruleId === "FLOW-PUSH-15")).toBe(true);
|
|
99
|
+
}, 120_000);
|
|
100
|
+
|
|
101
|
+
it("a forged persisted payload refuses FLOW-PUSH-15 — the file must preimage the quoted id", async () => {
|
|
102
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "push-forged-" });
|
|
103
|
+
await unpushedCommit(repo, "work.txt", "w\n");
|
|
104
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
105
|
+
// Session-writable forgery: keep the honest inputHash + id, swap the
|
|
106
|
+
// payload's develop tip for a session-authored evil commit.
|
|
107
|
+
const evil = (await gitExec(repo, ["rev-parse", "main"])).stdout.trim();
|
|
108
|
+
const file = digestFilePath(repo, digest.digestId);
|
|
109
|
+
const honest = JSON.parse(await readFile(file, "utf8")) as Record<string, unknown>;
|
|
110
|
+
const forgedDigest = {
|
|
111
|
+
...(honest["digest"] as Record<string, unknown>),
|
|
112
|
+
develop: { local: evil, remote: null, ahead: 1 },
|
|
113
|
+
};
|
|
114
|
+
await writeFile(file, JSON.stringify({ ...honest, digest: forgedDigest }));
|
|
115
|
+
|
|
116
|
+
const result = await pushFlow(repo, ambientIo, { digest: digest.digestId, dryRun: false });
|
|
117
|
+
expect(result.pushed).toBe(false);
|
|
118
|
+
const d = result.diagnostics.find((x) => x.ruleId === "FLOW-PUSH-15");
|
|
119
|
+
expect(d).toBeDefined();
|
|
120
|
+
expect(d!.message).toContain("preimage");
|
|
121
|
+
}, 120_000);
|
|
122
|
+
|
|
123
|
+
it("--recount bypasses the persisted file and reports the recount", async () => {
|
|
124
|
+
const { repo } = await initRepoWithOrigin(dirs, { prefix: "push-recount-" });
|
|
125
|
+
await unpushedCommit(repo, "work.txt", "w\n");
|
|
126
|
+
const digest = await collectDigest(repo, ambientIo, { fetch: false });
|
|
127
|
+
|
|
128
|
+
const result = await pushFlow(repo, ambientIo, {
|
|
129
|
+
digest: digest.digestId,
|
|
130
|
+
dryRun: false,
|
|
131
|
+
recount: true,
|
|
132
|
+
});
|
|
133
|
+
expect(result.pushed).toBe(true);
|
|
134
|
+
expect(result.attestation).toBe("recount");
|
|
135
|
+
expect(result.digestComputedAt).toBeDefined();
|
|
136
|
+
}, 120_000);
|
|
137
|
+
});
|