Skip to content

Force a live outdated recompute when the Packages pane Refresh button is clicked#14918

Open
juliasilge wants to merge 2 commits into
mainfrom
bugfix/packages-pane-live-recompute
Open

Force a live outdated recompute when the Packages pane Refresh button is clicked#14918
juliasilge wants to merge 2 commits into
mainfrom
bugfix/packages-pane-live-recompute

Conversation

@juliasilge

Copy link
Copy Markdown
Member

Addresses to #14294 (together with posit-dev/ark#1351)

The Packages pane persists outdated-package state to an on-disk cache so update indicators can render immediately on a warm start. The toolbar Refresh button reused that cache so that within the freshness window (default 24h) it re-rendered the cached indicators instead of recomputing, so an explicit Refresh could keep showing stale "outdated" flags that no longer matched the environment. Only the less-discoverable "Refresh Metadata" command forced a live recompute.

This makes the user-initiated Refresh authoritative. It now always recomputes outdated state live for every package, bypassing the freshness window, while automatic warm-start refreshes (on session attach) keep using the fast cached path. A forced recompute overwrites stale outdated: true entries with the current result, so clicking Refresh reliably clears indicators that no longer apply.

This is the Positron half of #14294. The complementary Ark change (posit-dev/ark#1351) stops pkg_outdated from flagging same-version packages that were merely rebuilt under a new R minor, which was the original trigger for the inflated counts.

Release Notes

New Features

  • N/A

Bug Fixes

Validation Steps

@:packages-pane

The bug only surfaces when the cache disagrees with reality while installed versions stay fixed, so the reliable way to exercise it is to change the configured repositories (the cache is keyed on the interpreter, not the repos) and confirm the pane tracks a live old.packages() after Refresh. It's pretty fiddly!

  1. Start an R session and point at a snapshot recent enough that most installed packages are current:

    options(repos = c(CRAN = "https://packagemanager.posit.co/cran/latest"))
  2. Open the Packages pane, click the Refresh button, and note the outdated count. Confirm it matches ground truth from the console:

    nrow(old.packages())
  3. Without reinstalling anything, point at an older dated snapshot so some installed versions are now behind:

    options(repos = c(CRAN = "https://packagemanager.posit.co/cran/2024-06-01"))
  4. Click Refresh again. The pane's outdated indicators should update to match the new nrow(old.packages()), even though only the repos changed. Before this fix, within the freshness window the pane would keep showing the step-2 result from the cache.

The Python equivalent is the same shape: install a package pinned below its latest version (pip install "requests<2.31"), Refresh so the pane caches it as outdated, upgrade it in the console (pip install -U requests), and confirm Refresh clears the indicator to match pip list --outdated.

@github-actions

Copy link
Copy Markdown

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:packages-pane

Why these tags?
Tag Source
@:critical Always runs (required)
@:packages-pane PR description

More on automatic tags from changed files.

readme  valid tags

@juliasilge juliasilge marked this pull request as ready for review July 16, 2026 18:12
@juliasilge juliasilge requested a review from bricestacey July 16, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant