Repository navigation
drive ppm vulnerability display off the session repositories, not env vars - #17822
Conversation
… vars
Vulnerability badges in the Packages pane are intentionally not opt-in: they
should appear whenever the session is using a Posit Package Manager repository
(a PPM URL in getOption("repos")), including open-source / desktop RStudio. This
was made an explicit decision in 88778df "always try to provide vuln info if
available", which removed an env-var gate that had been applied incidentally.
The async rewrite in #17808 reintroduced that gate, adding isPpmIntegrationEnabled()
early-returns to both refreshVulnerabilitiesAsync() (C++) and
getVulnerabilityRequestPlan() (R). isPpmIntegrationEnabled() requires the
Workbench-injected PWB_PPM_* env vars, so any session that points options(repos)
at PPM by hand (without Workbench PPM integration configured) stopped showing
vulnerability badges entirely.
Remove both gates so enablement is once again driven by repository detection,
keeping the env-var gate only for the Workbench-only metadata column. Add a
cheap PPM-URL pre-filter so installed.packages() is still skipped for non-PPM
sessions, and add comments recording the motivation.
Code Review SummaryA focused, well-reasoned regression fix. Core logic is correct and the non-PPM empty-plan / no-network behavior checks out. No critical issues. Important Issues (1)1. The real isPpmRepo <- vapply(repos, function(url) {
length(.rs.ppm.fromRepositoryUrl(url)) > 0L
}, logical(1))This isn't introduced here -- the per-repo loop below already had it -- but it previously ran only after the now-removed is.character(url) && !is.na(url) && length(.rs.ppm.fromRepositoryUrl(url)) > 0LLow-frequency, but the fix is small and belongs with the change that widened the path. Suggestions (5)2. Add a mixed PPM + non-PPM repo test -- 3. Assert the 4. 5. C++ gate removal is untested -- 6. Comment slightly overstates the gate's scope -- Notes
|
gtritchie
left a comment
There was a problem hiding this comment.
Overall LGTM! One small tweak suggested by the AI that seems worth making if correct.
- guard .rs.ppm.fromRepositoryUrl against non-string/NA repo entries so an
NA in getOption("repos") no longer aborts the now-unconditional vuln plan
- soften the integration-gate comment (the env-var gate also feeds
ppm_integration_enabled in client session info)
- add tests: mixed PPM/non-PPM repos, installed.packages() skip for non-PPM
sessions, NA repo tolerance, and direct fromRepositoryUrl coverage
Intent
Fixes a regression introduced by #17808. That PR moved the PPM vulnerability download off the R main thread (addressing the startup delay in #17807), but in the rewrite it reintroduced an
isPpmIntegrationEnabled()gate on the vulnerability path -- in bothrefreshVulnerabilitiesAsync()(C++) andgetVulnerabilityRequestPlan()(R).isPpmIntegrationEnabled()is satisfied only by the Workbench-injectedPWB_PPM_*environment variables. So any session that pointsoptions(repos)at a Posit Package Manager instance by hand -- without Workbench PPM integration configured -- stopped showing vulnerability badges in the Packages pane entirely.Vulnerability display is intentionally not opt-in. This was made an explicit decision in
88778df845("always try to provide vuln info if available"), which removed an env-var gate that had been applied incidentally when the metadata column landed. The user-facing documentation also describes vulnerabilities as appearing "when the R session has been configured to use Posit Package Manager" (including the public P3M instance), not as a Workbench-gated feature. The env-var gate is meant only for the Workbench-only metadata column.Changes
SessionPPM.cpp: remove theisPpmIntegrationEnabled()early-return inrefreshVulnerabilitiesAsync().SessionPPM.R: remove theisIntegrationEnabled()gate at the top ofgetVulnerabilityRequestPlan(); enablement is again driven by detecting a PPM URL ingetOption("repos")(the per-repofromRepositoryUrlcheck already in the loop). A cheap PPM-URL pre-filter is added soinstalled.packages()is still skipped for non-PPM sessions.88778df845reference) so this isn't re-broken.test-ppm.R: replace the now-obsolete "returns nothing when integration is disabled" test with a regression guard ("ignores the integration-enabled flag") that builds a plan for a PPM repo even when integration reports disabled; drop the now-deadisIntegrationEnabled()=TRUEmocks from the other plan tests.The metadata column remains gated by
isPpmMetadataColumnEnabled()exactly as before.Testing
cmake --build . --target rsession-- compiles and links cleanly.rstudio-tests --scope r --filter ppm--[ FAIL 0 | WARN 0 | SKIP 0 | PASS 69 ].rstudio-tests --scope rsession --filter ppm-- 231 passed, 0 failed.Notes
NEWS.mdentry: the regression existed only in2026.06.0dailies (reintroduced by move PPM vulnerability download off the R main thread #17808 on 2026-06-01), never in a shipped release.rstudio-ide-automationrepo): vulnerability badges are delivered asynchronously, so the QA Playwright assertion on the badge should use a generous explicit timeout rather than the Playwright default.