The on-wiki version of this newsletter can be found here: https://www.wikifunctions.org/wiki/Wikifunctions:Status_updates/2024-02-14
Recent Changes in the software: Fix-it week
As mentioned in last week's update, we had our regular "Fix-It Week", where we work on technical debt, design oddities, and other issues that can pile up when our main daily focus is on delivering larger-scale change for users.
One of main areas of change was in cleaning-up the Vue front-end code, which has undergone a lot of change in the past few months. We improved our front-end Vuex "store" code to remove now-unused methods and change the remaining ones to be safer in edge cases (T329107 https://phabricator.wikimedia.org/T329107); we re-organised and split up the 'mix-ins' in the Vuex store for consistency and better testability ( T328430 https://phabricator.wikimedia.org/T328430).
On the back-end services, we made a few improvements to code quality. One of these was shifting the logging system from a global into our "Invariants" class, so that it can be dependency-injected and so tested better (T337785 https://phabricator.wikimedia.org/T337785). Our internal ZWrapper class will now correctly error rather than silently continuing when asked for a non-existent key (T309809 https://phabricator.wikimedia.org/T309809). We migrated the JavaScript code coverage tool to use the built artefact pipeline rather than running directly on the repo's code (T355815 https://phabricator.wikimedia.org/T355815). We also added pyflakes to our CI, to improve our Python evaluator code quality, in the course of which we found some bugs and added tests (T306365 https://phabricator.wikimedia.org/T306365).
We switched the Beta Cluster test version of the back-end services to use the 'split' evaluator model that we rolled out to production last year ( T349008 https://phabricator.wikimedia.org/T349008), and so we were able to decommission the old 'omnibus' image that would process both Python and JavaScript code (T349557 https://phabricator.wikimedia.org/T349557). After some checking to ensure we were content with the now-fixed results, we added a test to demonstrate and enforce the current model of error-handling in the WASM-wrapped JavaScript evaluator (T347898 https://phabricator.wikimedia.org/T347898).
We added a little further coverage of the PHP code that mirrors how Objects work (T302599 https://phabricator.wikimedia.org/T302599), finding and fixing a bug in how incoming results were interpreted in some circumstances. We also found and fixed a forgotten remnant of a now-removed piece of our test infrastructure that would cause errors when Wikimedia production rolled forward to PHP 8.2.
Outside of proper "Fix-It" tasks, we also landed two improvements that will roll out this week:
Following-on from last week's change to how string values are shown as outputs, wrapping them in double quote characters, we now also do the same for the abbreviated form, commonly seen on Test pages. This does not show all whitespace, but it is a further minor improvement in this vein (T343608 https://phabricator.wikimedia.org/T343608).
Winston Sung, a Wikimedia community member very active in Chinese language support, made their first contribution, fixing our use of whitespace on each Object page's title headings in Chinese and some other languages ( T356731 https://phabricator.wikimedia.org/T356731). Thank you, and welcome! Function of the Week: duplicate string
Duplicate string https://www.wikifunctions.org/view/en/Z10753 is a function that takes a single string as the input, and returns a single string as the output: the output is repeating the input twice. https://www.wikifunctions.org/wiki/File:Twins_11183454.jpg
Duplication https://en.wikipedia.org/wiki/Reduplication of words or parts of words, for various different effects, is a feature of many different languages from all around the world. In some languages it may express emphasis, in others a plural, but it can have many other semantic effects too. The Wikipedia article https://en.wikipedia.org/wiki/Reduplication provides an overview of how duplication is used, with numerous examples. Here are just two examples stolen from that page:
- In Finnish, *“ruoka”* means "food", but *“ruokaruoka”* means "proper food", as opposed to snacks. - In Swahili, *“piga”* means to “to strike”; whereas *“pigapiga”* means “to strike repeatedly”
In Wikifunctions, duplicate string has five tests, WikiWiki https://www.wikifunctions.org/view/en/Z10754, 1.11.1 https://www.wikifunctions.org/view/en/Z10760, ¨¨ https://www.wikifunctions.org/view/en/Z10763, the space character https://www.wikifunctions.org/view/en/Z10756, and the empty string https://www.wikifunctions.org/view/en/Z10755 (a test that display correctly as of today, thanks to the fix-it tasks of this week). Those are great tests, trying out different kinds of characters and inputs. I particularly enjoyed the empty string as an edge case. What I am missing are non-English alphabet characters such as Hangul characters, left-to-right scripts, or emojis. But this is a great set already.
There are four implementations, of which three are unsurprising: JavaScript https://www.wikifunctions.org/view/en/Z10759, Python https://www.wikifunctions.org/view/en/Z10758, and a composition https://www.wikifunctions.org/view/en/Z10757 using join strings https://www.wikifunctions.org/view/en/Z10000, all of which are calling the argument twice. The fourth implementation https://www.wikifunctions.org/view/en/Z10913, another composition, is using the function duplicate string n-times https://www.wikifunctions.org/view/en/Z10911, which is a great function to be used here, but requires a number as one of its arguments, but uses a string (set to the string “2”, for the given composition). Once we actually have a number type, this would need to be cleaned up.
All in all, this is a neat functionality, which is usually not available through a standard library, and can exemplify tests and different implementations.
abstract-wikipedia@lists.wikimedia.org