Skip to content

Commit b9cfae9

Browse files
Copilotintel352
andauthored
fix: use @gocodealone/workflow-ui@0.2.0 from registry, fix trace type mismatches and ESLint (#267)
* Initial plan * fix: use @gocodealone/workflow-ui@0.2.0 from registry, fix trace types and ESLint Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
1 parent 8053059 commit b9cfae9

5 files changed

Lines changed: 47 additions & 73 deletions

File tree

ui/package-lock.json

Lines changed: 11 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test:e2e:execution": "npx playwright test --config playwright-e2e.config.ts"
1515
},
1616
"dependencies": {
17-
"@gocodealone/workflow-ui": "file:../../workflow-ui",
17+
"@gocodealone/workflow-ui": "^0.2.0",
1818
"@types/dagre": "^0.7.53",
1919
"@xyflow/react": "^12.10.0",
2020
"dagre": "^0.8.5",

ui/src/components/trace/TraceView.test.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, it, expect, beforeEach, vi } from 'vitest';
22
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
3-
import TraceView, { toTraceStep, toLogEntry } from './TraceView.tsx';
3+
import TraceView from './TraceView.tsx';
4+
import { toTraceStep, toLogEntry } from './traceUtils.ts';
45
import useObservabilityStore from '../../store/observabilityStore.ts';
56
import type { TraceStep } from '@gocodealone/workflow-ui/trace';
67

@@ -159,7 +160,7 @@ describe('TraceView', () => {
159160
it('handleStepClick selects a step on first click (via TraceCanvas)', async () => {
160161
// Make configToNodes return non-empty nodes so TraceCanvas renders
161162
vi.mocked(configToNodes).mockReturnValue({
162-
nodes: [{ id: 'n1', type: 'default', position: { x: 0, y: 0 }, data: {} }],
163+
nodes: [{ id: 'n1', type: 'default', position: { x: 0, y: 0 }, data: { moduleType: '', label: '', config: {} } }],
163164
edges: [],
164165
});
165166

@@ -177,7 +178,7 @@ describe('TraceView', () => {
177178

178179
it('handleStepClick toggles: clicking same step twice deselects it (via TraceCanvas)', async () => {
179180
vi.mocked(configToNodes).mockReturnValue({
180-
nodes: [{ id: 'n1', type: 'default', position: { x: 0, y: 0 }, data: {} }],
181+
nodes: [{ id: 'n1', type: 'default', position: { x: 0, y: 0 }, data: { moduleType: '', label: '', config: {} } }],
181182
edges: [],
182183
});
183184

@@ -288,7 +289,6 @@ describe('toTraceStep', () => {
288289
expect(result.status).toBe('completed');
289290
expect(result.sequenceNum).toBe(3);
290291
expect(result.durationMs).toBe(120);
291-
expect(result.startedAt).toBe('2026-01-01T00:00:00Z');
292292
expect(result.inputData).toEqual({ key: 'value' });
293293
expect(result.outputData).toEqual({ result: 42 });
294294
});
@@ -306,7 +306,6 @@ describe('toTraceStep', () => {
306306
const result = toTraceStep(step);
307307

308308
expect(result.durationMs).toBeUndefined();
309-
expect(result.startedAt).toBeUndefined();
310309
expect(result.inputData).toBeUndefined();
311310
expect(result.outputData).toBeUndefined();
312311
expect(result.errorMessage).toBeUndefined();
@@ -330,7 +329,7 @@ describe('toLogEntry', () => {
330329

331330
const result = toLogEntry(log);
332331

333-
expect(result.id).toBe(7);
332+
expect(result.id).toBe('7');
334333
expect(result.level).toBe('info');
335334
expect(result.message).toBe('Step started');
336335
expect(result.moduleName).toBe('step1');

ui/src/components/trace/TraceView.tsx

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,11 @@ import {
77
StepDetailPanel,
88
} from '@gocodealone/workflow-ui/trace';
99
import type { TraceStep, TraceData, LogEntry } from '@gocodealone/workflow-ui/trace';
10+
import { toTraceStep, toLogEntry } from './traceUtils.ts';
1011
import useObservabilityStore from '../../store/observabilityStore.ts';
1112
import useWorkflowStore from '../../store/workflowStore.ts';
1213
import { apiGetExecutionLogs, apiGetWorkflow } from '../../utils/api.ts';
1314
import { configToNodes, parseYaml } from '../../utils/serialization.ts';
14-
import type { ExecutionStep, ExecutionLog } from '../../types/observability.ts';
15-
16-
export function toTraceStep(step: ExecutionStep): TraceStep {
17-
return {
18-
stepName: step.step_name,
19-
stepType: step.step_type,
20-
status: step.status as TraceStep['status'],
21-
durationMs: step.duration_ms,
22-
startedAt: step.started_at,
23-
inputData: step.input_data as Record<string, unknown> | null | undefined,
24-
outputData: step.output_data as Record<string, unknown> | null | undefined,
25-
errorMessage: step.error_message,
26-
sequenceNum: step.sequence_num,
27-
};
28-
}
29-
30-
export function toLogEntry(log: ExecutionLog): LogEntry {
31-
const level = log.level === 'fatal' ? 'error' : log.level;
32-
return {
33-
id: log.id,
34-
level: level as LogEntry['level'],
35-
message: log.message,
36-
moduleName: log.module_name,
37-
fields: log.fields,
38-
createdAt: log.created_at,
39-
};
40-
}
4115

4216
const STATUS_COLORS: Record<string, string> = {
4317
pending: '#6c7086',
@@ -102,15 +76,15 @@ export default function TraceView({ executionId }: { executionId: string }) {
10276

10377
const handleStepClick = useCallback(
10478
(step: TraceStep) => {
105-
setSelectedStep((prev) => (prev?.stepName === step.stepName ? null : step));
79+
setSelectedStep((prev: TraceStep | null) => (prev?.stepName === step.stepName ? null : step));
10680
},
10781
[],
10882
);
10983

11084
const handleWaterfallStepClick = useCallback(
11185
(stepName: string) => {
11286
const step = executionSteps.map(toTraceStep).find((s) => s.stepName === stepName);
113-
if (step) setSelectedStep((prev) => (prev?.stepName === stepName ? null : step));
87+
if (step) setSelectedStep((prev: TraceStep | null) => (prev?.stepName === stepName ? null : step));
11488
},
11589
[executionSteps],
11690
);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { ExecutionStep, ExecutionLog } from '../../types/observability.ts';
2+
import type { TraceStep, LogEntry } from '@gocodealone/workflow-ui/trace';
3+
4+
export function toTraceStep(step: ExecutionStep): TraceStep {
5+
return {
6+
stepName: step.step_name,
7+
stepType: step.step_type,
8+
status: step.status as TraceStep['status'],
9+
durationMs: step.duration_ms,
10+
inputData: step.input_data as Record<string, unknown> | null | undefined,
11+
outputData: step.output_data as Record<string, unknown> | null | undefined,
12+
errorMessage: step.error_message,
13+
sequenceNum: step.sequence_num,
14+
};
15+
}
16+
17+
export function toLogEntry(log: ExecutionLog): LogEntry {
18+
const level = log.level === 'fatal' ? 'error' : log.level;
19+
return {
20+
id: String(log.id),
21+
level: level as LogEntry['level'],
22+
message: log.message,
23+
moduleName: log.module_name,
24+
fields: log.fields,
25+
createdAt: log.created_at,
26+
};
27+
}

0 commit comments

Comments
 (0)