Page MenuHomePhabricator

Switch WikiLambda front-end from hard-coded strings to using Z61/Programming language objects
Open, In Progress, MediumPublic

Description

  • [Existing behaviour] Proxy requests to the orchestrator which reference a language (Z16K1) with a hard-coded string.
  • [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.
    • 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:

  1. Initialize the ZCode value as a reference
  2. Change the selector menu item values to the programming language Zid
  3. When the selector emits an event, set the value under Z16K1->Z9K1 instead of Z16K1->Z61K1->Z6K1
  4. Pass to the ACE code editor the language string instead of the Zid for syntax highlight
  5. Make sure that the programming language is shown correctly in the FunctionViewerDetailsTable component
  6. 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: 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.
  3. Future (once all the persisted objects are fully migrated) ZCode only understand and creates referenced programming languages
    • TODO: create and implement migration plan

Event Timeline

Jdforrester-WMF changed the task status from Open to In Progress.Jan 9 2024, 8:24 PM
Jdforrester-WMF assigned this task to ecarg.
Jdforrester-WMF moved this task from Backlog to In Progress on the Abstract Wikipedia team board.

Change 989509 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] Adjust tests and allow them to fail

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

Change 989511 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] Fix lint errors

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

Change 989511 abandoned by Ecarg:

[mediawiki/extensions/WikiLambda@master] Fix lint errors

Reason:

mistake: meant to amend to an existing patch

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

Change 990175 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] add mock obj to zcode test

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

Change 989509 abandoned by Ecarg:

[mediawiki/extensions/WikiLambda@master] Adjust tests and allow them to fail

Reason:

having issues with squashing commits w/ same change-id, don't need these changes anyway

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

Change 990177 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] adjust zcode programming lang obj and add mock to test

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

Change 990175 abandoned by Ecarg:

[mediawiki/extensions/WikiLambda@master] add mock obj to zcode test

Reason:

rebasing mishap

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

Change 991464 had a related patch set uploaded (by Ecarg; author: Ecarg):

[mediawiki/extensions/WikiLambda@master] Set up selector menu items with updated Z61 reference objects

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

Change 990177 abandoned by Ecarg:

[mediawiki/extensions/WikiLambda@master] Adjust zcode programming lang obj value and fix test to correctly mock data

Reason:

this was using wrong repo/directory file configuration

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

Change 991464 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Dual support for selector value: Z reference objects and string literals

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

Change 1006539 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] Fix language column in implementations table when programming language is a reference

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

Change 1006539 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix language column in implementations table when programming language is a reference

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

Change 1006584 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] [WIP] Provide a maintenance script to migrate Z16s from strings to references

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

Change 1006584 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Provide a maintenance script to migrate Z16s from strings to references

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

Mentioned in SAL (#wikimedia-operations) [2024-05-22T16:13:33Z] <James_F> Running mwscript extensions/WikiLambda/maintenance/migrateZ16K1StringsToZ61s.php --wiki=wikifunctionswiki --implement on mwmaint1002 for T287153