Skip to content

fix(ladder): format timeline amounts, dates and enum labels - #820

Merged
cristim merged 1 commit into
mainfrom
fix/ladder-timeline-697-698
Oct 12, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/ladder-timeline-697-698

Conversation

@cristim

@cristim cristim commented Oct 12, 2026

Copy link
Copy Markdown
Member

Formats the ladder timeline for display (table, filters, summary, snapshot, tooltip, editor header) using the existing formatCurrency/formatDate/formatTerm/getPaymentLabel helpers plus a small layer/status label map. Unknown enum codes render raw. Dates are shown in UTC. Amounts under $1 show 4 digits; zero and absent stay distinct. Input values and filter option values keep the raw wire strings.

Tests: jest regression tests (hand-written fixtures, 3 fail on main), full jest, tsc, lint, build, Playwright ladder-timeline spec pass. ladder-config.spec fails as on main (#802), untouched.

Closes #697

Generated with Claude Code

Table, filters, summary, snapshot, tooltip and editor showed raw 6-decimal
USD strings, ISO timestamps and enum codes. Reuse formatCurrency, formatDate,
formatTerm and getPaymentLabel; add a label map for layer and status enums
that shows unknown codes raw. Dates render in UTC, amounts under $1 keep four
digits, and absent snapshots read 'unavailable' rather than zero.

Closes #697

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cristim cristim added priority/p2 Backlog-worthy severity/high Significant harm urgency/this-quarter Within the quarter impact/many Affects most users effort/s Hours type/bug Defect triaged Item has been triaged labels Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 6 billable files and costs up to $1.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 43 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 60 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 00c04688-6c3a-4764-94e7-8725ffefb207

📥 Commits

Reviewing files that changed from the base of the PR and between 20f6f4f and ad0a97e.


📒 Files selected for processing (6)
  • frontend/src/__tests__/ladder-timeline-filters.test.ts
  • frontend/src/__tests__/ladder-timeline.test.ts
  • frontend/src/ladder-timeline-editor.ts
  • frontend/src/ladder-timeline-filters.ts
  • frontend/src/ladder-timeline.ts
  • frontend/tests-e2e/ladder-timeline.spec.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@cristim

cristim commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

Independent merge-gate review: APPROVE at ad0a97e

Reviewer: independent gate agent (did not author this PR). Full diff vs origin/main reviewed (6 files, +132/-18).

Checks

  • Display paths: table cells, filter option text, summary, run snapshot, tooltip, editor header, run ceiling and preview all go through ladderLabel / formatLadderAmount / formatLadderDateTime. Filter <option value> stays raw; editor amount input stays raw (0.123456); existing jest asserts amendLadderEvent receives raw wire strings; E2E still filters with selectOption('3yr') / 'all-upfront' (raw values). E2E text changes are 1:1 rewrites of the same assertions, not loosened.
  • Money: 0.000000 -> $0.00/hr, null -> unavailable, 0.001200 -> $0.0012/hr, invalid -> throws; sums stay in bigint (ladderTotal), Number only at display.
  • Dates: probed under TZ=Pacific/Kiritimati (UTC+14) and America/Los_Angeles: 2030-01-01T00:00:00Z -> Jan 1, 2030, 00:00 UTC, 2030-12-31T23:59:59Z -> Dec 31, 2030, 23:59 UTC in both; no day shift.
  • Enums vs cloud-commitments-go pkg/ladder at the pinned rev b3b4cb5e (types.go:18-22 layers, :165-166 terms, :192-194 payments; store.go:61-65 tranche statuses): all covered; unknown codes render raw (escaped).
  • Security: every new label goes through escapeHtml in innerHTML paths; tooltip/snapshot/summary use textContent.

Local evidence (git archive of ad0a97e, macOS, under cc-heavy-run lock)

  • npm ci; jest --maxWorkers=2: 102 suites, 3221 passed, 1 skipped, exit 0
  • ladder-timeline jest under TZ=Pacific/Kiritimati, America/Los_Angeles, Pacific/Pago_Pago: 21/21 each
  • lint 0, tsc --noEmit 0, npm run build 0
  • Fail-before: PR tests against origin/main ladder sources: 3 failed (plus filters suite fails to import the new exports)
  • git ls-files -z | xargs -0 git secrets --scan with CI-style --register-aws --global (isolated config): BSD grep exit 0, GNU grep 3.12 exit 0
  • CI at this SHA: all checks green (Build frontend, Playwright Chromium, E2E, pre-commit, Unit/Integration, CI Success); mergeStateStatus CLEAN. Labels mirror fix(ladder): timeline shows raw backend values instead of formatted display #697; body has Closes #697.

Non-blocking follow-ups (no change requested)

  1. formatLadderAmount('0.000040') renders $0.0000/hr (non-zero below $0.00005/hr still reads as zero); 0.999990 renders $1.0000/hr. Negligible real-world amounts.
  2. Chart legend still shows the raw layer code (compute-sp (USD/hour)); PR2 (fix(ladder): timeline chart is a scatter and never shows cumulative commitment #698) rewrites the chart.
  3. Edit-reason text interpolates raw run/tranche status (e.g. Run is awaiting_approval.).

@cristim
cristim merged commit 1372057 into main Oct 12, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/many Affects most users priority/p2 Backlog-worthy severity/high Significant harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ladder): timeline shows raw backend values instead of formatted display

1 participant