Skip to content

Keep the latency dot in one column for measured rows - #9216

Merged
myleshorton merged 1 commit into
mainfrom
fisk/latency-dot-alignment
Oct 24, 2026
Merged

myleshorton merged 1 commit into
mainfrom
fisk/latency-dot-alignment

Conversation

@myleshorton

@myleshorton myleshorton commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #9215: with the chevron slot fixed, the status dots still scatter horizontally because the latency label's width varies — 1347 ms is wider than 61 ms, and the dot sits to its left.

Two root causes, both verified:

  • Urbanist ships no tnum OpenType feature (checked the font's GSUB/GPOS tables: ccmp, frac, kern, mark, mkmk only), so LatencyIndicator's existing FontFeature.tabularFigures() request is silently inert and even same-digit-count labels can vary.
  • Latencies span 2–4 digits, which no tabular-figures setting could equalize anyway.

Fix: for measured labels, lay out an invisible widest-case 8888 ms template behind the end-aligned real label (same Visibility(maintainSize) idiom as #9215's ChevronPlaceholder). The label block's width is now constant for the current text style and scale factor, so the dot column is stable — with any font, any locale, and no hardcoded pixel width. If a label ever exceeds the template (5-digit latency), the Stack grows instead of clipping. Testing…/Unreachable labels keep their natural width: they're exceptional states and reserving Unreachable's width on every row would push all dots far left.

Testing

  • New widget test: a 2-digit and a 4-digit measured label render the indicator at identical width (fails without the fix — the glyph counts differ even in the test font).
  • test/features/vpn/: 39/39; full flutter test: 534/534; analyzer clean on the changed files.
  • Font claim verified against the Urbanist woff2 served by Google Fonts (fontTools feature dump).

Risk

  • UI-only, single widget. Riskiest aspect: the invisible template renders one extra Text per measured row — negligible, and excluded from semantics/hit-testing by Visibility(visible: false).

How to revert

Revert the commit; no state to undo.

Pre-PR review (local Codex gate)

  • Rounds: 1 — final: round=1 range=origin/main...HEAD CODEX GATE: verdict=approve critical=0 important=0 minor=0 preexisting=0 reviewed=9
  • Reviewed at: 081245bc1
  • Exit: approve (the gate read the callers — server rows, single-city tile, smart-location tile — plus the Right-align latency labels on rows without a chevron #9215 chevron code, AppTile, and the text styles, with RTL, text-scale, and 5-digit cases in the prompt)
  • Step back: not needed
  • Fixed: none
  • Dismissed: none
  • Pre-existing (not introduced here, worth filing): none

🤖 Generated with Claude Code

https://claude.ai/code/session_01UG31BsLYqwPyN5StFB7RNN

Summary by CodeRabbit

  • UI Improvements
    • Measured latency labels now occupy a consistent width, regardless of the number of digits displayed. Testing and unreachable status labels remain unchanged.
  • Tests
    • Added coverage confirming that measured latency values with different digit counts render at the same width.

Urbanist ships no tnum feature, so the tabularFigures request in
LatencyIndicator is inert and 2- to 4-digit latencies gave every row a
different label width, scattering the dots horizontally. Lay out an
invisible widest-case '8888 ms' template behind the end-aligned label
so the block's width is constant in the current style and text scale.
Testing and unreachable labels keep their natural width.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UG31BsLYqwPyN5StFB7RNN
Copilot AI balanced review requested due to automatic review settings October 23, 2026 23:59
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30ad02af-11b7-45a5-9477-d0b631e10866
📥 Commits

Reviewing files that changed from the base of the PR and between 2af3e9c and 081245b.

📒 Files selected for processing: 2
  • lib/features/vpn/latency_indicator.dart
  • test/features/vpn/latency_indicator_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Measured latency labels now use an invisible 8888 ms template to maintain their layout width. The row renders the label widget, and a widget test checks that two- and four-digit measured values occupy the same width.

Changes: Latency label layout

Layer / File(s) Summary
Measured label width
lib/features/vpn/latency_indicator.dart, test/features/vpn/latency_indicator_test.dart
Measured latency labels are overlaid on an invisible 8888 ms template. Other statuses remain plain text. The row renders the label widget, and a widget test compares the widths for 61 ms and 1347 ms.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related issues

  • getlantern/engineering#4052: The issue covers latency values and status labels on server-location rows; this change adjusts the measured latency label layout.

Possibly related PRs

Merge Risk: ⚪ Minimal · up to 08124

No actionable merge-blocking risk is established by the supplied review evidence.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Keep the latency dot in one column for measured rows" matches the main change. The PR puts an invisible 8888 ms template behind measured latency labels so the status dot stays in one colu…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Keep the latency dot in one column for measured rows" matches the main change. The PR puts an invisible 8888 ms template behind measured latency labels so the status dot stays in one column despite varying label widths. The objectives and the widget test (61 ms vs 1347 ms same width) support this. The title is specific and does not use vague terms.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI 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.

🟢 Approved

The localized layout change includes a focused regression test, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Stabilizes the latency-dot column for measured server rows, complementing #9215’s chevron alignment fix.

Changes:

  • Reserves label width with an invisible 8888 ms template while allowing longer labels to expand.
  • Preserves natural widths for testing and unreachable states.
  • Adds a regression test comparing indicator widths for two- and four-digit measurements.
File Description
test/​features/​vpn/​latency_indicator_test.dart Verifies equal indicator widths across different measured digit counts.
lib/​features/​vpn/​latency_indicator.dart Reserves consistent measured-label width and end-aligns the visible text.

Review effort: Balanced

@myleshorton
myleshorton merged commit 82eb0f7 into main Oct 24, 2026
18 checks passed
@myleshorton
myleshorton deleted the fisk/latency-dot-alignment branch October 24, 2026 00:13
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.

2 participants