Conversation
WalkthroughA compile-time conditional in Plot.show was corrected from Changes
Sequence Diagram(s)sequenceDiagram
participant U as User Code
participant P as Plot.show
participant H as PlotlyHandler
participant S as Server
participant B as Browser
U->>P: call show()
alt test build
P-->>U: print "ignored in test"
else normal build
P->>H: init handler
P->>S: start server
P->>B: open URI
P-->>U: wait until close
end
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
where is my comment on this PR? :( more discussion can be found at vlang/v#25150 (comment) |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
plot/show.v (2)
26-29: Respect PlotConfig.use_cdn instead of hard-coding trueThe handler currently ignores the caller’s
use_cdnpreference. Propagateconfig.use_cdnfor consistency withget_html(...)which already honors it.- mut handler := PlotlyHandler{ - use_cdn: true - plot: p - } + mut handler := PlotlyHandler{ + use_cdn: config.use_cdn + plot: p + }
40-44: Avoid leaking the background server/thread on early errorsIf
server.wait_till_running()oros.open_uri(...)fails, the spawnedlisten_and_serve()thread keeps running andshow()returns an error without shutting it down. Wrap both calls withor { ... }to close the server and join the thread before propagating the error.t := spawn server.listen_and_serve() - server.wait_till_running()! - os.open_uri('http://${server.addr}')! - t.wait() + server.wait_till_running() or { + // Ensure cleanup on startup failure + server.close() + t.wait() + return err + } + os.open_uri('http://${server.addr}') or { + // Ensure cleanup if opening the browser fails + server.close() + t.wait() + return err + } + t.wait()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
plot/show.v(1 hunks)
🔇 Additional comments (1)
plot/show.v (1)
23-25: Correct compile-time guard for testsUsing
$if test { ... }is the right way to detect the built-in system define set byv test. This ensuresshow()is inert underv testwithout depending on a user-provided-d test. LGTM.
spytheman
left a comment
There was a problem hiding this comment.
Thank you @kbkpbot.
@ulises-jeremias that coderabbit thing is insanely annoying.
I think it only serves to scare contributors and harms the project.
* 'main' of github.com:vlang/vsl: noise: respect new wyhash v4.2 (#230) prepare for the fix for rand.shuffle in vlang/v#25617 fix warnings for examples/gm_spatial_binning/main.v fix warnings and notices for examples/plot_radar_performance/main.v remove unused `import json` in examples/plot_violin_distributions/main.v fix plot show test mode (#228) add `// vtest retry: 3` to three_d_test.v too, to prevent false positives on the CI of the main V repo add `// vtest retry: 3` to readhdf5_test.v to prevent false positives on the CI of the main V repo
Summary by CodeRabbit