feat: version format enforcement — sanitize to XX.YY.ZZ on bump/release for Joomla repos #313

Open
opened 2026-06-23 17:39:59 +00:00 by jmiller · 1 comment
Owner

Summary

mokocli's version tools require XX.YY.ZZ (zero-padded two-digit groups) but silently fail when manifests use standard semver (1.0.0). Need both detection and auto-correction.

Root Cause

The version regex \d{2}\.\d{2}\.\d{2} in version_read.php, version_bump.php, and release_publish.php requires exactly two digits per group. A manifest with <version>1.0.0</version> doesn't match, producing No version found.

Requirements

1. Version sanitization on bump and release

When platform_detect returns joomla, automatically sanitize any version found in manifests to XX.YY.ZZ:

  • 1.0.001.00.00
  • 2.1.302.01.03
  • 10.5.010.05.00

Apply in:

  • version_bump.php — sanitize before writing bumped version
  • version_read.php — sanitize on read (or at least accept both formats)
  • release_publish.php — sanitize before creating release tag/name

2. Clear error on format mismatch

When a Joomla manifest contains a non-padded version and sanitization is not applied (e.g. read-only mode), emit:

WARNING: Version "1.0.0" in source/pkg_foo.xml does not match XX.YY.ZZ format. Auto-correcting to 01.00.00.

3. Scope

  • Joomla repos only — generic/node/python repos use standard semver and should not be touched
  • Check platform_detect output before enforcing format

Context

  • MokoSuiteStoreLocator auto-release failed because manifests used 1.0.0 instead of 01.00.00
  • Fixed in consumer repo (167ae2d) but mokocli should handle this gracefully
  • Affects any new Joomla repo that doesn't know about the padding convention
## Summary mokocli's version tools require `XX.YY.ZZ` (zero-padded two-digit groups) but silently fail when manifests use standard semver (`1.0.0`). Need both detection and auto-correction. ## Root Cause The version regex `\d{2}\.\d{2}\.\d{2}` in `version_read.php`, `version_bump.php`, and `release_publish.php` requires exactly two digits per group. A manifest with `<version>1.0.0</version>` doesn't match, producing `No version found`. ## Requirements ### 1. Version sanitization on bump and release When `platform_detect` returns `joomla`, automatically sanitize any version found in manifests to `XX.YY.ZZ`: - `1.0.0` → `01.00.00` - `2.1.3` → `02.01.03` - `10.5.0` → `10.05.00` Apply in: - `version_bump.php` — sanitize before writing bumped version - `version_read.php` — sanitize on read (or at least accept both formats) - `release_publish.php` — sanitize before creating release tag/name ### 2. Clear error on format mismatch When a Joomla manifest contains a non-padded version and sanitization is not applied (e.g. read-only mode), emit: ``` WARNING: Version "1.0.0" in source/pkg_foo.xml does not match XX.YY.ZZ format. Auto-correcting to 01.00.00. ``` ### 3. Scope - **Joomla repos only** — generic/node/python repos use standard semver and should not be touched - Check `platform_detect` output before enforcing format ## Context - MokoSuiteStoreLocator auto-release failed because manifests used `1.0.0` instead of `01.00.00` - Fixed in consumer repo (`167ae2d`) but mokocli should handle this gracefully - Affects any new Joomla repo that doesn't know about the padding convention
Author
Owner

Root cause identified: Not a path resolution issue — SourceResolver already handles source/ correctly. The actual bug is the version regex \d{2}\.\d{2}\.\d{2} which requires exactly two digits per group (e.g. 01.00.00). Standard semver 1.0.0 doesn't match.

Fix applied in MokoSuiteStoreLocator: Changed all manifests to use 01.00.00 format per MokoStandards convention (167ae2d).

Enhancement request: Add error handling in version_read.php and version_bump.php that detects non-padded versions in Joomla manifests and either:

  1. Auto-corrects them to XX.YY.ZZ format, or
  2. Emits a clear error: Version "1.0.0" in {file} does not match required XX.YY.ZZ format. Use zero-padded versions (e.g. 01.00.00).

This should be enforced for Joomla platform repos only (not generic/node/python repos which use standard semver).

**Root cause identified**: Not a path resolution issue — `SourceResolver` already handles `source/` correctly. The actual bug is the version regex `\d{2}\.\d{2}\.\d{2}` which requires exactly two digits per group (e.g. `01.00.00`). Standard semver `1.0.0` doesn't match. **Fix applied in MokoSuiteStoreLocator**: Changed all manifests to use `01.00.00` format per MokoStandards convention (`167ae2d`). **Enhancement request**: Add error handling in `version_read.php` and `version_bump.php` that detects non-padded versions in Joomla manifests and either: 1. Auto-corrects them to `XX.YY.ZZ` format, or 2. Emits a clear error: `Version "1.0.0" in {file} does not match required XX.YY.ZZ format. Use zero-padded versions (e.g. 01.00.00).` This should be enforced for Joomla platform repos only (not generic/node/python repos which use standard semver).
jmiller changed title from bug: version_bump.php fails to find Joomla XML manifests in source/ subdirectory to feat: version format enforcement — sanitize to XX.YY.ZZ on bump/release for Joomla repos 2026-06-23 17:43:14 +00:00
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoCLI#313