fix(speedtest,portal): CodeRabbit Majors from #525 + wins_ref skip - #534
Conversation
- disconnect the provider when the run is cancelled while creating the scratch directory: connect() already succeeded at that point and every other post-connect error path disconnects (pin: cancel_after_connect_disconnects_provider) - reject descendants of public web document roots, not just exact roots: prefix match on a path-component boundary plus per-segment match for public_html/htdocs/wwwroot/www; false friends like /var/www-data stay allowed (extended pin: public_web_document_roots_are_rejected)
When the case 1 (cancel) session fails its precondition, its windows-after.txt is never written and count_lines quietly reads it as 0, turning a missing baseline into a chooser-shaped FAIL on the noportal case. Missing baseline is a skip, same contract as the #521 cascade-stop (CodeRabbit Minor from #525).
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Warning Review limit reached
Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe speedtest flow now disconnects providers after post-connect cancellation, and public document-root detection uses path-component boundaries with expanded tests. The portal chooser test now handles missing window-count baselines explicitly. ChangesSpeedtest safeguards
Portal chooser assertion
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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 `@src-tauri/src/speedtest.rs`:
- Around line 803-833: Normalize dot and dot-dot path components in
validate_remote_dir_for_speedtest before calling is_public_web_document_root,
matching the lexical resolution performed by join_remote_path. Ensure normalized
paths such as /tmp/../var/www/html and paths escaping from public_html are
classified by the existing PUBLIC_ROOTS and component checks, while preserving
the current root-boundary behavior.
🪄 Autofix (Beta)
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: d0adf5b5-ee27-4bab-87dc-61453c261cdb
📒 Files selected for processing (2)
src-tauri/src/speedtest.rstests/portal-chooser/portal-chooser-test.sh
CodeRabbit Major on #534: validate_remote_dir_for_speedtest classified the raw user string, so /tmp/../var/www/html bypassed the public document root rejection even though providers resolve .. server-side. Apply lexical ./.. resolution inside is_public_web_document_root before the prefix and component checks; pin extended with escaping and benign normalization cases.
Follow-up to #525 (merged as aabde69), closing the 2 Major and 1 portal Minor CodeRabbit findings.
Major: speedtest disconnect on cancel after connect
speedtest.rs: the cancel branch on scratch-dir creation returned without disconnecting, whileconnect()had already succeeded and every other post-connect error path disconnects. Now it disconnects before returning.Pin:
cancel_after_connect_disconnects_provider(structure pin, fails if the disconnect is removed).Major: reject descendants of public web document roots
is_public_web_document_rootonly matched exact roots and trailing suffixes, so/var/www/html/uploadsor/home/alice/public_html/benchpassed validation while being web-servable. Now: prefix match on a path-component boundary for the known roots, plus per-segment match forpublic_html/htdocs/wwwroot/www. False friends like/var/www-datastay allowed.Pin: extended
public_web_document_roots_are_rejectedwith descendant cases and false friends.Minor: portal wins_ref when case 1 failed
tests/portal-chooser/portal-chooser-test.sh: when the case 1 session fails its precondition,windows-after.txtis never written andcount_linesread it as 0, turning a missing baseline into a chooser-shaped FAIL. Missing baseline is now a skip, same contract as the #521 cascade-stop.Gates
cargo test --lib speedtest::27/27cargo clippy --lib -- -D warningsclean,cargo fmt --checkcleantests/portal-chooser/selftest-precondition.sh6/6,selftest-portal.sh14/14The 14 i18n Minor findings from #525 are intentionally out of scope here (separate batch via the GLM method).
Summary by CodeRabbit
Bug Fixes
Tests