feat: refuse placeholder versions in the schema

core_version is a string the code states, null or keyed by build mode,
and the schema refuses Git, SVN, unknown, master, main, latest, dev and
HEAD, alone or annotated. version_basis is defined per kind with the
fields each one needs, and kind none requires a null version.

tests/test_version_basis.py reads a recorded fixture of forge answers
offline and fails on drift, holds every profile to a basis (tag versions
in describe form, aliases equal to their profile, none as null), checks
that a pin advance reads the version again or is refused, and that the
schema refuses placeholders.
This commit is contained in:
Abdessamad Derraz committed 2026-10-27 19:23:17 +01:00
1 parent 3199bc2a55
commit 91b7bd94d0
7 files changed
+708 -8

No files matched your search

+5 -1
View File
@@ -93,7 +93,11 @@ def _by_mode(profile: dict, field: str, mode: str) -> str | None:
def is_placeholder(value: object) -> bool:
return isinstance(value, str) and value.strip().casefold() in PLACEHOLDERS
"""A VCS or branch word standing for a version, alone or annotated
("SVN (2015 snapshot)"). The schema refuses the same strings."""
if not isinstance(value, str):
return False
return re.split(r"[\s(]", value.strip(), maxsplit=1)[0].casefold() in PLACEHOLDERS
def format_version(match: re.Match, template: str | None) -> str: