Page MenuHomePhabricator

Fix and Maintain Wikilambda CLI Tool
Closed, ResolvedPublic

Description

This tool offers an expressive syntax for creating ZObjects. Among other things, this syntax can improve developer velocity by accelerating test creation.

  • Move to Gerrit and set up code review.
  • Add tests.
  • Set up continuous integration.

Event Timeline

It turns out the error UnhandledPromiseRejectionWarning: TypeError: s.toLowerCase(...).replaceAll is not a function was caused by my Node version being too old: https://stackoverflow.com/questions/13340131/string-prototype-replaceall-not-working. I switched to a newer version and the error went away.

Now getting "could not delabel reference" when trying to evaluate:

lambda.js --evaluate 'and(false, true)'
No config.json exists, using config.default.json instead.
Error
  error type: "could not delabel reference"
  error value: ZToken
  K1: "ZSymbol"
  K2: "1"
  K3: "and"

That one was resolved by pointing the "wiki" in the config to the correct address ("http://localhost:8080"). By default the first one in the config is used (which by default is "https://wikifunctions.beta.wmflabs.org").

Cliffy4040 renamed this task from Fix and Maintain Wikilambda CLI Tool to Seanchomo.May 31 2022, 7:16 AM
Cliffy4040 closed this task as Declined.
Cliffy4040 removed AAssaf as the assignee of this task.
Cliffy4040 triaged this task as Low priority.
Cliffy4040 updated the task description. (Show Details)
Cliffy4040 removed subscribers: AAssaf, cmassaro.
Aklapper renamed this task from Seanchomo to Fix and Maintain Wikilambda CLI Tool.May 31 2022, 7:58 AM
Aklapper reopened this task as Open.
Aklapper assigned this task to AAssaf.
Aklapper raised the priority of this task from Low to Needs Triage.
Aklapper updated the task description. (Show Details)
Aklapper added subscribers: cmassaro, AAssaf.

Some fixes were submitted in https://github.com/vrandezo/lambda-cli/pull/2.

Lists are still broken after the switch to Benjamin arrays.

Also mentioned with Denny and Ori the idea of bringing it over from Github into the WMF repositories and setting up CI for it to avoid future breakages.

In T308771#8055786, @AAssaf-WMF wrote:

Also mentioned with Denny and Ori the idea of bringing it over from Github into the WMF repositories and setting up CI for it to avoid future breakages.

James suggested creating this under the mediawiki/tools namespace, which makes sense to me. The full repo name can be mediawiki/tools/wikilambda-cli. The process for requesting a new repository is documented here: https://www.mediawiki.org/wiki/Gerrit/New_repositories. @AAssaf-WMF, do you want to give this a shot? If not, I'd be happy to request it.

Change 814155 had a related patch set uploaded (by AAssaf; author: AAssaf):

[mediawiki/tools/wikilambda-cli@master] Bring lambda CLI up to date with latest function schemata.

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

Change 814155 merged by jenkins-bot:

[mediawiki/tools/wikilambda-cli@master] Bring lambda CLI up to date with latest function schemata.

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

Hey @AAssaf-WMF, in the task triage meeting today we wondered if this was ready to mark as Resolved; if you're OK with it, shall we do that?

There are still some undefined that show up due to the typed lists migration that we need to fix.

Actually might not be related to lists migration, but here is an example:

$ lambda --noeval --normal 'if(true, [String, "a", "b"] , [String, "c", "d"])'
{
  "Z1K1": {
    "Z1K1": "Z9",
    "Z9K1": "Z7"
  },
  "Z7K1": {
    "Z1K1": "Z9",
    "Z9K1": "Z802"
  },
  "Z802K1": {
    "Z1K1": "Z9",
    "Z9K1": "Z41"
  },
  "Z802K2": {
    "Z1K1": {
      "Z1K1": {
        "Z1K1": "Z9",
        "Z9K1": "Z7"
      },
      "Z7K1": {
        "Z1K1": "Z9",
        "Z9K1": "Z881"
      },
      "Z881K1": {
        "Z1K1": "Z9",
        "Z9K1": "Z6"
      }
    },
    "K1": {
      "Z1K1": "Z6",
      "Z6K1": "a"
    },
    "K2": {
      "Z1K1": {
        "Z1K1": {
          "Z1K1": "Z9",
          "Z9K1": "Z7"
        },
        "Z7K1": {
          "Z1K1": "Z9",
          "Z9K1": "Z881"
        },
        "Z881K1": {
          "Z1K1": "Z9",
          "Z9K1": "Z6"
        }
      },
      "K1": {
        "Z1K1": "Z6",
        "Z6K1": "b"
      },
      "K2": {
        "Z1K1": {
          "Z1K1": {
            "Z1K1": "Z9",
            "Z9K1": "Z7"
          },
          "Z7K1": {
            "Z1K1": "Z9",
            "Z9K1": "Z881"
          },
          "Z881K1": {
            "Z1K1": "Z9",
            "Z9K1": "Z6"
          }
        }
      }
    }
  },
  "Z802K3": {
    "Z1K1": {
      "Z1K1": {
        "Z1K1": "Z9",
        "Z9K1": "Z7"
      },
      "Z7K1": {
        "Z1K1": "Z9",
        "Z9K1": "Z881"
      },
      "Z881K1": {
        "Z1K1": "Z9",
        "Z9K1": "Z6"
      }
    },
    "K1": {
      "Z1K1": "Z6",
      "Z6K1": "c"
    },
    "K2": {
      "Z1K1": {
        "Z1K1": {
          "Z1K1": "Z9",
          "Z9K1": "Z7"
        },
        "Z7K1": {
          "Z1K1": "Z9",
          "Z9K1": "Z881"
        },
        "Z881K1": {
          "Z1K1": "Z9",
          "Z9K1": "Z6"
        }
      },
      "K1": {
        "Z1K1": "Z6",
        "Z6K1": "d"
      },
      "K2": {
        "Z1K1": {
          "Z1K1": {
            "Z1K1": "Z9",
            "Z9K1": "Z7"
          },
          "Z7K1": {
            "Z1K1": "Z9",
            "Z9K1": "Z881"
          },
          "Z881K1": {
            "Z1K1": "Z9",
            "Z9K1": "Z6"
          }
        }
      }
    }
  }
}
undefined
  function: If
  condition: true
  then: undefined
  K1: "a"
  K2: undefined
  K1: "b"
  K2: undefined
  else: undefined
  K1: "c"
  K2: undefined
  K1: "d"
  K2: undefined

Change 820136 had a related patch set uploaded (by AAssaf; author: AAssaf):

[mediawiki/tools/wikilambda-cli@master] Fix indentation in formatting of lambda CLI output.

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

Change 820136 merged by jenkins-bot:

[mediawiki/tools/wikilambda-cli@master] Fix indentation in formatting of lambda CLI output.

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

Change 820449 had a related patch set uploaded (by AAssaf; author: AAssaf):

[mediawiki/tools/wikilambda-cli@master] Fix formatting of complex objects.

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

Change 820449 merged by jenkins-bot:

[mediawiki/tools/wikilambda-cli@master] Fix formatting of complex objects.

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

I think we can consider this done.