Skip to content

Commit 29cd5fb

Browse files
committed
Revert "fix(#155): finalize existing prerelease versions during bump planning (#156)"
This reverts commit f987c7e.
1 parent f987c7e commit 29cd5fb

8 files changed

Lines changed: 47 additions & 63 deletions

.github/prompts/pr-description.prompt.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,12 @@ Analyze the provided input and:
2828

2929
Be pragmatic: if information is missing, make reasonable assumptions but call them out briefly.
3030

31-
Before generating the PR description, you MUST:
32-
33-
- Read this prompt file from `.github/prompts/pr-description.prompt.md` directly, even if hidden folders were not
34-
surfaced by an earlier search.
35-
- Read `.github/pull_request_template.md` directly and treat it as authoritative.
36-
- Resolve all relative paths from the repository root.
37-
- Treat `./pr-descriptions/` as a repository-root-relative output folder.
38-
- Never assume `.github/` content is missing just because a previous listing or glob search did not show hidden folders.
39-
4031
---
4132

4233
## Output format
4334

44-
You MUST return the PR description using this exact structure, you will find the template in
45-
`.github/pull_request_template.md`:
46-
You MUST fill in all sections, and you MUST NOT modify the template structure.
47-
You MUST create a *.md file in the `./pr-descriptions/` folder with the same name as the PR title, and write the
48-
generated description there.
49-
If the folder does not exist yet, you MUST create it under the repository root before writing the file.
35+
You MUST return the PR description using this exact structure:
36+
37+
### Pull Request Template
38+
39+
.github/pull_request_template.md

CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ Keep stable `Update-NovaModuleVersion` / `% nova bump` releases on the SemVer ma
3434

3535
### Fixed
3636

37-
- Fix stable `Update-NovaModuleVersion` / `% nova bump` prerelease planning so existing prerelease versions finalize
38-
their current semantic core before any later semantic bump is considered.
39-
- `nova bump --what-if` now plans `2.0.0-preview01 -> 2.0.0` instead of `2.1.0` when commit history resolves to a
40-
`Minor` label.
4137
- Fix `Invoke-NovaBuild` help discovery so it only scans `docs/<ProjectName>/` for PlatyPS
4238
markdown.
4339
- Regular markdown elsewhere under `docs/` no longer breaks the help-generation step.

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,6 @@ These switches keep the behavior explicit and opt-in:
211211
- `Update-NovaModuleVersion -ContinuousIntegration` also falls back to a patch bump when the current `HEAD` already
212212
matches the latest tag, so release automation can seed the next prerelease line without requiring an extra commit
213213
first
214-
- Stable `Update-NovaModuleVersion` / `% nova bump` finalizes any existing prerelease by removing its suffix before
215-
planning a new semantic-core increment, so `2.0.0-preview01` becomes `2.0.0` unless you explicitly pass
216-
`-Preview` / `--preview`
217214
- `Update-NovaModuleVersion` and `% nova bump` treat stable `0.y.z` versions as the SemVer initial-development phase,
218215
so breaking-change bumps stay on the `0.y.z` line by planning the next minor version instead of jumping to `1.0.0`
219216
- `Publish-NovaModule -ContinuousIntegration` restores the built module after publish completes

docs/NovaModuleTools/en-US/Update-NovaModuleVersion.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ calculated release label and the exact next version without changing the stored
5959
Use `-ContinuousIntegration` when the same session should first re-activate the built `dist/` module before the version
6060
bump workflow starts. This is useful in CI/self-hosting flows where an earlier command changed the active module state.
6161

62-
When the current version is already a prerelease, Nova finalizes that same semantic version by default instead of
63-
incrementing to the next semantic core. For example, a `Minor` bump from `2.0.0-preview7` resolves to `2.0.0`, not
64-
`2.1.0`. Use `-Preview` when you want to continue the prerelease sequence instead.
62+
When the current version is already a prerelease for the selected release line, Nova finalizes that same semantic
63+
version instead of incrementing again. For example, a `Major` bump from `2.0.0-preview7` resolves to `2.0.0`, not
64+
`3.0.0-preview7`.
6565

6666

6767
## EXAMPLES

src/private/release/GetNovaVersionPartForLabel.ps1

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Get-NovaVersionPartForLabel {
66
[string]$Label = 'Patch'
77
)
88

9-
if (Test-NovaVersionShouldFinalizePrereleaseTarget -CurrentVersion $CurrentVersion) {
9+
if (Test-NovaVersionShouldFinalizePrereleaseTarget -CurrentVersion $CurrentVersion -Label $Label) {
1010
return Get-NovaVersionPartObject -CurrentVersion $CurrentVersion
1111
}
1212

@@ -36,12 +36,34 @@ function Get-NovaVersionPartForLabel {
3636
}
3737

3838
function Test-NovaVersionShouldFinalizePrereleaseTarget {
39+
[CmdletBinding()]
40+
param(
41+
[Parameter(Mandatory)][semver]$CurrentVersion,
42+
[Parameter(Mandatory)][string]$Label
43+
)
44+
45+
if ( [string]::IsNullOrWhiteSpace($CurrentVersion.PreReleaseLabel)) {
46+
return $false
47+
}
48+
49+
return (Get-NovaVersionTargetLabelForPrerelease -CurrentVersion $CurrentVersion) -eq $Label
50+
}
51+
52+
function Get-NovaVersionTargetLabelForPrerelease {
3953
[CmdletBinding()]
4054
param(
4155
[Parameter(Mandatory)][semver]$CurrentVersion
4256
)
4357

44-
return -not [string]::IsNullOrWhiteSpace($CurrentVersion.PreReleaseLabel)
58+
if ($CurrentVersion.Patch -gt 0) {
59+
return 'Patch'
60+
}
61+
62+
if ($CurrentVersion.Minor -gt 0) {
63+
return 'Minor'
64+
}
65+
66+
return 'Major'
4567
}
4668

4769
function Get-NovaVersionPartObject {

tests/CoverageGaps.ReleaseInternals.Tests.ps1

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ Describe 'Coverage gaps for release and git internals' {
5555
}
5656
}
5757

58-
It 'Get-NovaVersionPartForLabel finalizes any existing prerelease on the current semantic core when <Name>' -ForEach @(
59-
@{Name = 'a breaking-change label targets a major prerelease'; CurrentVersion = '2.0.0-preview7'; Label = 'Major'; Expected = '2.0.0'}
60-
@{Name = 'a feature label still finalizes a major prerelease'; CurrentVersion = '2.0.0-preview7'; Label = 'Minor'; Expected = '2.0.0'}
61-
@{Name = 'a patch label still finalizes a minor prerelease'; CurrentVersion = '1.3.0-preview7'; Label = 'Patch'; Expected = '1.3.0'}
62-
@{Name = 'a breaking-change label still finalizes a patch prerelease'; CurrentVersion = '1.2.4-preview7'; Label = 'Major'; Expected = '1.2.4'}
58+
It 'Get-NovaVersionPartForLabel finalizes prerelease targets or advances to the next stable core when <Name>' -ForEach @(
59+
@{Name = 'major prerelease already targets the current release line'; CurrentVersion = '2.0.0-preview7'; Label = 'Major'; Expected = '2.0.0'}
60+
@{Name = 'minor prerelease already targets the current release line'; CurrentVersion = '1.3.0-preview7'; Label = 'Minor'; Expected = '1.3.0'}
61+
@{Name = 'patch prerelease already targets the current release line'; CurrentVersion = '1.2.4-preview7'; Label = 'Patch'; Expected = '1.2.4'}
62+
@{Name = 'major prerelease on a lower release line advances to the next major'; CurrentVersion = '1.2.3-preview7'; Label = 'Major'; Expected = '2.0.0'}
63+
@{Name = 'minor prerelease on a lower release line advances to the next minor'; CurrentVersion = '1.2.3-preview7'; Label = 'Minor'; Expected = '1.3.0'}
64+
@{Name = 'patch prerelease on the current patch line finalizes that line'; CurrentVersion = '1.2.3-preview7'; Label = 'Patch'; Expected = '1.2.3'}
6365
) {
6466
InModuleScope $script:moduleName -Parameters @{TestCase = $_} {
6567
param($TestCase)
@@ -107,11 +109,11 @@ Describe 'Coverage gaps for release and git internals' {
107109
}
108110
}
109111

110-
It 'Get-NovaVersionUpdatePlan resolves prerelease versions to the current stable target when <Name>' -ForEach @(
111-
@{Name = 'finalizing a major prerelease after a breaking change'; CurrentVersion = '2.0.0-preview7'; Label = 'Major'; ExpectedVersion = '2.0.0'}
112-
@{Name = 'finalizing a major prerelease after a feature change'; CurrentVersion = '2.0.0-preview7'; Label = 'Minor'; ExpectedVersion = '2.0.0'}
113-
@{Name = 'finalizing a minor prerelease after a patch change'; CurrentVersion = '1.3.0-preview7'; Label = 'Patch'; ExpectedVersion = '1.3.0'}
114-
@{Name = 'finalizing a patch prerelease after a breaking change'; CurrentVersion = '1.2.4-preview7'; Label = 'Major'; ExpectedVersion = '1.2.4'}
112+
It 'Get-NovaVersionUpdatePlan resolves prerelease versions to the expected next stable target when <Name>' -ForEach @(
113+
@{Name = 'finalizing a major prerelease line'; CurrentVersion = '2.0.0-preview7'; Label = 'Major'; ExpectedVersion = '2.0.0'}
114+
@{Name = 'finalizing a minor prerelease line'; CurrentVersion = '1.3.0-preview7'; Label = 'Minor'; ExpectedVersion = '1.3.0'}
115+
@{Name = 'finalizing a patch prerelease line'; CurrentVersion = '1.2.4-preview7'; Label = 'Patch'; ExpectedVersion = '1.2.4'}
116+
@{Name = 'advancing from an earlier prerelease line to the next minor'; CurrentVersion = '1.2.3-preview7'; Label = 'Minor'; ExpectedVersion = '1.3.0'}
115117
) {
116118
InModuleScope $script:moduleName -Parameters @{TestCase = $_} {
117119
param($TestCase)

tests/NovaCommandModel.BumpAndCli.Tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ Describe 'Nova command model - bump and CLI confirmation behavior' {
491491
}
492492
}
493493

494-
It 'Update-NovaModuleVersion finalizes an existing prerelease while preserving nested package repository objects' {
494+
It 'Update-NovaModuleVersion preserves nested package repository objects when writing the bumped version' {
495495
InModuleScope $script:moduleName {
496496
$projectRoot = Join-Path $TestDrive 'package-repository-bump-project'
497497
New-Item -ItemType Directory -Path $projectRoot -Force | Out-Null
@@ -531,9 +531,9 @@ Describe 'Nova command model - bump and CLI confirmation behavior' {
531531
$updatedProject = Get-Content -LiteralPath $projectJsonPath -Raw | ConvertFrom-Json
532532

533533
$result.PreviousVersion | Should -Be '1.5.2-preview'
534-
$result.NewVersion | Should -Be '1.5.2'
534+
$result.NewVersion | Should -Be '2.0.0'
535535
$result.Label | Should -Be 'Major'
536-
$updatedProject.Version | Should -Be '1.5.2'
536+
$updatedProject.Version | Should -Be '2.0.0'
537537
($updatedProject.Package.Repositories[0] -is [string]) | Should -BeFalse
538538
$updatedProject.Package.Repositories[0].Name | Should -Be 'staging'
539539
$updatedProject.Package.Repositories[0].Auth.TokenEnvironmentVariable | Should -Be 'NEXUS_STAGING_TOKEN'

tests/NovaCommandModel.StandaloneCli.Tests.ps1

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -338,29 +338,6 @@ Describe '$projectName tests' {
338338
}
339339
}
340340

341-
It 'Install-NovaCli finalizes prerelease versions during stable what-if bumps' {
342-
Assert-TestInstalledNovaCliBumpBehavior -DistModuleDir $script:distModuleDir -TestDriveRoot $TestDrive -TestCase @{
343-
TargetDirectory = 'prerelease-finalize-bin'
344-
ProjectName = 'CliPrereleaseFinalizeProject'
345-
ProjectGuid = '45444444-4444-4444-4444-444444444444'
346-
FunctionName = 'Invoke-TestCliPrereleaseFinalize'
347-
CurrentVersion = '2.0.0-preview01'
348-
CommitMessage = 'feat: finalize prerelease stable bump planning'
349-
Arguments = @('bump', '--what-if')
350-
ExpectedPatterns = @(
351-
'What if:'
352-
'Version plan: 2\.0\.0-preview01 -> 2\.0\.0 \| Label: Minor \| Commits: 1'
353-
)
354-
UnexpectedPatterns = @(
355-
'Version plan: 2\.0\.0-preview01 -> 2\.1\.0'
356-
'Unknown argument:'
357-
'Version bumped to :'
358-
)
359-
ExpectedWarningCount = 0
360-
ExpectedVersionAfterBump = '2.0.0-preview01'
361-
}
362-
}
363-
364341
It 'Install-NovaCli rejects unsupported nova init invocations with clear migration guidance' -ForEach @(
365342
@{
366343
Name = 'WhatIf'

0 commit comments

Comments
 (0)