Skip to content

Fix stale preindexed package details#30

Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits into
masterfrom
mamoreau-devolutions/fix-stale-details
Jun 1, 2026
Merged

Fix stale preindexed package details#30
Gabriel Dufresne (GabrielDuf) merged 2 commits into
masterfrom
mamoreau-devolutions/fix-stale-details

Conversation

@mamoreau-devolutions
Copy link
Copy Markdown
Contributor

Summary

Fixes stale WinGet package details for explicit version/channel requests in both the C# and Rust implementations.

  • Stops explicit version requests from silently falling back to the latest available manifest when the requested version is missing.
  • Adds bounded pre-indexed source refresh/retry behavior for explicit version misses so stale local indexes can recover once, then fail clearly if the version is still unavailable.
  • Adds pre-indexed freshness policy support for existing indexes, with stale-cache fallback for non-explicit/latest requests when refresh fails.
  • Preserves latest-version behavior when no explicit version/channel is requested.
  • Prevents repeated source downloads for a single explicit request after a fresh stale-index refresh already ran.
  • Replaces pre-indexed index.db through a temporary file in both implementations to avoid partially written active indexes.
  • Handles V2 pre-indexed channel requests explicitly instead of ignoring unavailable channel metadata.

C# changes

  • Added RepositoryOptions.PreIndexedSourceAutoUpdateInterval and MissingPackageVersionException.
  • Updated V1, V2, and REST version selection to require exact explicit version/channel matches.
  • Added pre-indexed TTL refresh, refresh attempt tracking, per-source refresh locking, diagnostics, and refresh-on-explicit-miss retry.
  • Uses read-only SQLite with Pooling=False for pre-indexed reads so refresh replacement is safe on Windows.
  • Added tests for strict version selection, REST misses, stale index refresh, stale fallback, refresh failure recovery, no double-refresh, and V2 channel rejection.

Rust changes

  • Added RepositoryOptions.pre_indexed_source_auto_update_interval with builder support.
  • Added strict V1/V2/REST version selection and a focused missing-version error.
  • Added pre-indexed TTL refresh, bounded explicit-miss refresh/retry, recent refresh throttling, per-source refresh locks, and safe temp-file index replacement.
  • Added an in-process fake pre-indexed source regression harness covering cache/indexing behavior end-to-end.
  • Added tests for explicit miss refresh, still-missing failures, TTL refresh, stale fallback, no double-refresh, and exact/channel selectors.

Validation

  • dotnet format dotnet\Devolutions.Pinget.slnx --verbosity minimal
  • dotnet test dotnet\src\Devolutions.Pinget.Core.Tests\Devolutions.Pinget.Core.Tests.csproj -c Release --no-restore — 180 total, 179 passed, 1 skipped
  • dotnet build dotnet\Devolutions.Pinget.slnx -c Release --no-restore
  • pwsh -NoLogo -NoProfile -File (Resolve-Path 'dotnet\tests\RunTests.ps1') — 13 passed
  • cargo +nightly fmt --manifest-path rust\Cargo.toml --all
  • cargo clippy -q --manifest-path rust\Cargo.toml --workspace --tests -- -D warnings
  • cargo test -p pinget-core --manifest-path rust\Cargo.toml — 151 passed
  • cargo test -p pinget-cli --manifest-path rust\Cargo.toml — 9 passed
  • cargo build -p pinget-cli --manifest-path rust\Cargo.toml
  • git --no-pager diff --check

Ensure explicit version and channel requests do not silently fall back to latest manifests. Refresh stale pre-indexed indexes on bounded explicit misses and add cache freshness coverage for C# and Rust.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify downloaded pre-indexed cache files before persisting them and replace Rust source indexes without deleting the existing fallback first.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit ef2cc0d into master Jun 1, 2026
13 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the mamoreau-devolutions/fix-stale-details branch June 1, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants