Revamp NuGet package validation#1071
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
…errors, unknown-package detection Agent-Logs-Url: https://github.com/reqnroll/Reqnroll/sessions/24ab2a7a-4d15-4146-bbad-3f3a81bf9076 Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update validate-packages job for per-package rules and error handling
Revamp NuGet package validation: per-package rule overrides, strict failure mode, and unknown-package detection
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
validate-packagesCI job silently swallowed all validation failures (warning-only, "gradual improvement mode"), applied a single shared exclusion list to every package, and had no mechanism to detect when a new package was introduced without being registered.Changes
ci.yml— Validate NuGet packages stepGet-NupkgIdhelper: reads the.nuspecfrom inside the.nupkgZIP in-memory to get the canonical package ID (filename parsing is unreliable with pre-release version strings)$packageRuleOverrideshashtable: replaces the flat$excludedRulesarray; each key is the NuGet package ID, value is the rules to suppress for that package onlyAssembliesMustBeOptimizedexclusion retained for non-main branches (debug builds in PRs)::warning::→::error::+$errorCount++; any validation issue not explicitly excluded causesexit 1.nupkgis not in the hashtable, emits an error with exact syntax to register it and fails the buildInitial exclusions are derived from actual errors observed in the latest CI run.
PACKAGE_VALIDATION.mdReadmeMustBeSet,XmlDocumentationMustBePresent,Symbols, etc.)Original prompt
Context
The current
validate-packagesjob in.github/workflows/ci.yml(lines 241–304) validates all NuGet packages but has several shortcomings:PACKAGE_VALIDATION.mdlists known error codes (12, 33, 52, 61, 81, 101, 112, 119) that are currently ignored across the board.What needs to change
1. Per-package rule overrides hashtable
Replace the single shared
$excludedRulesarray with an ordered hashtable where the key is the NuGet package ID (not the filename) and the value is an array of rule names to exclude for that specific package.Use the
Get-NupkgIdhelper (reading the.nuspecinside the.nupkgZIP) to map each file to its package ID before looking up overrides.The hashtable should be defined at the top of the script, with one entry per known Reqnroll package. Base the initial set of exclusions on the known current issues from
PACKAGE_VALIDATION.md:AuthorNotSetIconNotFound/IconMustBeSetProjectUrlNotAccessibleReadmeNotSetAssembliesMustBeOptimizedXmlDocumentationNotFoundDeterministicBuildSourceFileNotAccessibleThe known Reqnroll packages to register (from the repo's build output pattern) are:
ReqnrollReqnroll.GeneratorReqnroll.MsTestReqnroll.NUnitReqnroll.xUnitReqnroll.MSBuild.GenerationReqnroll.Tools.MsBuild.GenerationReqnroll.VisualStudio.SpecFlowCompatibility.NuGetPackageLook at the repo's
.csproj/Directory.Build.propsfiles to confirm the full list of packages if needed.The
AssembliesMustBeOptimizedexclusion should still be added globally (not per-package) for non-main branches.2. Validation failures → error, not warning
Change the
elsebranch (when$exitCode -ne 0) from emitting a::warning::to emitting a::error::and incrementing$errorCount. This means the build will fail if any package has validation issues that are not explicitly excluded in the hashtable.Remove the comment about "gradual improvement mode".
3. Unknown packages → clear instruction, then fail
Before running validation for a package, check if its ID exists in
$packageRuleOverrides. If it does not:::error::annotation explaining that the package is unknown.$errorCountandcontinueto the next package.4. Update
PACKAGE_VALIDATION.mdUpdate
PACKAGE_VALIDATION.mdto reflect the new behaviour:Implementation notes
Add-Type -AssemblyName System.IO.Compression.FileSystemand read the.nuspecin-memory (no temp dir) to extract the package ID — exactly as shown in our earlier conversation.$packageRuleOverrideshashtable should use[ordered]@{}for readability.+ | Select-Object -Unique).run: |block inci.yml— do not split into a separate.ps1file.Get-NupkgIdfunction is defined before the loop.Files to change
.github/workflows/ci.yml— replace theValidate NuGet packagesstep script (lines ~254–304)PACKAGE_VALIDATION.md— update documentation to reflect new behaviourThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: Kan in powershell een leesbare dictionary maken zoals in json of yaml?
Assistant: Ja, in PowerShell gebruik je een hashtable als equivalent van een dictionary (zoals JSON of YAML). De syntax is goed leesbaar:
Hashtable (standaard, ongeordend)
Ordered dictionary (behoudt volgorde van keys)
Geneste hashtables (dictionary in dictionary)
Waarden opvragen
...
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.