Record: Generated semantic-sort version — 2026-08-24
Outcome
Replaced the hardcoded PROGRAM_VERSION with a build-time generated version.
Format: date-branch or date-branch-tag, where date is YYYY-MM-DD, branch is the current git branch, and tag is appended only when all sources are committed and the current commit is tagged.
Implementation:
- scripts/version-generate.sh generates version_info.h into the build tree.
- The header carries VERSION_STRING, VERSION_DATE, VERSION_BRANCH, VERSION_TAG, and VERSION_BUILD_COUNTER.
- The build counter increments on each build; stored in .build-counter (gitignored).
- sources/version.{h,cpp} is a separate compilation unit exposing version_string() and version_build_counter(), so a version change recompiles one unit instead of the whole program.
- CMake runs the generator on every build (version_header target) and adds the generated dir to the include path.
- –version prints e.g. “amd-mi25-fanctl 2026-08-24-master (build 4)”.
Decisions
- The generated header lives in the build output directory, not in sources/.
- The build counter persists in .build-counter so it counts across clean rebuilds of the build tree.
- The convention is documented in prompts/03-conventions.md section 6.2 for propagation to 00-project-skeleton.
Verification
- Version output correct: 2026-08-24-master, counter increments per build.
- tests/03-version-generate.sh covers: no-commit repo (date-branch, counter 1), committed+tagged (date-branch-tag, counter 2), dirty tree (tag dropped, counter 3).
- make test and ctest pass (3/3).
- Deployed on beast.lan: service active, –version reports amd-mi25-fanctl 2026-08-24-master (build 4); temps steady 40-41 C.
- Verified 2026-08-24.
Commits
- dbc0718 feat: generate semantic-sort version from git state at build time
- d259b41 chore: add rollback script from deployment
- d4d6ff3 feat: add git hash and -changes suffix to generated version
Follow-up: build-counter policy decided (2026-08-24)
The open question about the build counter is settled.
- The short git hash disambiguates builds across commits, directories, and developers; the counter stays local and gitignored.
- Version format is
date-branch[-tag]-hash. - The hash gains a
-changessuffix when the working tree is dirty. - Encoded in
prompts/03-conventions.md§6.2.
Deployed on beast.lan: amd-mi25-fanctl 2026-08-24-master-d4d6ff3 (build 7), service active, temps 42 C.