Skip to content

feat(ui-core): add worker timeline layout helpers - #87

Open
andrewkcchung wants to merge 1 commit into
mainfrom
upstream/u18-worker-timeline-helpers
Open

andrewkcchung wants to merge 1 commit into
mainfrom
upstream/u18-worker-timeline-helpers

Conversation

@andrewkcchung

@andrewkcchung andrewkcchung commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Why

Timeline renderers need the same deterministic answers for visible-span zoom and worker-lane order regardless of which product surface renders them. Keeping these calculations as pure UI-core helpers prevents renderer-specific copies, makes layout behavior testable without a DOM, and provides a reusable foundation for current and future timelines.

What changed

  • Add a pure helper that derives bounded timeline geometry and zoom from the visible time span.
  • Add deterministic lane ordering that preserves known choices and appends newly observed lanes stably.
  • Export both helpers from the shared UI core.
  • Cover boundary snapping, midpoint behavior, geometry caps, duplicate lanes, and input immutability.

Behavioral proof

Command:

node --test packages/app/ui/core/test/worker-timeline-layout.test.mjs
  • Red — test-only patch on main: The test failed because the shared timeline helper modules did not exist on main.
  • Green — this branch: 5 tests passed.

Risk assessment

Relative risk: Low

The contribution is additive, pure, DOM-independent UI-core logic and does not yet replace an existing renderer path. Its risk is limited to the public geometry and ordering contract exposed for future consumers. Deterministic boundary, duplicate-lane, immutability, and chart-cap tests constrain that behavior.

Review focus

  • Confirm the fixed lane, gutter, row-height, and maximum-chart dimensions are suitable shared UI-core contracts.
  • Review zoom snapping at exact level boundaries and midpoint selection between levels.
  • Confirm duplicate and newly discovered lane IDs retain deterministic ordering.
  • Confirm the helpers remain renderer- and DOM-independent.

Keep deterministic lane ordering and bounded zoom geometry in DOM-free UI core helpers with boundary-focused tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant