Skip to content

Commit cf4ef3f

Browse files
xesrevinuGit Agent
andcommitted
fix(shared): use Option for parent span id
- Update import to include Option - Use Option.getOrUndefined for parent span - Clarify no behavioral change to tracing refines parent span id handling by using Option to safely extract spanId, aligning with existing optional value patterns and preventing runtime issues. Co-Authored-By: Git Agent <noreply@git-agent.dev>
1 parent d8c498d commit cf4ef3f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/shared/tracing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { clearScreenDown, cursorTo, moveCursor } from "node:readline";
2-
import { Cause, Duration, Effect, Exit, Layer, Schema, ServiceMap, Tracer } from "effect";
2+
import { Cause, Duration, Effect, Exit, Layer, Option, Schema, ServiceMap, Tracer } from "effect";
33
import { renderError } from "./errors.ts";
44

55
type ProgressStatus = "running" | "done" | "failed" | "interrupted";
@@ -313,7 +313,7 @@ const renderRawAttributesWithConfig = (
313313
};
314314

315315
const toParentId = (span: Tracer.Span): string | undefined =>
316-
span.parent == null ? undefined : span.parent.spanId;
316+
span.parent == null ? undefined : Option.getOrUndefined(Option.map(span.parent, (_) => _.spanId));
317317

318318
const isPureInterrupt = (exit: Exit.Exit<unknown, unknown>): boolean => {
319319
if (!Exit.isFailure(exit)) {

0 commit comments

Comments
 (0)