|
| 1 | +/** |
| 2 | + * Signal safe-output scenarios: noop, missing-tool, missing-data, |
| 3 | + * report-incomplete. |
| 4 | + * |
| 5 | + * These tools have no ADO write path — they emit a signal record to |
| 6 | + * `safe_outputs.ndjson` and the executor writes back the result without |
| 7 | + * touching any ADO API. Accordingly: |
| 8 | + * - `setup()` is trivial (no REST calls, returns an empty state). |
| 9 | + * - `assert()` is a no-op for the succeeded tools; `report-incomplete` |
| 10 | + * uses `expectedFailure` so `assert()` is never reached. |
| 11 | + * - `cleanup()` is a no-op. |
| 12 | + * |
| 13 | + * Adding these scenarios closes the executor-e2e coverage gap left by |
| 14 | + * removing the dedicated per-tool agentic smoke pipelines. |
| 15 | + * |
| 16 | + * Test-harness module; not shipped in `ado-script.zip`. |
| 17 | + */ |
| 18 | +import type { Scenario } from "../scenario.js"; |
| 19 | + |
| 20 | +export const noop: Scenario<unknown> = { |
| 21 | + tool: "noop", |
| 22 | + config: () => ({}), |
| 23 | + setup: async () => ({}), |
| 24 | + ndjson: async (ctx) => ({ |
| 25 | + context: `deterministic executor e2e noop for build ${ctx.buildId}`, |
| 26 | + }), |
| 27 | + assert: async () => { |
| 28 | + /* no ADO side effect to verify */ |
| 29 | + }, |
| 30 | + cleanup: async () => { |
| 31 | + /* nothing to tear down */ |
| 32 | + }, |
| 33 | +}; |
| 34 | + |
| 35 | +export const missingTool: Scenario<unknown> = { |
| 36 | + id: "missing-tool", |
| 37 | + tool: "missing-tool", |
| 38 | + config: () => ({}), |
| 39 | + setup: async () => ({}), |
| 40 | + ndjson: async (ctx) => ({ |
| 41 | + tool_name: `ado-aw-det-${ctx.buildId}-bash`, |
| 42 | + context: `deterministic executor e2e missing-tool for build ${ctx.buildId}`, |
| 43 | + }), |
| 44 | + assert: async () => { |
| 45 | + /* no ADO side effect to verify */ |
| 46 | + }, |
| 47 | + cleanup: async () => { |
| 48 | + /* nothing to tear down */ |
| 49 | + }, |
| 50 | +}; |
| 51 | + |
| 52 | +export const missingData: Scenario<unknown> = { |
| 53 | + id: "missing-data", |
| 54 | + tool: "missing-data", |
| 55 | + config: () => ({}), |
| 56 | + setup: async () => ({}), |
| 57 | + ndjson: async (ctx) => ({ |
| 58 | + data_type: "deterministic-e2e-data-type", |
| 59 | + reason: `deterministic executor e2e missing-data for build ${ctx.buildId}`, |
| 60 | + }), |
| 61 | + assert: async () => { |
| 62 | + /* no ADO side effect to verify */ |
| 63 | + }, |
| 64 | + cleanup: async () => { |
| 65 | + /* nothing to tear down */ |
| 66 | + }, |
| 67 | +}; |
| 68 | + |
| 69 | +export const reportIncomplete: Scenario<unknown> = { |
| 70 | + id: "report-incomplete", |
| 71 | + tool: "report-incomplete", |
| 72 | + config: () => ({}), |
| 73 | + setup: async () => ({}), |
| 74 | + ndjson: async (ctx) => ({ |
| 75 | + // reason must be >= 10 characters (validated by ReportIncompleteParams). |
| 76 | + reason: `deterministic executor e2e report-incomplete for build ${ctx.buildId}`, |
| 77 | + context: `build ${ctx.buildId}`, |
| 78 | + }), |
| 79 | + // report-incomplete always returns ExecutionResult::failure(), so the |
| 80 | + // executor writes status="failed". Declare that as the expected outcome so |
| 81 | + // the runner treats it as a pass rather than a suite failure. |
| 82 | + expectedFailure: { |
| 83 | + status: "failed", |
| 84 | + error: /Agent reported task incomplete/, |
| 85 | + }, |
| 86 | + assert: async () => { |
| 87 | + throw new Error("report-incomplete expected failure should have been caught before assert"); |
| 88 | + }, |
| 89 | + cleanup: async () => { |
| 90 | + /* nothing to tear down */ |
| 91 | + }, |
| 92 | +}; |
| 93 | + |
| 94 | +export const signalScenarios: Scenario<unknown>[] = [ |
| 95 | + noop, |
| 96 | + missingTool, |
| 97 | + missingData, |
| 98 | + reportIncomplete, |
| 99 | +]; |
0 commit comments