Skip to content

feat(csharp-ci): fail when a packable net10.0 target resolves Microsoft.Extensions or AspNetCore 11 - #53

Merged
monsieurleberre merged 3 commits into
devfrom
feat/csharp-ci-net10-package-guard
Nov 21, 2026
Merged

monsieurleberre merged 3 commits into
devfrom
feat/csharp-ci-net10-package-guard

Conversation

@monsieurleberre

Copy link
Copy Markdown
Contributor

Summary

  • csharp-ci.yaml gains a Guard net10.0 package majors step between Restore and Build. It fails the shard when a packable project with a net10.0 target resolves a Microsoft.Extensions.* or Microsoft.AspNetCore.* package at major 11 or later, directly or transitively. A net10.0 library that requires the 11.x line drags its consumers off 10.x while CI stays green.
  • New optional input net10-package-exceptions (package@major pairs, default empty). It reaches the script only through the environment and is validated before anything runs.
  • The check is on by default, so a caller whose net10.0 target resolves 11.x goes red until it pins the package to 10.x or lists an exception.
csharp-ci build-and-test (every shard)
  Checkout CI helpers            (now on every shard, was coverage only)
  Restore
+ Guard net10.0 package majors   scripts/guard-net10-package-majors.sh
+   dotnet msbuild -getProperty  packable? net10.0 in TargetFrameworks?
+   obj/project.assets.json      targets net10.0, net10.0/<rid>
+   fail on Microsoft.Extensions.* / AspNetCore.* >= 11, minus exceptions
  Build
scripts/
+├── guard-net10-package-majors.sh
+└── net10-package-majors.jq
test/
+└── guard-net10-package-majors_test.sh     (50 checks, fixture projects)

Two gaps found in an earlier version of this guard are fixed and covered by fixtures:

  • TargetFrameworks with spaces, newlines or other casing (netstandard2.0; net10.0) was skipped silently. Whitespace is now removed and the match is case-insensitive.
  • Under Git Bash on Windows jq and dotnet print CRLF, so packable became true\r and the shard checked nothing. Every captured value now goes through tr -d '\r'.

jq is installed on the self-hosted Hetzner runners (base package list) and on the GitHub-hosted images; the script fails with exit 3 and a clear error when jq or dotnet is missing.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking at the interface; see Merge Danger)
  • Breaking change (public behaviour, schema, or state)
  • Refactor / internal-only
  • Docs / examples
  • CI / build / chore

Evidence

  • Before (fixture cases for the two gaps, run against the unfixed port): TargetFrameworks with a space after the semicolon exits 1: expected [1] got [0], TargetFrameworks spread over several lines, net10.0 spelled in upper case, jq and dotnet emitting CRLF still exit 1 on an offender all FAIL.
    After: bash test/guard-net10-package-majors_test.sh prints 50 ok, 0 FAIL, exit 0. actionlint clean, shellcheck clean.
  • Real data, a clone of a four-package .NET repo (net10.0;net11.0, Serilog.AspNetCore split per TFM), run after dotnet restore:
baseline                                  guard rc=0
net10.0 Serilog.AspNetCore -> 11.0.0      guard rc=1
  ::error::src/Peaceful.Extensions.Serilog/Peaceful.Extensions.Serilog.csproj resolves
  Microsoft.Extensions.Configuration 11.0.0 (via Serilog.AspNetCore); ... Microsoft.Extensions.Options 11.0.0 (via Serilog.AspNetCore); ...
reverted                                  guard rc=0
  • The new test net10.0 package guard job in build-and-test.yaml runs the fixture test on Ubuntu, macOS, Windows and Windows ARM.

Test plan

  • Unit tests pass locally
  • Integration / acceptance tests run: real-data proof above
  • Manual verification: a consumer run of csharp-ci.yaml on the self-hosted pool and on windows-11-arm is not exercised by this repo's CI (it never calls csharp-ci.yaml)

Checklist

  • Followed red-green TDD where applicable
  • Every new source file carries the two-line SPDX copyright header
  • Updated public-facing docs / examples if the API changed
  • Added a [Unreleased] entry in CHANGELOG.md
  • Lint clean
  • No secrets or credentials in code, fixtures, or commit messages

Merge Danger

Door: two-way. Reverting the commit removes the step and the input.

Blast Radius: every csharp-ci.yaml caller on a floating tag. The guard is on by default: a caller whose packable net10.0 target resolves 11.x goes red on its next run until it pins 10.x or sets net10-package-exceptions. Callers with no such package see no change except an extra helper checkout on non-coverage shards and a few seconds of dotnet msbuild evaluation per project.

Breaking changes / migration notes

No input, output or secret is removed or renamed. A caller that is newly red either pins the offending package to 10.x for its net10.0 target or accepts it with net10-package-exceptions: 'Microsoft.Extensions.Options@11'.

@monsieurleberre
monsieurleberre marked this pull request as ready for review November 21, 2026 10:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T12:22:43.968738Z 16c3127 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68d6c100bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/guard-net10-package-majors.sh Resolved
Comment thread scripts/guard-net10-package-majors.sh Resolved
Comment thread scripts/guard-net10-package-majors.sh Resolved
@monsieurleberre

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16c31278fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/csharp-ci.yaml Resolved
@monsieurleberre
monsieurleberre merged commit ced7805 into dev Nov 21, 2026
6 checks passed
@monsieurleberre
monsieurleberre deleted the feat/csharp-ci-net10-package-guard branch November 21, 2026 16:11
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