[x] [Existing behaviour] Proxy requests to the orchestrator which reference a language (Z16K1) with a hard-coded string.
[x] [New] Change the UX to save new and edited Implementations to use a ZID not a language string.
[ ] [New] Write and run a one-off migration script that changes all on-wiki Z16s to use a Z61 by reference.
[x] Written
[ ] Run
[ ] [New] Proxy requests that reference a language with a ZID; add tests that assert this works.
[ ] [New] Re-write incoming requests that use a hard-coded string instead to use the correct ZID; add tests that this works.
[ ] [**Once the front-end only emits ZIDs**] Drop re-write code and extra tests.
---
**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:
1. **Current**: ZCode only understand and creates literal programming languages
2. **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: [[ https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikiLambda/+/refs/heads/master/resources/ext.wikilambda.edit/store/modules/zobject/submission.js#44 | 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: [[ https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikiLambda/+/refs/heads/master/resources/ext.wikilambda.edit/store/modules/zobject/submission.js#286 | 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.
# **Future** (once all the persisted objects are fully migrated) ZCode only understand and creates referenced programming languages
*** TODO: create and implement migration plan