Skip to content

Serve NuGet sources that are local folders or network shares - #5435

Merged
Gabriel Dufresne (GabrielDuf) merged 6 commits into
mainfrom
fix/5426-nuget-local-folder-feeds
Sep 28, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 6 commits into
mainfrom
fix/5426-nuget-local-folder-feeds

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request adds comprehensive support for local folder-based NuGet feeds throughout the codebase. It introduces detection and handling for local folder feeds, allowing package search, details, updates, icons, and versions to be retrieved directly from disk, bypassing HTTP requests. Additionally, there are improvements to Chocolatey source parsing and small utility enhancements.

Local NuGet feed support:

  • Added detection for local folder feeds by checking if the source URL uses the file scheme; these feeds are now handled by NuGetLocalFeed and scanned up to three directories deep for packages.
  • Updated BaseNuGet and BaseNuGetDetailsHelper to support searching, retrieving package details, updates, available versions, and icons directly from local folder feeds. This includes new helper methods for local feed enumeration, manifest parsing, and dependency extraction. [1] [2] [3] [4] [5] [6] [7] [8]

Chocolatey source parsing improvements:

  • Improved parsing of Chocolatey sources to correctly handle and strip the "(Authenticated)" marker and robustly extract the source URL, preventing issues with authenticated feeds. [1] [2] [3] [4]

Utilities and bug fixes:

  • Enhanced Tools.GetFileSizeAsLong and Tools.GetFileName to handle file:// URLs, allowing local file size and name retrieval without HTTP requests. [1] [2]

These changes ensure seamless integration of local folder NuGet feeds, improving performance and reliability when working with packages stored on disk.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical file-copy and manifest-parsing risks remain, alongside multiple functional and performance issues in local-feed handling.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)
What changed in this PR

Adds local-folder and network-share support for NuGet feeds, including package discovery, metadata, updates, versions, icons, downloads, and improved Chocolatey source parsing.

Changes:

  • Adds local .nupkg enumeration, caching, and manifest parsing.
  • Integrates local feeds into NuGet search, details, updates, versions, icons, and downloads.
  • Improves Chocolatey source parsing, file-URI utilities, tests, fixtures, and documentation.
File Description
src/​UniGetUI.PackageEngine.Tests/​NuGetLocalFeedTests.cs Tests local NuGet feed behavior.
src/​UniGetUI.PackageEngine.Tests/​Infrastructure/​Builders/​LocalNuGetFeedBuilder.cs Builds temporary local-feed packages for tests.
src/​UniGetUI.PackageEngine.Tests/​Fixtures/​Chocolatey/​source-list-output.txt Adds local and authenticated Chocolatey source fixtures.
src/​UniGetUI.PackageEngine.Tests/​DownloadOperationProgressTests.cs Tests local installer copying.
src/​UniGetUI.PackageEngine.Tests/​ChocolateyManagerTests.cs Tests Chocolatey source parsing and local searches.
src/​UniGetUI.PackageEngine.Operations/​DownloadOperation.cs Copies file-based installers directly; requires a same-file guard.
src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​Internal/​NuGetLocalFeed.cs Implements local package discovery, caching, and metadata parsing; has security, performance, icon, cache-key, and symbol-package issues.
src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​BaseNuGetDetailsHelper.cs Loads local metadata, icons, and versions; embedded icons and Chocolatey local versions remain unsupported.
src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​BaseNuGet.cs Adds local search and updates; PowerShell source parsing does not reliably preserve local or UNC paths.
src/​UniGetUI.PackageEngine.Managers.Chocolatey/​Helpers/​ChocolateySourceHelper.cs Improves authenticated and filesystem source parsing.
src/​UniGetUI.Core.Tools/​Tools.cs Adds file-URI size and filename handling.
AGENTS.md Documents local-feed behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Multiple moderate issues remain in source discovery, update filtering, icon handling and caching, path cache keys, and symbol-package exclusion.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Medium severity PowerShell managers cannot dispatch local or UNC NuGet feeds

src/​UniGetUI.PackageEngine.Managers.Generic.NuGet/​BaseNuGet.cs:124

This dispatch is unreachable for local repositories exposed by the two PowerShell managers. PowerShell7SourceHelper.cs:112-120 accepts only URLs matching https?://, while PowerShellSourceHelper.cs:104-112 truncates a filesystem location at its first space. Consequently, local/UNC feeds (including paths like C:\Shared Packages) cannot be searched through those NuGet-backed managers. Please emit a structured or explicitly delimited repository listing and preserve the complete location in both source helpers.

The extracted icon was named after the package version alone, inside a
directory keyed on the manager and the package id. Two local sources
carrying the same id and version - a staging share and a production share,
say - therefore resolved to one file, and whichever was read first won:
the second source was served the first one's icon, because the extracted
file is newer than the .nupkg it is compared against.

The same comparison had a second hole. It accepted the cached file whenever
it was at least as new as the archive, so a package replaced by one with an
older timestamp, as a restore from a backup or a copy that preserves times
produces, kept serving the previous icon.

The file name now carries a digest of the archive's path, write time and
size, so its existence alone answers both questions and the timestamp
comparison is gone: a second source cannot land on the same name, and a
package that changed in either direction gets a new one.

NuGetLocalFeedTests also ran without a data directory override, so icon
extraction wrote into the real per-user cache. It now redirects
CoreData.TEST_DataDirectoryOverride like the other manager tests.

Raised by Copilot on #5435. Both tests were checked against the unfixed
code: the two-source test fails with the icons resolving to one path, and
the replaced-package test fails with the stale bytes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A critical unsafe local-file copy path and several moderate correctness and cache issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)
Resolved since last review (1)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Generic file-size resolution permits remote metadata to trigger unsafe UNC access, and replaced package icons remain stale in the outer cache.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (4)

Comment thread src/UniGetUI.Core.Tools/Tools.cs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Cache-clearing in the test helpers prevents the replacement tests from exercising production cache freshness.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Previously missed (2)

In code that hasn't changed since last review

Low severity Avoid clearing manifest cache after writes in replacement test

src/​UniGetUI.PackageEngine.Tests/​Infrastructure/​Builders/​LocalNuGetFeedBuilder.cs:78

This clears the production manifest cache after every test write, so FindPackagesPicksUpAPackageFileThatWasReplaced starts its second lookup with an empty cache and cannot catch broken size/write-time invalidation. Keep the constructor clear for test isolation, but do not clear after writes so the replacement test exercises the cached path.

Low severity Test backward timestamp invalidation without clearing parsed package cache

src/​UniGetUI.PackageEngine.Tests/​NuGetLocalFeedTests.cs:510

Clearing ParsedPackages immediately before the second lookup means this test does not verify that an archive whose timestamp moves backward is re-read in production. Remove the clear (together with the builder's per-write clear) so the assertion exercises cache freshness rather than an empty cache.

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "f7278990-bb4f-11f1-897e-ddfbcc242701",
	"headSha": "c970592c978834c7955de797bc58aa819f93f04e",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 0f1c2ce into main Sep 28, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/5426-nuget-local-folder-feeds branch September 28, 2026 15:42
Maxime Forest (forestmaxime) added a commit that referenced this pull request Sep 28, 2026
…notification per run

The Add source prompt for Chocolatey, PowerShell, PowerShell7 and .NET Tool now
asks for a URL or a folder (local path or network share), matching #5435.

A running operation reports Canceled twice (Cancel() and again when the run
winds down), so the registry now shows "Operation canceled" once per run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Marc-André Moreau (mamoreau-devolutions) pushed a commit that referenced this pull request Oct 5, 2026
…notification per run

The Add source prompt for Chocolatey, PowerShell, PowerShell7 and .NET Tool now
asks for a URL or a folder (local path or network share), matching #5435.

A running operation reports Canceled twice (Cancel() and again when the run
winds down), so the registry now shows "Operation canceled" once per run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Marc-André Moreau (mamoreau-devolutions) added a commit that referenced this pull request Oct 6, 2026
* Add the UniGetUI terminal UI (TUI)

A Consolonia (Avalonia 12 in the console) front-end for the UniGetUI engine,
in src/UniGetUI.Tui, with feature parity with the desktop app and end-to-end
tests on fake data. See docs/TUI.md.

- Pages: Discover, Updates, Installed, Bundles, Operations, Managers,
  Settings (with search), Logs and History as numbered tabs; Help (F1) and
  About as dialogs. Code-only UI, dialogs as in-window overlays.
- Layout: framed page header with Mode / Sources / Sort chips (clickable; F3
  for the search mode), split details / actions panel, function-key bar.
- Keyboard: Alt+letter menu bar, Alt+1-9 / Ctrl+Tab pages, focus always in
  the page; AltGr text and ConPTY clipboard fixes.
- Themes: 16 colour themes switchable live and saved (TuiTheme setting,
  --theme); Devolutions Graphite (default), Black, Light, Dark Blue, Blue, Gray
  and High contrast follow the RDM colour tokens; WCAG contrast is tested.
- Fake data mode (--fake-data): sandboxed data, fake package managers backed
  by a JSON state file, fake elevator, downloads and cloud backup; nothing real
  is installed. Consolonia.NUnit E2E tests drive the real UI with it.
- Release publishes are NativeAOT (about 3x faster startup than ReadyToRun):
  compiled grid bindings, Consolonia kept untrimmed, no Skia, translations and
  data embedded (new BundledAssets helper in UniGetUI.Core.Data, disk first).
  The publish is UniGetUI.Tui.exe, e_sqlite3.dll, the WinGet .winmd and the
  PowerShell operation launcher.
- Scoop install / uninstall / cleanup run as TUI operations instead of the
  desktop app's .cmd scripts.
- Pin SQLitePCLRaw.bundle_e_sqlite3 2.1.13 in the WinGet manager to fix
  GHSA-2m69-gcr7-jv3q (CVE-2025-6965); remove once Pinget.Core moves up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* TUI: accept folder sources for NuGet-based managers, show one cancel notification per run

The Add source prompt for Chocolatey, PowerShell, PowerShell7 and .NET Tool now
asks for a URL or a folder (local path or network share), matching #5435.

A running operation reports Canceled twice (Cancel() and again when the run
winds down), so the registry now shows "Operation canceled" once per run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* TUI: pass the fake state JSON type info through a typeInfo field

MetaTests.TestJsonSerializationOptions counts trim-safe metadata per line, and
the calls using FakeStateJsonContext.Default.FakeState directly didn't match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Update TUI for Consolonia 12.0.3.14 and rebased bundle imports

Use Consolonia's NativeAOT fixes without whole-assembly roots, adapt its per-test NUnit lifecycle, and require review before importing high-risk bundles after the mainline security-report changes.

Co-authored-by: Copilot App <[email protected]>

* Embed terminal UI in the main UniGetUI executable

Host the TUI as a main-executable command, preserve fake-data subprocesses and installer guards, harden CLI parsing and secure settings, and document blocking PowerShell launch. Add main-host regressions and remove build numbers from TUI version displays.

Co-authored-by: Copilot App <[email protected]>

* Fix terminal UI review findings and document installed usage

Correct proxy handling, OAuth polling, selected paste, operation history and batch summaries, pending-operation roles, repair failures, and localized help. Add deterministic regression coverage and a user-oriented terminal guide.

Co-authored-by: Copilot App <[email protected]>

* Fix TUI import ordering for CI

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Marc-André Moreau <[email protected]>
Co-authored-by: Copilot App <[email protected]>
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