Implementation details
Currently, the component ZCode handles literal values for Z16K1 (programming language) by:
- Initializing the ZCode value as:
{
"Z1K1": "Z16",
"Z16K1": {
"Z1K1": "Z61",
"Z61K1": ""
},
"Z16K2": ""
}- Setting cdx-selector menu items to have values of literal programming language strings (Z61K1)
- When clicking on the cdx-selector item, setting the emitted string as the value of "Z61K1"
To move to using references instead of literals we need to:
- Initialize the ZCode value as a reference
- Change the selector menu item values to the programming language Zid
- When the selector emits an event, set the value under Z16K1->Z9K1 instead of Z16K1->Z61K1->Z6K1
- Pass to the ACE code editor the language string instead of the Zid for syntax highlight
- Make sure that the programming language is shown correctly in the FunctionViewerDetailsTable component
- Make sure that the implementation validator checks the completion of the reference field
Transition from literal to reference
Final Goal: All ZCode objects must reference the programming language, none will contain literals.
Phases:
- Current: ZCode only understand and creates literal programming languages
- After accomplishment of this task:
- ZCode component:
- should be able to read literal and referenced programming languages.
- when creating new code objects, it should create them with referenced programming languages.
- when editing existing code objects, the new values should have referenced programming languages.
- ZImplementation validation: submission.validateZObject
- should be able to validate ZCode objects when they have literal and referenced programming languages
- should be able to detect empty values, and flag completion errors, when they have literal and referenced programming languages
- ZImplementation transformation: submission.transformZObjectForSubmission
- on saving any edit in a ZImplementation object, automatically transform the ZCode programming language from literal to reference
- FunctionViewerDetailsTable component should be able to show the language for both literal and referenced programming languages.
- ZCode component:
- Future (once all the persisted objects are fully migrated) ZCode only understand and creates referenced programming languages
- Make sure all implementations in production use referenced programming languages (search for Z61K1 and make sure there are no implementations using this key)
- Make sure all implementations in beta cluster use referenced programming languages
- Run migrateZ16K1StringsToZ61s maintenance script in beta cluster: Currently there are many implementations using Z61K1 (see search in beta, all zids over Z10000 are user-contributed implementations)
- Remove dual functionality from:
- ZCode.vue component
- ZImplementation validation: submission.validateZObject
- Tests
See the patch implementing dual support to find things to revert: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/991464