Skip to content

Add POSIX configuration migration and legacy-format warnings - #5159

Merged
arturcic merged 6 commits into
mainfrom
feature/5133-config-migration
Sep 7, 2026
Merged

Add POSIX configuration migration and legacy-format warnings#5159
arturcic merged 6 commits into
mainfrom
feature/5133-config-migration

Conversation

@arturcic

@arturcic arturcic commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds the POSIX-only gitversion config migrate command with atomic output, overwrite safeguards, and explicit-v6 warnings.
  • Preserves root-level workflow while migrating flat settings into calculation and output.
  • Migration can relocate the earlier draft's calculation.workflow; duplicate selectors and output.workflow are rejected. Runtime loading remains strict.
  • Preserves migration idempotence and effective configuration.

Validation

  • Full-stack configuration tests — 168 passed; app tests — 406 passed.
  • Includes workflow-only input, draft-selector migration, duplicate rejection, and in-place idempotence.
  • Full solution build and scoped dotnet format.

Closes #5133

@mergify

mergify Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

⚠️ The sha of the head commit of this PR conflicts with #5156. Mergify cannot evaluate rules on this PR. Once #5156 is merged or closed, Mergify will resume processing this PR. ⚠️

Comment thread src/GitVersion.Core/Configuration/ConfigurationVersion.cs Fixed
@arturcic
arturcic force-pushed the feature/5133-config-migration branch 2 times, most recently from 1ddfbaf to 895cda7 Compare August 19, 2026 19:48
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from 895cda7 to ded5bac Compare August 19, 2026 21:16
@arturcic
arturcic force-pushed the feature/5133-config-migration branch 2 times, most recently from 3fe3835 to 7cd3af3 Compare August 19, 2026 21:49
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from 7cd3af3 to 9f5c005 Compare August 20, 2026 00:34
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from 9f5c005 to b350b09 Compare August 20, 2026 01:31
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from b350b09 to b615b7d Compare August 28, 2026 18:16
@arturcic
arturcic force-pushed the feature/5133-config-migration branch 2 times, most recently from 4908b42 to f3e474d Compare September 6, 2026 13:03
@arturcic
arturcic marked this pull request as ready for review September 6, 2026 15:55
Copilot AI lite review requested due to automatic review settings September 6, 2026 15:55

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.

🟡 Changes recommended

The migration overwrite path currently emits a replacement warning twice (direct Console.Error + warning logger routed to stderr), producing duplicated stderr output.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds a stable (legacy src/ CLI) POSIX-only gitversion config migrate command that migrates legacy flat (v6) configuration YAML into the nested v7 calculation/output structure, and introduces explicit-v6 compatibility warnings that are routed to stderr to avoid contaminating machine-readable stdout.

Changes:

  • Adds a configuration migration engine (ConfigurationMigrationService) plus YAML mapping helpers (ConfigurationDocumentMapper.Nest).
  • Adds the POSIX config migrate subcommand wiring, executor, and options surface (GitVersionOptions.ConfigurationMigrationInfo).
  • Adds explicit v6-selection detection and warning behavior, plus stdout/stderr isolation updates and test coverage.
File summaries
File Description
src/GitVersion.Core/PublicAPI.Unshipped.txt Tracks the newly exposed ConfigurationMigrationInfo API surface.
src/GitVersion.Core/Options/GitVersionOptions.cs Adds ConfigurationMigrationInfo to top-level execution options.
src/GitVersion.Core/Options/ConfigurationMigrationInfo.cs Introduces migration-specific options (input/output/in-place/force).
src/GitVersion.Core/Extensions/ServiceCollectionExtensions.cs Routes warnings to stderr when console logging is disabled to keep stdout machine-readable.
src/GitVersion.Core/Configuration/IConfigurationMigrationService.cs Defines the migration service contract.
src/GitVersion.Core/Configuration/ConfigurationVersion.cs Adds IsExplicitV6() to detect explicit v6 selection.
src/GitVersion.Core.Tests/Core/ConfigurationVersionSelectorTests.cs Adds unit tests for explicit v6 selection detection.
src/GitVersion.Configuration/GitVersionConfigurationModule.cs Registers the migration service in DI.
src/GitVersion.Configuration/ConfigurationSerializer.cs Adds deterministic serialization for migrated YAML documents.
src/GitVersion.Configuration/ConfigurationProvider.cs Logs once-per-invocation warning when explicit v6 loads a user config file.
src/GitVersion.Configuration/ConfigurationMigrationService.cs Implements v6→v7 migration with validation and mixed-structure rejection.
src/GitVersion.Configuration/ConfigurationDocumentMapper.cs Adds nesting logic and branch splitting between calculation/output sections.
src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs Adds tests for explicit v6 warning behavior and non-warning cases.
src/GitVersion.Configuration.Tests/Configuration/ConfigurationMigrationServiceTests.cs Adds migration unit tests for nesting, determinism, and invalid input handling.
src/GitVersion.App/LegacyArgumentParser.cs Explicitly rejects config migrate under the legacy (non-POSIX) parser.
src/GitVersion.App/IConfigurationMigrationExecutor.cs Adds executor contract for the migration command.
src/GitVersion.App/GitVersionAppModule.cs Registers the migration executor in DI.
src/GitVersion.App/GitVersionApp.cs Dispatches to migration executor when migration is requested.
src/GitVersion.App/ConfigurationMigrationExecutor.cs Implements file discovery, safeguards, and atomic write for migrated configs.
src/GitVersion.App/Arguments.cs Adds migration argument fields and maps them into GitVersionOptions.
src/GitVersion.App/ArgumentParser.cs Adds config migrate subcommand parsing and safeguards (--output vs --in-place, --force).
src/GitVersion.App.Tests/LegacyArgumentParserTests.cs Tests that legacy parser rejects config migrate clearly.
src/GitVersion.App.Tests/JsonOutputOnBuildServerTest.cs Updates tests to validate JSON via captured stdout (not mixed streams).
src/GitVersion.App.Tests/HelpWriterTests.cs Excludes migration-only internal argument fields from help completeness checks.
src/GitVersion.App.Tests/Helpers/GitVersionHelper.cs Captures stdout/stderr separately while preserving combined output for existing assertions.
src/GitVersion.App.Tests/Helpers/ExecutionResults.cs Exposes StandardOutput/StandardError for stream-specific assertions.
src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs Adds integration tests for migration command behaviors and stderr warning isolation.
src/GitVersion.App.Tests/ConfigurationMigrationExecutorTests.cs Adds unit test ensuring overwrite warnings are logged during in-place migration.
src/GitVersion.App.Tests/ArgumentParserTests.cs Adds parser tests for config migrate options and safeguards.
Review details
  • Files reviewed: 29/29 changed files
  • Comments generated: 2
  • Review effort level: Lite

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

Comment thread src/GitVersion.App/ConfigurationMigrationExecutor.cs
Comment thread src/GitVersion.App/ArgumentParser.cs
Copilot AI review requested due to automatic review settings September 6, 2026 16:15
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from f3e474d to 465f9c8 Compare September 6, 2026 16:15

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.

🟢 Approval recommended

The implementation aligns with the stated acceptance criteria (migration behavior, safeguards, explicit-v6 warning semantics, and stdout/stderr isolation) and is covered by targeted unit/integration tests.

Review details
  • Files reviewed: 29/29 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@arturcic
arturcic requested review from HHobeck and asbjornu September 6, 2026 16:59

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.

🟡 Changes recommended

Logging-to-stdout behavior in BuildServer output mode may still interleave warnings/logs with machine-consumed output, conflicting with the intended stdout isolation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 28/28 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/GitVersion.Core/Extensions/ServiceCollectionExtensions.cs
Copilot AI review requested due to automatic review settings September 7, 2026 11:04
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from a3b0d15 to bce1070 Compare September 7, 2026 11:04

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.

🟡 Changes recommended

config migrate reuses --config/-c at both root and subcommand scope, which can silently ignore user-specified input when options appear before the subcommand, leading to migrating the wrong file.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 28/28 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/GitVersion.App/ArgumentParser.cs
Copilot AI review requested due to automatic review settings September 7, 2026 11:15
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from bce1070 to 2048012 Compare September 7, 2026 11:15

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.

🟢 Approval recommended

The implementation aligns with the stated acceptance criteria and is backed by comprehensive unit and integration test coverage for migration, safeguards, and stdout/stderr behavior.

Review details
  • Files reviewed: 28/28 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@arturcic
arturcic requested a review from asbjornu September 7, 2026 11:56
Base automatically changed from feature/5132-versioned-configuration to main September 7, 2026 15:39
@arturcic
arturcic force-pushed the feature/5133-config-migration branch from 2048012 to 02c4722 Compare September 7, 2026 15:39
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@mergify

mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@arturcic
arturcic merged commit d40581e into main Sep 7, 2026
63 checks passed
@arturcic
arturcic deleted the feature/5133-config-migration branch September 7, 2026 16:17
@mergify

mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

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.

Add POSIX configuration migration and legacy-format warnings

3 participants