kubernetes / kubernetes/release
krel release-notes validate rejects the NONE release-note sentinel as a punctuation error
- Dominant language
- Go
- Stars
- 504
- Forks
- 556
- Avg merge
- 18h 43m
- Merged PRs (30d)
- 33
Description
## Title
`krel release-notes validate` rejects the `NONE` release-note sentinel as a punctuation error
## What happened
`krel release-notes validate` fails any release-notes map file whose `releasenote.text` field is the literal string `NONE`, because `validateTextFieldPunctuation()` requires every `text` value to end in `.`, `!`, or `?`:
```go
// cmd/krel/cmd/validate.go
// validateTextFieldPunctuation checks if the "text" field in a YAML map
// ends with valid punctuation (., !, ?).
func validateTextFieldPunctuation(data *notes.ReleaseNotesMap) error {
validPunctuation := regexp.MustCompile(`[.!?]$`)
...
if !validPunctuation.MatchString(strings.TrimSpace(text)) {
return fmt.Errorf("the 'text' field does not end with valid punctuation: '%s'", text)
```
`NONE` is not prose — it's the documented convention (from the PR template's own instructions: *"If no, just write `NONE` in the release-note block below"*) for "this PR has no user-facing change." It has been used verbatim across `kubernetes/sig-release` release-notes maps for years and is not meant to end in sentence punctuation.
## Reproduction
```
$ krel version
GitVersion: v0.21.1
Platform: darwin/arm64
$ cat releases/release-1.27/release-notes/maps/pr-111372-map.yaml
pr: 111372
releasenote:
text: NONE
$ krel release-notes validate --path-to-release-notes releases/release-1.27/release-notes/maps/pr-111372-map.yaml
Validating YAML file: releases/release-1.27/release-notes/maps/pr-111372-map.yaml
level=fatal msg="validating release notes: validating YAML file releases/release-1.27/release-notes/maps/pr-111372-map.yaml: punctuation check for file releases/release-1.27/release-notes/maps/pr-111372-map.yaml: the 'text' field does not end with valid punctuation: 'NONE'"
```
This is not specific to one release branch — the same failure reproduces against long-merged map files from release-1.19 and release-1.27 in `kubernetes/sig-release`, confirming this is a validator gap rather than a data error in any specific PR's map file.
## Impact
`kubernetes/sig-release` runs `krel release-notes validate` in CI (`.github/workflows/krel-release-notes-validate.yaml`) on every PR that touches a release-notes map under `releases/**/release-notes/**.yaml`. Any PR whose map legitimately records `text: NONE` fails CI with no way to satisfy the check without corrupting the sentinel value (e.g. appending a period turns `NONE` into `NONE.`, which likely breaks any downstream code that pattern-matches on the exact string `NONE` to exclude the PR from rendered notes).
## Expected behavior
`validateTextFieldPunctuation` (or its caller) should special-case `NONE` (and any other sentinel values the notes pipeline treats as "no release note," if there are others) and skip the punctuation check for it.
## Suggested fix
```go
func validateTextFieldPunctuation(data *notes.ReleaseNotesMap) error {
text := strings.TrimSpace(data.ReleaseNote.Text)
if text == "NONE" {
return nil
}
validPunctuation := regexp.MustCompile(`[.!?]$`)
if !validPunctuation.MatchString(text) {
return fmt.Errorf("the 'text' field does not end with valid punctuation: '%s'", text)
}
return nil
}
```
(Existing signature/behavior of the surrounding function preserved; adjust to match actual field access in current source.)
## Environment
- `krel` GitVersion: v0.21.1 (also confirmed present on `kubernetes/release@master` as of this report)
- OS/Arch: darwin/arm64
- Found while validating `kubernetes/sig-release` release-notes maps for the v1.37.0-rc.0 draft
Contributor guide
Research direction
Start in cmd/krel/cmd/validate.go at validateTextFieldPunctuation and inspect how the release-note text field is accessed. Run krel release-notes validate against a map containing text: NONE and a normally punctuated value; done means NONE passes without changing the existing punctuation validation for prose.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- ci-cd, release
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100