-
-
Notifications
You must be signed in to change notification settings - Fork 698
Warm start UI #1882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warm start UI #1882
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces several new React components and adjusts existing UI elements. A new Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
apps/webapp/app/components/primitives/Tooltip.tsx (1)
40-51
: Improved tooltip rendering with Portal.Wrapping
TooltipPrimitive.Content
inTooltipPrimitive.Portal
is an excellent improvement. This ensures that tooltips will:
- Render at the root of the DOM tree instead of within their parent component
- Avoid z-index conflicts and containment issues with parent elements
- Display correctly even when parent elements have
overflow: hidden
This follows React best practices for tooltip implementations, particularly when using Radix UI primitives.
Consider adding a comment explaining the purpose of using Portal for future maintainers, especially if this pattern isn't consistent across the codebase:
<TooltipPrimitive.Portal> + {/* Portal ensures tooltip content renders at the root level to avoid z-index and overflow issues */} <TooltipPrimitive.Content ...
apps/webapp/app/components/WarmStarts.tsx (1)
24-38
: Check z-index value for tooltip.While the component correctly implements the tooltip functionality, the hardcoded z-index value of 9999 might be unnecessarily high and could potentially conflict with other UI elements.
Consider using a more moderate z-index value or, better yet, use a z-index variable from your design system to ensure consistency across the application:
- className="relative z-[9999]" + className="relative z-[50]"apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1)
513-520
: Unused helper function.The
isWarmStart
function is defined but not used anywhere in the codebase. While it's a well-implemented utility function, it should either be used or removed to avoid dead code.If this function is intended for future use, consider adding a TODO comment explaining its purpose. If not needed, you should remove it to keep the codebase clean:
-function isWarmStart( - attributes: string | number | boolean | Record<string, unknown> | null | undefined -): boolean | undefined { - if (!attributes || typeof attributes !== "object") return undefined; - const attribute = attributes[SemanticInternalAttributes.WARM_START]; - if (typeof attribute !== "boolean") return undefined; - return attribute; -}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
apps/webapp/app/assets/icons/TraceIcon.tsx
(1 hunks)apps/webapp/app/assets/icons/WaitpointTokenIcon.tsx
(1 hunks)apps/webapp/app/assets/icons/WarmStartIcon.tsx
(1 hunks)apps/webapp/app/components/WarmStarts.tsx
(1 hunks)apps/webapp/app/components/primitives/Tooltip.tsx
(1 hunks)apps/webapp/app/components/runs/v3/RunIcon.tsx
(2 hunks)apps/webapp/app/presenters/v3/SpanPresenter.server.ts
(3 hunks)apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam/route.tsx
(2 hunks)apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx
(5 hunks)apps/webapp/app/v3/eventRepository.server.ts
(2 hunks)
🧰 Additional context used
🧬 Code Definitions (4)
apps/webapp/app/components/runs/v3/RunIcon.tsx (1)
apps/webapp/app/assets/icons/TraceIcon.tsx (1)
TraceIcon
(1-9)
apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2)
apps/webapp/app/components/run/RunTimeline.tsx (1)
SpanTimeline
(582-677)apps/webapp/app/utils/timelineSpanEvents.ts (1)
createTimelineSpanEventsFromSpanEvents
(26-131)
apps/webapp/app/v3/eventRepository.server.ts (2)
apps/webapp/app/v3/marqs/fairDequeuingStrategy.server.ts (1)
T
(296-313)apps/webapp/app/v3/marqs/index.server.ts (1)
T
(760-794)
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (4)
packages/core/src/v3/taskContext/index.ts (2)
isWarmStart
(34-36)attributes
(38-48)apps/webapp/app/v3/eventRepository.server.ts (1)
rehydrateAttribute
(1641-1664)packages/core/src/v3/index.ts (1)
SemanticInternalAttributes
(21-21)packages/core/src/v3/semanticInternalAttributes.ts (1)
SemanticInternalAttributes
(1-63)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: typecheck / typecheck
- GitHub Check: units / 🧪 Unit Tests
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (14)
apps/webapp/app/assets/icons/TraceIcon.tsx (1)
1-9
: Clean implementation of the TraceIcon component.The implementation follows React best practices with:
- A properly exported function component
- Typed props with optional className
- Clean SVG structure with proper viewBox and namespace
- Use of "currentColor" for fill to inherit colors from parent styling
apps/webapp/app/assets/icons/WaitpointTokenIcon.tsx (1)
7-7
: SVG path updated successfully.The SVG path data has been updated to change the visual appearance of the WaitpointTokenIcon. The new path definition maintains proper SVG formatting with appropriate rules and attributes.
apps/webapp/app/components/runs/v3/RunIcon.tsx (2)
21-21
: Proper import of the new TraceIcon component.The import statement is correctly formatted and uses the appropriate relative path.
69-69
: Icon component update for "trace" case.The code properly replaces
Squares2X2Icon
with the newTraceIcon
component while maintaining the same styling approach.apps/webapp/app/v3/eventRepository.server.ts (2)
1641-1644
: Good change making the rehydrateAttribute function exportable.This change appropriately exposes the
rehydrateAttribute
function so it can be used elsewhere in the codebase, specifically for extracting warm start information from event metadata.
1659-1661
: Improved condition check for falsy values.The condition has been refined from a general falsy check (
!value
) to a specific check forundefined
. This is a good change as it allows other falsy values like0
,false
, or empty strings to be valid return values rather than being treated the same asundefined
.apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam/route.tsx (1)
1041-1047
: Successfully implemented warm/cold start indicators in the UI.The NodeStatusIcon component now properly handles warm and cold start variants, displaying the appropriate
WarmStartIconWithTooltip
component based on the variant. This implementation matches the PR objective of enhancing the UI to indicate whether an attempt is a warm start.apps/webapp/app/assets/icons/WarmStartIcon.tsx (2)
4-13
: Well-implemented Cold Start icon component.The SVG implementation for the cold start icon uses clear, maintainable code with
currentColor
allowing for flexible colorization through CSS classes. The snowflake design choice clearly represents the cold start concept.
15-26
: Clean conditional rendering based on warm start state.The component correctly implements conditional rendering based on the
isWarmStart
prop, using appropriate icons and colors (orange for warm, blue for cold) to provide clear visual distinction. The use of thecn
utility ensures proper class name handling.apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx (2)
934-967
: Good implementation of attempt entity type handling.The new case for handling spans of type "attempt" follows the existing pattern in the codebase. The conditional rendering of
WarmStartCombo
based on the presence ofisWarmStart
property provides users with valuable information about execution environment reuse.
990-991
: Improved type safety with assertNever.Using
assertNever
in the default case ensures that all entity types are properly handled, providing better compile-time type checking. This is a best practice for exhaustive switch statements in TypeScript.apps/webapp/app/components/WarmStarts.tsx (2)
6-22
: Clean implementation of WarmStartCombo component.The component effectively combines the icon, text label, and optional tooltip to create a reusable UI element. The default parameter for
showTooltip
and consistent styling with dimmed text maintain UI consistency.
40-59
: Clear and informative tooltip content.The tooltip content provides excellent user education about the difference between warm and cold starts, with clear visual indicators and concise explanations of the performance implications.
apps/webapp/app/presenters/v3/SpanPresenter.server.ts (1)
491-506
: Proper handling of warm start data in attempt entities.The implementation correctly extracts the warm start information from span metadata using the rehydrateAttribute function, making this data available to the UI components.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
references/hello-world/src/trigger/example.ts (1)
19-27
: Consider distinguishing between trace messagesBoth trace calls use the same message "my trace" and similar callback functions. Consider using more descriptive and unique messages to differentiate between these trace points for better debugging.
logger.trace( - "my trace", + "custom trace with icon", async (span) => { logger.debug("some log", { span }); }, { icon: "tabler-ad-circle", } );packages/core/src/v3/logger/taskLogger.ts (1)
102-102
: Default icon now consistently applied to tracesThis change ensures all traces have an associated icon by defaulting to "trace" when no specific icon is provided. This is consistent with the PR's objective to enhance UI indicators for warm starts.
Interestingly, the
startSpan
method at line 114 still uses the conditional spread approach without a default value. Consider using a similar approach there for consistency.startSpan(name: string, options?: TraceOptions): Span { const spanOptions = { ...options, attributes: { ...options?.attributes, - ...(options?.icon ? { [SemanticInternalAttributes.STYLE_ICON]: options.icon } : {}), + [SemanticInternalAttributes.STYLE_ICON]: options?.icon ?? "span", }, }; return this._config.tracer.startSpan(name, spanOptions); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/core/src/v3/logger/taskLogger.ts
(1 hunks)references/hello-world/src/trigger/example.ts
(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
packages/core/src/v3/logger/taskLogger.ts (1)
packages/core/src/v3/index.ts (1)
SemanticInternalAttributes
(21-21)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: units / 🧪 Unit Tests
- GitHub Check: typecheck / typecheck
🔇 Additional comments (2)
references/hello-world/src/trigger/example.ts (2)
15-17
: Good addition of trace loggingAdding trace logging improves the observability of the task execution, which is helpful for debugging and monitoring.
24-26
: Good usage of icon for visual representationUsing the
icon
property is aligned with the PR objective of enhancing the UI with warm start indicators.
We show whether it's a warm start or not on the Attempt, with a useful tooltip.
Summary by CodeRabbit
New Features
TraceIcon
,WarmStartIcon
, andColdStartIcon
for improved visual representation.NodeStatusIcon
logic to dynamically display warm and cold start indicators.Refactor