Skip to content

fix(ci): derive package-validation dependency ranges from Directory.Packages.props - #125

Merged
ncipollina merged 1 commit into
mainfrom
fix/122-package-validation-dependency-range-drift
Sep 2, 2026
Merged

fix(ci): derive package-validation dependency ranges from Directory.Packages.props#125
ncipollina merged 1 commit into
mainfrom
fix/122-package-validation-dependency-range-drift

Conversation

@ncipollina

Copy link
Copy Markdown
Contributor

Summary

  • inspect-packed-nupkgs.sh's assert_dependency_range hardcoded each expected third-party dependency range as a literal separate from Directory.Packages.props's PackageVersion, which already states the same policy for MSBuild. Dependabot updates the latter but not the former, so a correctly-packed bump (PR chore: Bump the dotnet-minor-patch group with 3 updates #121's TUnit.Core update) failed validation until manually patched (5cfe446).
  • assert_dependency_range now derives its expected range from Directory.Packages.props itself (via dotnet msbuild -getItem:PackageVersion, SDK-native, plus jq, already a CI dependency) instead of a duplicated string. The validator still independently compares that value against the actually-packed .nuspec — only the duplicated literal is gone.
  • Adds inspect-packed-nupkgs.tests.sh, a dependency-free regression suite proving pass/fail cases including the exact "bump only the props file" scenario from [Bug]: package-validation dependency-range literals drift when Dependabot bumps Directory.Packages.props #122, wired into package-validation.yaml.
  • Amends ADR-0031 (Amendment 4) to record the drift and the fix; Amendment 1's tested-range policy itself is unchanged.

Fixes all five current dependency-range checks structurally: Compono.XunitV3, Compono.NSubstitute, Compono.Bogus, Compono.TUnit, Compono.MSTest.

Closes #122

Test plan

  • dotnet build Compono.slnx — clean
  • dotnet test Compono.slnx -f net10.0 — 976/976 passed
  • .github/scripts/inspect-packed-nupkgs.tests.sh — all regression cases pass (matching range, mismatched range, bump-only-props-file, bump-with-stale-nuspec, missing-authoritative-entry diagnostic, real-repo sanity check)
  • Packed all ten publishable packages and ran inspect-packed-nupkgs.sh against real output — all five dependency-range checks pass, reading Directory.Packages.props directly
  • Simulated the Dependabot scenario: bumped TUnit.Core in Directory.Packages.props only (to [1.65.68, 2.0.0)), repacked Compono.TUnit, ran the validator without touching the script — passed. Reverted the bump and repacked back to the original range — passed again.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GMQEjFrUVGYkctE3ECfRuA

…ackages.props (#122)

inspect-packed-nupkgs.sh's assert_dependency_range hardcoded each expected
third-party dependency range as a duplicate literal, separate from the
Directory.Packages.props PackageVersion that already states the same policy.
Dependabot updates the latter but not the former, so a correct package bump
(e.g. PR #121's TUnit.Core update) failed validation until someone noticed
and hand-edited the script (5cfe446).

assert_dependency_range now looks up the expected range from
Directory.Packages.props itself, evaluated via `dotnet msbuild -getItem`
(SDK-native, no new CI dependency) and matched by dependency ID via jq. The
validator still independently compares that authoritative value against the
actually-packed .nuspec - only the duplicated literal is gone, not the
check's strength. A missing Directory.Packages.props entry now fails with a
distinct diagnostic instead of masquerading as a packed-range mismatch.

Adds inspect-packed-nupkgs.tests.sh, a dependency-free regression suite
proving both the pass and fail cases, including the exact "bump only the
props file" scenario from issue #122, wired into package-validation.yaml.
Amends ADR-0031 to record the drift and the fix.

Closes #122

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMQEjFrUVGYkctE3ECfRuA
@github-actions github-actions Bot added the type: fix Bug fix label Sep 2, 2026
@ncipollina
ncipollina merged commit f0e3b70 into main Sep 2, 2026
8 checks passed
@ncipollina
ncipollina deleted the fix/122-package-validation-dependency-range-drift branch September 2, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: package-validation dependency-range literals drift when Dependabot bumps Directory.Packages.props

1 participant