fix(ci): guard migration SQL files against exceeding the manifest version #53

Merged
jmiller merged 1 commits from fix/ci-schema-version-guard into main 2026-07-12 21:38:35 +00:00
Owner

Problem

The SQL schema validation step in ci-joomla.yml had two gaps that let a real bug through on MokoSuiteCommunity:

  1. No over-manifest guard. Check #10 only verified that a .sql exists for the manifest version. Nothing flagged update files above the manifest. Migration files 01.02.00.sql..01.14.00.sql (a stray semver lane) coexisted with a 01.01.40 manifest, so Joomla recorded #__schemas.version_id = 01.14.00 while the release version was 01.01.40 — a runtime "database version mismatch" that CI never caught.
  2. Package-level version applied to every component. Check #10 resolved one manifest (the package XML at maxdepth 2) and required every sql/updates/mysql dir to contain a file at that single version, mis-flagging sub-extensions that version independently (e.g. membership).

Fix

Rewrite the block to iterate each sql/updates/mysql dir and resolve its own component manifest (three levels up), then per component:

  • (10) require a ${component_version}.sql in that component's own update dir;
  • (11) new guard — fail if any update file's version exceeds that component's manifest version (sort -V comparison, pre-release suffix stripped).

Applies only to Template-JoomlaTemplate-Generic has no Joomla SQL-migration concept (verified: zero sql/updates references in its workflows).

Authored-by: Moko Consulting

https://claude.ai/code/session_01VXrBk7psPzJPHVuBDJwt2x

## Problem The `SQL schema validation` step in `ci-joomla.yml` had two gaps that let a real bug through on MokoSuiteCommunity: 1. **No over-manifest guard.** Check #10 only verified that a `.sql` *exists* for the manifest version. Nothing flagged update files *above* the manifest. Migration files `01.02.00.sql`..`01.14.00.sql` (a stray semver lane) coexisted with a `01.01.40` manifest, so Joomla recorded `#__schemas.version_id = 01.14.00` while the release version was `01.01.40` — a runtime "database version mismatch" that CI never caught. 2. **Package-level version applied to every component.** Check #10 resolved one manifest (the package XML at `maxdepth 2`) and required *every* `sql/updates/mysql` dir to contain a file at that single version, mis-flagging sub-extensions that version independently (e.g. membership). ## Fix Rewrite the block to iterate each `sql/updates/mysql` dir and resolve its **own** component manifest (three levels up), then per component: - **(10)** require a `${component_version}.sql` in that component's own update dir; - **(11) new guard** — fail if any update file's version exceeds that component's manifest version (`sort -V` comparison, pre-release suffix stripped). Applies only to `Template-Joomla` — `Template-Generic` has no Joomla SQL-migration concept (verified: zero `sql/updates` references in its workflows). Authored-by: Moko Consulting https://claude.ai/code/session_01VXrBk7psPzJPHVuBDJwt2x
jmiller added 1 commit 2026-07-12 21:37:23 +00:00
fix(ci): guard migration SQL files against exceeding the manifest version
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Universal: PR Check / Secret Scan (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Branch Cleanup / Delete merged branch (pull_request) Has been cancelled
RC Revert / Rename rc/ back to dev/ (pull_request) Has been cancelled
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Has been cancelled
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
8c579a2841
Rework the SQL-schema check so each component is validated against ITS OWN
manifest version instead of a single package-level version applied to every
sql/updates/mysql dir (which mis-flagged independently-versioned sub-extensions).

Add check #11: fail if any update file version exceeds its component manifest
version. This catches migration files drifting onto a different numbering lane
and getting ahead of the release version (e.g. 01.14.00.sql while the manifest
is 01.01.40) at PR time instead of surfacing as a runtime schema mismatch.

Authored-by: Moko Consulting
Claude-Session: https://claude.ai/code/session_01VXrBk7psPzJPHVuBDJwt2x
jmiller merged commit e37c98d70d into main 2026-07-12 21:38:35 +00:00
jmiller deleted branch fix/ci-schema-version-guard 2026-07-12 21:38:36 +00:00
Sign in to join this conversation.
No Reviewers
Priority -
Type -
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/Template-Joomla#53