flow-run-store-e2e.test.mjs
sha256:baa800aedf841dbf32081aa7b2befa288ac33dfc7175ac55014c55c4d8c742f9
docs: move durable-auth freeze/evidence to local developmen…
Human
10 days ago
| 1 | /** |
| 2 | * Tier 3 — E2E: empty vault → seed → get by run_ref + run_id (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 { getFlowRun, listFlowRuns, OVERSEER_FIXTURE_RUN_REF } from '../lib/flow/flow-store.mjs'; |
| 11 | |
| 12 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 13 | const tmpRoot = path.join(__dirname, 'fixtures', 'tmp-flow-run-store-e2e'); |
| 14 | |
| 15 | describe('Flow run store — e2e', () => { |
| 16 | beforeEach(() => { |
| 17 | fs.rmSync(tmpRoot, { recursive: true, force: true }); |
| 18 | fs.mkdirSync(tmpRoot, { recursive: true }); |
| 19 | }); |
| 20 | |
| 21 | afterEach(() => { |
| 22 | fs.rmSync(tmpRoot, { recursive: true, force: true }); |
| 23 | }); |
| 24 | |
| 25 | it('empty vault → first read seeds overseer run → get by run_ref and run_id', () => { |
| 26 | const dataDir = path.join(tmpRoot, 'walk'); |
| 27 | fs.mkdirSync(dataDir); |
| 28 | const projectScopes = new Set(['project', 'org']); |
| 29 | |
| 30 | const list = listFlowRuns(dataDir, 'default', { |
| 31 | visibleScopes: projectScopes, |
| 32 | filterScopes: projectScopes, |
| 33 | effectiveScope: 'project', |
| 34 | }); |
| 35 | assert.ok(list.runs.length >= 1); |
| 36 | |
| 37 | const byRef = getFlowRun(dataDir, 'default', OVERSEER_FIXTURE_RUN_REF, { |
| 38 | visibleScopes: projectScopes, |
| 39 | }); |
| 40 | const byId = getFlowRun(dataDir, 'default', 'run_overseer_in_progress', { |
| 41 | visibleScopes: projectScopes, |
| 42 | }); |
| 43 | |
| 44 | assert.ok(byRef); |
| 45 | assert.ok(byId); |
| 46 | assert.deepEqual(byRef.run, byId.run); |
| 47 | assert.equal(byRef.run.step_states.length, 2); |
| 48 | const doneStep = byRef.run.step_states.find((s) => s.status === 'done'); |
| 49 | assert.equal(doneStep?.verified, true); |
| 50 | }); |
| 51 | |
| 52 | it('personal scope never sees project overseer run', () => { |
| 53 | const dataDir = path.join(tmpRoot, 'scope'); |
| 54 | fs.mkdirSync(dataDir); |
| 55 | const personal = new Set(['personal']); |
| 56 | const got = getFlowRun(dataDir, 'default', OVERSEER_FIXTURE_RUN_REF, { |
| 57 | visibleScopes: personal, |
| 58 | }); |
| 59 | assert.equal(got, null); |
| 60 | }); |
| 61 | }); |
File History
1 commit
sha256:baa800aedf841dbf32081aa7b2befa288ac33dfc7175ac55014c55c4d8c742f9
docs: move durable-auth freeze/evidence to local developmen…
Human
10 days ago