|
| 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