deps: evaluate requires.lua.<lib> (min/max) of a module #31

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

Problem

A module.conf can declare hard Lua library dependencies in
[requires.lua.<lib>] sections with min and max (this repository's own
config/module.conf does for daw-lua-common and daw-lua-net). The module-manager
does not evaluate them: deps.lua reads only requires.system, and
install/module_deps.lua only requires.module; requires.lua.* is ignored.

A module whose requires.lua.<lib> range does not match the library version in
use is therefore installed without notice. Mixed versions are prevented only by
the version pins of the host program.

Scope

  • decide first where the version of an installed library comes from (settled in
    this issue before anything is implemented)
  • on install and update: check the declared min and max against that version;
    a mismatch is a daw_error/v1 error with its own resource_id and nothing is
    changed (same behaviour as for requires.module)
  • how libraries are delivered to the host is not part of this issue

Acceptance criteria

  • the source of the library version is decided and written down here
  • install and update check requires.lua.<lib>; tests first
  • fragjan code . and make test (Lua 5.1 and 5.4) pass
## Problem A module.conf can declare hard Lua library dependencies in `[requires.lua.<lib>]` sections with min and max (this repository's own config/module.conf does for daw-lua-common and daw-lua-net). The module-manager does not evaluate them: deps.lua reads only `requires.system`, and install/module_deps.lua only `requires.module`; `requires.lua.*` is ignored. A module whose `requires.lua.<lib>` range does not match the library version in use is therefore installed without notice. Mixed versions are prevented only by the version pins of the host program. ## Scope - decide first where the version of an installed library comes from (settled in this issue before anything is implemented) - on install and update: check the declared min and max against that version; a mismatch is a daw_error/v1 error with its own resource_id and nothing is changed (same behaviour as for requires.module) - how libraries are delivered to the host is not part of this issue ## Acceptance criteria - [x] the source of the library version is decided and written down here - [x] install and update check `requires.lua.<lib>`; tests first - [x] `fragjan code .` and `make test` (Lua 5.1 and 5.4) pass
Author
Owner

Decision 2026-11-18: where the installed library version comes from

  • The version of an installed library is the string field version of the
    table returned by require(<module path>), the same way as for modules.
  • The consumer names that module path: [requires.lua.<lib>] gets the field
    require (e.g. require = daw.common), next to min and max.
  • A core library or core module (delivered as a submodule of a host, no
    make dist) carries its real version in init.lua, maintained by hand and
    equal to its VERSION file. The sentinel <DAW_SED_REPLACE_VERSION> is not
    used there, because nothing replaces it.

Follow-up issues are filed in daw-lua-common, daw-lua-net,
daw-modul-berhtjan-core, daw-modul-berhtjan-cli and fragjan.

Still to settle before implementing: what happens when require is missing in a
section, and when the module has no readable version (compare
module_version_unreadable for modules).

## Decision 2026-11-18: where the installed library version comes from - The version of an installed library is the string field `version` of the table returned by `require(<module path>)`, the same way as for modules. - The consumer names that module path: `[requires.lua.<lib>]` gets the field `require` (e.g. `require = daw.common`), next to `min` and `max`. - A core library or core module (delivered as a submodule of a host, no `make dist`) carries its real version in `init.lua`, maintained by hand and equal to its `VERSION` file. The sentinel `<DAW_SED_REPLACE_VERSION>` is not used there, because nothing replaces it. Follow-up issues are filed in daw-lua-common, daw-lua-net, daw-modul-berhtjan-core, daw-modul-berhtjan-cli and fragjan. Still to settle before implementing: what happens when `require` is missing in a section, and when the module has no readable `version` (compare `module_version_unreadable` for modules).
Author
Owner

Done 2026-11-18

install and update check requires.lua of the registry entry before anything
is downloaded (install/lib_deps.lua).

  • The version of a library in use is the version field of the table that
    require(<require>) returns. A section [requires.lua.<lib>] names that Lua
    module in its require field, next to min and max.
  • Unmet libraries (not loadable, or outside the range) are
    library_dependencies_unmet; a section without require is
    library_require_missing; a library without a version string is
    library_version_unreadable. Nothing is changed in any of these cases.
  • This repository's own config/module.conf names daw.common and daw.net.
  • fragjan code and make test (Lua 5.4 and 5.1) pass.

Not part of this issue, tracked elsewhere:

## Done 2026-11-18 `install` and `update` check `requires.lua` of the registry entry before anything is downloaded (`install/lib_deps.lua`). - The version of a library in use is the `version` field of the table that `require(<require>)` returns. A section `[requires.lua.<lib>]` names that Lua module in its `require` field, next to `min` and `max`. - Unmet libraries (not loadable, or outside the range) are `library_dependencies_unmet`; a section without `require` is `library_require_missing`; a library without a version string is `library_version_unreadable`. Nothing is changed in any of these cases. - This repository's own `config/module.conf` names `daw.common` and `daw.net`. - `fragjan code` and `make test` (Lua 5.4 and 5.1) pass. Not part of this issue, tracked elsewhere: - the `version` field in `init.lua` of the libraries: DAW/daw-lua-common#63, DAW/daw-lua-net#15, DAW/daw-modul-berhtjan-core#27, DAW/daw-modul-berhtjan-cli#17 - a check that `init.lua` and `VERSION` agree: DAW/fragjan#158 - the index tool has to write `requires.module` and `requires.lua` into the registry entry; until it does, an entry carries no `requires.lua` and nothing is checked.
michael 2026-11-18 17:25: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/daw-module-manager#31
No description provided.