Skip to content

feat(sdk): harden trace IDs, refund grace, preflight, and telemetry s… - #708

Open
spotkorner-dot wants to merge 1 commit into
Stellar-split:mainfrom
spotkorner-dot:feat/observability-preflight-hardening
Open

feat(sdk): harden trace IDs, refund grace, preflight, and telemetry s…#708
spotkorner-dot wants to merge 1 commit into
Stellar-split:mainfrom
spotkorner-dot:feat/observability-preflight-hardening

Conversation

@spotkorner-dot

Copy link
Copy Markdown

closes #634
closes #635
closes #636
closes #637

…pans

traceId: extract the crypto.randomUUID-preferring generator into a public generateTraceId(), keeping the Math.random UUID v4 fallback for Node < 19. TraceIdManager and existing callers are unchanged.

refundGrace: add an optional graceStartedAt anchor to CanRefundOptions and a new applyPartialRefund() that resets the grace countdown to the current timestamp so full-refund eligibility is re-evaluated from the reset point. Grace period duration is untouched; callers that omit the option keep the deadline-based behaviour.

preflight: add runPreflight() performing a HEAD probe against the configured RPC URL with a configurable timeout (default 3s) via the existing withTimeout utility, throwing a new PreflightError with URL and reason on failure.

telemetry: add an optional parentSpanId to TelemetryEvent plus an active-span stack (startSpan/endSpan/runInSpan). Events inherit the innermost active span ID, or undefined outside any span. Existing consumers are unaffected.

Tests added/extended for all four modules (37 passing).

…pans

traceId: extract the crypto.randomUUID-preferring generator into a public
generateTraceId(), keeping the Math.random UUID v4 fallback for Node < 19.
TraceIdManager and existing callers are unchanged.

refundGrace: add an optional graceStartedAt anchor to CanRefundOptions and a
new applyPartialRefund() that resets the grace countdown to the current
timestamp so full-refund eligibility is re-evaluated from the reset point.
Grace period duration is untouched; callers that omit the option keep the
deadline-based behaviour.

preflight: add runPreflight() performing a HEAD probe against the configured
RPC URL with a configurable timeout (default 3s) via the existing withTimeout
utility, throwing a new PreflightError with URL and reason on failure.

telemetry: add an optional parentSpanId to TelemetryEvent plus an active-span
stack (startSpan/endSpan/runInSpan). Events inherit the innermost active span
ID, or undefined outside any span. Existing consumers are unaffected.

Tests added/extended for all four modules (37 passing).

Signed-off-by: afurious <[email protected]>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@spotkorner-dot Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants