Skip to content

feat(validation): validate command and project configuration versions - #908

Merged
Rockdell merged 2 commits into
developmentfrom
feat/validate-version-inputs-at-command-and-configuration-entry-points
Nov 13, 2026
Merged

Rockdell merged 2 commits into
developmentfrom
feat/validate-version-inputs-at-command-and-configuration-entry-points

Conversation

@JoaoMagalhaesCrit

@JoaoMagalhaesCrit JoaoMagalhaesCrit commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What was done

Version validation was inconsistent across CLI commands and project configuration loading. Missing or malformed versions could produce parsing errors or fail after command execution had already started.

This PR:

  • Adds shared parsing and validation for NuGet versions, semantic versions, npm versions, and build/prerelease suffixes, with errors identifying the affected option or configuration field.
  • Uses NuGetVersion and SemanticVersion in the changed commands, converting to text for existing downstream APIs and scaffolding arguments.
  • Validates CLI version inputs before scaffolding or file changes in init, new test, upgrade base, bump, and the IoT bump commands.
  • Keeps bump-specific validation in BumpCommand, including mutually exclusive suffix options and validation of the resulting version.
  • Validates version fields when loading .project-config.json, while keeping the existing minimum supported MES major version of 10 at CLI entry points.
  • Checks project configurations before upgrading packages to prevent partial upgrades caused by invalid configuration versions.
  • Preserves existing defaults, optional and suffix-only updates, npm dist-tags, and original NuGet version formatting.
  • Adds regression tests and updates the command and configuration documentation.

Validation

  • Build: passed.
  • Unit tests: 1,057 passed, 2 skipped.
  • Node 18 integration: 63 passed.
  • Node 20 integration: 58 passed.

Validation checklist

  • Code validation (careful with side-effects)
  • Integration test run provided
  • Main WorkItem is linked
  • Target branch version is correct

@JoaoMagalhaesCrit
JoaoMagalhaesCrit marked this pull request as ready for review November 10, 2026 12:32
@JoaoMagalhaesCrit
JoaoMagalhaesCrit requested a review from a team November 10, 2026 12:32

@Rockdell Rockdell 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.

The empty optional init overrides and bump suffixes introduce breaking changes. Please preserve those existing invocations and close the IoT npm-version validation gap before merging.

Rechecked against this head with a focused command-source harness using fake project files; the full test suite was not rerun.

Comment thread cmf-cli/Commands/init/InitCommand.cs Resolved
@Rockdell

Copy link
Copy Markdown
Contributor

Could we move argument parsing and version validation into the System.CommandLine definitions and pass the validated version objects to Execute? That would catch invalid CLI inputs before execution and avoid parsing the same values again downstream. Configuration versions would still be validated when loading .project-config.json.

Within these version checks, please also look at reusing the existing helpers and removing checks or wrappers that become redundant. The bump overloads currently validate the same inputs twice, and upgrade can reload the same project configuration for every package. We should be able to keep one validation per entry point and one load per distinct configuration during preflight. Keep the existing public string overloads as validating adapters where needed for compatibility, along with the current optional defaults and the separate MES/NuGet/npm rules.

@JoaoMagalhaesCrit
JoaoMagalhaesCrit force-pushed the feat/validate-version-inputs-at-command-and-configuration-entry-points branch from 9faf413 to d4dbf1e Compare November 10, 2026 15:45
@JoaoMagalhaesCrit
JoaoMagalhaesCrit force-pushed the feat/validate-version-inputs-at-command-and-configuration-entry-points branch 2 times, most recently from e0d8979 to 73299b0 Compare November 12, 2026 16:40
@JoaoMagalhaesCrit
JoaoMagalhaesCrit force-pushed the feat/validate-version-inputs-at-command-and-configuration-entry-points branch from 73299b0 to cb6473e Compare November 12, 2026 19:55
Comment thread cmf-cli/Utilities/VersionUtilities.cs Resolved
@JoaoMagalhaesCrit
JoaoMagalhaesCrit force-pushed the feat/validate-version-inputs-at-command-and-configuration-entry-points branch from cb6473e to afe5678 Compare November 13, 2026 13:58
@Rockdell
Rockdell force-pushed the feat/validate-version-inputs-at-command-and-configuration-entry-points branch from afe5678 to 8400508 Compare November 13, 2026 14:13
@Rockdell
Rockdell enabled auto-merge (rebase) November 13, 2026 14:13
@github-actions

Copy link
Copy Markdown
Contributor

.NET Test Results

View full test report

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Health
cmf 58% 50% ➖
core 78% 61% ✔
Summary 66% (7257 / 11039) 56% (3541 / 6374) ➖

@Rockdell
Rockdell merged commit ece29fe into development Nov 13, 2026
4 checks passed
@Rockdell
Rockdell deleted the feat/validate-version-inputs-at-command-and-configuration-entry-points branch November 13, 2026 14:23
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.

2 participants