Check: version in init.lua must equal the VERSION file #158

Closed
opened 2026-11-18 15:12:40 +01:00 by michael · 2 comments
Owner

Goal

Core libraries and core modules keep their real version by hand in the version
field of init.lua (see DAW/daw-module-manager#31). A check reports an error
when that field differs from the VERSION file of the repository.

Acceptance criteria

  • a difference between init.lua version and VERSION is reported
  • equal versions pass; the sentinel <DAW_SED_REPLACE_VERSION> is not an error for repositories that are not core
  • tests first; make test passes

Open

  • How the check knows that a repository is a core library or core module has to be decided before implementing.
## Goal Core libraries and core modules keep their real version by hand in the `version` field of `init.lua` (see DAW/daw-module-manager#31). A check reports an error when that field differs from the `VERSION` file of the repository. ## Acceptance criteria - [ ] a difference between `init.lua` `version` and `VERSION` is reported - [ ] equal versions pass; the sentinel `<DAW_SED_REPLACE_VERSION>` is not an error for repositories that are not core - [ ] tests first; `make test` passes ## Open - How the check knows that a repository is a core library or core module has to be decided before implementing.
Author
Owner

Clarification 2026-11-18

The version in init.lua of a core library or core module is the plain
MAJOR.MINOR.PATCH of VERSION; a +hash suffix is not expected there (the
hash of a commit cannot be part of a file in that commit). The check compares
the two values as they are.

A repository whose init.lua carries the sentinel <DAW_SED_REPLACE_VERSION>
is a module built by make dist; there the field is replaced at build time and
is not part of this check.

## Clarification 2026-11-18 The version in `init.lua` of a core library or core module is the plain `MAJOR.MINOR.PATCH` of `VERSION`; a `+hash` suffix is not expected there (the hash of a commit cannot be part of a file in that commit). The check compares the two values as they are. A repository whose `init.lua` carries the sentinel `<DAW_SED_REPLACE_VERSION>` is a module built by `make dist`; there the field is replaced at build time and is not part of this check.
Author
Owner

Done 2026-11-20

The check is implemented as a new project-level primitive,
DAW/daw-modul-fragjan-check-valueequals (daw.fragjan.check.valueequals).
It extracts a value from one file with a Lua pattern and compares it with a
value from a second file. If either file is unreadable, the check is skipped.

Used for lua-lib projects, it compares the version field in init.lua
with VERSION. Verified with fragjan code: a matching pair passes, a
differing pair (2.2.1 vs 2.2.2) reports an error, and a lua-module project
(sentinel version) is not checked.

The primitive passes make test on Lua 5.4 and 5.1 (43 tests).
Installable via fragjan modules install.

## Done 2026-11-20 The check is implemented as a new project-level primitive, `DAW/daw-modul-fragjan-check-valueequals` (`daw.fragjan.check.valueequals`). It extracts a value from one file with a Lua pattern and compares it with a value from a second file. If either file is unreadable, the check is skipped. Used for `lua-lib` projects, it compares the `version` field in `init.lua` with `VERSION`. Verified with `fragjan code`: a matching pair passes, a differing pair (2.2.1 vs 2.2.2) reports an error, and a `lua-module` project (sentinel version) is not checked. The primitive passes `make test` on Lua 5.4 and 5.1 (43 tests). Installable via `fragjan modules install`.
michael 2026-11-20 16:06:38 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#158
No description provided.