Skip to content

Improve fallout-migrate: NuGet-scoped version pin, TFM warning, confirmation prompt#509

Draft
dennisdoomen wants to merge 11 commits into
migrate-ansiconsole-outputfrom
actual-migration-improvements
Draft

Improve fallout-migrate: NuGet-scoped version pin, TFM warning, confirmation prompt#509
dennisdoomen wants to merge 11 commits into
migrate-ansiconsole-outputfrom
actual-migration-improvements

Conversation

@dennisdoomen

Copy link
Copy Markdown
Collaborator

Stacked on #508.

Three independent improvements to fallout-migrate's Migration pipeline:

  • ResolveFalloutVersionStep now resolves the latest non-prerelease Fallout.Common version from NuGet, scoped to the running tool's own major (calendar year), instead of only reading its own AssemblyInformationalVersion. Falls back to the tool's own version when NuGet is unreachable or has no matching-major stable release. Logs which path was taken via AnsiConsole.
  • VerifyBuildTargetFrameworkStep (new) warns when _build.csproj targets an older .NET than 10, so consumers know to check their build tools before finishing the migration.
  • ConfirmMigrationStep (new) prompts for confirmation immediately before the first file-mutating step. Skipped for --dry-run and when stdin is redirected (CI/tests). Declining sets Summary.Cancelled, which stops the pipeline and makes MigrateCommand exit 1.

Also bumps Fallout.Migrate onto the 10.x version line (version.json + AssemblyVersion).

dennisdoomen and others added 4 commits July 18, 2026 14:19
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ajor

ResolveFalloutVersionStep now queries NuGet's flat-container index for the
latest non-prerelease Fallout.Common release matching the running tool's
own major (calendar year), instead of only reading the tool's own
AssemblyInformationalVersion. This keeps a migration pinned to what's
actually installable without jumping to a newer, potentially breaking
yearly major the tool wasn't built against.

Falls back to the tool's own version when NuGet can't be reached or has
no matching-major stable release yet, and logs via AnsiConsole which path
was taken so the resolved version is never a silent guess.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fallout's tooling is built and tested against .NET 10; a build project
still on an older TFM can hit tool incompatibilities that this
migration's other, purely textual rewrites won't catch.

VerifyBuildTargetFrameworkStep reads _build.csproj's TargetFramework(s)
and adds a warning for any moniker that isn't a modern net10.0+ (catching
net8.0, net48, netstandard2.0, netcoreapp3.1, etc.).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ConfirmMigrationStep runs immediately before RewriteCsprojsStep, the
first step that mutates files, and prompts via AnsiConsole.Confirm
before letting the migration proceed. Declining sets the new
Summary.Cancelled flag, which Migration.Run checks to stop executing
further steps, and MigrateCommand returns exit code 1 without printing
the (now meaningless) summary.

The prompt is skipped for --dry-run (nothing would be written) and
when stdin is redirected (CI, piped input, automated tests) since
there's nothing to prompt against.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dennisdoomen dennisdoomen added enhancement New feature or request target/vCurrent Targets the current version labels Jul 18, 2026
dennisdoomen and others added 2 commits July 18, 2026 14:26
CsprojRewriter.Rewrite had a single caller (RewriteCsprojsStep). Move its
regex fields and Rewrite method directly into the step and delete the
now-empty class. Rename the spec file/class to match.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add BumpDotNetVersionStep: rewrites _build.csproj's TargetFramework(s)
to net10.0 and global.json's sdk.version to 10.0.100 during migration,
matching the versions Fallout's own tooling targets.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread src/Fallout.Migrate/Steps/BumpDotNetVersionStep.cs
Comment thread src/Fallout.Migrate/Steps/ConfirmMigrationStep.cs
{
try
{
using HttpResponseMessage response = httpClient.GetAsync(FlatContainerIndex).GetAwaiter().GetResult();

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.

Can this be "real async" here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, was thinking about that as well.

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.

nice one

dennisdoomen and others added 5 commits July 19, 2026 08:55
BumpDotNetVersionStep previously overwrote any TargetFramework/SDK
version that wasn't an exact match, including newer ones. Now it
compares against the minimum (net10.0 / 10.0.100) and leaves anything
already at or above it untouched. Multi-targeting bumps only the
monikers that are behind.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Build projects don't multi-target, so only match the singular
TargetFramework element instead of splitting/rejoining a
TargetFrameworks list.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MinimumSupportedMajor (10) had to be kept in sync by hand with
TargetFramework (net10.0). Parse it from the constant instead so
there's a single source of truth.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace the blocking GetAsync(...).GetAwaiter().GetResult() in
ResolveFalloutVersionStep with a proper await. IMigrationStep.Execute
is now Task ExecuteAsync; Migration.Run is Migration.RunAsync;
MigrateCommand is now an AsyncCommand<MigrateSettings>; Program.Main
awaits CommandApp.RunAsync. ConfirmMigrationStep now awaits
ConfirmationPrompt.ShowAsync instead of the blocking AnsiConsole.Confirm.
Steps with no async work simply return Task.CompletedTask.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nvocation order, tag NuGet requests

Extract the modern-moniker regex and IsOlderThanMinimumSupported logic
duplicated between BumpDotNetVersionStep and VerifyBuildTargetFrameworkStep
into a shared TargetFrameworkMonikers helper. VerifyBuildTargetFrameworkStep
now reads BumpDotNetVersionStep.MinimumSupportedMajor instead of
maintaining its own separate constant.

Reorder ResolveFalloutVersionStep's private methods to match the order
they're invoked from ExecuteAsync (assembly, then major, then NuGet).

Add a User-Agent header to the NuGet flat-container HttpClient so
requests aren't sent as anonymous script traffic.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request target/vCurrent Targets the current version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants