Skip to content

feat(mcp,web): support above-box span labels and optional duration in render_timelines - #1256

Merged
kyasbal merged 5 commits into
mainfrom
push-qrwxnluoloos
Nov 17, 2026
Merged

kyasbal merged 5 commits into
mainfrom
push-qrwxnluoloos

Conversation

@kyasbal

@kyasbal kyasbal commented Nov 11, 2026

Copy link
Copy Markdown
Member

Summary

Improves readability of row-scoped span annotations in MCP render_timelines scenes by supporting above-box header chip placement (labelPlacement: "auto" | "above" | "inside") and optional duration suffix suppression (hideDuration: true).

Motivation

  1. Prevent label occlusion on compact row-scoped spans: Previously, layoutSpanHeaderChip always positioned the opaque .span-label-chip inside the top edge of the span box (vertical.topPx + 1..4px). On single-row or compact two-row spans (< 44px tall, such as a single HorizontalPodAutoscaler or container row with includeSubtree: false), the internal chip covered the exact revision bricks and event dots highlighted by the box.
  2. Allow clean metric comparison labels: Appending (${durationLabel}) unconditionally widened narrow metric comparison labels (e.g., averageUtilization: 20 ~ 27% vs averageUtilization: 1 ~ 2%) and caused premature ellipsis truncation.

Changes

  • Backend MCP Scene Schema & Resolution (pkg/server/mcp/scene/):
    • Added SpanLabelPlacement (auto, above, inside) and optional labelPlacement and hideDuration fields to SpanAnnotation and ResolvedSpan.
    • Validated labelPlacement in resolveSpans (defaulting "" to "auto" and returning INVALID_ARGUMENT on unsupported values) and omitted durationLabel when hideDuration is true.
  • Frontend Scene Builder & Overlay (web/src/app/pages/timeline-render/):
    • Added TimelineSpanLabelPlacement enum and optional labelPlacement / hideDuration fields on TimelineResolvedSpan.
    • Updated resolveSpanIsLabelAbove, layoutSpanHeaderChip, and buildSpanViewModels:
      • auto places header chips directly above compact row-scoped spans (isRowScoped && heightPx < 44 when vertical headroom is available) and keeps chips inside full-height or tall multi-row spans.
      • above chips align with box.leftPx, dodge vertical marker/excerpt stems intersecting the external chip band via findStemFreeSpanIntervals, and expand chipMaxWidthPx into open space on the right while clamping right-to-left against adjacent same-band above chips so side-by-side intervals never overlap.
      • Omitted (${durationLabel}) when hideDuration is true.
    • Styled .span-label-chip.above in timeline-scene-overlay.component and added a Storybook story for compact row above-box span labels.

Verification

  • make pre-commit
  • make build-go && make lint-go && make test-go
  • make build-web && make lint-web && make test-web
  • make build-storybook

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for customizable span label placements (auto, above, inside) and an option to hide the duration suffix on timeline spans. The changes span both the Go backend, where validation and resolution logic are updated, and the Angular frontend, which implements the rendering and collision avoidance logic for above-box labels. The review feedback correctly identifies a potential layout issue in the collision avoidance logic where using a strict inequality > instead of >= could cause adjacent chips with identical starting coordinates to overlap.

if (
Math.abs(placed.aboveBandTopPx - curr.aboveBandTopPx) <
SPAN_CHIP_HEIGHT_PX &&
placed.chipStageLeftPx > curr.alignedAboveLeftPx &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a strict inequality > can cause adjacent chips with the exact same starting coordinate (e.g., due to rounding or identical start times on adjacent very short rows) to not be recognized as neighbors, leading to complete visual overlap. Changing this to >= ensures they are correctly treated as neighbors and shifted to avoid overlapping.

Suggested change
placed.chipStageLeftPx > curr.alignedAboveLeftPx &&
placed.chipStageLeftPx >= curr.alignedAboveLeftPx &&
… render_timelines

Adds SpanLabelPlacement ('auto', 'above', 'inside') and hideDuration options to SpanAnnotation and ResolvedSpan. Compact row-scoped spans (< 44px tall) automatically place their header chips above the span box while avoiding vertical stems and clamping width right-to-left against adjacent same-band above-box chips.
@github-actions

Copy link
Copy Markdown

Code Quality Report — ✅ Cloud Build success

Cloud Build completed without an embedded report envelope.


Commit: d431a62d81ba · Cloud Build Logs

@kyasbal
kyasbal added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 2230648 Nov 17, 2026
22 checks passed
@kyasbal
kyasbal deleted the push-qrwxnluoloos branch November 17, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant