Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ export function JobLine(
case "running": {
if (runningSteps.length === 1) {
const step = runningSteps[0];
const label = step.modelName && step.methodName
const modelMethod = step.modelName && step.methodName
? `${step.modelName} \u2192 ${step.methodName}`
: step.id;
: null;
const stepPrefix = modelMethod && step.id !== step.modelName
? `${step.id}: `
: "";
const label = modelMethod ? `${stepPrefix}${modelMethod}` : step.id;
const dur = elapsed > 0 ? ` (${formatDuration(elapsed)})` : "";
statusInfo = (
<Text dimColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ export function StepLine({ step, prefix }: StepLineProps) {
const spinnerFrame = useSpinner();
const elapsed = useElapsed(step.startedAt);

const label = step.modelName && step.methodName
const modelMethod = step.modelName && step.methodName
? `${step.modelName} \u2192 ${step.methodName}`
: step.id;
: null;
const stepPrefix = modelMethod && step.id !== step.modelName
? `${step.id}: `
: "";
const label = modelMethod ? `${stepPrefix}${modelMethod}` : step.id;

const duration = elapsed > 0 ? formatDuration(elapsed) : "";

Expand Down
3 changes: 2 additions & 1 deletion src/presentation/renderers/workflow_run_tree/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ function graduateJob(job: JobState): ScrollbackItem {
if (job.stepOrder.length === 1) {
const step = job.steps.get(job.stepOrder[0]);
if (step?.modelName && step?.methodName) {
singleStepLabel = `${step.modelName} \u2192 ${step.methodName}`;
const prefix = step.id !== step.modelName ? `${step.id}: ` : "";
singleStepLabel = `${prefix}${step.modelName} \u2192 ${step.methodName}`;
}
}

Expand Down
63 changes: 62 additions & 1 deletion src/presentation/renderers/workflow_run_tree/state_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Deno.test("treeReducer: job_completed graduates to scrollback and unblocks depen
if (item.type === "job") {
assertEquals(item.jobId, "provision");
assertEquals(item.status, "succeeded");
assertEquals(item.singleStepLabel, "ec2-instance \u2192 create");
assertEquals(item.singleStepLabel, "step-1: ec2-instance \u2192 create");
}

// configure should now be waiting (provision dependency resolved)
Expand Down Expand Up @@ -483,3 +483,64 @@ Deno.test("treeReducer: batch action processes multiple events atomically", () =
assertEquals(step.modelName, "ec2");
assertEquals(step.outputBuffer, ["Creating..."]);
});

Deno.test("treeReducer: singleStepLabel includes step name prefix for forEach-expanded steps", () => {
const state = reduce(
createInitialState("test"),
{
kind: "started",
runId: "run-1",
workflowName: "test",
jobs: [{ id: "test-job", stepCount: 1, dependsOn: [] }],
},
{ kind: "job_started", jobId: "test-job" },
{ kind: "step_started", jobId: "test-job", stepId: "test-alpine" },
{
kind: "model_resolved",
jobId: "test-job",
stepId: "test-alpine",
modelName: "tester",
modelType: "test/runner",
methodName: "smokeTest",
},
{ kind: "step_completed", jobId: "test-job", stepId: "test-alpine" },
{ kind: "job_completed", jobId: "test-job", status: "succeeded" },
);

const item = state.scrollback[0];
assertEquals(item.type, "job");
if (item.type === "job") {
assertEquals(item.singleStepLabel, "test-alpine: tester \u2192 smokeTest");
}
});

Deno.test("treeReducer: singleStepLabel omits prefix when stepId matches modelName", () => {
const state = reduce(
createInitialState("deploy"),
{
kind: "started",
runId: "run-1",
workflowName: "deploy",
jobs: [{ id: "provision", stepCount: 1, dependsOn: [] }],
},
{ kind: "job_started", jobId: "provision" },
{ kind: "step_started", jobId: "provision", stepId: "ec2-instance" },
{
kind: "model_resolved",
jobId: "provision",
stepId: "ec2-instance",
modelName: "ec2-instance",
modelType: "aws/ec2",
methodName: "create",
},
{ kind: "step_completed", jobId: "provision", stepId: "ec2-instance" },
{ kind: "job_completed", jobId: "provision", status: "succeeded" },
);

const item = state.scrollback[0];
assertEquals(item.type, "job");
if (item.type === "job") {
// No prefix when stepId matches modelName
assertEquals(item.singleStepLabel, "ec2-instance \u2192 create");
}
});
Loading