Skip to content

Commit bf301b9

Browse files
committed
docs(versioning): document major-date-patch release policy
1 parent 1700745 commit bf301b9

2 files changed

Lines changed: 138 additions & 22 deletions

File tree

VERSIONING.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VERSIONING
22

3-
`kmsg` uses a calendar-based release version.
3+
`kmsg` uses a major-plus-date release version.
44

55
## Source of truth
66

@@ -11,54 +11,55 @@
1111
Example:
1212

1313
```text
14-
VERSION -> 2026.0422.22
15-
Git tag -> v2026.0422.22
16-
CLI version -> 2026.0422.22
14+
VERSION -> 1.260424.0
15+
Git tag -> v1.260424.0
16+
CLI version -> 1.260424.0
1717
```
1818

1919
## Format
2020

2121
Version format:
2222

2323
```text
24-
YYYY.MMDD.COUNT
24+
MAJOR.YYMMDD.PATCH_COUNT
2525
```
2626

2727
Tag format:
2828

2929
```text
30-
vYYYY.MMDD.COUNT
30+
vMAJOR.YYMMDD.PATCH_COUNT
3131
```
3232

3333
Field rules:
3434

35-
- `YYYY`: 4-digit calendar year
36-
- `MMDD`: 2-digit month + 2-digit day
37-
- `COUNT`: cumulative release counter across all published versions, increasing by `1` for every release regardless of date
35+
- `MAJOR`: major release line, incremented manually when you want to signal a breaking or milestone release
36+
- `YYMMDD`: 2-digit year suffix + 2-digit month + 2-digit day
37+
- `PATCH_COUNT`: zero-based daily release counter; starts at `0` for the first release of a given `YYMMDD` and increments by `1` for each additional release that day
3838

3939
Examples:
4040

41-
- `2026.0422.1`
42-
- `2026.0422.22`
43-
- `2026.1231.7`
41+
- `1.260424.0`
42+
- `1.260424.9`
43+
- `2.261231.0`
4444

4545
Invalid examples:
4646

47-
- `2026.422.1`
48-
- `26.0422.1`
49-
- `2026.1399.1`
50-
- `v2026.0422.22` in `VERSION` file
47+
- `1.26042.0`
48+
- `1.261399.0`
49+
- `0.260424.0`
50+
- `v1.260424.0` in `VERSION` file
5151

5252
## Operational rules
5353

5454
- Update `VERSION` before creating a release tag.
55-
- Do not reset `COUNT` on a new day.
56-
- For every new release, increment `COUNT` by `1`.
57-
- During migration from legacy semver tags, continue counting from the total number of previously published version tags.
58-
- Manual release tags and workflow inputs must match `vYYYY.MMDD.COUNT`.
55+
- Keep `PATCH_COUNT` at `0` for the first release on a new `YYMMDD`.
56+
- For additional releases on the same day, increment `PATCH_COUNT` by `1`.
57+
- Reset `PATCH_COUNT` back to `0` when `YYMMDD` changes.
58+
- Manual release tags and workflow inputs must match `vMAJOR.YYMMDD.PATCH_COUNT`.
59+
- `YY` is interpreted as the year suffix in the 2000s for validation, so `260424` means `2026-04-24`.
5960

6061
## Compatibility notes
6162

62-
- Build-time version generation validates the calendar format directly from `VERSION`.
63+
- Build-time version generation validates the `MAJOR.YYMMDD.PATCH_COUNT` format directly from `VERSION`.
6364
- Release automation resolves the Git tag from `VERSION` as `v{VERSION}`.
64-
- Homebrew tap sync supports the current calendar format and also reads legacy semver tags during migration, so older exact-version formulas are not dropped immediately after the format switch.
65+
- Homebrew tap sync supports the current format and still reads legacy semver tags during migration, so older exact-version formulas are not dropped immediately after the format switch.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Versioning Rule Migration Implementation Plan
2+
3+
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4+
5+
**Goal:** Switch kmsg releases to `MAJOR.YYMMDD.PATCH_COUNT`, reset `PATCH_COUNT` to `0` each day, and replace the lone old calendar tag with the new-format tag.
6+
7+
**Architecture:** Treat `VERSION` as the source of truth, update every validator/parser that reads release tags, and keep legacy semver tag handling only for historical release metadata. Add regression coverage around the workflow, Homebrew sync script, and generated build version so the new format is enforced end-to-end.
8+
9+
**Tech Stack:** SwiftPM, Swift 6, GitHub Actions, Python `unittest`
10+
11+
---
12+
13+
### Task 1: Lock expected release behavior with failing tests
14+
15+
**Files:**
16+
- Create: `tests/test_version_gen_tool.py`
17+
- Modify: `tests/test_release_workflow.py`
18+
- Modify: `tests/test_sync_homebrew_tap.py`
19+
20+
**Step 1: Write the failing tests**
21+
22+
- Update workflow assertions to require `vMAJOR.YYMMDD.PATCH_COUNT`.
23+
- Update Homebrew sync tests to use new-format release tags.
24+
- Add a `VersionGenTool` integration test that accepts `1.260424.0` and rejects `2026.0422.22`.
25+
26+
**Step 2: Run test to verify it fails**
27+
28+
Run: `python3 -m unittest tests.test_release_workflow tests.test_sync_homebrew_tap tests.test_version_gen_tool -v`
29+
Expected: failures showing the repository still expects `YYYY.MMDD.COUNT`.
30+
31+
### Task 2: Implement the new version parsing rules
32+
33+
**Files:**
34+
- Modify: `Sources/VersionGenTool/main.swift`
35+
- Modify: `.github/workflows/release.yml`
36+
- Modify: `tools/sync_homebrew_tap.py`
37+
- Modify: `VERSION`
38+
39+
**Step 1: Update validators and examples**
40+
41+
- Accept `MAJOR.YYMMDD.PATCH_COUNT`.
42+
- Require `MAJOR >= 1`.
43+
- Require `PATCH_COUNT >= 0`.
44+
- Validate `YYMMDD` as a real date by mapping `YY` to `20YY`.
45+
46+
**Step 2: Set the new release version**
47+
48+
- Change `VERSION` to `1.260424.0`.
49+
50+
**Step 3: Run the focused tests**
51+
52+
Run: `python3 -m unittest tests.test_release_workflow tests.test_sync_homebrew_tap tests.test_version_gen_tool -v`
53+
Expected: all selected tests pass.
54+
55+
### Task 3: Rewrite human-facing versioning documentation
56+
57+
**Files:**
58+
- Modify: `VERSIONING.md`
59+
60+
**Step 1: Update the spec**
61+
62+
- Replace all examples and invalid examples with the new format.
63+
- Document the daily reset behavior for `PATCH_COUNT`.
64+
- Clarify that `YY` is the two-digit year suffix and `v{VERSION}` remains the tag format.
65+
66+
### Task 4: Verify build output and release version wiring
67+
68+
**Files:**
69+
- Verify only
70+
71+
**Step 1: Build the project**
72+
73+
Run: `swift build`
74+
Expected: success.
75+
76+
**Step 2: Verify CLI version output**
77+
78+
Run: `.build/debug/kmsg --version`
79+
Expected: `1.260424.0`
80+
81+
### Task 5: Replace the old calendar tag with the new tag
82+
83+
**Files:**
84+
- Verify only
85+
86+
**Step 1: Commit the migration**
87+
88+
Run:
89+
90+
```bash
91+
git add VERSION VERSIONING.md Sources/VersionGenTool/main.swift .github/workflows/release.yml tools/sync_homebrew_tap.py tests/test_release_workflow.py tests/test_sync_homebrew_tap.py tests/test_version_gen_tool.py docs/plans/2026-04-24-versioning-rule-migration.md
92+
git commit -m "feat(versioning): switch to major-date-patch release tags"
93+
```
94+
95+
**Step 2: Replace the tag**
96+
97+
Run:
98+
99+
```bash
100+
git tag -d v2026.0422.22
101+
git push origin :refs/tags/v2026.0422.22
102+
git tag -a v1.260424.0 -m v1.260424.0
103+
git push origin main v1.260424.0
104+
```
105+
106+
**Step 3: Verify the final state**
107+
108+
Run:
109+
110+
```bash
111+
git ls-remote --tags origin "refs/tags/v1.260424.0*"
112+
git status --short --branch
113+
```
114+
115+
Expected: the new tag exists remotely and the branch is synchronized.

0 commit comments

Comments
 (0)