oh-my-copilot 5.18.2 → 5.19.2
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +206 -104
- package/bridge/__pycache__/gyoshu_bridge.cpython-314.pyc +0 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +7155 -4471
- package/bridge/mcp-server.cjs +2470 -1027
- package/bridge/runtime-cli.cjs +102 -12
- package/bridge/team-mcp.cjs +100 -11
- package/bridge/team.js +100 -11
- package/dist/budget/ledger.d.ts +5 -0
- package/dist/budget/ledger.d.ts.map +1 -1
- package/dist/budget/ledger.js +2 -1
- package/dist/budget/ledger.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-forge-cli.test.js +3 -3
- package/dist/cli/commands/__tests__/factory-forge-cli.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-init.test.js +239 -17
- package/dist/cli/commands/__tests__/factory-init.test.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-run-cli.test.js +103 -2
- package/dist/cli/commands/__tests__/factory-run-cli.test.js.map +1 -1
- package/dist/cli/commands/factory-board.d.ts +9 -0
- package/dist/cli/commands/factory-board.d.ts.map +1 -0
- package/dist/cli/commands/factory-board.js +34 -0
- package/dist/cli/commands/factory-board.js.map +1 -0
- package/dist/cli/commands/factory-check.d.ts +1 -0
- package/dist/cli/commands/factory-check.d.ts.map +1 -1
- package/dist/cli/commands/factory-check.js +2 -1
- package/dist/cli/commands/factory-check.js.map +1 -1
- package/dist/cli/commands/factory-poll.d.ts +9 -0
- package/dist/cli/commands/factory-poll.d.ts.map +1 -0
- package/dist/cli/commands/factory-poll.js +34 -0
- package/dist/cli/commands/factory-poll.js.map +1 -0
- package/dist/cli/commands/factory-setup.d.ts +2 -0
- package/dist/cli/commands/factory-setup.d.ts.map +1 -1
- package/dist/cli/commands/factory-setup.js +9 -3
- package/dist/cli/commands/factory-setup.js.map +1 -1
- package/dist/cli/commands/factory.d.ts +61 -18
- package/dist/cli/commands/factory.d.ts.map +1 -1
- package/dist/cli/commands/factory.js +325 -53
- package/dist/cli/commands/factory.js.map +1 -1
- package/dist/factory/__tests__/check-run.test.js +37 -96
- package/dist/factory/__tests__/check-run.test.js.map +1 -1
- package/dist/factory/__tests__/enqueue-ado.test.d.ts +2 -0
- package/dist/factory/__tests__/enqueue-ado.test.d.ts.map +1 -0
- package/dist/factory/__tests__/enqueue-ado.test.js +375 -0
- package/dist/factory/__tests__/enqueue-ado.test.js.map +1 -0
- package/dist/factory/__tests__/enqueue.test.d.ts +2 -0
- package/dist/factory/__tests__/enqueue.test.d.ts.map +1 -0
- package/dist/factory/__tests__/enqueue.test.js +470 -0
- package/dist/factory/__tests__/enqueue.test.js.map +1 -0
- package/dist/factory/__tests__/heal-ado.test.d.ts +2 -0
- package/dist/factory/__tests__/heal-ado.test.d.ts.map +1 -0
- package/dist/factory/__tests__/heal-ado.test.js +237 -0
- package/dist/factory/__tests__/heal-ado.test.js.map +1 -0
- package/dist/factory/__tests__/listener.test.js +27 -9
- package/dist/factory/__tests__/listener.test.js.map +1 -1
- package/dist/factory/__tests__/map-frontier.test.js +68 -0
- package/dist/factory/__tests__/map-frontier.test.js.map +1 -1
- package/dist/factory/__tests__/map-ingest.test.js +4 -3
- package/dist/factory/__tests__/map-ingest.test.js.map +1 -1
- package/dist/factory/__tests__/poll-ado.test.d.ts +2 -0
- package/dist/factory/__tests__/poll-ado.test.d.ts.map +1 -0
- package/dist/factory/__tests__/poll-ado.test.js +263 -0
- package/dist/factory/__tests__/poll-ado.test.js.map +1 -0
- package/dist/factory/__tests__/poll.test.d.ts +2 -0
- package/dist/factory/__tests__/poll.test.d.ts.map +1 -0
- package/dist/factory/__tests__/poll.test.js +748 -0
- package/dist/factory/__tests__/poll.test.js.map +1 -0
- package/dist/factory/board/__tests__/board-ado.test.d.ts +2 -0
- package/dist/factory/board/__tests__/board-ado.test.d.ts.map +1 -0
- package/dist/factory/board/__tests__/board-ado.test.js +194 -0
- package/dist/factory/board/__tests__/board-ado.test.js.map +1 -0
- package/dist/factory/board/__tests__/board.test.d.ts +2 -0
- package/dist/factory/board/__tests__/board.test.d.ts.map +1 -0
- package/dist/factory/board/__tests__/board.test.js +287 -0
- package/dist/factory/board/__tests__/board.test.js.map +1 -0
- package/dist/factory/board/collect.d.ts +145 -0
- package/dist/factory/board/collect.d.ts.map +1 -0
- package/dist/factory/board/collect.js +330 -0
- package/dist/factory/board/collect.js.map +1 -0
- package/dist/factory/board/render.d.ts +12 -0
- package/dist/factory/board/render.d.ts.map +1 -0
- package/dist/factory/board/render.js +93 -0
- package/dist/factory/board/render.js.map +1 -0
- package/dist/factory/check/__tests__/ado.test.js +14 -1
- package/dist/factory/check/__tests__/ado.test.js.map +1 -1
- package/dist/factory/check/__tests__/cli.test.js +38 -0
- package/dist/factory/check/__tests__/cli.test.js.map +1 -1
- package/dist/factory/check/__tests__/rules.test.js +72 -2
- package/dist/factory/check/__tests__/rules.test.js.map +1 -1
- package/dist/factory/check/cli.d.ts +34 -6
- package/dist/factory/check/cli.d.ts.map +1 -1
- package/dist/factory/check/cli.js +56 -34
- package/dist/factory/check/cli.js.map +1 -1
- package/dist/factory/check/rules.d.ts +11 -3
- package/dist/factory/check/rules.d.ts.map +1 -1
- package/dist/factory/check/rules.js +18 -5
- package/dist/factory/check/rules.js.map +1 -1
- package/dist/factory/check/score.d.ts +22 -2
- package/dist/factory/check/score.d.ts.map +1 -1
- package/dist/factory/check/score.js +55 -1
- package/dist/factory/check/score.js.map +1 -1
- package/dist/factory/enqueue.d.ts +195 -0
- package/dist/factory/enqueue.d.ts.map +1 -0
- package/dist/factory/enqueue.js +788 -0
- package/dist/factory/enqueue.js.map +1 -0
- package/dist/factory/heal/cli.d.ts +34 -2
- package/dist/factory/heal/cli.d.ts.map +1 -1
- package/dist/factory/heal/cli.js +88 -19
- package/dist/factory/heal/cli.js.map +1 -1
- package/dist/factory/heal/history.d.ts +12 -6
- package/dist/factory/heal/history.d.ts.map +1 -1
- package/dist/factory/heal/history.js +16 -6
- package/dist/factory/heal/history.js.map +1 -1
- package/dist/factory/heal/implement.d.ts +3 -1
- package/dist/factory/heal/implement.d.ts.map +1 -1
- package/dist/factory/heal/implement.js +1 -0
- package/dist/factory/heal/implement.js.map +1 -1
- package/dist/factory/heal/run.d.ts +3 -0
- package/dist/factory/heal/run.d.ts.map +1 -1
- package/dist/factory/heal/run.js +1 -1
- package/dist/factory/heal/run.js.map +1 -1
- package/dist/factory/listener.d.ts +13 -17
- package/dist/factory/listener.d.ts.map +1 -1
- package/dist/factory/listener.js +37 -63
- package/dist/factory/listener.js.map +1 -1
- package/dist/factory/map-frontier.d.ts +8 -1
- package/dist/factory/map-frontier.d.ts.map +1 -1
- package/dist/factory/map-frontier.js +65 -5
- package/dist/factory/map-frontier.js.map +1 -1
- package/dist/factory/map-ingest.d.ts.map +1 -1
- package/dist/factory/map-ingest.js +12 -1
- package/dist/factory/map-ingest.js.map +1 -1
- package/dist/factory/poll.d.ts +308 -0
- package/dist/factory/poll.d.ts.map +1 -0
- package/dist/factory/poll.js +677 -0
- package/dist/factory/poll.js.map +1 -0
- package/dist/factory/run/__tests__/engine.ado.test.js +157 -8
- package/dist/factory/run/__tests__/engine.ado.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.outcome.test.d.ts +2 -0
- package/dist/factory/run/__tests__/engine.outcome.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/engine.outcome.test.js +223 -0
- package/dist/factory/run/__tests__/engine.outcome.test.js.map +1 -0
- package/dist/factory/run/__tests__/engine.test.js +91 -0
- package/dist/factory/run/__tests__/engine.test.js.map +1 -1
- package/dist/factory/run/__tests__/units.test.js +299 -2
- package/dist/factory/run/__tests__/units.test.js.map +1 -1
- package/dist/factory/run/engine.d.ts +11 -3
- package/dist/factory/run/engine.d.ts.map +1 -1
- package/dist/factory/run/engine.js +145 -22
- package/dist/factory/run/engine.js.map +1 -1
- package/dist/factory/run/exec.d.ts +32 -4
- package/dist/factory/run/exec.d.ts.map +1 -1
- package/dist/factory/run/exec.js +120 -15
- package/dist/factory/run/exec.js.map +1 -1
- package/dist/factory/run/outcome.d.ts +31 -0
- package/dist/factory/run/outcome.d.ts.map +1 -0
- package/dist/factory/run/outcome.js +70 -0
- package/dist/factory/run/outcome.js.map +1 -0
- package/dist/factory/run/review-output.d.ts +6 -1
- package/dist/factory/run/review-output.d.ts.map +1 -1
- package/dist/factory/run/review-output.js +13 -3
- package/dist/factory/run/review-output.js.map +1 -1
- package/dist/factory/run/state.d.ts +2 -0
- package/dist/factory/run/state.d.ts.map +1 -1
- package/dist/factory/run/state.js.map +1 -1
- package/dist/factory/setup/__tests__/pipeline-pick.test.d.ts +2 -0
- package/dist/factory/setup/__tests__/pipeline-pick.test.d.ts.map +1 -0
- package/dist/factory/setup/__tests__/pipeline-pick.test.js +84 -0
- package/dist/factory/setup/__tests__/pipeline-pick.test.js.map +1 -0
- package/dist/factory/setup/__tests__/setup.test.js +1 -0
- package/dist/factory/setup/__tests__/setup.test.js.map +1 -1
- package/dist/factory/setup/detect.js +1 -1
- package/dist/factory/setup/detect.js.map +1 -1
- package/dist/factory/setup/pipeline-pick.d.ts +25 -0
- package/dist/factory/setup/pipeline-pick.d.ts.map +1 -0
- package/dist/factory/setup/pipeline-pick.js +55 -0
- package/dist/factory/setup/pipeline-pick.js.map +1 -0
- package/dist/factory/setup/write.d.ts +6 -0
- package/dist/factory/setup/write.d.ts.map +1 -1
- package/dist/factory/setup/write.js +3 -1
- package/dist/factory/setup/write.js.map +1 -1
- package/dist/factory/watchdog.d.ts +3 -2
- package/dist/factory/watchdog.d.ts.map +1 -1
- package/dist/factory/watchdog.js +5 -4
- package/dist/factory/watchdog.js.map +1 -1
- package/dist/factory/watchdog.test.js +19 -4
- package/dist/factory/watchdog.test.js.map +1 -1
- package/dist/forge/__tests__/config.test.js +51 -0
- package/dist/forge/__tests__/config.test.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.chain.test.js +2 -2
- package/dist/forge/__tests__/gh-argv-baseline.chain.test.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js +6 -4
- package/dist/forge/__tests__/gh-argv-baseline.factory.test.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.d.ts +2 -0
- package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.d.ts.map +1 -0
- package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.js +100 -0
- package/dist/forge/__tests__/gh-argv-baseline.tracker-writes.test.js.map +1 -0
- package/dist/forge/ado/__tests__/acceptance-scripts.test.js +360 -30
- package/dist/forge/ado/__tests__/acceptance-scripts.test.js.map +1 -1
- package/dist/forge/ado/__tests__/adapter.test.js +18 -3
- package/dist/forge/ado/__tests__/adapter.test.js.map +1 -1
- package/dist/forge/ado/__tests__/ci.test.d.ts +2 -0
- package/dist/forge/ado/__tests__/ci.test.d.ts.map +1 -0
- package/dist/forge/ado/__tests__/ci.test.js +271 -0
- package/dist/forge/ado/__tests__/ci.test.js.map +1 -0
- package/dist/forge/ado/__tests__/routes.test.js +24 -5
- package/dist/forge/ado/__tests__/routes.test.js.map +1 -1
- package/dist/forge/ado/__tests__/tracker-writes.test.d.ts +8 -0
- package/dist/forge/ado/__tests__/tracker-writes.test.d.ts.map +1 -0
- package/dist/forge/ado/__tests__/tracker-writes.test.js +377 -0
- package/dist/forge/ado/__tests__/tracker-writes.test.js.map +1 -0
- package/dist/forge/ado/__tests__/world.d.ts +4 -0
- package/dist/forge/ado/__tests__/world.d.ts.map +1 -1
- package/dist/forge/ado/__tests__/world.js +3 -2
- package/dist/forge/ado/__tests__/world.js.map +1 -1
- package/dist/forge/ado/checks.d.ts +25 -2
- package/dist/forge/ado/checks.d.ts.map +1 -1
- package/dist/forge/ado/checks.js +47 -23
- package/dist/forge/ado/checks.js.map +1 -1
- package/dist/forge/ado/ci.d.ts +13 -0
- package/dist/forge/ado/ci.d.ts.map +1 -0
- package/dist/forge/ado/ci.js +134 -0
- package/dist/forge/ado/ci.js.map +1 -0
- package/dist/forge/ado/guard.d.ts +19 -6
- package/dist/forge/ado/guard.d.ts.map +1 -1
- package/dist/forge/ado/guard.js +52 -11
- package/dist/forge/ado/guard.js.map +1 -1
- package/dist/forge/ado/index.d.ts +7 -1
- package/dist/forge/ado/index.d.ts.map +1 -1
- package/dist/forge/ado/index.js +16 -3
- package/dist/forge/ado/index.js.map +1 -1
- package/dist/forge/ado/reviews.d.ts +9 -1
- package/dist/forge/ado/reviews.d.ts.map +1 -1
- package/dist/forge/ado/reviews.js +45 -1
- package/dist/forge/ado/reviews.js.map +1 -1
- package/dist/forge/ado/routes.d.ts +35 -5
- package/dist/forge/ado/routes.d.ts.map +1 -1
- package/dist/forge/ado/routes.js +181 -9
- package/dist/forge/ado/routes.js.map +1 -1
- package/dist/forge/ado/tracker.d.ts +13 -2
- package/dist/forge/ado/tracker.d.ts.map +1 -1
- package/dist/forge/ado/tracker.js +139 -3
- package/dist/forge/ado/tracker.js.map +1 -1
- package/dist/forge/ado/wiql.d.ts +2 -0
- package/dist/forge/ado/wiql.d.ts.map +1 -1
- package/dist/forge/ado/wiql.js +6 -0
- package/dist/forge/ado/wiql.js.map +1 -1
- package/dist/forge/body-file.d.ts +17 -0
- package/dist/forge/body-file.d.ts.map +1 -0
- package/dist/forge/body-file.js +59 -0
- package/dist/forge/body-file.js.map +1 -0
- package/dist/forge/config.d.ts +3 -1
- package/dist/forge/config.d.ts.map +1 -1
- package/dist/forge/config.js +37 -2
- package/dist/forge/config.js.map +1 -1
- package/dist/forge/github/__tests__/argv-parity.test.js +17 -1
- package/dist/forge/github/__tests__/argv-parity.test.js.map +1 -1
- package/dist/forge/github/gh.d.ts +6 -0
- package/dist/forge/github/gh.d.ts.map +1 -1
- package/dist/forge/github/gh.js +2 -0
- package/dist/forge/github/gh.js.map +1 -1
- package/dist/forge/github/reviews.d.ts +2 -0
- package/dist/forge/github/reviews.d.ts.map +1 -1
- package/dist/forge/github/reviews.js +6 -0
- package/dist/forge/github/reviews.js.map +1 -1
- package/dist/forge/github/tracker.d.ts +20 -4
- package/dist/forge/github/tracker.d.ts.map +1 -1
- package/dist/forge/github/tracker.js +59 -5
- package/dist/forge/github/tracker.js.map +1 -1
- package/dist/forge/types.d.ts +108 -2
- package/dist/forge/types.d.ts.map +1 -1
- package/dist/forge/types.js +8 -0
- package/dist/forge/types.js.map +1 -1
- package/dist/graph/schema.d.ts +10 -10
- package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js +156 -35
- package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/check-evidence.test.js +4 -4
- package/dist/hooks/session-end/__tests__/check-evidence.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/copilot-liveness.test.js +3 -3
- package/dist/hooks/session-end/__tests__/copilot-liveness.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js +3 -3
- package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/routing.test.js +36 -1
- package/dist/hooks/session-end/__tests__/routing.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/spawn-next.test.js +96 -5
- package/dist/hooks/session-end/__tests__/spawn-next.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/worker.test.js +38 -2
- package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
- package/dist/hooks/session-end/chain-enqueuer.d.ts.map +1 -1
- package/dist/hooks/session-end/chain-enqueuer.js +22 -2
- package/dist/hooks/session-end/chain-enqueuer.js.map +1 -1
- package/dist/hooks/session-end/routing.d.ts +14 -0
- package/dist/hooks/session-end/routing.d.ts.map +1 -1
- package/dist/hooks/session-end/routing.js +25 -0
- package/dist/hooks/session-end/routing.js.map +1 -1
- package/dist/hooks/session-end/spawn-next.d.ts +20 -2
- package/dist/hooks/session-end/spawn-next.d.ts.map +1 -1
- package/dist/hooks/session-end/spawn-next.js +72 -5
- package/dist/hooks/session-end/spawn-next.js.map +1 -1
- package/dist/smoke/__tests__/copilot-chain-scenario.test.js +2 -1
- package/dist/smoke/__tests__/copilot-chain-scenario.test.js.map +1 -1
- package/dist/smoke/copilot-chain-scenario.d.ts.map +1 -1
- package/dist/smoke/copilot-chain-scenario.js +5 -1
- package/dist/smoke/copilot-chain-scenario.js.map +1 -1
- package/dist/team/__tests__/worker-launch-ack.test.js +134 -5
- package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
- package/dist/team/worker-launch-ack.d.ts.map +1 -1
- package/dist/team/worker-launch-ack.js +19 -4
- package/dist/team/worker-launch-ack.js.map +1 -1
- package/docs/CLAUDE.md +1 -1
- package/docs/MIGRATION.md +26 -0
- package/docs/REFERENCE.md +187 -20
- package/docs/design/FACTORY-FINAL-DESIGN.md +1 -1
- package/docs/shipyard.md +17 -1
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/scripts/ado-acceptance.mjs +309 -70
- package/scripts/lib/backlog-to-workitems.mjs +24 -21
- package/skills/ask-navigator/SKILL.md +5 -2
- package/skills/drydock/SKILL.md +2 -1
- package/skills/harbor/SKILL.md +17 -2
- package/skills/intent/SKILL.md +4 -0
- package/skills/launch/SKILL.md +35 -2
- package/skills/map/SKILL.md +2 -1
- package/skills/refit/SKILL.md +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh-argv-baseline.tracker-writes.test.js","sourceRoot":"","sources":["../../../src/forge/__tests__/gh-argv-baseline.tracker-writes.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EA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C"}
|
|
@@ -8,11 +8,12 @@ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync,
|
|
|
8
8
|
import { tmpdir } from 'os';
|
|
9
9
|
import { join } from 'path';
|
|
10
10
|
import { afterAll, describe, expect, it } from 'vitest';
|
|
11
|
+
import { parseTicketFile } from '../../../factory/enqueue.js';
|
|
11
12
|
import { redactAdoSecrets } from '../redact.js';
|
|
12
13
|
import { ADO_ROUTES } from '../routes.js';
|
|
13
14
|
import { parseAdoFixture } from './fixtures.js';
|
|
14
15
|
// @ts-expect-error Script source is intentionally JavaScript-only.
|
|
15
|
-
import {
|
|
16
|
+
import { backlogToTicketFile, inlineHtml, parseBacklog } from '../../../../scripts/lib/backlog-to-workitems.mjs';
|
|
16
17
|
// @ts-expect-error Script source is intentionally JavaScript-only.
|
|
17
18
|
import * as acceptance from '../../../../scripts/ado-acceptance.mjs';
|
|
18
19
|
// @ts-expect-error Script source is intentionally JavaScript-only.
|
|
@@ -78,19 +79,28 @@ describe('scripts/lib/backlog-to-workitems.mjs', () => {
|
|
|
78
79
|
expect(tickets[1].dependsOn).toEqual([]);
|
|
79
80
|
expect(tickets[2].dependsOn).toEqual(['EXC-007', 'EXC-001']);
|
|
80
81
|
});
|
|
81
|
-
it('builds
|
|
82
|
-
const {
|
|
83
|
-
expect(
|
|
84
|
-
|
|
82
|
+
it('builds the enqueue ticket file: lower-case keys, blockedBy keys the backlog defines, unknown dependencies reported', () => {
|
|
83
|
+
const { file, unknown } = backlogToTicketFile(BACKLOG, 500);
|
|
84
|
+
expect(file).toMatchObject({ schemaVersion: 1, spec: 500 });
|
|
85
|
+
expect(file.tickets[0]).toEqual({
|
|
86
|
+
key: 'exc-001',
|
|
85
87
|
title: 'EXC-001 Fuel gauge',
|
|
86
|
-
|
|
88
|
+
body: 'Depends on: none.',
|
|
89
|
+
acceptance: [
|
|
90
|
+
'Add `fuel` (0..`EXCAVATOR.fuelCapacity`) to `ExcavatorState`.',
|
|
91
|
+
'At zero fuel the excavator cannot drive; delivered >= required & <done>.',
|
|
92
|
+
'Tests: drain rate, empty-tank immobility, refuel pickup.',
|
|
93
|
+
],
|
|
94
|
+
blockedBy: [],
|
|
87
95
|
});
|
|
88
|
-
expect(
|
|
89
|
-
+ '<li>At zero fuel the excavator cannot drive; delivered >= required & <done>.</li>'
|
|
90
|
-
+ '<li>Tests: drain rate, empty-tank immobility, refuel pickup.</li></ul>');
|
|
96
|
+
expect(file.tickets[2]).toMatchObject({ key: 'exc-009', blockedBy: ['exc-001'] });
|
|
91
97
|
expect(unknown).toEqual(['EXC-009 depends on EXC-007, which BACKLOG.md does not define']);
|
|
92
98
|
expect(inlineHtml('`<script>` & "x"')).toBe('<code><script></code> & "x"');
|
|
93
99
|
});
|
|
100
|
+
it('writes a ticket file that omg factory enqueue accepts', () => {
|
|
101
|
+
const { file } = backlogToTicketFile(BACKLOG, 500);
|
|
102
|
+
expect(parseTicketFile(file, 12)).toMatchObject({ spec: 500, tickets: file.tickets });
|
|
103
|
+
});
|
|
94
104
|
it('refuses a duplicate ticket and a ticket without acceptance criteria', () => {
|
|
95
105
|
expect(() => parseBacklog('## EXC-001 A\n- [ ] x\n## EXC-001 B\n- [ ] y\n')).toThrow(/appears twice/);
|
|
96
106
|
expect(() => parseBacklog('## EXC-001 A\nDepends on: none.\n')).toThrow(/no checkbox acceptance criteria/);
|
|
@@ -103,25 +113,39 @@ const ENTRY = { command: 'C:\\CLI2\\python.exe', prefix: ['-IBm', 'azure.cli'],
|
|
|
103
113
|
function manifest(home, over = {}) {
|
|
104
114
|
const m = {
|
|
105
115
|
schemaVersion: 1, runId: RUN, org: ORG, source: 'C:/src', runDir: join(home, RUN), pool: { kind: 'self-hosted', name: 'Default' },
|
|
106
|
-
project: { name: RUN, id: PROJECT_ID }, repo: { name: RUN, id: 'r', url: 'u' }, pipeline: { id: 7 }, policy: { id: 3 },
|
|
116
|
+
project: { name: RUN, id: PROJECT_ID }, repo: { name: RUN, id: 'r', url: 'u' }, pipeline: { id: 7 }, policy: { id: 3 },
|
|
117
|
+
spec: { id: 40, createdBy: 'robin@contoso.example' }, tickets: { 'exc-001': { id: 41, blockedBy: [] }, 'exc-009': { id: 43, blockedBy: ['exc-001'] } }, trustedAuthorsAdded: [],
|
|
107
118
|
...over,
|
|
108
119
|
};
|
|
109
120
|
mkdirSync(home, { recursive: true });
|
|
110
121
|
writeFileSync(join(home, `${RUN}.json`), JSON.stringify(m), 'utf8');
|
|
111
122
|
return m;
|
|
112
123
|
}
|
|
113
|
-
|
|
124
|
+
/** trustedUserConfigPath() (src/ship/config.ts) on Windows for the account robin. */
|
|
125
|
+
const USER_CONFIG = 'C:\\Users\\robin\\AppData\\Roaming\\claude-omc\\config.jsonc';
|
|
126
|
+
function context(o, answer, extra = {}) {
|
|
114
127
|
const lines = [];
|
|
115
128
|
const calls = [];
|
|
116
|
-
const
|
|
117
|
-
|
|
129
|
+
const asked = [];
|
|
130
|
+
const spawn = (cmd, args, opts) => {
|
|
131
|
+
calls.push({ cmd, args, env: opts?.env });
|
|
118
132
|
if (!answer)
|
|
119
133
|
throw new Error(`spawned in a dry run: ${cmd} ${args.join(' ')}`);
|
|
120
134
|
return { stderr: '', ...answer({ cmd, args }) };
|
|
121
135
|
};
|
|
122
|
-
const
|
|
123
|
-
|
|
136
|
+
const confirm = (q) => {
|
|
137
|
+
asked.push(q);
|
|
138
|
+
lines.push(`asked: ${q}`);
|
|
139
|
+
if (!extra.confirm)
|
|
140
|
+
throw new Error(`asked in a dry run: ${q}`);
|
|
141
|
+
return extra.confirm(q);
|
|
142
|
+
};
|
|
143
|
+
const userConfig = { path: USER_CONFIG, trustedAuthors: () => extra.trustedAuthors ?? [] };
|
|
144
|
+
const ctx = acceptance.createContext(o, { spawn, azEntry: ENTRY, log: (l) => lines.push(l), now: () => new Date('2026-10-29T12:00:00Z'), env: {}, confirm, userConfig });
|
|
145
|
+
return { ctx, lines, calls, asked };
|
|
124
146
|
}
|
|
147
|
+
/** An omg call's argv after bin/oh-my-copilot.js. */
|
|
148
|
+
const omgArgs = (call) => call.args.slice(1);
|
|
125
149
|
const azArgs = (call) => call.args.slice(ENTRY.prefix.length);
|
|
126
150
|
/** What azArgv appends to every azure-devops extension command. */
|
|
127
151
|
const J = ['--detect', 'false', '--output', 'json'];
|
|
@@ -214,7 +238,7 @@ describe('scripts/ado-acceptance.mjs az output and cleanup hardening', () => {
|
|
|
214
238
|
});
|
|
215
239
|
describe('scripts/ado-acceptance.mjs heal-drill', () => {
|
|
216
240
|
const SHA = 'a'.repeat(40);
|
|
217
|
-
const drill = (withLanes, healRunStatus = 0) => {
|
|
241
|
+
const drill = (withLanes, healRunStatus = 0, completedPrs = '[]') => {
|
|
218
242
|
const home = freshDir('home');
|
|
219
243
|
manifest(home);
|
|
220
244
|
mkdirSync(join(home, RUN, 'repo'), { recursive: true });
|
|
@@ -225,6 +249,8 @@ describe('scripts/ado-acceptance.mjs heal-drill', () => {
|
|
|
225
249
|
if (c.cmd === ENTRY.command) {
|
|
226
250
|
if (azArgs(c)[0] === 'pipelines')
|
|
227
251
|
return { status: 0, stdout: JSON.stringify([{ id: 9, sourceVersion: SHA, status: 'completed', result: 'failed' }]) };
|
|
252
|
+
if (azArgs(c).slice(0, 3).join(' ') === 'repos pr list')
|
|
253
|
+
return { status: 0, stdout: completedPrs };
|
|
228
254
|
return { status: 0, stdout: '{}' };
|
|
229
255
|
}
|
|
230
256
|
const omg = c.args.slice(1).join(' ');
|
|
@@ -248,6 +274,10 @@ describe('scripts/ado-acceptance.mjs heal-drill', () => {
|
|
|
248
274
|
expect(heal(drill(false))).toEqual(['omg factory heal run abcdef12 --dry-run']);
|
|
249
275
|
expect(() => drill(true, 1)).toThrow(/heal-drill: 1 of/);
|
|
250
276
|
});
|
|
277
|
+
it('asks az for completed PRs of the run and fails when there is one (the factory never merges)', () => {
|
|
278
|
+
expect(() => drill(true, 0, JSON.stringify([{ pullRequestId: 12, status: 'completed' }]))).toThrow(/heal-drill: 1 of/);
|
|
279
|
+
expect(drill(true).filter((l) => l.startsWith('az repos pr list'))).toEqual([`az repos pr list --status completed --repository ${RUN} --project ${RUN} --org ${ORG} ${J.join(' ')}`]);
|
|
280
|
+
});
|
|
251
281
|
});
|
|
252
282
|
describe('scripts/ado-acceptance.mjs --dry-run', () => {
|
|
253
283
|
const source = freshDir('source');
|
|
@@ -258,7 +288,7 @@ describe('scripts/ado-acceptance.mjs --dry-run', () => {
|
|
|
258
288
|
expect(calls).toEqual([]);
|
|
259
289
|
return lines;
|
|
260
290
|
};
|
|
261
|
-
it.each(['preflight', 'create', 'exercise', 'heal-drill', 'capture', 'cleanup', 'all'])('--phase %s prints argv, spawns nothing and writes nothing', (phase) => {
|
|
291
|
+
it.each(['preflight', 'create', 'enqueue', 'exercise', 'heal-drill', 'capture', 'cleanup', 'all'])('--phase %s prints argv, spawns nothing and writes nothing', (phase) => {
|
|
262
292
|
const home = join(freshDir('dry'), 'acceptance');
|
|
263
293
|
const lines = dryLines(['--org', ORG, '--source', source, '--phase', phase, '--with-lanes'], home);
|
|
264
294
|
expect(lines.some((l) => l.startsWith('[dry-run] '))).toBe(true);
|
|
@@ -270,11 +300,12 @@ describe('scripts/ado-acceptance.mjs --dry-run', () => {
|
|
|
270
300
|
expect(lines).toContain(az(['devops', 'project', 'create', '--name', RUN, '--org', ORG, '--process', 'Agile', '--visibility', 'private', '--source-control', 'git', ...J]));
|
|
271
301
|
expect(lines).toContain(az(['pipelines', 'create', '--name', 'ci', '--repository', RUN, '--repository-type', 'tfsgit', '--branch', 'main', '--yml-path', 'azure-pipelines.yml', '--skip-first-run', 'true', '--project', RUN, '--org', ORG, ...J]));
|
|
272
302
|
expect(lines).toContain(az([
|
|
273
|
-
'boards', 'work-item', 'create', '--type', '
|
|
274
|
-
'--description', '<p>
|
|
275
|
-
'--
|
|
303
|
+
'boards', 'work-item', 'create', '--type', 'Feature', '--title', `${RUN} spec: the BACKLOG.md tickets`,
|
|
304
|
+
'--description', '<p>omg live acceptance spec: the <code>BACKLOG.md</code> tickets of the test repository, enqueued as its children with <code>omg factory enqueue</code>.</p>',
|
|
305
|
+
'--project', RUN, '--org', ORG, ...J,
|
|
276
306
|
]));
|
|
277
|
-
|
|
307
|
+
// The tickets are enqueue's job: create makes no other work item and no link.
|
|
308
|
+
expect(lines.filter((l) => l.includes('"work-item"'))).toHaveLength(1);
|
|
278
309
|
// The manifest is written before each create.
|
|
279
310
|
const firstWrite = lines.findIndex((l) => l.startsWith('[dry-run] write') && l.includes(`${RUN}.json`));
|
|
280
311
|
expect(firstWrite).toBeGreaterThanOrEqual(0);
|
|
@@ -293,11 +324,30 @@ describe('scripts/ado-acceptance.mjs --dry-run', () => {
|
|
|
293
324
|
it('spends no Copilot credits without --with-lanes: no factory run without --dry-run, no heal approve', () => {
|
|
294
325
|
const home = join(freshDir('dry'), 'acceptance');
|
|
295
326
|
const lines = [...dryLines(['--org', ORG, '--phase', 'exercise'], home), ...dryLines(['--org', ORG, '--phase', 'heal-drill'], home)];
|
|
296
|
-
const omg = lines.filter((l) => l.startsWith('[dry-run] omg: '));
|
|
297
|
-
expect(omg
|
|
298
|
-
expect(omg.
|
|
299
|
-
expect(omg.some((
|
|
300
|
-
|
|
327
|
+
const omg = lines.filter((l) => l.startsWith('[dry-run] omg: ')).map((l) => JSON.parse(l.slice('[dry-run] omg: '.length).replace(/ \(cwd .*$/, '')).slice(2));
|
|
328
|
+
expect(omg).toContainEqual(['factory', 'run', '--next', '--parent', '<specId>', '--dry-run', '--json']);
|
|
329
|
+
expect(omg.filter((a) => a[1] === 'run' && !a.includes('--dry-run'))).toEqual([]);
|
|
330
|
+
expect(omg.some((a) => a.includes('approve') || a.includes('poll'))).toBe(false);
|
|
331
|
+
});
|
|
332
|
+
it('prints the enqueue flow in order: the user-config write, enqueue --dry-run, the signature, enqueue, the re-run', () => {
|
|
333
|
+
const home = join(freshDir('dry'), 'acceptance');
|
|
334
|
+
const lines = dryLines(['--org', ORG, '--source', source, '--phase', 'enqueue'], home);
|
|
335
|
+
const tickets = join(home, `${acceptance.RUN_PREFIX}000000000000`, 'tickets.json');
|
|
336
|
+
const at = (pred) => lines.findIndex(pred);
|
|
337
|
+
const write = at((l) => l.startsWith(`user-scope write: ${USER_CONFIG}\n factory.forge.azureDevOps.trustedAuthors: [] -> ["<spec creator uniqueName>"]`));
|
|
338
|
+
const ask = at((l) => l.startsWith('[dry-run] would ask: Add <spec creator uniqueName> to factory.forge.azureDevOps.trustedAuthors'));
|
|
339
|
+
const setup = at((l) => l.includes('"--trusted-author","<spec creator uniqueName>","--scope","user","--yes","--json"'));
|
|
340
|
+
const dry = at((l) => l.includes(JSON.stringify(['factory', 'enqueue', '--spec', '<specId>', '--file', tickets, '--dry-run', '--json']).slice(1, -1)));
|
|
341
|
+
const sign = at((l) => l.startsWith('[dry-run] would ask: Signature (launch C3): enqueue these 3 tickets as children of spec #<specId>?'));
|
|
342
|
+
const real = at((l) => l.includes(JSON.stringify(['factory', 'enqueue', '--spec', '<specId>', '--file', tickets, '--json']).slice(1, -1)));
|
|
343
|
+
expect([write, ask, setup, dry, sign, real].every((i) => i >= 0)).toBe(true);
|
|
344
|
+
expect(write < ask && ask < setup && setup < dry && dry < sign && sign < real).toBe(true);
|
|
345
|
+
expect(lines.slice(real + 1).some((l) => l.includes('"--dry-run","--json"') && l.includes('"enqueue"'))).toBe(true);
|
|
346
|
+
expect(lines.some((l) => l.startsWith(`[dry-run] write ${tickets} (`))).toBe(true);
|
|
347
|
+
// Without --source there is no BACKLOG.md to read: the dry run says so and still prints every argv.
|
|
348
|
+
const bare = dryLines(['--org', ORG, '--phase', 'enqueue'], join(freshDir('dry'), 'acceptance'));
|
|
349
|
+
expect(bare.some((l) => l.includes('pass --source to preview the ticket file'))).toBe(true);
|
|
350
|
+
expect(bare.filter((l) => l.includes('"enqueue","--spec"'))).toHaveLength(3);
|
|
301
351
|
});
|
|
302
352
|
});
|
|
303
353
|
describe('scripts/ado-acceptance.mjs create', () => {
|
|
@@ -307,6 +357,7 @@ describe('scripts/ado-acceptance.mjs create', () => {
|
|
|
307
357
|
const home = join(freshDir('live'), 'acceptance');
|
|
308
358
|
const manifestFile = join(home, `${RUN}.json`);
|
|
309
359
|
let pendingAtCreate;
|
|
360
|
+
let pendingAtSpec;
|
|
310
361
|
let nextId = 100;
|
|
311
362
|
const o = acceptance.parseAcceptanceArgs(['--org', ORG, '--source', source, '--phase', 'create', '--home', home]);
|
|
312
363
|
const { ctx, calls } = context(o, (c) => {
|
|
@@ -327,14 +378,17 @@ describe('scripts/ado-acceptance.mjs create', () => {
|
|
|
327
378
|
}
|
|
328
379
|
if (cmd.startsWith('repos show'))
|
|
329
380
|
return { status: 0, stdout: JSON.stringify({ id: 'b7a1c1a4-0000-4000-8000-000000000001', remoteUrl: `https://contoso-acc@dev.azure.com/contoso-acc/${RUN}/_git/${RUN}` }) };
|
|
330
|
-
if (cmd
|
|
331
|
-
|
|
381
|
+
if (cmd === 'boards work-item create --type') {
|
|
382
|
+
pendingAtSpec = JSON.parse(readFileSync(manifestFile, 'utf8')).pending;
|
|
383
|
+
return { status: 0, stdout: JSON.stringify({ id: nextId++, fields: { 'System.CreatedBy': { displayName: 'Robin', uniqueName: 'robin@contoso.example' } } }) };
|
|
384
|
+
}
|
|
332
385
|
return { status: 0, stdout: JSON.stringify({ id: nextId++ }) };
|
|
333
386
|
});
|
|
334
387
|
acceptance.runPhases(ctx);
|
|
335
388
|
expect(pendingAtCreate).toBe('project');
|
|
389
|
+
expect(pendingAtSpec).toBe('spec');
|
|
336
390
|
const m = JSON.parse(readFileSync(manifestFile, 'utf8'));
|
|
337
|
-
expect(m).toMatchObject({ runId: RUN, project: { name: RUN, id: PROJECT_ID }, pipeline: { id: 100 },
|
|
391
|
+
expect(m).toMatchObject({ runId: RUN, project: { name: RUN, id: PROJECT_ID }, pipeline: { id: 100 }, spec: { id: 101, createdBy: 'robin@contoso.example' }, policy: { id: 102 }, tickets: {}, trustedAuthorsAdded: [], pending: null, createdDone: true });
|
|
338
392
|
const git = calls.filter((c) => c.cmd === 'git').map((c) => c.args.slice(2).join(' '));
|
|
339
393
|
expect(git).toContain('push origin refs/remotes/origin/fix/v1-review:refs/heads/fix/v1-review');
|
|
340
394
|
expect(git.every((g) => !/--force|\s-f\b|\+refs/.test(g))).toBe(true);
|
|
@@ -347,6 +401,252 @@ describe('scripts/ado-acceptance.mjs create', () => {
|
|
|
347
401
|
expect(omg?.args.slice(1)).toEqual(['factory', 'setup', '--forge', 'azure-devops', '--org', 'contoso-acc', '--project', RUN, '--repo', RUN, '--intake', `area-tag:${RUN}#factory`, '--progress', join(home, RUN, 'progress.json'), '--yes', '--json']);
|
|
348
402
|
});
|
|
349
403
|
});
|
|
404
|
+
describe('scripts/ado-acceptance.mjs enqueue', () => {
|
|
405
|
+
const ROWS = (action, ids) => ['exc-001', 'exc-006', 'exc-009'].map((key, i) => ({ key, id: ids[i], action, bucket: null, reasons: [], markCandidate: true }));
|
|
406
|
+
const setupRun = (over = {}) => {
|
|
407
|
+
const home = freshDir('home');
|
|
408
|
+
manifest(home, { tickets: {}, ...over });
|
|
409
|
+
mkdirSync(join(home, RUN, 'repo'), { recursive: true });
|
|
410
|
+
writeFileSync(join(home, RUN, 'repo', 'BACKLOG.md'), BACKLOG, 'utf8');
|
|
411
|
+
return home;
|
|
412
|
+
};
|
|
413
|
+
const run = (home, extra, enqueueAnswer, more = []) => {
|
|
414
|
+
const manifests = [];
|
|
415
|
+
let dryRuns = 0;
|
|
416
|
+
const o = acceptance.parseAcceptanceArgs(['--org', ORG, '--phase', 'enqueue', '--run', RUN, '--home', home, ...more]);
|
|
417
|
+
const t = context(o, (c) => {
|
|
418
|
+
const a = omgArgs(c);
|
|
419
|
+
manifests.push(JSON.parse(readFileSync(join(home, `${RUN}.json`), 'utf8')));
|
|
420
|
+
const custom = enqueueAnswer?.(a);
|
|
421
|
+
if (custom)
|
|
422
|
+
return custom;
|
|
423
|
+
if (a[1] === 'setup')
|
|
424
|
+
return { status: 0, stdout: '{}' };
|
|
425
|
+
if (a.includes('--dry-run')) {
|
|
426
|
+
dryRuns += 1;
|
|
427
|
+
return { status: 0, stdout: JSON.stringify({ ok: true, dryRun: true, items: dryRuns === 1 ? ROWS('created', [null, null, null]) : ROWS('unchanged', [41, 42, 43]) }) };
|
|
428
|
+
}
|
|
429
|
+
return { status: 0, stdout: JSON.stringify({ ok: true, dryRun: false, items: ROWS('created', [41, 42, 43]), mark: { marker: 'factory-ready', marked: [41, 42], alreadyMarked: [], failed: [] } }) };
|
|
430
|
+
}, extra);
|
|
431
|
+
return { ...t, manifests, run: () => acceptance.runPhases(t.ctx) };
|
|
432
|
+
};
|
|
433
|
+
const tickets = (home) => join(home, RUN, 'tickets.json');
|
|
434
|
+
it('prints and confirms the trustedAuthors write, records it first, then enqueues: --dry-run, the signature, enqueue, a re-run', () => {
|
|
435
|
+
const home = setupRun();
|
|
436
|
+
const r = run(home, { confirm: () => true, trustedAuthors: ['alice@contoso.example'] });
|
|
437
|
+
r.run();
|
|
438
|
+
const enqueue = ['factory', 'enqueue', '--spec', '40', '--file', tickets(home)];
|
|
439
|
+
expect(r.calls.map(omgArgs)).toEqual([
|
|
440
|
+
['factory', 'setup', '--forge', 'azure-devops', '--org', 'contoso-acc', '--project', RUN, '--repo', RUN, '--intake', `area-tag:${RUN}#factory`, '--progress', join(home, RUN, 'progress.json'),
|
|
441
|
+
'--trusted-author', 'alice@contoso.example,robin@contoso.example', '--scope', 'user', '--yes', '--json'],
|
|
442
|
+
[...enqueue, '--dry-run', '--json'],
|
|
443
|
+
[...enqueue, '--json'],
|
|
444
|
+
[...enqueue, '--dry-run', '--json'],
|
|
445
|
+
]);
|
|
446
|
+
expect(r.asked).toEqual([
|
|
447
|
+
`Add robin@contoso.example to factory.forge.azureDevOps.trustedAuthors in ${USER_CONFIG}?`,
|
|
448
|
+
'Signature (launch C3): enqueue these 3 tickets as children of spec #40?',
|
|
449
|
+
]);
|
|
450
|
+
const shown = r.lines.findIndex((l) => l === `user-scope write: ${USER_CONFIG}\n factory.forge.azureDevOps.trustedAuthors: ["alice@contoso.example"] -> ["alice@contoso.example","robin@contoso.example"]\n robin@contoso.example created spec #40; enqueue trusts only these uniqueNames. Cleanup lists what this run added; it never removes it.`);
|
|
451
|
+
expect(shown).toBeGreaterThanOrEqual(0);
|
|
452
|
+
expect(shown).toBeLessThan(r.lines.findIndex((l) => l.startsWith('asked: Add')));
|
|
453
|
+
// The manifest names the author as pending before the user config is written, and the pending enqueue before the real one.
|
|
454
|
+
expect(r.manifests[0]).toMatchObject({ trustPending: 'robin@contoso.example', trustedAuthorsAdded: [] });
|
|
455
|
+
expect(r.manifests[1]).toMatchObject({ trustPending: null, trustedAuthorsAdded: ['robin@contoso.example'] });
|
|
456
|
+
expect(r.manifests[2]).toMatchObject({ pending: 'enqueue' });
|
|
457
|
+
// enqueue records into its own directory, never into the recording exercise reads.
|
|
458
|
+
expect(r.calls.map((c) => c.env?.OMG_ADO_RECORD_DIR)).toEqual(Array(4).fill(join(home, RUN, 'recorded-enqueue')));
|
|
459
|
+
expect(JSON.parse(readFileSync(tickets(home), 'utf8'))).toEqual(backlogToTicketFile(BACKLOG, 40).file);
|
|
460
|
+
expect(JSON.parse(readFileSync(join(home, `${RUN}.json`), 'utf8'))).toMatchObject({
|
|
461
|
+
pending: null, trustedAuthorsAdded: ['robin@contoso.example'],
|
|
462
|
+
tickets: { 'exc-001': { id: 41, blockedBy: [] }, 'exc-006': { id: 42, blockedBy: [] }, 'exc-009': { id: 43, blockedBy: ['exc-001'] } },
|
|
463
|
+
});
|
|
464
|
+
expect(r.lines.filter((l) => l.startsWith('PASS'))).toHaveLength(4);
|
|
465
|
+
});
|
|
466
|
+
it('writes nothing to the user config and enqueues nothing when the trust is declined', () => {
|
|
467
|
+
const home = setupRun();
|
|
468
|
+
const r = run(home, { confirm: () => false });
|
|
469
|
+
expect(r.run).toThrow(/not confirmed: .* is unchanged/);
|
|
470
|
+
expect(r.calls).toEqual([]);
|
|
471
|
+
expect(JSON.parse(readFileSync(join(home, `${RUN}.json`), 'utf8')).trustedAuthorsAdded).toEqual([]);
|
|
472
|
+
});
|
|
473
|
+
it('skips the user-config write when the creator is already trusted (uniqueNames fold case)', () => {
|
|
474
|
+
const home = setupRun();
|
|
475
|
+
const r = run(home, { confirm: () => true, trustedAuthors: ['ROBIN@contoso.example'] });
|
|
476
|
+
r.run();
|
|
477
|
+
expect(r.calls.map((c) => omgArgs(c)[1])).toEqual(['enqueue', 'enqueue', 'enqueue']);
|
|
478
|
+
expect(r.asked).toEqual(['Signature (launch C3): enqueue these 3 tickets as children of spec #40?']);
|
|
479
|
+
expect(JSON.parse(readFileSync(join(home, `${RUN}.json`), 'utf8')).trustedAuthorsAdded).toEqual([]);
|
|
480
|
+
});
|
|
481
|
+
it('runs only the dry run when the signature is declined', () => {
|
|
482
|
+
const home = setupRun();
|
|
483
|
+
const r = run(home, { confirm: (q) => q.startsWith('Add ') });
|
|
484
|
+
expect(r.run).toThrow(/enqueue not signed: nothing written/);
|
|
485
|
+
expect(r.calls.map(omgArgs).map((a) => `${a[1]}${a.includes('--dry-run') ? ' --dry-run' : ''}`)).toEqual(['setup', 'enqueue --dry-run']);
|
|
486
|
+
});
|
|
487
|
+
it('stops on an enqueue refusal with enqueue\'s own error', () => {
|
|
488
|
+
const home = setupRun();
|
|
489
|
+
const r = run(home, { confirm: () => true, trustedAuthors: ['robin@contoso.example'] }, (a) => (a[1] === 'enqueue' ? { status: 2, stdout: JSON.stringify({ ok: false, error: 'ticket file: duplicate key exc-001' }) } : undefined));
|
|
490
|
+
expect(r.run).toThrow(/omg factory enqueue --dry-run exited 2: ticket file: duplicate key exc-001/);
|
|
491
|
+
expect(r.asked).toEqual([]);
|
|
492
|
+
});
|
|
493
|
+
it('keeps a failed real enqueue\'s warnings, records the ids it made, and says a rerun is idempotent', () => {
|
|
494
|
+
const home = setupRun();
|
|
495
|
+
const failed = { ok: false, dryRun: false, items: [{ key: 'exc-001', id: 41, action: 'created' }, { key: 'exc-006', id: null, action: 'created' }], warnings: ['exc-006: az exited 1: TF401019'] };
|
|
496
|
+
const r = run(home, { confirm: () => true, trustedAuthors: ['robin@contoso.example'] }, (a) => (a[1] === 'enqueue' && !a.includes('--dry-run') ? { status: 1, stdout: JSON.stringify(failed) } : undefined));
|
|
497
|
+
expect(r.run).toThrow(/omg factory enqueue exited 1: exc-006: az exited 1: TF401019; the manifest records ids #41; rerunning --phase enqueue is idempotent/);
|
|
498
|
+
expect(JSON.parse(readFileSync(join(home, `${RUN}.json`), 'utf8'))).toMatchObject({ pending: 'enqueue', enqueuedBeforeFailure: { 'exc-001': 41 } });
|
|
499
|
+
});
|
|
500
|
+
it('keeps the author pending when setup fails, and cleanup says it may have been added', () => {
|
|
501
|
+
const home = setupRun();
|
|
502
|
+
const r = run(home, { confirm: () => true }, (a) => (a[1] === 'setup' ? { status: 1, stdout: '' } : undefined));
|
|
503
|
+
expect(r.run).toThrow(/exit 1 from omg/);
|
|
504
|
+
const m = JSON.parse(readFileSync(join(home, `${RUN}.json`), 'utf8'));
|
|
505
|
+
expect(m).toMatchObject({ trustPending: 'robin@contoso.example', trustedAuthorsAdded: [] });
|
|
506
|
+
const o = acceptance.parseAcceptanceArgs(['--org', ORG, '--phase', 'cleanup', '--run', RUN, '--home', home]);
|
|
507
|
+
const { ctx, lines } = context(o, (c) => (azArgs(c)[2] === 'show' ? { status: 0, stdout: JSON.stringify({ id: PROJECT_ID, name: RUN }) } : { status: 0, stdout: '' }));
|
|
508
|
+
acceptance.runPhases(ctx);
|
|
509
|
+
expect(lines).toContain('no trustedAuthors were added by this run.');
|
|
510
|
+
expect(lines).toContain(`robin@contoso.example may have been added to factory.forge.azureDevOps.trustedAuthors in ${USER_CONFIG}: the setup that adds it did not finish; check there yourself.`);
|
|
511
|
+
});
|
|
512
|
+
it('--yes gives both confirmations without asking and logs each one', () => {
|
|
513
|
+
const home = setupRun();
|
|
514
|
+
const r = run(home, {}, undefined, ['--yes']);
|
|
515
|
+
r.run();
|
|
516
|
+
expect(r.asked).toEqual([]);
|
|
517
|
+
expect(r.lines).toContain(`Add robin@contoso.example to factory.forge.azureDevOps.trustedAuthors in ${USER_CONFIG}? yes (--yes)`);
|
|
518
|
+
expect(r.lines).toContain('Signature (launch C3): enqueue these 3 tickets as children of spec #40? yes (--yes)');
|
|
519
|
+
expect(r.calls.map((c) => omgArgs(c)[1])).toEqual(['setup', 'enqueue', 'enqueue', 'enqueue']);
|
|
520
|
+
});
|
|
521
|
+
it('refuses a run made before the enqueue flow (no spec work item)', () => {
|
|
522
|
+
const home = setupRun({ spec: undefined });
|
|
523
|
+
expect(run(home, { confirm: () => true }).run).toThrow(/has no spec work item/);
|
|
524
|
+
});
|
|
525
|
+
it('cleanup lists the trustedAuthors this run added and the user config they are in', () => {
|
|
526
|
+
const home = freshDir('home');
|
|
527
|
+
manifest(home, { trustedAuthorsAdded: ['robin@contoso.example'] });
|
|
528
|
+
const o = acceptance.parseAcceptanceArgs(['--org', ORG, '--phase', 'cleanup', '--run', RUN, '--home', home]);
|
|
529
|
+
const { ctx, lines } = context(o, (c) => (azArgs(c)[2] === 'show' ? { status: 0, stdout: JSON.stringify({ id: PROJECT_ID, name: RUN }) } : { status: 0, stdout: '' }));
|
|
530
|
+
acceptance.runPhases(ctx);
|
|
531
|
+
expect(lines).toContain(`this run added robin@contoso.example to factory.forge.azureDevOps.trustedAuthors in ${USER_CONFIG}; cleanup never edits the user config, so remove them there yourself if they should not stay trusted.`);
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
describe('scripts/ado-acceptance.mjs exercise', () => {
|
|
535
|
+
const ITEMS_BEFORE = [{ id: 41, bucket: 'runnable', reasons: [] }, { id: 43, bucket: 'blocked', reasons: ['depends-on:#41'] }];
|
|
536
|
+
const ITEMS_AFTER = [{ id: 41, bucket: 'blocked', reasons: ['run-active:merge'] }, { id: 43, bucket: 'blocked', reasons: ['depends-on:#41'] }];
|
|
537
|
+
const RECORDED = [
|
|
538
|
+
{ route: 'git.pullRequests.POST', exitCode: 0, requestBody: { isDraft: true, workItemRefs: [{ id: '41' }] }, stdout: {} },
|
|
539
|
+
{ route: 'policy.evaluations.GET', exitCode: 0, stdout: { value: [] } },
|
|
540
|
+
{ route: 'git.pullRequests.GET', exitCode: 0, stdout: { status: 'active' } },
|
|
541
|
+
{ route: 'wit.workItems.PATCH', exitCode: 0, routeParameters: { id: '41' }, requestBody: [{ op: 'add', path: '/fields/System.State', value: 'Resolved' }], stdout: {} },
|
|
542
|
+
{ route: 'wit.comments.POST', exitCode: 0, routeParameters: { workItemId: '41' }, requestBody: { text: 'Factory run for #41 is awaiting a human: **merge** (phase merge).' }, stdout: {} },
|
|
543
|
+
{ route: 'wit.comments.POST', exitCode: 0, routeParameters: { workItemId: '40' }, requestBody: { text: '- #41 ready to merge: https://dev.azure.com/contoso-acc/x/_git/x/pullrequest/5\n\n<!-- omg-factory-rollup: #41 ready-to-merge 0123456789ab -->\n' }, stdout: {} },
|
|
544
|
+
];
|
|
545
|
+
/** What enqueue records: relation and mark PATCHes, here on the other tickets. */
|
|
546
|
+
const ENQUEUE_PATCHES = [
|
|
547
|
+
{ route: 'wit.workItems.PATCH', exitCode: 0, routeParameters: { id: '42' }, requestBody: [{ op: 'add', path: '/relations/-', value: { rel: 'System.LinkTypes.Hierarchy-Reverse', url: 'x/40' } }], stdout: {} },
|
|
548
|
+
{ route: 'wit.workItems.PATCH', exitCode: 0, routeParameters: { id: '43' }, requestBody: [{ op: 'add', path: '/fields/System.Tags', value: 'factory-ready' }], stdout: {} },
|
|
549
|
+
];
|
|
550
|
+
const exercise = (withLanes, recorded = RECORDED, completed = '[]') => {
|
|
551
|
+
const home = freshDir('home');
|
|
552
|
+
manifest(home);
|
|
553
|
+
mkdirSync(join(home, RUN, 'recorded'), { recursive: true });
|
|
554
|
+
recorded.forEach((f, i) => writeFileSync(join(home, RUN, 'recorded', `${i}.json`), JSON.stringify(f), 'utf8'));
|
|
555
|
+
let parentChecks = 0;
|
|
556
|
+
const o = acceptance.parseAcceptanceArgs(['--org', ORG, '--phase', 'exercise', '--run', RUN, '--home', home, ...(withLanes ? ['--with-lanes'] : [])]);
|
|
557
|
+
const t = context(o, (c) => {
|
|
558
|
+
if (c.cmd === ENTRY.command)
|
|
559
|
+
return { status: 0, stdout: completed };
|
|
560
|
+
const a = omgArgs(c).join(' ');
|
|
561
|
+
if (a === 'factory check --parent 40 --json')
|
|
562
|
+
return { status: 0, stdout: JSON.stringify({ items: parentChecks++ === 0 ? ITEMS_BEFORE : ITEMS_AFTER }) };
|
|
563
|
+
if (a === 'factory run --next --parent 40 --dry-run --json')
|
|
564
|
+
return { status: 0, stdout: JSON.stringify({ ok: true, next: 41, message: 'dry run' }) };
|
|
565
|
+
if (a === 'factory run --next --parent 40 --json')
|
|
566
|
+
return { status: 0, stdout: JSON.stringify({ ok: true, next: 41, message: 'awaiting-human: merge: ready. Resume with omg factory run 41.' }) };
|
|
567
|
+
return { status: 0, stdout: '{}' };
|
|
568
|
+
});
|
|
569
|
+
return { ...t, run: () => acceptance.runPhases(t.ctx) };
|
|
570
|
+
};
|
|
571
|
+
it('checks the spec, picks with run --next --parent, and asserts ordering, write-back and no completed PR', () => {
|
|
572
|
+
const r = exercise(true);
|
|
573
|
+
r.run();
|
|
574
|
+
expect(r.calls.filter((c) => c.cmd !== ENTRY.command).map((c) => omgArgs(c).join(' '))).toEqual([
|
|
575
|
+
'factory check --json',
|
|
576
|
+
'factory check --parent 40 --json',
|
|
577
|
+
'factory board --json',
|
|
578
|
+
'factory run --next --parent 40 --dry-run --json',
|
|
579
|
+
'factory run --next --parent 40 --json',
|
|
580
|
+
'factory poll --once --json',
|
|
581
|
+
'factory check --parent 40 --json',
|
|
582
|
+
]);
|
|
583
|
+
expect(r.calls.filter((c) => c.cmd === ENTRY.command).map(azArgs)).toEqual([['repos', 'pr', 'list', '--status', 'completed', '--repository', RUN, '--project', RUN, '--org', ORG, ...J]]);
|
|
584
|
+
expect(r.lines.filter((l) => l.startsWith('FAIL'))).toEqual([]);
|
|
585
|
+
expect(r.lines).toEqual(expect.arrayContaining([
|
|
586
|
+
'PASS the 1 ticket(s) with a predecessor are blocked by it (depends-on)',
|
|
587
|
+
'PASS run --next picked #41, a runnable ticket without an open predecessor',
|
|
588
|
+
'PASS the spec #40 got the rollup line "- #41 ready to merge"',
|
|
589
|
+
'PASS #41 is no longer runnable while its PR waits for the human merge',
|
|
590
|
+
'PASS no PR of the run reached completed (the factory never merges)',
|
|
591
|
+
]));
|
|
592
|
+
});
|
|
593
|
+
it('runs no real factory run without --with-lanes, and still asserts the ordering', () => {
|
|
594
|
+
const r = exercise(false);
|
|
595
|
+
r.run();
|
|
596
|
+
const omg = r.calls.filter((c) => c.cmd !== ENTRY.command).map((c) => omgArgs(c).join(' '));
|
|
597
|
+
expect(omg.filter((a) => a.startsWith('factory run'))).toEqual(['factory run --next --parent 40 --dry-run --json']);
|
|
598
|
+
expect(r.lines).toContain('PASS run --next picked #41, a runnable ticket without an open predecessor');
|
|
599
|
+
});
|
|
600
|
+
it('fails when a PR of the run is completed or the rollup line is missing', () => {
|
|
601
|
+
expect(exercise(true, RECORDED, JSON.stringify([{ pullRequestId: 5 }])).run).toThrow(/exercise: 1 of/);
|
|
602
|
+
expect(exercise(true, RECORDED.slice(0, -1)).run).toThrow(/exercise: 1 of/);
|
|
603
|
+
});
|
|
604
|
+
it('fails the progress check when the recording holds only enqueue-style PATCHes on other ids, or no State op on the item', () => {
|
|
605
|
+
const noProgress = [...RECORDED.filter((f) => f.route !== 'wit.workItems.PATCH'), ...ENQUEUE_PATCHES];
|
|
606
|
+
const r = exercise(true, noProgress);
|
|
607
|
+
expect(r.run).toThrow(/exercise: 1 of/);
|
|
608
|
+
expect(r.lines).toContain('FAIL progress moved #41 (a System.State PATCH)');
|
|
609
|
+
const tagOnly = [...noProgress, { route: 'wit.workItems.PATCH', exitCode: 0, routeParameters: { id: '41' }, requestBody: [{ op: 'add', path: '/fields/System.Tags', value: 'x' }], stdout: {} }];
|
|
610
|
+
expect(exercise(true, tagOnly).run).toThrow(/exercise: 1 of/);
|
|
611
|
+
const moved = exercise(true, [...RECORDED, ...ENQUEUE_PATCHES]);
|
|
612
|
+
moved.run();
|
|
613
|
+
expect(moved.lines).toContain('PASS progress moved #41 (a System.State PATCH)');
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
describe('scripts/ado-acceptance.mjs flow assertions', () => {
|
|
617
|
+
const TICKETS = { 'exc-001': { id: 41, blockedBy: [] }, 'exc-007': { id: 42, blockedBy: [] }, 'exc-009': { id: 43, blockedBy: ['exc-007', 'exc-001'] } };
|
|
618
|
+
const what = (results) => results.filter((r) => !r.ok).map((r) => r.what);
|
|
619
|
+
it('orderingAssertions: a ticket must be blocked by each of its predecessors, and --next must pick a runnable one', () => {
|
|
620
|
+
const rows = [{ id: 41, bucket: 'runnable', reasons: [] }, { id: 42, bucket: 'runnable', reasons: [] }, { id: 43, bucket: 'blocked', reasons: ['depends-on:#42,#41'] }];
|
|
621
|
+
expect(what(acceptance.orderingAssertions({ items: rows }, TICKETS, 41))).toEqual([]);
|
|
622
|
+
expect(what(acceptance.orderingAssertions({ items: rows }, TICKETS, 43))).toEqual(['run --next picked #43, a runnable ticket without an open predecessor']);
|
|
623
|
+
expect(what(acceptance.orderingAssertions({ items: [rows[0], rows[1], { id: 43, bucket: 'blocked', reasons: ['depends-on:#42'] }] }, TICKETS))).toEqual(['the 1 ticket(s) with a predecessor are blocked by it (depends-on)']);
|
|
624
|
+
expect(what(acceptance.orderingAssertions({ items: [rows[0], rows[1], { id: 43, bucket: 'runnable', reasons: [] }] }, TICKETS))).toEqual(['the 1 ticket(s) with a predecessor are blocked by it (depends-on)']);
|
|
625
|
+
expect(what(acceptance.orderingAssertions({ items: rows.slice(1) }, TICKETS))).toEqual(['check --parent lists all 3 tickets']);
|
|
626
|
+
expect(what(acceptance.orderingAssertions({ items: rows }, TICKETS, null))).toEqual(['run --next picked #null, a runnable ticket without an open predecessor']);
|
|
627
|
+
});
|
|
628
|
+
it('enqueueAssertions: planned, ids, marked, and an unchanged re-run', () => {
|
|
629
|
+
const file = { tickets: [{ key: 'exc-001' }, { key: 'exc-009' }] };
|
|
630
|
+
const dry = { ok: true, dryRun: true, items: [{ key: 'exc-001', id: null, action: 'created' }, { key: 'exc-009', id: null, action: 'created' }] };
|
|
631
|
+
const real = { ok: true, dryRun: false, items: [{ key: 'exc-001', id: 41, action: 'created' }, { key: 'exc-009', id: 43, action: 'created' }], mark: { marked: [41], alreadyMarked: [], failed: [] } };
|
|
632
|
+
const again = { ok: true, dryRun: true, items: [{ key: 'exc-001', id: 41, action: 'unchanged' }, { key: 'exc-009', id: 43, action: 'unchanged' }] };
|
|
633
|
+
expect(what(acceptance.enqueueAssertions(file, dry, real, again))).toEqual([]);
|
|
634
|
+
const changed = { ...again, items: [again.items[0], { ...again.items[1], action: 'updated' }] };
|
|
635
|
+
expect(what(acceptance.enqueueAssertions(file, dry, { ...real, mark: { marked: [], alreadyMarked: [], failed: [{ id: 41, error: 'x' }] } }, changed))).toEqual([
|
|
636
|
+
'the mark step marked the runnable tickets', 'an enqueue re-run (--dry-run) finds every ticket unchanged',
|
|
637
|
+
]);
|
|
638
|
+
});
|
|
639
|
+
it('outcomeAssertions: the merge gate comment, the rollup line on the spec, and no spec edit', () => {
|
|
640
|
+
const posts = [
|
|
641
|
+
{ route: 'wit.comments.POST', exitCode: 0, routeParameters: { workItemId: '41' }, requestBody: { text: 'Factory run for #41 is awaiting a human: **merge** (phase merge).' } },
|
|
642
|
+
{ route: 'wit.comments.POST', exitCode: 0, routeParameters: { workItemId: '40' }, requestBody: { text: '- #41 ready to merge: https://x/pr/5' } },
|
|
643
|
+
];
|
|
644
|
+
expect(what(acceptance.outcomeAssertions(posts, '40', 41))).toEqual([]);
|
|
645
|
+
expect(what(acceptance.outcomeAssertions([{ ...posts[0], exitCode: 1 }, posts[1], { route: 'wit.workItems.PATCH', exitCode: 0, routeParameters: { id: '40' } }], '40', 41))).toEqual([
|
|
646
|
+
'#41 got the merge gate comment', 'the spec #40 itself is never edited',
|
|
647
|
+
]);
|
|
648
|
+
});
|
|
649
|
+
});
|
|
350
650
|
describe('scripts/ado-acceptance.mjs options and assertions', () => {
|
|
351
651
|
it('defaults to the self-hosted pool Default and selects Microsoft-hosted with --hosted', () => {
|
|
352
652
|
const base = ['--org', ORG, '--source', 'C:/src'];
|
|
@@ -365,13 +665,43 @@ describe('scripts/ado-acceptance.mjs options and assertions', () => {
|
|
|
365
665
|
{ route: 'policy.evaluations.GET', exitCode: 0, stdout: { value: [] } },
|
|
366
666
|
{ route: 'git.pullRequests.GET', exitCode: 0, stdout: { status: 'active' } },
|
|
367
667
|
{ route: 'git.pullRequests.PATCH', exitCode: 0, requestBody: { isDraft: false }, stdout: {} },
|
|
368
|
-
{ route: 'wit.workItems.PATCH', exitCode: 0, stdout: {} },
|
|
668
|
+
{ route: 'wit.workItems.PATCH', exitCode: 0, routeParameters: { id: '102' }, requestBody: [{ op: 'add', path: '/fields/System.State', value: 'Active' }], stdout: {} },
|
|
369
669
|
];
|
|
370
670
|
expect(acceptance.exerciseAssertions(recorded, 'issue 102: awaiting-human: merge', '102').every((r) => r.ok)).toBe(true);
|
|
371
671
|
const merged = [...recorded, { route: 'git.pullRequests.GET', exitCode: 0, stdout: { value: [{ status: 'completed' }] } }];
|
|
372
672
|
expect(acceptance.exerciseAssertions(merged, 'awaiting-human: merge', '102').find((r) => r.what.includes('never completed')).ok).toBe(false);
|
|
373
673
|
});
|
|
374
674
|
});
|
|
675
|
+
describe('scripts/ado-acceptance.mjs confirmOnTty', () => {
|
|
676
|
+
const ask = (isTerminal, chunks) => {
|
|
677
|
+
const out = [];
|
|
678
|
+
const read = (buf) => {
|
|
679
|
+
const next = chunks.shift();
|
|
680
|
+
if (next === undefined)
|
|
681
|
+
return 0;
|
|
682
|
+
if (next instanceof Error)
|
|
683
|
+
throw next;
|
|
684
|
+
return buf.write(next);
|
|
685
|
+
};
|
|
686
|
+
return { answer: acceptance.confirmOnTty('Proceed?', { isTerminal: () => isTerminal, read, out: (s) => out.push(s) }), out: out.join('') };
|
|
687
|
+
};
|
|
688
|
+
it('says no without a terminal, never reading', () => {
|
|
689
|
+
const r = ask(false, [new Error('read without a terminal')]);
|
|
690
|
+
expect(r.answer).toBe(false);
|
|
691
|
+
expect(r.out).toContain('no: stdin is not a terminal (pass --yes to confirm)');
|
|
692
|
+
});
|
|
693
|
+
it('reads y as yes and an empty line as no, across chunks and CRLF', () => {
|
|
694
|
+
expect(ask(true, ['y\r\n']).answer).toBe(true);
|
|
695
|
+
expect(ask(true, ['Y', 'es\r\n']).answer).toBe(true);
|
|
696
|
+
expect(ask(true, ['\r\n']).answer).toBe(false);
|
|
697
|
+
expect(ask(true, ['n\n']).answer).toBe(false);
|
|
698
|
+
});
|
|
699
|
+
it('says no with the reason on a read error (EAGAIN)', () => {
|
|
700
|
+
const r = ask(true, [Object.assign(new Error('resource temporarily unavailable'), { code: 'EAGAIN' })]);
|
|
701
|
+
expect(r.answer).toBe(false);
|
|
702
|
+
expect(r.out).toContain('no: could not read the answer (EAGAIN); pass --yes to confirm');
|
|
703
|
+
});
|
|
704
|
+
});
|
|
375
705
|
describe('scripts/ado-capture.mjs', () => {
|
|
376
706
|
it('runs GETs only', () => {
|
|
377
707
|
expect(() => assertReadOnly(['devops', 'invoke', '--area', 'git', '--http-method', 'GET'])).not.toThrow();
|