Page MenuHomePhabricator

Migration Schemas to a non-latest version is broken
Open, MediumPublic5 Estimated Story PointsBUG REPORT

Description

The migrateSchema.php maintenance script developer for T357532: Create a system to support developers while upgrading configuration schemas supports in principle both upgrading and downgrading. However, there is a fundamental problem with migrating to anything besides the most recent version of a Schema: The store and the validator used to save that schema are not version-aware.
That means when migrating to anything but the most-recent version, then the schema saved will still be validated with the most recent Schema and it will be saved with the version of the most-recent Schema.

Acceptance Criteria:

  • It is possible to migrate Configuration to any version of a Schema. That version will be validated with the Schema at that version, and have that version as the value for $version in the stored json.
  • in particular, it is possible to migrate to the first version of a Schema
  • there exist e2e tests asserting that functionality in the CommunityConfiguration extension

Related Objects

Event Timeline

Michael renamed this task from Migration Schemas to a non-latest fundamentally broken to Migration Schemas to a non-latest version is fundamentally broken.
Michael renamed this task from Migration Schemas to a non-latest version is fundamentally broken to Migration Schemas to a non-latest version is broken.

Change #1056959 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/GrowthExperiments@master] refactor(SchemaConverters): prepare rename of downgradeFromNewer to downgradeToPrevious

https://gerrit.wikimedia.org/r/1056959

Change #1056960 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/GrowthExperiments@master] refactor: Remove unused code

https://gerrit.wikimedia.org/r/1056960

Change #1056961 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] fix(migrateSchema): use correct converter when downgrading

https://gerrit.wikimedia.org/r/1056961

Change #1056962 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] refactor(ISchemaConverter): rename downgrading method

https://gerrit.wikimedia.org/r/1056962

Note that while the added changes improve the code, they do not yet address the fundamental issue brought up in this task and mentioned in the AC. So this task should not move to QA until the main points have actually been addressed.

Change #1056961 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] fix(migrateSchema): use correct converter when downgrading

https://gerrit.wikimedia.org/r/1056961

Change #1056959 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] refactor(SchemaConverters): prepare rename of downgradeFromNewer to downgradeToPrevious

https://gerrit.wikimedia.org/r/1056959

Change #1056962 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] refactor(ISchemaConverter): rename downgrading method

https://gerrit.wikimedia.org/r/1056962

Change #1056960 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] refactor: Remove unused code

https://gerrit.wikimedia.org/r/1056960

KStoller-WMF subscribed.

Estimation planning decision: this task should be broken into subtasks

KStoller-WMF set the point value for this task to 5.Mar 3 2025, 5:18 PM

General approach to finish implementing the migration feature:

  • write example migration and test for CommunityConfigurationExample (test will be failing for now)
  • when writing configuration, it should be validated with the Schema of its own version
  • when reading configuration for functional usage from code, the converters must be applied to bring it to the latest version
  • when reading configuration for rendering value in the Special:CommunityConfiguration form, then too the converters must be applied to bring it to the latest version

⇒ running the migration script will be a "convenience" so that the change of functionality is visible in the history of the config wiki-page, but it should not change anything functionality-wise

Change #1131996 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] fix: finish implementing migrations

https://gerrit.wikimedia.org/r/1131996

Change #1139103 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] refactor: make IValidator implementations version-aware

https://gerrit.wikimedia.org/r/1139103

Change #1139104 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/CommunityConfiguration@master] refactor: make IValidator version aware

https://gerrit.wikimedia.org/r/1139104

Change #1139106 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/ReportIncident@master] refactor: make use of version in schema for validation

https://gerrit.wikimedia.org/r/1139106

This is finally ready for review now.

Change #1161998 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/TemplateData@master] refactor: make use of version in schema for validation

https://gerrit.wikimedia.org/r/1161998

Change #1139103 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] refactor: make IValidator implementations version-aware

https://gerrit.wikimedia.org/r/1139103

Change #1139104 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] refactor: make IValidator version aware

https://gerrit.wikimedia.org/r/1139104

Change #1161998 merged by jenkins-bot:

[mediawiki/extensions/TemplateData@master] refactor: make use of version in schema for validation

https://gerrit.wikimedia.org/r/1161998

Change #1169068 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Cite@master] Fix incomplete CommunityConfiguration SchemaProviderTestCase

https://gerrit.wikimedia.org/r/1169068

Change #1169068 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] Fix incomplete CommunityConfiguration SchemaProviderTestCase

https://gerrit.wikimedia.org/r/1169068