GitTools / GitTools/GitVersion

v7.1: remove legacy argument parser and v6 configuration runtime

Open
#5,188 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.1k
Forks
659
Avg merge
13h 15m
Merged PRs (30d)
51

Description

Summary

Split from #5135: remove the legacy argument parser and flat v6 configuration runtime in v7.1, after the v7.0 defaults and temporary fallbacks ship. The completed configuration foundation is #5131 (#5158, #5159, #5160).

Scope

  • Complete prerequisite #5135 (v7.0 selector alignment).
  • Remove LegacyArgumentParser and runtime loading/serialization of flat v6 configuration.
  • Keep gitversion config migrate, including conversion of v6 input, available.
  • Retain GITVERSION_ARGUMENT_PARSER_VERSION and GITVERSION_CONFIGURATION_VERSION during v7.x; reject v6 with actionable removal/migration guidance and accept explicit v7 as a no-op.
  • Preserve consistent selector validation and effective-selection logging without contaminating machine-readable stdout.
  • Remove obsolete runtime tests and update migration/breaking-change documentation; test retired-value diagnostics and retained migration support.

Boundaries and dependencies

#5135 owns v7.0 defaults and temporary fallbacks. #5040 separately removes LibGit2Sharp/native binaries in v7.1. #5136 removes all three selectors in v8 and depends on both v7.1 cleanup issues. Do not remove selectors here.

Cleanup inventory from the v7.0 selector branch

The following inventory comes from arturcic:feature/v7-feature-selectors at 54adbb24e, the implementation of #5135. Implementation PR: #5189, opened from the fork after all four fork workflows passed on that commit. The inventory describes the PR branch; completion of #5135 remains a prerequisite until the PR is merged.

Production code to adapt in v7.1
  • src/GitVersion.App/ArgumentParserVersion.cs: remove the legacy parser implementation path; retain the environment-variable compatibility validator so v6 reports removal guidance and v7 remains accepted. Preserve the actionable diagnostic for the already-retired GITVERSION_USE_V6_ARGUMENT_PARSER boolean.
  • src/GitVersion.Core/Configuration/ConfigurationVersion.cs: retire v6 runtime selection with guidance to gitversion config migrate, while keeping v7 accepted. Remove runtime flat-format loading/serialization without deleting the migration service's ability to read flat v6 input.
  • Adapt src/GitVersion.App/FeatureSelections.cs, CliHost.cs and GitVersionAppModule.cs to register only the v7 parser/configuration. Retain effective-selection snapshots/logging during v7.x and the managed/libgit2 backend boundary owned by #5040.
  • Keep shared normalization/error handling in src/GitVersion.Core/FeatureSelector.cs until all selector removal occurs under #5136. Preserve its source link in new-cli/GitVersion.Common/GitVersion.Common.csproj while the source-linked backend selector still uses it.
  • Preserve Program.cs startup error handling: exit code 1, An error occurred: prefix and actionable stderr text, with no stack trace or machine-readable stdout pollution.
  • Preserve ArgumentParser.MapMigrationValues handling of a root-level --log-file and the stderr routing in ServiceCollectionExtensions.ConfigureLogger. These are retained logging/migration behavior, not disposable v6 scaffolding.
Tests to remove, rewrite or retain
  • src/GitVersion.App.Tests/FeatureSelectorTests.cs: replace v6 success cases in ParserResolvesKnownValues and CompositionRegistersSelectedImplementations with retirement diagnostics; retain normalization/unknown-value tests, RetiredBooleanIsRejectedEvenWithNewSelector and captured-value behavior in SelectionLogUsesCapturedValues using supported selections.
  • src/GitVersion.App.Tests/ExecFeatureSelectorTests.cs: reduce the eight runtime combinations in SelectorCombinationsCalculateAndLogWithoutPollutingOutput to supported implementations; add explicit parser-v6 and configuration-v6 failure cases with migration guidance. Retain JSON, show-variable, show-config and stderr-isolation assertions, including DefaultsSelectV7AndManagedWithConsoleLogsOnStderr and InvalidSelectorsFailBeforeHelpWithActionableStderr.
  • Adapt MigrationRetainsYamlStdoutWithEitherConfigurationAndBackend: v6 input files must still migrate with the supported v7 runtime selection. A removed v6 selector value must not be mistaken for retained flat-file migration support. Coordinate libgit2 cases with #5040.
  • src/GitVersion.App.Tests/ExecCmdLineArgumentTest.cs now selects the fallback through GITVERSION_ARGUMENT_PARSER_VERSION=v6; remove its legacy-parser variants while keeping modern commit-selection and verbosity regressions.
  • Rewrite v6 success cases in src/GitVersion.Core.Tests/Core/ConfigurationVersionSelectorTests.cs and related configuration integration tests as actionable retirement failures. Do not delete normalization, default-selection or migration coverage wholesale.

Update BREAKING_CHANGES.md, docs/input/docs/migration/v6-to-v7.md, docs/input/docs/usage/cli/arguments.md, docs/input/docs/reference/environment-variables.md and docs/design/managed-git-migration.md from temporary-fallback guidance to v7.1 removal guidance. Actual selector-variable removal stays in #5136 for v8.

Output-isolation regression added during #5189 review
  • Preserve the buildServer dimension in ExecFeatureSelectorTests.SelectorCombinationsCalculateAndLogWithoutPollutingOutput: JSON, single-variable and show-config stdout must stay free of diagnostics even when build-server output is also selected. This dimension is independent of the parser/configuration/backend selectors being retired.
  • Retain consistent stderr routing for console logs in ServiceCollectionExtensions.ConfigureLogger. Build-server integration commands keep their existing output channel; diagnostic logs must not move back to stdout during cleanup.
  • Keep CLI help (ArgumentParser and, until legacy removal, legacy_help.md) and the CLI/migration documentation consistent with stderr logging.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

First verify prerequisite #5135, then read the selector implementations in src/GitVersion.App/ArgumentParserVersion.cs, src/GitVersion.Core/Configuration/ConfigurationVersion.cs and the registration files listed in the issue. Run the named feature-selector, execution, command-line and configuration tests before changing them. Done means v6 runtime selections fail with migration guidance, v7 remains supported, v6 input migration still works, and diagnostics stay out of machine-readable stdout.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
cli, documentation, testing
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.