@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,253 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Unit tests for probe-batch — segment planning across barriers, per-(file,testName) report attribution, runProbeSet ordering and --no-batch escape, and the one-spawn e2e (RFC-1489).
|
|
5
|
+
</purpose>
|
|
6
|
+
<non-goals>
|
|
7
|
+
<item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
|
|
8
|
+
</non-goals>
|
|
9
|
+
</MODULE_CONTRACT>
|
|
10
|
+
<CHANGE_SUMMARY>
|
|
11
|
+
<item>RFC-1489: batched test-probe planning + attribution coverage.</item>
|
|
12
|
+
</CHANGE_SUMMARY>
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { test, expect, describe } from "vitest";
|
|
16
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { tmpdir } from "node:os";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
planProbeSegments,
|
|
22
|
+
attributeProbeResult,
|
|
23
|
+
runBatchedTestSegment,
|
|
24
|
+
type ProbeSegment,
|
|
25
|
+
} from "./probe-batch.ts";
|
|
26
|
+
import { runProbeSet } from "./acceptance.ts";
|
|
27
|
+
import type { AcceptanceProbe } from "./types.ts";
|
|
28
|
+
|
|
29
|
+
const WORKSPACE_ROOT = join(__dirname, "..", "..", "..", "..");
|
|
30
|
+
|
|
31
|
+
const testProbe = (
|
|
32
|
+
file: string,
|
|
33
|
+
overrides: Partial<Extract<AcceptanceProbe, { probe: "test" }>> = {},
|
|
34
|
+
): Extract<AcceptanceProbe, { probe: "test" }> => ({
|
|
35
|
+
probe: "test",
|
|
36
|
+
file,
|
|
37
|
+
expect: { exitCode: 0 },
|
|
38
|
+
...overrides,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const fileExists = (path: string): AcceptanceProbe => ({ probe: "file-exists", path });
|
|
42
|
+
const runProbe = (command: string): AcceptanceProbe => ({
|
|
43
|
+
probe: "run",
|
|
44
|
+
command,
|
|
45
|
+
expect: { exitCode: 0 },
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe("planProbeSegments — AC-1 barrier-free grouping", () => {
|
|
49
|
+
test("contiguous same-bound test probes form one segment", () => {
|
|
50
|
+
const probes = [
|
|
51
|
+
testProbe("a.test.ts"),
|
|
52
|
+
testProbe("b.test.ts"),
|
|
53
|
+
testProbe("c.test.ts", { timeoutMs: 120_000 }),
|
|
54
|
+
];
|
|
55
|
+
expect(planProbeSegments(probes, 120_000)).toEqual([
|
|
56
|
+
{ start: 0, members: [0, 1, 2], boundMs: 120_000 },
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("a timeoutMs change closes the segment", () => {
|
|
61
|
+
const probes = [
|
|
62
|
+
testProbe("a.test.ts"),
|
|
63
|
+
testProbe("b.test.ts", { timeoutMs: 5_000 }),
|
|
64
|
+
testProbe("c.test.ts"),
|
|
65
|
+
];
|
|
66
|
+
expect(planProbeSegments(probes, 120_000)).toEqual([
|
|
67
|
+
{ start: 0, members: [0], boundMs: 120_000 },
|
|
68
|
+
{ start: 1, members: [1], boundMs: 5_000 },
|
|
69
|
+
{ start: 2, members: [2], boundMs: 120_000 },
|
|
70
|
+
]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("run/page/proof are the only barriers — other kinds span without splitting", () => {
|
|
74
|
+
const probes: AcceptanceProbe[] = [
|
|
75
|
+
testProbe("a.test.ts"),
|
|
76
|
+
runProbe("site-kernel run x"),
|
|
77
|
+
testProbe("b.test.ts"),
|
|
78
|
+
{ probe: "page", target: "site", path: "/", expect: { status: 200 } } as AcceptanceProbe,
|
|
79
|
+
testProbe("c.test.ts"),
|
|
80
|
+
{ probe: "proof", spec: "s.yaml" },
|
|
81
|
+
testProbe("d.test.ts"),
|
|
82
|
+
fileExists("x.txt"),
|
|
83
|
+
testProbe("e.test.ts"),
|
|
84
|
+
];
|
|
85
|
+
expect(planProbeSegments(probes, 120_000)).toEqual([
|
|
86
|
+
{ start: 0, members: [0], boundMs: 120_000 },
|
|
87
|
+
{ start: 2, members: [2], boundMs: 120_000 },
|
|
88
|
+
{ start: 4, members: [4], boundMs: 120_000 },
|
|
89
|
+
{ start: 6, members: [6, 8], boundMs: 120_000 },
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("attributeProbeResult — AC-2/AC-3 per-slice attribution", () => {
|
|
95
|
+
const report = {
|
|
96
|
+
testResults: [
|
|
97
|
+
{
|
|
98
|
+
name: join(WORKSPACE_ROOT, "os/rfc/a.test.ts"),
|
|
99
|
+
status: "passed",
|
|
100
|
+
assertionResults: [
|
|
101
|
+
{ title: "first", fullName: "suite first", status: "passed" },
|
|
102
|
+
{ title: "second", fullName: "suite second", status: "passed" },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: join(WORKSPACE_ROOT, "os/rfc/b.test.ts"),
|
|
107
|
+
status: "failed",
|
|
108
|
+
assertionResults: [
|
|
109
|
+
{ title: "x", fullName: "bsuite x", status: "failed" },
|
|
110
|
+
{ title: "y", fullName: "bsuite y", status: "passed" },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
test("each probe derives only from its own file slice", () => {
|
|
117
|
+
const a = attributeProbeResult(testProbe("os/rfc/a.test.ts"), WORKSPACE_ROOT, report);
|
|
118
|
+
const b = attributeProbeResult(testProbe("os/rfc/b.test.ts"), WORKSPACE_ROOT, report);
|
|
119
|
+
expect(a.ok).toBe(true);
|
|
120
|
+
expect(a.verdict).toBe("pass");
|
|
121
|
+
expect(b.ok).toBe(false);
|
|
122
|
+
expect(b.verdict).toBe("fail");
|
|
123
|
+
expect(b.detail).toContain("expected 0");
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("testName attribution matches only its own assertions", () => {
|
|
127
|
+
const ok = attributeProbeResult(
|
|
128
|
+
testProbe("os/rfc/b.test.ts", { testName: "bsuite y" }),
|
|
129
|
+
WORKSPACE_ROOT,
|
|
130
|
+
report,
|
|
131
|
+
);
|
|
132
|
+
expect(ok.ok).toBe(true);
|
|
133
|
+
const fail = attributeProbeResult(
|
|
134
|
+
testProbe("os/rfc/b.test.ts", { testName: "bsuite x" }),
|
|
135
|
+
WORKSPACE_ROOT,
|
|
136
|
+
report,
|
|
137
|
+
);
|
|
138
|
+
expect(fail.ok).toBe(false);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("expected-nonzero exitCode inverts the derived verdict", () => {
|
|
142
|
+
const p = attributeProbeResult(
|
|
143
|
+
testProbe("os/rfc/b.test.ts", { expect: { exitCode: 1 } }),
|
|
144
|
+
WORKSPACE_ROOT,
|
|
145
|
+
report,
|
|
146
|
+
);
|
|
147
|
+
expect(p.ok).toBe(true);
|
|
148
|
+
expect(p.verdict).toBe("pass");
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("absent file slice is unverified, never pass", () => {
|
|
152
|
+
const p = attributeProbeResult(testProbe("os/rfc/missing.test.ts"), WORKSPACE_ROOT, report);
|
|
153
|
+
expect(p.ok).toBe(false);
|
|
154
|
+
expect(p.verdict).toBe("unverified");
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("testName matching no assertion is a fail (vitest -t parity, spec §4)", () => {
|
|
158
|
+
const p = attributeProbeResult(
|
|
159
|
+
testProbe("os/rfc/a.test.ts", { testName: "no such test" }),
|
|
160
|
+
WORKSPACE_ROOT,
|
|
161
|
+
report,
|
|
162
|
+
);
|
|
163
|
+
expect(p.ok).toBe(false);
|
|
164
|
+
expect(p.verdict).toBe("fail");
|
|
165
|
+
expect(p.detail).toContain("no testName match");
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("file-level requires status passed — skipped cannot prove execution", () => {
|
|
169
|
+
const skipped = {
|
|
170
|
+
testResults: [
|
|
171
|
+
{
|
|
172
|
+
name: join(WORKSPACE_ROOT, "os/rfc/s.test.ts"),
|
|
173
|
+
status: "skipped",
|
|
174
|
+
assertionResults: [{ title: "x", fullName: "s x", status: "skipped" }],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
const p = attributeProbeResult(testProbe("os/rfc/s.test.ts"), WORKSPACE_ROOT, skipped);
|
|
179
|
+
expect(p.ok).toBe(false);
|
|
180
|
+
expect(p.verdict).not.toBe("pass");
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe("runProbeSet — AC-2 order/shape, AC-4 --no-batch", () => {
|
|
185
|
+
test("preserves declared order across barriers; missing files are unverified", async () => {
|
|
186
|
+
const dir = mkdtempSync(join(tmpdir(), "probe-set-"));
|
|
187
|
+
try {
|
|
188
|
+
writeFileSync(join(dir, "present.txt"), "x");
|
|
189
|
+
const probes: AcceptanceProbe[] = [
|
|
190
|
+
fileExists("present.txt"),
|
|
191
|
+
testProbe("missing-a.test.ts"),
|
|
192
|
+
testProbe("missing-b.test.ts"),
|
|
193
|
+
fileExists("absent.txt"),
|
|
194
|
+
testProbe("missing-c.test.ts"),
|
|
195
|
+
];
|
|
196
|
+
const { results, durationsMs } = await runProbeSet(probes, { workspaceRoot: dir });
|
|
197
|
+
expect(results).toHaveLength(5);
|
|
198
|
+
expect(results[0]!.ok).toBe(true);
|
|
199
|
+
expect(results[1]!.verdict).toBe("unverified");
|
|
200
|
+
expect(results[1]!.detail).toContain("missing-a.test.ts");
|
|
201
|
+
expect(results[2]!.verdict).toBe("unverified");
|
|
202
|
+
expect(results[3]!.ok).toBe(false);
|
|
203
|
+
expect(results[3]!.verdict).not.toBe("unverified");
|
|
204
|
+
// Indexes 1,2,4 are all same-bound test probes with no run/page/proof
|
|
205
|
+
// barrier between them — they share ONE segment; each missing file is
|
|
206
|
+
// attributed unverified from its own slice.
|
|
207
|
+
expect(results[4]!.verdict).toBe("unverified");
|
|
208
|
+
expect(results[4]!.detail).toContain("missing-c.test.ts");
|
|
209
|
+
expect(durationsMs).toHaveLength(5);
|
|
210
|
+
// Each batched result echoes its own declared probe.
|
|
211
|
+
results.forEach((r, i) => expect(r.probe).toBe(probes[i]));
|
|
212
|
+
} finally {
|
|
213
|
+
rmSync(dir, { recursive: true, force: true });
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test("--no-batch forces the legacy per-probe path (spawn-failure != unverified)", async () => {
|
|
218
|
+
const dir = mkdtempSync(join(tmpdir(), "probe-set-nb-"));
|
|
219
|
+
try {
|
|
220
|
+
const probes = [testProbe("missing-a.test.ts"), testProbe("missing-b.test.ts")];
|
|
221
|
+
const legacy = await runProbeSet(probes, { workspaceRoot: dir, noBatch: true });
|
|
222
|
+
// Legacy spawns vitest per probe in the tmp workspace — the spawn fails,
|
|
223
|
+
// producing a fail verdict rather than the batched "unverified".
|
|
224
|
+
for (const r of legacy.results) {
|
|
225
|
+
expect(r.verdict).not.toBe("unverified");
|
|
226
|
+
expect(r.ok).toBe(false);
|
|
227
|
+
}
|
|
228
|
+
} finally {
|
|
229
|
+
rmSync(dir, { recursive: true, force: true });
|
|
230
|
+
}
|
|
231
|
+
}, 60_000);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
describe("e2e — one instrumented Vitest run attributes two files", () => {
|
|
235
|
+
test(
|
|
236
|
+
"two real test files in one segment produce per-file verdicts (AC-1/AC-2)",
|
|
237
|
+
async () => {
|
|
238
|
+
const segment: ProbeSegment = { start: 0, members: [0, 1], boundMs: 120_000 };
|
|
239
|
+
const probes = [
|
|
240
|
+
testProbe("packages/forge/os/rfc/verification-normalize.test.ts"),
|
|
241
|
+
testProbe("packages/forge/os/rfc/frontmatter-io.test.ts"),
|
|
242
|
+
];
|
|
243
|
+
const results = await runBatchedTestSegment(probes, segment, WORKSPACE_ROOT);
|
|
244
|
+
expect(results.size).toBe(2);
|
|
245
|
+
const a = results.get(0)!;
|
|
246
|
+
const b = results.get(1)!;
|
|
247
|
+
expect(a.verdict, `probe 0 must attribute its own file — ${a.detail}`).toBe("pass");
|
|
248
|
+
expect(b.verdict, `probe 1 must attribute its own file — ${b.detail}`).toBe("pass");
|
|
249
|
+
expect(a.detail).toContain("batched:");
|
|
250
|
+
},
|
|
251
|
+
180_000,
|
|
252
|
+
);
|
|
253
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
Independent acceptance-verifier check for RFC-1391 (ac10-operating-model-policy) — authored inside
|
|
5
|
+
rfc.verify.workspace by the clean-context verifier, not by the implementer.
|
|
6
|
+
Derives its expectation from the RFC text and the observable behavior of the
|
|
7
|
+
real handlers/runner it exercises.
|
|
8
|
+
</purpose>
|
|
9
|
+
<non-goals>
|
|
10
|
+
<item>Do not treat as implementer-authored evidence — its expectationSource is independent.</item>
|
|
11
|
+
<item>Do not edit to fit the code — a failure here is a counterexample, fix the implementation.</item>
|
|
12
|
+
</non-goals>
|
|
13
|
+
</MODULE_CONTRACT>
|
|
14
|
+
<CHANGE_SUMMARY>
|
|
15
|
+
<item>RFC-1391 r1 verification: independent check ac10-operating-model-policy.</item>
|
|
16
|
+
<item>RFC-1391: commit independent verifier checks + independent probes + round-1 pass report
|
|
17
|
+
|
|
18
|
+
Round-0 verdict counterexamples (CX-1: emit dead for proof-probe RFCs),
|
|
19
|
+
fixed in 1342fe21a; round-1 verdict pass — 47/47 checks, AC-1..AC-10 all
|
|
20
|
+
verified on the real implementation surface, non-vacuity re-verified by
|
|
21
|
+
mutation.</item>
|
|
22
|
+
</CHANGE_SUMMARY>
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// RFC-1391 AC-10 — "The agent operating model SHALL state that only a
|
|
26
|
+
// mechanical checker verdict counts as formal-tier evidence."
|
|
27
|
+
// RFC design: an agent-written argument, a random-sampling property test, or
|
|
28
|
+
// an unavailable checker must never be accepted as formal evidence — the
|
|
29
|
+
// operating model text is the enforcement surface agents read.
|
|
30
|
+
//
|
|
31
|
+
// Independent check: the canonical source file under packages/forge/skills/
|
|
32
|
+
// carries the policy, and the synced .agents mirror is byte-identical (the
|
|
33
|
+
// documented sync contract — drift would silently un-teach agents).
|
|
34
|
+
|
|
35
|
+
import { createHash } from "node:crypto";
|
|
36
|
+
import { readFileSync } from "node:fs";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { describe, expect, it } from "vitest";
|
|
39
|
+
|
|
40
|
+
import { EXPORT_ROOT, FORGE_ROOT } from "./support.ts";
|
|
41
|
+
|
|
42
|
+
const SRC = join(FORGE_ROOT, "skills/_shared/agent-operating-model.md");
|
|
43
|
+
const MIRROR = join(EXPORT_ROOT, ".agents/skills/_shared/agent-operating-model.md");
|
|
44
|
+
|
|
45
|
+
const sha = (p: string) => createHash("sha256").update(readFileSync(p)).digest("hex");
|
|
46
|
+
|
|
47
|
+
describe("AC-10: operating model binds formal evidence to a mechanical checker verdict", () => {
|
|
48
|
+
it("the source operating model states the policy", () => {
|
|
49
|
+
const text = readFileSync(SRC, "utf8");
|
|
50
|
+
// The load-bearing claim: mechanical-verdict-only formal evidence.
|
|
51
|
+
expect(text).toContain("Only a mechanical checker verdict");
|
|
52
|
+
// It must name the instrument and the bound spec schema.
|
|
53
|
+
expect(text).toContain("proof.check");
|
|
54
|
+
expect(text).toContain("proved");
|
|
55
|
+
expect(text).toContain("forge/proof-spec@1");
|
|
56
|
+
// And it must exclude the non-mechanical substitutes the RFC calls out.
|
|
57
|
+
expect(text).toMatch(/never does|never counts/i);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("the .agents mirror is byte-identical to the source (sync contract)", () => {
|
|
61
|
+
expect(sha(MIRROR)).toBe(sha(SRC));
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
type SessionArchiveMove,
|
|
36
36
|
type SessionArchiveSkip,
|
|
37
37
|
} from "../types.ts";
|
|
38
|
-
import { loadPinnedManifest,
|
|
38
|
+
import { loadPinnedManifest, isArchiveBlocked } from "../../core/handlers/pinned-check.ts";
|
|
39
39
|
|
|
40
40
|
const DEFAULT_MAX_AGE_DAYS = 7;
|
|
41
41
|
|
|
@@ -118,11 +118,7 @@ export async function runSessionArchive(
|
|
|
118
118
|
|
|
119
119
|
// RFC-0733: Check if file is pinned before moving
|
|
120
120
|
// Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
|
|
121
|
-
if (
|
|
122
|
-
pinnedManifest &&
|
|
123
|
-
isPinned(pinnedManifest, relFile) &&
|
|
124
|
-
!isIntraDirMove(pinnedManifest, relFile, targetRel)
|
|
125
|
-
) {
|
|
121
|
+
if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
|
|
126
122
|
skipped.push({ id, file: relFile, reason: "pinned (protected by .forge/pinned.yaml)" });
|
|
127
123
|
if (outputFormat === "pretty") {
|
|
128
124
|
logger.warn(` pinned: skipping ${relFile} (protected)`);
|
|
@@ -206,11 +202,7 @@ export async function runSessionArchive(
|
|
|
206
202
|
|
|
207
203
|
// RFC-0733: Check if file is pinned before moving
|
|
208
204
|
// Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
|
|
209
|
-
if (
|
|
210
|
-
pinnedManifest &&
|
|
211
|
-
isPinned(pinnedManifest, archRelFile) &&
|
|
212
|
-
!isIntraDirMove(pinnedManifest, archRelFile, targetRel)
|
|
213
|
-
) {
|
|
205
|
+
if (pinnedManifest && isArchiveBlocked(pinnedManifest, archRelFile, targetRel)) {
|
|
214
206
|
skipped.push({ id, file: archRelFile, reason: "pinned (protected by .forge/pinned.yaml)" });
|
|
215
207
|
if (outputFormat === "pretty") {
|
|
216
208
|
logger.warn(` pinned: skipping ${archRelFile} (protected)`);
|