Commit 20d57dd
feat: Add dynamic upper bound for speed test gauge based on historical data (#628)
* docs: Add UI Kit Library principle and translate constitution to English
- Add Article XIV: UI Kit Library Principle with mandatory UI component usage rules
- Translate all remaining Chinese content in constitution.md to English
- Update "Last Amended" date to 2026-02-11
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: Add implement-feature-with-checks skill for automated constitution compliance
Create new Claude Code skill that automatically enforces project constitution principles during feature implementation.
Key features:
- Requirements clarity check before implementation starts
- Integrates with brainstorming skill for unclear requirements
- Enforces UI Kit Library usage with component verification
- Mandates test coverage (Service ≥90%, Provider ≥85%, Overall ≥80%)
- Automates testing execution (unit tests + screenshot tests)
- Runs code formatting (dart format) and analysis (flutter analyze)
- Validates architecture compliance (layer separation, error handling)
- Provides decision trees and examples for common scenarios
The skill automatically triggers on keywords like 實作, 創建, 新增, 開發, 修改, 重構, 修正, etc., ensuring consistent adherence to constitution without manual reminders.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: Add dynamic upper bound for speed test gauge based on historical data
The speed test gauge now automatically adjusts its upper limit based on
historical test results, providing better visualization across different
network speed ranges.
Changes:
- Add helper methods to calculate maximum historical speed and round to
nearest hundred
- Generate appropriate markers dynamically based on the upper bound
- Update meterView and _startButton to use dynamic markers instead of
fixed 100 Mbps limit
Behavior:
- No history: defaults to 100 Mbps (maintains backward compatibility)
- With history: uses maximum speed from history, rounded up to nearest
hundred (e.g., 345 Mbps → 400 Mbps upper bound)
- Markers are distributed appropriately for different speed ranges
(100-200, 200-500, 500-1000, 1000+ Mbps)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: Ensure gauge markers stay sorted and within upper bound (#624)
Fix marker generation bug in _generateMarkers for 500-1000 Mbps range.
Previously, when upperBound was less than 750 (e.g., 600 or 700), the
method unconditionally added 750 marker, resulting in unsorted list
that exceeded the upper bound.
Changes:
- Add conditional check before adding 750 marker (only if upperBound >= 750)
- Ensure markers list maintains ascending order
- Ensure all markers stay within upperBound
Before: upperBound=600 → [0, 100, 200, 300, 400, 500, 750, 600] (unsorted)
After: upperBound=600 → [0, 100, 200, 300, 400, 500, 600] (sorted)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: Extract gauge calculation logic to SpeedTestGaugeUtils
Extract the 4 gauge calculation methods from SpeedTestWidget into a
reusable SpeedTestGaugeUtils class with comprehensive unit tests.
Changes:
- Create SpeedTestGaugeUtils class with 4 static methods:
- calculateMaxHistoricalSpeed(): Find max speed from history
- roundUpToHundred(): Round up to nearest hundred
- calculateGaugeUpperBound(): Calculate dynamic upper bound
- generateMarkers(): Generate appropriate markers for different ranges
- Add 39 comprehensive unit tests covering all edge cases
- Refactor SpeedTestWidget to use the new utils class
- Remove 4 private methods from SpeedTestWidget (130 lines)
Benefits:
- Improved testability: 100% test coverage for calculation logic
- Better code organization: Follows project pattern (feature/utils/)
- Reusability: Utils can be used in other contexts
- Maintainability: Centralized logic with clear documentation
Testing:
- All 39 utils tests pass
- All 23 existing health_check tests pass (regression)
- Static analysis clean
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent a98fc8f commit 20d57dd
3 files changed
Lines changed: 785 additions & 15 deletions
File tree
- lib/page/health_check
- utils
- test/page/health_check/utils
Lines changed: 17 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
226 | 234 | | |
227 | 235 | | |
228 | 236 | | |
| |||
237 | 245 | | |
238 | 246 | | |
239 | 247 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 248 | + | |
254 | 249 | | |
255 | 250 | | |
256 | 251 | | |
| |||
540 | 535 | | |
541 | 536 | | |
542 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
543 | 545 | | |
544 | 546 | | |
545 | 547 | | |
546 | 548 | | |
547 | | - | |
| 549 | + | |
548 | 550 | | |
549 | 551 | | |
550 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
0 commit comments