diff --git a/integration-tests/worker/CHANGELOG.md b/integration-tests/worker/CHANGELOG.md index bb0c78d97..abfc5888f 100644 --- a/integration-tests/worker/CHANGELOG.md +++ b/integration-tests/worker/CHANGELOG.md @@ -1,5 +1,13 @@ # @openfn/integration-tests-worker +## 1.0.32 + +### Patch Changes + +- Updated dependencies [39af8e1] + - @openfn/lightning-mock@1.1.11 + - @openfn/ws-worker@0.6.1 + ## 1.0.31 ### Patch Changes diff --git a/integration-tests/worker/package.json b/integration-tests/worker/package.json index c7da14c47..9fe31ba8d 100644 --- a/integration-tests/worker/package.json +++ b/integration-tests/worker/package.json @@ -1,7 +1,7 @@ { "name": "@openfn/integration-tests-worker", "private": true, - "version": "1.0.31", + "version": "1.0.32", "description": "Lightning WOrker integration tests", "author": "Open Function Group ", "license": "ISC", diff --git a/integration-tests/worker/test/attempts.test.ts b/integration-tests/worker/test/attempts.test.ts index 2b4fcbc1e..1392cb690 100644 --- a/integration-tests/worker/test/attempts.test.ts +++ b/integration-tests/worker/test/attempts.test.ts @@ -35,10 +35,10 @@ const humanMb = (sizeInBytes: number) => Math.round(sizeInBytes / 1024 / 1024); const run = async (t, attempt) => { return new Promise(async (done, reject) => { - lightning.on('run:complete', ({ payload }) => { + lightning.on('step:complete', ({ payload }) => { // TODO friendlier job names for this would be nice (rather than run ids) t.log( - `run ${payload.run_id} done in ${payload.duration / 1000}s [${humanMb( + `run ${payload.step_id} done in ${payload.duration / 1000}s [${humanMb( payload.mem.job )} / ${humanMb(payload.mem.system)}mb] [thread ${payload.thread_id}]` ); @@ -90,11 +90,11 @@ test.serial('start from a trigger node', async (t) => { dataclip_id: 's1', }); - lightning.once('run:start', (evt) => { + lightning.once('step:start', (evt) => { runStartEvent = evt.payload; }); - lightning.once('run:complete', (evt) => { + lightning.once('step:complete', (evt) => { runCompleteEvent = evt.payload; }); @@ -102,7 +102,7 @@ test.serial('start from a trigger node', async (t) => { t.truthy(runStartEvent); t.is(runStartEvent.job_id, job.id); - t.truthy(runStartEvent.run_id); + t.truthy(runStartEvent.step_id); t.is(runStartEvent.input_dataclip_id, 's1'); t.truthy(runCompleteEvent); @@ -145,14 +145,14 @@ test.serial('run parallel jobs', async (t) => { // This saves the dataclip returned by a job const outputId = {}; - lightning.on('run:start', (evt) => { + lightning.on('step:start', (evt) => { // x and y should both be passed the dataclip produced by job a - if (evt.payload.run_id === x.id || evt.payload.run_id === y.id) { + if (evt.payload.step_id === x.id || evt.payload.step_id === y.id) { evt.payload.input_dataclip_id = outputId[a.id]; } }); - lightning.on('run:complete', (evt) => { + lightning.on('step:complete', (evt) => { // save the output dataclip outputJson[evt.payload.job_id] = evt.payload.output_dataclip_id; outputJson[evt.payload.job_id] = JSON.parse(evt.payload.output_dataclip); diff --git a/integration-tests/worker/test/benchmark.test.ts b/integration-tests/worker/test/benchmark.test.ts index bc304b1d3..c080384a1 100644 --- a/integration-tests/worker/test/benchmark.test.ts +++ b/integration-tests/worker/test/benchmark.test.ts @@ -88,7 +88,7 @@ test.serial.skip('run 100 attempts', async (t) => { lightning.enqueueAttempt(attempt); } - lightning.on('run:complete', (evt) => { + lightning.on('step:complete', (evt) => { // May want to disable this but it's nice feedback t.log('Completed ', evt.attemptId); diff --git a/integration-tests/worker/test/integration.test.ts b/integration-tests/worker/test/integration.test.ts index b1dc71c4e..423c4802c 100644 --- a/integration-tests/worker/test/integration.test.ts +++ b/integration-tests/worker/test/integration.test.ts @@ -327,7 +327,7 @@ test('blacklist a non-openfn adaptor', (t) => { }); }); -test('a timeout error should still call run-complete', (t) => { +test('a timeout error should still call step-complete', (t) => { return new Promise(async (done) => { const attempt = { id: crypto.randomUUID(), @@ -346,7 +346,7 @@ test('a timeout error should still call run-complete', (t) => { t.log('attempt started'); }); - lightning.once('run:complete', (event) => { + lightning.once('step:complete', (event) => { t.is(event.payload.reason, 'kill'); t.is(event.payload.error_type, 'TimeoutError'); }); @@ -359,7 +359,7 @@ test('a timeout error should still call run-complete', (t) => { }); }); -test('an OOM error should still call run-complete', (t) => { +test('an OOM error should still call step-complete', (t) => { return new Promise(async (done) => { const attempt = { id: crypto.randomUUID(), @@ -378,7 +378,7 @@ test('an OOM error should still call run-complete', (t) => { ], }; - lightning.once('run:complete', (event) => { + lightning.once('step:complete', (event) => { t.is(event.payload.reason, 'kill'); }); diff --git a/packages/lightning-mock/CHANGELOG.md b/packages/lightning-mock/CHANGELOG.md index f07474b89..61608fdb4 100644 --- a/packages/lightning-mock/CHANGELOG.md +++ b/packages/lightning-mock/CHANGELOG.md @@ -1,5 +1,11 @@ # @openfn/lightning-mock +## 1.1.11 + +### Patch Changes + +- 39af8e1: Ensure that we refer to the child of a 'run' (aka attempt) as a 'step' + ## 1.1.10 ### Patch Changes diff --git a/packages/lightning-mock/package.json b/packages/lightning-mock/package.json index c1fe76e05..c4c61e605 100644 --- a/packages/lightning-mock/package.json +++ b/packages/lightning-mock/package.json @@ -1,6 +1,6 @@ { "name": "@openfn/lightning-mock", - "version": "1.1.10", + "version": "1.1.11", "private": true, "description": "A mock Lightning server", "main": "dist/index.js", diff --git a/packages/lightning-mock/src/api-dev.ts b/packages/lightning-mock/src/api-dev.ts index 869d33d68..bd6d97e99 100644 --- a/packages/lightning-mock/src/api-dev.ts +++ b/packages/lightning-mock/src/api-dev.ts @@ -50,7 +50,7 @@ const setupDevAPI = ( state.pending[attempt.id] = { status: 'queued', logs: [], - runs: {}, + steps: {}, }; state.queue.push(attempt.id); }; diff --git a/packages/lightning-mock/src/api-sockets.ts b/packages/lightning-mock/src/api-sockets.ts index 9c4b17140..8bdd9c3f4 100644 --- a/packages/lightning-mock/src/api-sockets.ts +++ b/packages/lightning-mock/src/api-sockets.ts @@ -15,8 +15,8 @@ import { GET_ATTEMPT, GET_CREDENTIAL, GET_DATACLIP, - RUN_COMPLETE, - RUN_START, + STEP_COMPLETE, + STEP_START, } from './events'; import { extractAttemptId, stringify } from './util'; @@ -37,10 +37,10 @@ import type { GetCredentialReply, GetDataclipPayload, GetDataClipReply, - RunCompletePayload, - RunCompleteReply, - RunStartPayload, - RunStartReply, + StepCompletePayload, + StepCompleteReply, + StepStartPayload, + StepStartReply, } from './types'; // dumb cloning id @@ -118,7 +118,7 @@ const createSocketAPI = ( state.pending[attemptId] = { status: 'started', logs: [], - runs: {}, + steps: {}, }; const wrap = ( @@ -145,9 +145,9 @@ const createSocketAPI = ( [ATTEMPT_START]: wrap(handleStartAttempt), [GET_CREDENTIAL]: wrap(getCredential), [GET_DATACLIP]: wrap(getDataclip), - [RUN_START]: wrap(handleRunStart), + [STEP_START]: wrap(handleStepStart), [ATTEMPT_LOG]: wrap(handleLog), - [RUN_COMPLETE]: wrap(handleRunComplete), + [STEP_COMPLETE]: wrap(handleStepComplete), [ATTEMPT_COMPLETE]: wrap((...args) => { handleAttemptComplete(...args); unsubscribe(); @@ -369,28 +369,28 @@ const createSocketAPI = ( }); } - function handleRunStart( + function handleStepStart( state: ServerState, ws: DevSocket, - evt: PhoenixEvent + evt: PhoenixEvent ) { const { ref, join_ref, topic } = evt; - const { run_id, job_id, input_dataclip_id } = evt.payload; + const { step_id, job_id, input_dataclip_id } = evt.payload; const [_, attemptId] = topic.split(':'); if (!state.dataclips) { state.dataclips = {}; } - state.pending[attemptId].runs[job_id] = run_id; + state.pending[attemptId].steps[job_id] = step_id; let payload: any = { status: 'ok', }; - if (!run_id) { + if (!step_id) { payload = { status: 'error', - response: 'no run_id', + response: 'no step_id', }; } else if (!job_id) { payload = { @@ -404,7 +404,7 @@ const createSocketAPI = ( }; } - ws.reply({ + ws.reply({ ref, join_ref, topic, @@ -412,10 +412,10 @@ const createSocketAPI = ( }); } - function handleRunComplete( + function handleStepComplete( state: ServerState, ws: DevSocket, - evt: PhoenixEvent + evt: PhoenixEvent ) { const { ref, join_ref, topic } = evt; const { output_dataclip_id, output_dataclip } = evt.payload; @@ -440,7 +440,7 @@ const createSocketAPI = ( } // be polite and acknowledge the event - ws.reply({ + ws.reply({ ref, join_ref, topic, diff --git a/packages/lightning-mock/src/events.ts b/packages/lightning-mock/src/events.ts index 36e389501..c5a7ca8c2 100644 --- a/packages/lightning-mock/src/events.ts +++ b/packages/lightning-mock/src/events.ts @@ -12,5 +12,5 @@ export const GET_DATACLIP = 'fetch:dataclip'; export const ATTEMPT_START = 'attempt:start'; export const ATTEMPT_COMPLETE = 'attempt:complete'; export const ATTEMPT_LOG = 'attempt:log'; -export const RUN_START = 'run:start'; -export const RUN_COMPLETE = 'run:complete'; +export const STEP_START = 'step:start'; +export const STEP_COMPLETE = 'step:complete'; diff --git a/packages/lightning-mock/src/server.ts b/packages/lightning-mock/src/server.ts index a0b8a53f6..47d568bbb 100644 --- a/packages/lightning-mock/src/server.ts +++ b/packages/lightning-mock/src/server.ts @@ -13,13 +13,13 @@ import createDevAPI from './api-dev'; import type { AttemptLogPayload, Attempt, DevServer } from './types'; -type RunId = string; +type StepId = string; type JobId = string; export type AttemptState = { status: 'queued' | 'started' | 'complete'; logs: AttemptLogPayload[]; - runs: Record; + steps: Record; }; export type ServerState = { diff --git a/packages/lightning-mock/src/types.ts b/packages/lightning-mock/src/types.ts index 5abd925bc..ae6b3db2e 100644 --- a/packages/lightning-mock/src/types.ts +++ b/packages/lightning-mock/src/types.ts @@ -114,23 +114,23 @@ export type AttemptLogPayload = { level?: string; source?: string; // namespace job_id?: string; - run_id?: string; + step_id?: string; }; export type AttemptLogReply = void; -export type RunStartPayload = { +export type StepStartPayload = { job_id: string; - run_id: string; + step_id: string; attempt_id?: string; input_dataclip_id?: string; }; -export type RunStartReply = void; +export type StepStartReply = void; -export type RunCompletePayload = ExitReason & { +export type StepCompletePayload = ExitReason & { attempt_id?: string; job_id: string; - run_id: string; + step_id: string; output_dataclip?: string; output_dataclip_id?: string; }; -export type RunCompleteReply = void; +export type StepCompleteReply = void; diff --git a/packages/lightning-mock/test/channels/attempt.test.ts b/packages/lightning-mock/test/channels/attempt.test.ts index 6dc0e0819..9cbf367c6 100644 --- a/packages/lightning-mock/test/channels/attempt.test.ts +++ b/packages/lightning-mock/test/channels/attempt.test.ts @@ -94,7 +94,7 @@ test.serial('complete an attempt through the attempt channel', async (t) => { t.deepEqual(pending[a.id], { status: 'complete', logs: [], - runs: {}, + steps: {}, }); t.deepEqual(results[a.id].state, { answer: 42 }); done(); diff --git a/packages/lightning-mock/test/events/run-complete.test.ts b/packages/lightning-mock/test/events/step-complete.test.ts similarity index 86% rename from packages/lightning-mock/test/events/run-complete.test.ts rename to packages/lightning-mock/test/events/step-complete.test.ts index c84b3a546..1f5bbae41 100644 --- a/packages/lightning-mock/test/events/run-complete.test.ts +++ b/packages/lightning-mock/test/events/step-complete.test.ts @@ -1,5 +1,5 @@ import test from 'ava'; -import { RUN_COMPLETE } from '../../src/events'; +import { STEP_COMPLETE } from '../../src/events'; import { join, setup, createAttempt } from '../util'; @@ -24,7 +24,7 @@ test.serial('acknowledge valid message', async (t) => { const channel = await join(client, attempt.id); - channel.push(RUN_COMPLETE, event).receive('ok', (evt) => { + channel.push(STEP_COMPLETE, event).receive('ok', (evt) => { t.pass('event acknowledged'); done(); }); @@ -45,7 +45,7 @@ test.serial('save dataclip id to state', async (t) => { const channel = await join(client, attempt.id); - channel.push(RUN_COMPLETE, event).receive('ok', () => { + channel.push(STEP_COMPLETE, event).receive('ok', () => { t.deepEqual(server.state.dataclips.t, JSON.parse(event.output_dataclip)); done(); }); @@ -65,7 +65,7 @@ test.serial('error if no reason', async (t) => { }; const channel = await join(client, attempt.id); - channel.push(RUN_COMPLETE, event).receive('error', () => { + channel.push(STEP_COMPLETE, event).receive('error', () => { t.pass('event rejected'); done(); }); @@ -88,7 +88,7 @@ test.serial('error if no output dataclip', async (t) => { }; const channel = await join(client, attempt.id); - channel.push(RUN_COMPLETE, event).receive('error', (e) => { + channel.push(STEP_COMPLETE, event).receive('error', (e) => { t.is(e.toString(), 'no output_dataclip'); done(); }); @@ -108,7 +108,7 @@ test.serial('error if no output dataclip_id', async (t) => { }; const channel = await join(client, attempt.id); - channel.push(RUN_COMPLETE, event).receive('error', (e) => { + channel.push(STEP_COMPLETE, event).receive('error', (e) => { t.is(e.toString(), 'no output_dataclip_id'); done(); }); diff --git a/packages/lightning-mock/test/events/run-start.test.ts b/packages/lightning-mock/test/events/step-start.test.ts similarity index 76% rename from packages/lightning-mock/test/events/run-start.test.ts rename to packages/lightning-mock/test/events/step-start.test.ts index b478d35cf..8ca3be76f 100644 --- a/packages/lightning-mock/test/events/run-start.test.ts +++ b/packages/lightning-mock/test/events/step-start.test.ts @@ -1,5 +1,5 @@ import test from 'ava'; -import { RUN_START } from '../../src/events'; +import { STEP_START } from '../../src/events'; import { join, setup, createAttempt } from '../util'; let server; @@ -17,13 +17,13 @@ test.serial('acknowledge valid message', async (t) => { const event = { job_id: 'a', - run_id: 'r:a', + step_id: 'r:a', input_dataclip_id: 'x', }; const channel = await join(client, attempt.id); - channel.push(RUN_START, event).receive('ok', () => { + channel.push(STEP_START, event).receive('ok', () => { t.pass('event acknowledged'); done(); }); @@ -38,22 +38,22 @@ test.serial('save run id to state', async (t) => { const event = { job_id: 'a', - run_id: 'r:a', + step_id: 'r:a', input_dataclip_id: 'x', }; const channel = await join(client, attempt.id); - channel.push(RUN_START, event).receive('ok', () => { - t.deepEqual(server.state.pending[attempt.id].runs, { - [event.job_id]: event.run_id, + channel.push(STEP_START, event).receive('ok', () => { + t.deepEqual(server.state.pending[attempt.id].steps, { + [event.job_id]: event.step_id, }); done(); }); }); }); -test.serial('error if no run_id', async (t) => { +test.serial('error if no step_id', async (t) => { return new Promise(async (done) => { const attempt = createAttempt(); @@ -61,13 +61,13 @@ test.serial('error if no run_id', async (t) => { const event = { job_id: 'a', - run_id: undefined, + step_id: undefined, input_dataclip_id: 'x', }; const channel = await join(client, attempt.id); - channel.push(RUN_START, event).receive('error', () => { + channel.push(STEP_START, event).receive('error', () => { t.pass('event rejected'); done(); }); @@ -82,13 +82,13 @@ test.serial('error if no job_id', async (t) => { const event = { job_id: undefined, - run_id: 'r:a', + step_id: 'r:a', input_dataclip_id: 'x', }; const channel = await join(client, attempt.id); - channel.push(RUN_START, event).receive('error', () => { + channel.push(STEP_START, event).receive('error', () => { t.pass('event rejected'); done(); }); @@ -103,13 +103,13 @@ test.serial('error if no input_dataclip_id', async (t) => { const event = { job_id: 'a', - run_id: 'r:a', + step_id: 'r:a', input_dataclip_id: undefined, }; const channel = await join(client, attempt.id); - channel.push(RUN_START, event).receive('error', () => { + channel.push(STEP_START, event).receive('error', () => { t.pass('event rejected'); done(); }); diff --git a/packages/ws-worker/CHANGELOG.md b/packages/ws-worker/CHANGELOG.md index 1d2956e96..aa49d152c 100644 --- a/packages/ws-worker/CHANGELOG.md +++ b/packages/ws-worker/CHANGELOG.md @@ -1,5 +1,11 @@ # ws-worker +## 0.7.0 + +### Minor Changes + +- 39af8e1: Ensure that we refer to the child of a 'run' (aka attempt) as a 'step' + ## 0.6.0 ### Patch Changes diff --git a/packages/ws-worker/package.json b/packages/ws-worker/package.json index dcbc05722..6e32e1530 100644 --- a/packages/ws-worker/package.json +++ b/packages/ws-worker/package.json @@ -1,6 +1,6 @@ { "name": "@openfn/ws-worker", - "version": "0.6.0", + "version": "0.7.0", "description": "A Websocket Worker to connect Lightning to a Runtime Engine", "main": "dist/index.js", "type": "module", diff --git a/packages/ws-worker/src/api/execute.ts b/packages/ws-worker/src/api/execute.ts index 387c0409c..2d7234dd6 100644 --- a/packages/ws-worker/src/api/execute.ts +++ b/packages/ws-worker/src/api/execute.ts @@ -6,8 +6,8 @@ import { AttemptStartPayload, GET_CREDENTIAL, GET_DATACLIP, - RUN_COMPLETE, - RUN_START, + STEP_COMPLETE, + STEP_START, } from '../events'; import { AttemptOptions, Channel, AttemptState } from '../types'; import { getWithReply, createAttemptState } from '../util'; @@ -20,17 +20,16 @@ import type { } from '@openfn/engine-multi'; import { ExecutionPlan } from '@openfn/runtime'; -// TODO: I want to move all event handlers out into their own files -// TODO just export the index yeah? -import handleRunComplete from '../events/run-complete'; -import handleRunStart from '../events/run-start'; +import handleStepComplete from '../events/step-complete'; +import handleStepStart from '../events/step-start'; import handleAttemptComplete from '../events/attempt-complete'; import handleAttemptError from '../events/attempt-error'; + import createThrottler from '../util/throttle'; const enc = new TextDecoder('utf-8'); -export { handleRunComplete, handleRunStart }; +export { handleStepComplete, handleStepStart }; export type Context = { channel: Channel; @@ -45,8 +44,8 @@ export type Context = { // mapping engine events to lightning events const eventMap = { 'workflow-start': ATTEMPT_START, - 'job-start': RUN_START, - 'job-complete': RUN_COMPLETE, + 'job-start': STEP_START, + 'job-complete': STEP_COMPLETE, 'workflow-log': ATTEMPT_LOG, 'workflow-complete': ATTEMPT_COMPLETE, }; @@ -105,8 +104,8 @@ export function execute( const listeners = Object.assign( {}, addEvent('workflow-start', throttle(onWorkflowStart)), - addEvent('job-start', throttle(handleRunStart)), - addEvent('job-complete', throttle(handleRunComplete)), + addEvent('job-start', throttle(handleStepStart)), + addEvent('job-complete', throttle(handleStepComplete)), addEvent('job-error', throttle(onJobError)), addEvent('workflow-log', throttle(onJobLog)), // This will also resolve the promise @@ -180,16 +179,16 @@ export function onJobError(context: Context, event: any) { // awkward error handling // If the error is written to state, it's a fail, - // and we don't want to send that to handleRunComplete + // and we don't want to send that to handleStepComplete // because it'll count it as a crash // This isn't very good: maybe we shouldn't trigger an error // at all for a fail state? const { state, error, jobId } = event; // This test is horrible too if (state?.errors?.[jobId]?.message === error.message) { - return handleRunComplete(context, event); + return handleStepComplete(context, event); } else { - return handleRunComplete(context, event, event.error); + return handleStepComplete(context, event, event.error); } } @@ -212,8 +211,8 @@ export function onJobLog({ channel, state }: Context, event: JSONLog) { timestamp: timeInMicroseconds.toString(), }; - if (state.activeRun) { - log.run_id = state.activeRun; + if (state.activeStep) { + log.step_id = state.activeStep; } return sendEvent(channel, ATTEMPT_LOG, log); diff --git a/packages/ws-worker/src/events.ts b/packages/ws-worker/src/events.ts index 10f42490b..d66a843af 100644 --- a/packages/ws-worker/src/events.ts +++ b/packages/ws-worker/src/events.ts @@ -39,29 +39,29 @@ export type AttemptLogPayload = { level?: string; source?: string; // namespace job_id?: string; - run_id?: string; + step_id?: string; }; export type AttemptLogReply = void; -export const RUN_START = 'run:start'; -export type RunStartPayload = { +export const STEP_START = 'step:start'; +export type StepStartPayload = { job_id: string; - run_id: string; + step_id: string; attempt_id?: string; input_dataclip_id?: string; versions: Record; }; -export type RunStartReply = void; +export type StepStartReply = void; -export const RUN_COMPLETE = 'run:complete'; -export type RunCompletePayload = ExitReason & { +export const STEP_COMPLETE = 'step:complete'; +export type StepCompletePayload = ExitReason & { attempt_id?: string; job_id: string; - run_id: string; + step_id: string; output_dataclip?: string; output_dataclip_id?: string; }; -export type RunCompleteReply = void; +export type StepCompleteReply = void; // These are internal server events // Explicitly (and awkwardly) namespaced to avoid confusion diff --git a/packages/ws-worker/src/events/run-complete.ts b/packages/ws-worker/src/events/step-complete.ts similarity index 86% rename from packages/ws-worker/src/events/run-complete.ts rename to packages/ws-worker/src/events/step-complete.ts index 92cc78d6d..18591fdc9 100644 --- a/packages/ws-worker/src/events/run-complete.ts +++ b/packages/ws-worker/src/events/step-complete.ts @@ -1,13 +1,13 @@ import crypto from 'node:crypto'; -import { RUN_COMPLETE, RunCompletePayload } from '../events'; +import { STEP_COMPLETE, StepCompletePayload } from '../events'; import { stringify } from '../util'; import { calculateJobExitReason } from '../api/reasons'; import { sendEvent, Context } from '../api/execute'; import type { JobCompletePayload } from '@openfn/engine-multi'; -export default function onRunComplete( +export default function onStepComplete( { channel, state }: Context, event: JobCompletePayload, // TODO this isn't terribly graceful, but accept an error for crashes @@ -15,7 +15,7 @@ export default function onRunComplete( ) { const dataclipId = crypto.randomUUID(); - const run_id = state.activeRun as string; + const step_id = state.activeStep as string; const job_id = state.activeJob as string; if (!state.dataclips) { @@ -25,7 +25,7 @@ export default function onRunComplete( state.dataclips[dataclipId] = event.state; - delete state.activeRun; + delete state.activeStep; delete state.activeJob; // TODO right now, the last job to run will be the result for the attempt @@ -49,7 +49,7 @@ export default function onRunComplete( state.reasons[job_id] = { reason, error_message, error_type }; const evt = { - run_id, + step_id, job_id, output_dataclip_id: dataclipId, output_dataclip: stringify(outputState), @@ -62,5 +62,5 @@ export default function onRunComplete( duration: event.duration, thread_id: event.threadId, }; - return sendEvent(channel, RUN_COMPLETE, evt); + return sendEvent(channel, STEP_COMPLETE, evt); } diff --git a/packages/ws-worker/src/events/run-start.ts b/packages/ws-worker/src/events/step-start.ts similarity index 79% rename from packages/ws-worker/src/events/run-start.ts rename to packages/ws-worker/src/events/step-start.ts index 094a64e90..9703fb0e5 100644 --- a/packages/ws-worker/src/events/run-start.ts +++ b/packages/ws-worker/src/events/step-start.ts @@ -3,11 +3,11 @@ import { JobStartPayload } from '@openfn/engine-multi'; import { timestamp } from '@openfn/logger'; import pkg from '../../package.json' assert { type: 'json' }; -import { RUN_START, RunStartPayload } from '../events'; +import { STEP_START, StepStartPayload } from '../events'; import { sendEvent, Context, onJobLog } from '../api/execute'; import calculateVersionString from '../util/versions'; -export default async function onRunStart( +export default async function onStepStart( context: Context, event: JobStartPayload ) { @@ -17,7 +17,7 @@ export default async function onRunStart( const { channel, state } = context; // generate a run id and write it to state - state.activeRun = crypto.randomUUID(); + state.activeStep = crypto.randomUUID(); state.activeJob = event.jobId; const job = state.plan.jobs.find(({ id }) => id === event.jobId); @@ -32,18 +32,18 @@ export default async function onRunStart( // Send the log with its own little state object // to preserve the run id // Otherwise, by the time the log sends, - // the activerun could have changed + // the active step could have changed // TODO if I fix ordering I think I can kill this const versionLogContext = { ...context, state: { ...state, - activeRun: state.activeRun, + activeStep: state.activeStep, }, }; - await sendEvent(channel, RUN_START, { - run_id: state.activeRun!, + await sendEvent(channel, STEP_START, { + step_id: state.activeStep!, job_id: state.activeJob!, input_dataclip_id, @@ -51,7 +51,7 @@ export default async function onRunStart( }); const versionMessage = calculateVersionString( - versionLogContext.state.activeRun, + versionLogContext.state.activeStep, versions, job?.adaptor ); diff --git a/packages/ws-worker/src/types.d.ts b/packages/ws-worker/src/types.d.ts index 3923a9e98..f2aed29ca 100644 --- a/packages/ws-worker/src/types.d.ts +++ b/packages/ws-worker/src/types.d.ts @@ -91,7 +91,7 @@ export type AttemptOptions = { // Internal server state for each attempt export type AttemptState = { - activeRun?: string; + activeStep?: string; activeJob?: string; plan: ExecutionPlan; options: AttemptOptions; diff --git a/packages/ws-worker/src/util/versions.ts b/packages/ws-worker/src/util/versions.ts index bbf1a71e0..35e7d1dbf 100644 --- a/packages/ws-worker/src/util/versions.ts +++ b/packages/ws-worker/src/util/versions.ts @@ -10,7 +10,7 @@ export type Versions = { [adaptor: string]: string; }; -export default (runId: string, versions: Versions, adaptor?: string) => { +export default (stepId: string, versions: Versions, adaptor?: string) => { let longest = 'compiler'.length; // Bit wierdly defensive but ensure padding is reasonable even if version has no props for (const v in versions) { longest = Math.max(v.length, longest); @@ -20,7 +20,7 @@ export default (runId: string, versions: Versions, adaptor?: string) => { // Prefix and pad version numbers const prefix = (str: string) => ` ${t} ${str.padEnd(longest + 4, ' ')}`; - let str = `Versions for run ${runId}: + let str = `Versions for step ${stepId}: ${prefix('node.js')}${versions.node || 'unknown'} ${prefix('worker')}${versions.worker || 'unknown'} ${prefix('engine')}${versions.engine || 'unknown'}`; diff --git a/packages/ws-worker/test/api/execute.test.ts b/packages/ws-worker/test/api/execute.test.ts index 6419bdc67..51eaa0112 100644 --- a/packages/ws-worker/test/api/execute.test.ts +++ b/packages/ws-worker/test/api/execute.test.ts @@ -2,8 +2,8 @@ import test from 'ava'; import { JSONLog, createMockLogger } from '@openfn/logger'; import { - RUN_START, - RUN_COMPLETE, + STEP_START, + STEP_COMPLETE, ATTEMPT_LOG, ATTEMPT_START, ATTEMPT_COMPLETE, @@ -34,9 +34,9 @@ const noop = () => true; const mockEventHandlers = { [ATTEMPT_START]: noop, - [RUN_START]: noop, + [STEP_START]: noop, [ATTEMPT_LOG]: noop, - [RUN_COMPLETE]: noop, + [STEP_COMPLETE]: noop, [ATTEMPT_COMPLETE]: noop, }; @@ -118,12 +118,12 @@ test('jobLog should should send a log event inside a run', async (t) => { const state = { plan, activeJob: jobId, - activeRun: 'b', + activeStep: 'b', } as AttemptState; const channel = mockChannel({ [ATTEMPT_LOG]: (evt) => { - t.truthy(evt.run_id); + t.truthy(evt.step_id); t.deepEqual(evt.message, log.message); t.is(evt.level, log.level); t.is(evt.source, log.name); @@ -134,16 +134,16 @@ test('jobLog should should send a log event inside a run', async (t) => { await onJobLog({ channel, state }, log); }); -test('jobError should trigger run:complete with a reason', async (t) => { - let runCompleteEvent; +test('jobError should trigger step:complete with a reason', async (t) => { + let stepCompleteEvent; const state = createAttemptState({ id: 'attempt-23' } as Attempt); state.activeJob = 'job-1'; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_COMPLETE]: (evt) => { - runCompleteEvent = evt; + [STEP_COMPLETE]: (evt) => { + stepCompleteEvent = evt; return true; }, }); @@ -155,20 +155,20 @@ test('jobError should trigger run:complete with a reason', async (t) => { }; await onJobError({ channel, state }, event); - t.is(runCompleteEvent.reason, 'kill'); - t.is(runCompleteEvent.error_message, 'nope'); - t.is(runCompleteEvent.error_type, 'TEST'); - t.deepEqual(runCompleteEvent.output_dataclip, JSON.stringify(exitState)); + t.is(stepCompleteEvent.reason, 'kill'); + t.is(stepCompleteEvent.error_message, 'nope'); + t.is(stepCompleteEvent.error_type, 'TEST'); + t.deepEqual(stepCompleteEvent.output_dataclip, JSON.stringify(exitState)); }); -test('jobError should trigger run:complete with a reason and default state', async (t) => { - let runCompleteEvent; +test('jobError should trigger step:complete with a reason and default state', async (t) => { + let stepCompleteEvent; const state = createAttemptState({ id: 'attempt-23' } as Attempt); const channel = mockChannel({ - [RUN_COMPLETE]: (evt) => { - runCompleteEvent = evt; + [STEP_COMPLETE]: (evt) => { + stepCompleteEvent = evt; return true; }, }); @@ -178,7 +178,7 @@ test('jobError should trigger run:complete with a reason and default state', asy }; await onJobError({ channel, state }, event); - t.deepEqual(runCompleteEvent.output_dataclip, '{}'); + t.deepEqual(stepCompleteEvent.output_dataclip, '{}'); }); test('workflowStart should send an empty attempt:start event', async (t) => { @@ -414,9 +414,9 @@ test('execute should call all events on the socket', async (t) => { GET_CREDENTIAL, // GET_DATACLIP, // TODO not really implemented properly yet ATTEMPT_START, - RUN_START, + STEP_START, ATTEMPT_LOG, - RUN_COMPLETE, + STEP_COMPLETE, ATTEMPT_COMPLETE, ]; diff --git a/packages/ws-worker/test/events/attempt-error.test.ts b/packages/ws-worker/test/events/attempt-error.test.ts index 0d1f540a9..2d9e3efce 100644 --- a/packages/ws-worker/test/events/attempt-error.test.ts +++ b/packages/ws-worker/test/events/attempt-error.test.ts @@ -2,7 +2,7 @@ import test from 'ava'; import onAttemptError from '../../src/events/attempt-error'; import { mockChannel } from '../../src/mock/sockets'; -import { ATTEMPT_COMPLETE, ATTEMPT_LOG, RUN_COMPLETE } from '../../src/events'; +import { ATTEMPT_COMPLETE, ATTEMPT_LOG, STEP_COMPLETE } from '../../src/events'; import { createAttemptState } from '../../src/util'; const plan = { id: 'attempt-1', jobs: [] }; @@ -12,12 +12,12 @@ test('attemptError should trigger runComplete with a reason', async (t) => { const state = createAttemptState(plan); state.lastDataclipId = 'x'; - state.activeRun = 'b'; + state.activeStep = 'b'; state.activeJob = jobId; const channel = mockChannel({ [ATTEMPT_LOG]: () => true, - [RUN_COMPLETE]: (evt) => { + [STEP_COMPLETE]: (evt) => { t.is(evt.reason, 'crash'); t.is(evt.error_message, 'it crashed'); return true; @@ -41,12 +41,12 @@ test('workflow error should send reason to onFinish', async (t) => { const state = createAttemptState(plan); state.lastDataclipId = 'x'; - state.activeRun = 'b'; + state.activeStep = 'b'; state.activeJob = jobId; const channel = mockChannel({ [ATTEMPT_LOG]: () => true, - [RUN_COMPLETE]: (evt) => true, + [STEP_COMPLETE]: (evt) => true, [ATTEMPT_COMPLETE]: () => true, }); @@ -76,7 +76,7 @@ test('attemptError should not call job complete if the job is not active', async const channel = mockChannel({ [ATTEMPT_LOG]: () => true, - [RUN_COMPLETE]: (evt) => { + [STEP_COMPLETE]: (evt) => { t.fail('should not call!'); return true; }, @@ -111,7 +111,7 @@ test('attemptError should log the reason', async (t) => { jobs: [{ id: 'job-1' }], }); state.lastDataclipId = 'x'; - state.activeRun = 'b'; + state.activeStep = 'b'; state.activeJob = jobId; const event = { @@ -127,7 +127,7 @@ test('attemptError should log the reason', async (t) => { [ATTEMPT_LOG]: (e) => { logEvent = e; }, - [RUN_COMPLETE]: (evt) => true, + [STEP_COMPLETE]: (evt) => true, [ATTEMPT_COMPLETE]: () => true, }); diff --git a/packages/ws-worker/test/events/run-complete.test.ts b/packages/ws-worker/test/events/step-complete.test.ts similarity index 74% rename from packages/ws-worker/test/events/run-complete.test.ts rename to packages/ws-worker/test/events/step-complete.test.ts index d577e8f0c..6b11348c3 100644 --- a/packages/ws-worker/test/events/run-complete.test.ts +++ b/packages/ws-worker/test/events/step-complete.test.ts @@ -1,29 +1,29 @@ import test from 'ava'; -import handleRunStart from '../../src/events/run-complete'; +import handleStepStart from '../../src/events/step-complete'; import { mockChannel } from '../../src/mock/sockets'; import { createAttemptState } from '../../src/util'; -import { RUN_COMPLETE } from '../../src/events'; +import { STEP_COMPLETE } from '../../src/events'; import type { ExecutionPlan } from '@openfn/runtime'; -test('clear the run id and active job on state', async (t) => { +test('clear the step id and active job on state', async (t) => { const plan = { id: 'attempt-1' }; const jobId = 'job-1'; const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_COMPLETE]: () => true, + [STEP_COMPLETE]: () => true, }); const event = { state: { x: 10 } }; - await handleRunStart({ channel, state }, event); + await handleStepStart({ channel, state }, event); t.falsy(state.activeJob); - t.falsy(state.activeRun); + t.falsy(state.activeStep); }); test('setup input mappings on on state', async (t) => { @@ -33,16 +33,16 @@ test('setup input mappings on on state', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_COMPLETE]: (evt) => { + [STEP_COMPLETE]: (evt) => { lightningEvent = evt; }, }); const engineEvent = { state: { x: 10 }, next: ['job-2'] }; - await handleRunStart({ channel, state }, engineEvent); + await handleStepStart({ channel, state }, engineEvent); t.deepEqual(state.inputDataclips, { ['job-2']: lightningEvent.output_dataclip_id, @@ -55,14 +55,14 @@ test('save the dataclip to state', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_COMPLETE]: () => true, + [STEP_COMPLETE]: () => true, }); const event = { state: { x: 10 } }; - await handleRunStart({ channel, state }, event); + await handleStepStart({ channel, state }, event); t.is(Object.keys(state.dataclips).length, 1); const [dataclip] = Object.values(state.dataclips); @@ -75,16 +75,16 @@ test('write a reason to state', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; t.is(Object.keys(state.reasons).length, 0); const channel = mockChannel({ - [RUN_COMPLETE]: () => true, + [STEP_COMPLETE]: () => true, }); const event = { state: { x: 10 } }; - await handleRunStart({ channel, state }, event); + await handleStepStart({ channel, state }, event); t.is(Object.keys(state.reasons).length, 1); t.deepEqual(state.reasons[jobId], { @@ -100,17 +100,17 @@ test('generate an exit reason: success', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; let event; const channel = mockChannel({ - [RUN_COMPLETE]: (e) => { + [STEP_COMPLETE]: (e) => { event = e; }, }); - await handleRunStart({ channel, state }, { state: { x: 10 } }); + await handleStepStart({ channel, state }, { state: { x: 10 } }); t.truthy(event); t.is(event.reason, 'success'); @@ -118,19 +118,19 @@ test('generate an exit reason: success', async (t) => { t.is(event.error_message, null); }); -test('send a run:complete event', async (t) => { +test('send a step:complete event', async (t) => { const plan = { id: 'attempt-1' }; const jobId = 'job-1'; const result = { x: 10 }; const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_COMPLETE]: (evt) => { + [STEP_COMPLETE]: (evt) => { t.is(evt.job_id, jobId); - t.truthy(evt.run_id); + t.truthy(evt.step_id); t.truthy(evt.output_dataclip_id); t.is(evt.output_dataclip, JSON.stringify(result)); t.deepEqual(evt.mem, event.mem); @@ -146,5 +146,5 @@ test('send a run:complete event', async (t) => { duration: 61, threadId: 'abc', }; - await handleRunStart({ channel, state }, event); + await handleStepStart({ channel, state }, event); }); diff --git a/packages/ws-worker/test/events/run-start.test.ts b/packages/ws-worker/test/events/step-start.test.ts similarity index 77% rename from packages/ws-worker/test/events/run-start.test.ts rename to packages/ws-worker/test/events/step-start.test.ts index 4fce62b98..d2f7647a3 100644 --- a/packages/ws-worker/test/events/run-start.test.ts +++ b/packages/ws-worker/test/events/step-start.test.ts @@ -1,32 +1,32 @@ import test from 'ava'; -import handleRunStart from '../../src/events/run-start'; +import handleStepStart from '../../src/events/step-start'; import { JobStartPayload } from '@openfn/engine-multi'; import { mockChannel } from '../../src/mock/sockets'; import { createAttemptState } from '../../src/util'; -import { ATTEMPT_LOG, RUN_START } from '../../src/events'; +import { ATTEMPT_LOG, STEP_START } from '../../src/events'; import pkg from '../../package.json' assert { type: 'json' }; -test('set a run id and active job on state', async (t) => { +test('set a step id and active job on state', async (t) => { const plan = { id: 'attempt-1', jobs: [{ id: 'job-1' }] }; const jobId = 'job-1'; const state = createAttemptState(plan); const channel = mockChannel({ - [RUN_START]: (x) => x, + [STEP_START]: (x) => x, [ATTEMPT_LOG]: (x) => x, }); - await handleRunStart({ channel, state }, { jobId }); + await handleStepStart({ channel, state }, { jobId }); t.is(state.activeJob, jobId); - t.truthy(state.activeRun); + t.truthy(state.activeStep); }); -test('send a run:start event', async (t) => { +test('send a step:start event', async (t) => { const plan = { id: 'attempt-1', initialState: 'abc', @@ -39,22 +39,22 @@ test('send a run:start event', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_START]: (evt) => { + [STEP_START]: (evt) => { t.is(evt.job_id, jobId); t.is(evt.input_dataclip_id, plan.initialState); - t.truthy(evt.run_id); + t.truthy(evt.step_id); return true; }, [ATTEMPT_LOG]: () => true, }); - await handleRunStart({ channel, state }, { jobId }); + await handleStepStart({ channel, state }, { jobId }); }); -test('run:start event should include versions', async (t) => { +test('step:start event should include versions', async (t) => { const plan = { id: 'attempt-1', initialState: 'abc', @@ -78,10 +78,10 @@ test('run:start event should include versions', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_START]: (evt) => { + [STEP_START]: (evt) => { t.deepEqual(evt.versions, { ...versions, worker: pkg.version, @@ -91,7 +91,7 @@ test('run:start event should include versions', async (t) => { [ATTEMPT_LOG]: () => true, }); - await handleRunStart({ channel, state }, event); + await handleStepStart({ channel, state }, event); }); test('also logs the version number', async (t) => { @@ -119,10 +119,10 @@ test('also logs the version number', async (t) => { const state = createAttemptState(plan); state.activeJob = jobId; - state.activeRun = 'b'; + state.activeStep = 'b'; const channel = mockChannel({ - [RUN_START]: (evt) => true, + [STEP_START]: (evt) => true, [ATTEMPT_LOG]: (evt) => { if (evt.source === 'VER') { logEvent = evt; @@ -131,7 +131,7 @@ test('also logs the version number', async (t) => { }, }); - await handleRunStart({ channel, state }, event); + await handleStepStart({ channel, state }, event); t.truthy(logEvent); t.is(logEvent.level, 'info'); diff --git a/packages/ws-worker/test/lightning.test.ts b/packages/ws-worker/test/lightning.test.ts index 99242cc95..002471d44 100644 --- a/packages/ws-worker/test/lightning.test.ts +++ b/packages/ws-worker/test/lightning.test.ts @@ -243,13 +243,13 @@ test.serial( } ); -test.serial(`events: lightning should receive a ${e.RUN_START} event`, (t) => { +test.serial(`events: lightning should receive a ${e.STEP_START} event`, (t) => { return new Promise((done) => { const attempt = getAttempt(); - lng.onSocketEvent(e.RUN_START, attempt.id, ({ payload }) => { + lng.onSocketEvent(e.STEP_START, attempt.id, ({ payload }) => { t.is(payload.job_id, 'j'); - t.truthy(payload.run_id); + t.truthy(payload.step_id); t.pass('called run start'); }); @@ -262,14 +262,14 @@ test.serial(`events: lightning should receive a ${e.RUN_START} event`, (t) => { }); test.serial( - `events: lightning should receive a ${e.RUN_COMPLETE} event`, + `events: lightning should receive a ${e.STEP_COMPLETE} event`, (t) => { return new Promise((done) => { const attempt = getAttempt(); - lng.onSocketEvent(e.RUN_COMPLETE, attempt.id, ({ payload }) => { + lng.onSocketEvent(e.STEP_COMPLETE, attempt.id, ({ payload }) => { t.is(payload.job_id, 'j'); - t.truthy(payload.run_id); + t.truthy(payload.step_id); t.truthy(payload.output_dataclip); t.truthy(payload.output_dataclip_id); t.truthy(payload.mem.job); @@ -288,7 +288,7 @@ test.serial( ); test.serial( - `events: lightning should receive a ${e.RUN_COMPLETE} event even if the attempt fails`, + `events: lightning should receive a ${e.STEP_COMPLETE} event even if the attempt fails`, (t) => { return new Promise((done) => { const attempt = getAttempt({}, [ @@ -299,9 +299,9 @@ test.serial( }, ]); - lng.onSocketEvent(e.RUN_COMPLETE, attempt.id, ({ payload }) => { + lng.onSocketEvent(e.STEP_COMPLETE, attempt.id, ({ payload }) => { t.is(payload.reason, 'fail'); - t.pass('called run complete'); + t.pass('called step complete'); }); lng.onSocketEvent(e.ATTEMPT_COMPLETE, attempt.id, ({ payload }) => { @@ -331,7 +331,7 @@ test.serial( t.is(log.level, 'info'); t.truthy(log.attempt_id); - t.truthy(log.run_id); + t.truthy(log.step_id); t.truthy(log.message); t.deepEqual(log.message, ['x']); }); @@ -533,7 +533,7 @@ test.serial('should pass the right dataclip when running in parallel', (t) => { // Save all the input dataclip ids for each job const unsub2 = lng.onSocketEvent( - e.RUN_START, + e.STEP_START, attempt.id, ({ payload }) => { inputDataclipIds[payload.job_id] = payload.input_dataclip_id; @@ -543,7 +543,7 @@ test.serial('should pass the right dataclip when running in parallel', (t) => { // Save all the output dataclips & ids for each job const unsub1 = lng.onSocketEvent( - e.RUN_COMPLETE, + e.STEP_COMPLETE, attempt.id, ({ payload }) => { outputDataclipIds[payload.job_id] = payload.output_dataclip_id; @@ -601,7 +601,7 @@ test.serial( // If job C completes, we're good here const unsub = lng.onSocketEvent( - e.RUN_COMPLETE, + e.STEP_COMPLETE, attempt.id, (evt) => { results[evt.payload.job_id] = JSON.parse(evt.payload.output_dataclip); diff --git a/packages/ws-worker/test/reasons.test.ts b/packages/ws-worker/test/reasons.test.ts index cbb50208a..8d1caa7b5 100644 --- a/packages/ws-worker/test/reasons.test.ts +++ b/packages/ws-worker/test/reasons.test.ts @@ -7,8 +7,8 @@ import { execute as doExecute } from '../src/api/execute'; import { mockChannel } from '../src/mock/sockets'; import { - RUN_START, - RUN_COMPLETE, + STEP_START, + STEP_COMPLETE, ATTEMPT_LOG, ATTEMPT_START, ATTEMPT_COMPLETE, @@ -45,9 +45,9 @@ const execute = async (plan, options = {}) => // In these test we assume that the correct messages are sent to the channel const channel = mockChannel({ [ATTEMPT_START]: async () => true, - [RUN_START]: async () => true, + [STEP_START]: async () => true, [ATTEMPT_LOG]: async () => true, - [RUN_COMPLETE]: async () => true, + [STEP_COMPLETE]: async () => true, [ATTEMPT_COMPLETE]: async () => true, }); diff --git a/packages/ws-worker/test/util/create-attempt-state.test.ts b/packages/ws-worker/test/util/create-attempt-state.test.ts index 7a559d52c..8cc2da464 100644 --- a/packages/ws-worker/test/util/create-attempt-state.test.ts +++ b/packages/ws-worker/test/util/create-attempt-state.test.ts @@ -15,14 +15,14 @@ test('create attempt', (t) => { t.deepEqual(attempt.options, options); }); -test('Set initial input dataclip if no explicit start and first job is a run', (t) => { +test('Set initial input dataclip if no explicit start and first job is a step', (t) => { const plan = { initialState: 'x', jobs: [{ id: 'a', expression: '.' }] }; const attempt = createAttemptState(plan); t.deepEqual(attempt.inputDataclips, { a: 'x' }); }); -test('Set initial input dataclip if the explicit start is a run', (t) => { +test('Set initial input dataclip if the explicit start is a step', (t) => { const plan = { initialState: 'x', start: 'a', diff --git a/packages/ws-worker/test/util/versions.test.ts b/packages/ws-worker/test/util/versions.test.ts index e7cfb797d..fe4c41de6 100644 --- a/packages/ws-worker/test/util/versions.test.ts +++ b/packages/ws-worker/test/util/versions.test.ts @@ -28,11 +28,11 @@ const parse = (str: string) => { }; test('calculate version string', (t) => { - const str = calculateVersionString('run-1', versions); + const str = calculateVersionString('step-1', versions); // Formatting is super fussy in this test but it's sort of OK t.is( str, - `Versions for run run-1: + `Versions for step step-1: ▸ node.js 1 ▸ worker 2 ▸ engine 3` @@ -40,7 +40,7 @@ test('calculate version string', (t) => { }); test('helper should parse a version string and return the correct order', (t) => { - const str = calculateVersionString('run-1', versions); + const str = calculateVersionString('step-1', versions); const parsed = parse(str); t.deepEqual(parsed, [ @@ -52,7 +52,7 @@ test('helper should parse a version string and return the correct order', (t) => test("show unknown if a version isn't passed", (t) => { // @ts-ignore - const str = calculateVersionString('run-1', {}); + const str = calculateVersionString('step-1', {}); const parsed = parse(str); t.deepEqual(parsed, [ @@ -63,7 +63,7 @@ test("show unknown if a version isn't passed", (t) => { }); test('show adaptors last', (t) => { - const str = calculateVersionString('run-1', { + const str = calculateVersionString('step-1', { '@openfn/language-common': '1.0.0', ...versions, }); @@ -74,7 +74,7 @@ test('show adaptors last', (t) => { }); test('sort and list multiple adaptors', (t) => { - const str = calculateVersionString('run-1', { + const str = calculateVersionString('step-1', { j: '2', z: '3', a: '1', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03bcddc98..b4efc4aa9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -406,8 +406,6 @@ importers: specifier: ^5.1.6 version: 5.1.6 - packages/engine-multi/tmp/a/b/c: {} - packages/engine-multi/tmp/repo: {} packages/lightning-mock: