Page MenuHomePhabricator

When creating a function definition the argument declaration ids start from K2 instead of K1
Closed, ResolvedPublic

Description

Steps to reproduce

    • Observed behavior**
  • Once the function is successfully created, you should be redirected to the function view page
  • On the "Current ZObject" JSON textbox, under the Details sidebar, on exploration of the created ZObject, the ID for the created function is K2:
"Z8K1": [
     "Z17",
     {
         "Z1K1": "Z17",
         "Z17K1": "Z6",
         "Z17K2": {
             "Z1K1": "Z6",
             "Z6K1": "Z10014K2" <<-----------------
         },
         "Z17K3": {
             "Z1K1": "Z12",
             "Z12K1": [
                 "Z11",
                 {
                     "Z1K1": "Z11",
                     "Z11K1": "Z1002",
                     "Z11K2": "input one"
                 }
             ]
         }
     }
 ],

Expected behavior

  • Argument IDs should start at K1
"Z8K1": [
     "Z17",
     {
         "Z1K1": "Z17",
         "Z17K1": "Z6",
         "Z17K2": {
             "Z1K1": "Z6",
             "Z6K1": "Z10014K1" <<-----------------
         },
         "Z17K3": {
             "Z1K1": "Z12",
             "Z12K1": [
                 "Z11",
                 {
                     "Z1K1": "Z11",
                     "Z11K1": "Z1002",
                     "Z11K2": "input one"
                 }
             ]
         }
     }
 ],

Event Timeline

This bug is extremely confusing and difficult to replicate. Following the same process (same function creation, from the same page, same inputs and same output, added in the same order), has rendered different results (one correctly starting keys at K1 and the other starting keys at K2). See screenshots:

Screenshot from 2022-07-22 11-34-51.png (1×1 px, 183 KB)

Screenshot from 2022-07-22 11-35-29.png (1×1 px, 183 KB)

I'm wondering if https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/816760 might fix this? I noticed sometimes you end up on 'K2+' if you've overwritten the existing argument. So on creating a totally new function I get 'K1', but editing I end up with 'K2'.

Ah nevermind, it still seems to be an issue even with that patch in.

When I try to do it I consistently get the wrong numbering, I never get the case that the numbering is right. I am curious about what the difference is :/ These non-deterministic bugs are the worst!

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

[mediawiki/extensions/WikiLambda@master] Remove double initialization of ZFunction

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

Change 819633 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Remove double initialization of ZFunction

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