fix: measure upload and latency without server timing - #4
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe Cloudflare client now records successful request-write time. Upload measurement uses this timing when available. Latency measurement falls back to validated client timing. Tests cover delayed transmission, delayed first-byte receipt, and fallback warnings. ChangesCloudflare timing measurement
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/cloudflare/measure.go`:
- Around line 65-70: Validate serverTiming immediately after ParseServerTiming
in the measurement flow: if it is NaN, infinite, or negative, return
clientDuration with no error. Preserve the existing parse-error fallback and
only calculate dur after the parsed timing passes these checks.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cc9dc6be-a42a-48ff-9c52-e1c845647b0a
📒 Files selected for processing (5)
internal/cloudflare/client.gointernal/cloudflare/client_test.gointernal/cloudflare/measure.gointernal/cloudflare/types.gointernal/cloudflare/upload_test.go
Summary
cfRequestDurationis absent.Root cause
Cloudflare's current speed-test responses no longer include the
cfRequestDurationserver-timing entry that the CLI treated as required for latency and upload calculations. The CLI therefore rejected all unloaded latency samples and could report an upload value of0.00 Mbps.Validation
go test ./...(70 tests passed)go vet ./...go mod verifygo build -trimpath -ldflags='-s -w' -o dist/unispeedtest ./cmd/unispeedtest-jsonrun completed with positive upload throughput (2558.96 Mbps) and valid JSON output.Summary by CodeRabbit