flow-run-store-integration.test.mjs
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠ breaking
10 days ago
| 1 | /** |
| 2 | * Tier 2 — INTEGRATION: flow_run read parity CLI = MCP = Hub handler (P-FLOW). |
| 3 | */ |
| 4 | import { describe, it, beforeEach, afterEach } from 'node:test'; |
| 5 | import assert from 'node:assert/strict'; |
| 6 | import fs from 'node:fs'; |
| 7 | import path from 'node:path'; |
| 8 | import { fileURLToPath } from 'node:url'; |
| 9 | |
| 10 | import { |
| 11 | handleFlowRunGetRequest, |
| 12 | handleFlowRunListRequest, |
| 13 | handleFlowRunMcpRequest, |
| 14 | } from '../lib/flow/flow-execution.mjs'; |
| 15 | import { OVERSEER_FIXTURE_RUN_REF } from '../lib/flow/flow-store.mjs'; |
| 16 | |
| 17 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 18 | const tmpRoot = path.join(__dirname, 'fixtures', 'tmp-flow-run-store-integration'); |
| 19 | |
| 20 | describe('Flow run store — triple-surface parity', () => { |
| 21 | beforeEach(() => { |
| 22 | fs.rmSync(tmpRoot, { recursive: true, force: true }); |
| 23 | fs.mkdirSync(tmpRoot, { recursive: true }); |
| 24 | }); |
| 25 | |
| 26 | afterEach(() => { |
| 27 | fs.rmSync(tmpRoot, { recursive: true, force: true }); |
| 28 | }); |
| 29 | |
| 30 | it('Hub handler and MCP get by run_ref produce deep-equal payloads', () => { |
| 31 | const hubDir = path.join(tmpRoot, 'hub'); |
| 32 | const mcpDir = path.join(tmpRoot, 'mcp'); |
| 33 | fs.mkdirSync(hubDir); |
| 34 | fs.mkdirSync(mcpDir); |
| 35 | const scopes = ['personal', 'project', 'org']; |
| 36 | |
| 37 | const hub = handleFlowRunGetRequest({ |
| 38 | dataDir: hubDir, |
| 39 | vaultId: 'default', |
| 40 | cliScopes: scopes, |
| 41 | runId: OVERSEER_FIXTURE_RUN_REF, |
| 42 | }); |
| 43 | const mcp = handleFlowRunMcpRequest({ |
| 44 | dataDir: mcpDir, |
| 45 | vaultId: 'default', |
| 46 | cliScopes: scopes, |
| 47 | action: 'get', |
| 48 | run_id: OVERSEER_FIXTURE_RUN_REF, |
| 49 | }); |
| 50 | |
| 51 | assert.equal(hub.ok, true); |
| 52 | assert.equal(mcp.ok, true); |
| 53 | assert.deepEqual(hub.payload, mcp.payload); |
| 54 | assert.equal(hub.payload.run.run_ref, OVERSEER_FIXTURE_RUN_REF); |
| 55 | }); |
| 56 | |
| 57 | it('list by flow_id matches filtered store rows', () => { |
| 58 | const dataDir = path.join(tmpRoot, 'list'); |
| 59 | fs.mkdirSync(dataDir); |
| 60 | const scopes = ['personal', 'project', 'org']; |
| 61 | const list = handleFlowRunListRequest({ |
| 62 | dataDir, |
| 63 | vaultId: 'default', |
| 64 | cliScopes: scopes, |
| 65 | flowId: 'flow_overseer_handover', |
| 66 | }); |
| 67 | assert.equal(list.ok, true); |
| 68 | assert.ok(list.payload.runs.every((r) => r.flow_id === 'flow_overseer_handover')); |
| 69 | }); |
| 70 | }); |
File History
1 commit
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠
10 days ago