From 711a1538c0a4661c8e624cf9da4c11e106e58169 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 13:05:48 -0800 Subject: [PATCH 1/8] Update dependencies Switch back to a released version of ThingTalk --- package-lock.json | 143 +++++++++++++++++++++++++++++----------------- package.json | 22 +++---- 2 files changed, 101 insertions(+), 64 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99eaf60ec..ce1166444 100644 --- a/package-lock.json +++ b/package-lock.json @@ -643,6 +643,27 @@ } } }, + "@node-redis/client": { + "version": "1.0.0-rc.0", + "resolved": "https://registry.npmjs.org/@node-redis/client/-/client-1.0.0-rc.0.tgz", + "integrity": "sha512-+DHbQ5rObps7WW3rMsOFG/4JfpPZQ6EqPHRlRUNOBtwE3sadYqpLTJMSRHDFjRFjhgwnIbvmbN/V6TnB14lCAw==", + "requires": { + "cluster-key-slot": "1.1.0", + "generic-pool": "3.8.2", + "redis-parser": "3.0.0", + "yallist": "4.0.0" + } + }, + "@node-redis/json": { + "version": "1.0.0-rc.0", + "resolved": "https://registry.npmjs.org/@node-redis/json/-/json-1.0.0-rc.0.tgz", + "integrity": "sha512-bSLHcDWZKGvLIq8YjpkZJNy8FnNQSZNlYwNSvnUIDV+NInhWcY3e0i0xkBbGevrXscNUzPMZCUDMW9/SI/57sQ==" + }, + "@node-redis/search": { + "version": "1.0.0-rc.0", + "resolved": "https://registry.npmjs.org/@node-redis/search/-/search-1.0.0-rc.0.tgz", + "integrity": "sha512-FEVsL18GXmYh4Figh7aGW/xyP3b7TXiE2d4/dLasK8szinmHz3oYyXFh1H5opz9oqBkwZsoPWkQMgXxsRUnNRA==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -755,19 +776,12 @@ } }, "@types/body-parser": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.1.tgz", - "integrity": "sha512-a6bTJ21vFOGIkwM0kzh9Yr89ziVxq4vYH2fQ6N8AeipEzai/cFK6aGMArIkUeIdRIgpwQa+2bXiLuUJCpSf2Cg==", + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", "requires": { "@types/connect": "*", "@types/node": "*" - }, - "dependencies": { - "@types/node": { - "version": "16.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", - "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==" - } } }, "@types/byline": { @@ -1040,9 +1054,9 @@ "dev": true }, "@types/jsonwebtoken": { - "version": "8.5.5", - "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.5.tgz", - "integrity": "sha512-OGqtHQ7N5/Ap/TUwO6IgHDuLiAoTmHhGpNvgkCm/F4N6pKzx/RBSfr2OXZSwC6vkfnsEdb6+7DNZVtiXiwdwFw==", + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.6.tgz", + "integrity": "sha512-+P3O/xC7nzVizIi5VbF34YtqSonFsdnbXBnWUCYRiKOi1f9gA4sEFvXkrGr/QVV23IbMYvcoerI7nnhDUiWXRQ==", "dev": true, "requires": { "@types/node": "*" @@ -2145,9 +2159,9 @@ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, "aws-sdk": { - "version": "2.1023.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1023.0.tgz", - "integrity": "sha512-RAI8sUfK+00yL9i3xz5kbM3+t/0mjjnKhKyauXAlJN4seDYtIX5+BqMghpkZwvLBdi6idXIuz+FHWETHZccyuA==", + "version": "2.1031.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1031.0.tgz", + "integrity": "sha512-XXrQG7l9WMYSg4fZNZctrgPjpTb6HPk1DaM2vXfhMHaNl8TyHjyeMkvU+CC0ctlPqgoCMLrGWI4Zxnq8yrsnXA==", "requires": { "buffer": "4.9.2", "events": "1.1.1", @@ -2284,9 +2298,9 @@ } }, "big-integer": { - "version": "1.6.50", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.50.tgz", - "integrity": "sha512-+O2uoQWFRo8ysZNo/rjtri2jIwjr3XfeAgRjAUADRqGG+ZITvyn8J1kvXLTaKVr3hhGXk+f23tKfdzmklVM9vQ==" + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==" }, "bignumber.js": { "version": "9.0.1", @@ -3020,19 +3034,35 @@ "dev": true }, "cli-table": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.6.tgz", - "integrity": "sha512-ZkNZbnZjKERTY5NwC2SeMeLeifSPq/pubeRoTpdr3WchLlnZg6hEgvHkK5zL7KNFdd9PmHN8lxrENUwI3cE8vQ==", + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.7.tgz", + "integrity": "sha512-ADKScujxlVFQhcea3OW7MmQRhUW3VDhaVRLx/77FjIME04K/BrguPa+p8DaXYSSlxDTO1f4ykf71a6WG0OB2/A==", "dev": true, "requires": { - "colors": "1.0.3" + "colors": "1.0.3", + "strip-ansi": "^6.0.1" }, "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, "colors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } } } }, @@ -3320,12 +3350,19 @@ "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" }, "cookie-parser": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz", - "integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", "requires": { - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6" + }, + "dependencies": { + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + } } }, "cookie-signature": { @@ -5086,8 +5123,8 @@ "integrity": "sha512-nGToKy6p3PAbYQ7p1UlWl6vSPwfwU6TMSWK7TTu+WUY4ZjyZQGniGGt2oNVvyNSpyZYSB43zMXVLcBm08MTMkg==" }, "genie-toolkit": { - "version": "github:stanford-oval/genie-toolkit#6ae4efe2e078e82762a7955b1b3f1bca6ab87d65", - "from": "github:stanford-oval/genie-toolkit#wip/misc-fixes", + "version": "github:stanford-oval/genie-toolkit#85f6cddadead2c833965bf59d06e27cb39c673af", + "from": "github:stanford-oval/genie-toolkit", "requires": { "@js-temporal/polyfill": "^0.2.0", "JSONStream": "^1.3.5", @@ -5106,7 +5143,7 @@ "fastest-levenshtein": "^1.0.12", "flex-js": "^1.0.5", "form-data": "^4.0.0", - "gettext-parser": "^4.0.4", + "gettext-parser": "^4.2.0", "ip": "^1.1.5", "js-yaml": "^4.1.0", "lice-js": "^0.2.0", @@ -5114,7 +5151,7 @@ "mmap-io": "^1.1.7", "morgan": "^1.9.1", "node-gettext": "^3.0.0", - "nodemailer": "^6.7.0", + "nodemailer": "^6.7.1", "q": "^1.5.0", "qs": "^6.10.1", "query-validation": "^0.2.1", @@ -5124,7 +5161,7 @@ "stemmer": "^1.0.5", "string-interp": "^0.3.1", "thingpedia": "^2.10.0-alpha.5", - "thingtalk": "github:stanford-oval/thingtalk#master", + "thingtalk": "^2.1.0-alpha.11", "thingtalk-units": "^0.2.0", "twilio": "^3.71.1", "typescript": "~4.3.5", @@ -5207,9 +5244,9 @@ } }, "gettext-parser": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-4.0.4.tgz", - "integrity": "sha512-VDZEeOIYd0veZXt5iAn0SS3I0Fz14fJw+59avRNa7VIslEDriRLxcfrBd/xeQyOcm6nyS4uuufxm2iw88qirAg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-4.2.0.tgz", + "integrity": "sha512-aMgPyjC9W5Mz9tbFU8DcQ7GYMXoFWq633kaWGt4imlcpBWzDIWk7HY7nCSZTCJxyjRaLq9L/NEjMKkZ9gR630Q==", "requires": { "content-type": "^1.0.4", "encoding": "^0.1.13", @@ -7963,9 +8000,9 @@ "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "moment-timezone": { - "version": "0.5.33", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.33.tgz", - "integrity": "sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w==", + "version": "0.5.34", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz", + "integrity": "sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==", "requires": { "moment": ">= 2.9.0" } @@ -8310,9 +8347,9 @@ "dev": true }, "nodemailer": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.0.tgz", - "integrity": "sha512-AtiTVUFHLiiDnMQ43zi0YgkzHOEWUkhDgPlBXrsDzJiJvB29Alo4OKxHQ0ugF3gRqRQIneCLtZU3yiUo7pItZw==" + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.1.tgz", + "integrity": "sha512-E1C8G3rnXrGjznwGP1k+OrW5k4rl0XtqTEB19f7vtJAMYwfxZVSsAu2iY5xJkrZsbVYr6PwwAwRmFlakPoFC0A==" }, "nodemon": { "version": "2.0.14", @@ -9669,14 +9706,13 @@ } }, "redis": { - "version": "4.0.0-rc.3", - "resolved": "https://registry.npmjs.org/redis/-/redis-4.0.0-rc.3.tgz", - "integrity": "sha512-yvijGYWp3aOvqpFgqovUWLWSdHgjUEtScqJmjTfUXj/4kEHuSW2TERFQelIBnrGeKh8//eYlLpCFKCjDYT4NQw==", + "version": "4.0.0-rc.4", + "resolved": "https://registry.npmjs.org/redis/-/redis-4.0.0-rc.4.tgz", + "integrity": "sha512-rcYOxvURG1kNg9t+BIY9PLDQh1JH0ZtJJxCQ8FwWSZXJ6TSWmk1VLXWkgzpNj/NAqN0nGdzjVPB4+1lFvOAO3w==", "requires": { - "cluster-key-slot": "1.1.0", - "generic-pool": "3.8.2", - "redis-parser": "3.0.0", - "yallist": "4.0.0" + "@node-redis/client": "^1.0.0-rc.0", + "@node-redis/json": "^1.0.0-rc.0", + "@node-redis/search": "^1.0.0-rc.0" } }, "redis-errors": { @@ -10768,8 +10804,9 @@ } }, "thingtalk": { - "version": "github:stanford-oval/thingtalk#245e51bbca5f66d8982e68c6baef000626764a81", - "from": "github:stanford-oval/thingtalk#master", + "version": "2.1.0-alpha.11", + "resolved": "https://registry.npmjs.org/thingtalk/-/thingtalk-2.1.0-alpha.11.tgz", + "integrity": "sha512-2uIj+fzQlFuz1FwVB7y6xyRSHqMLk0HRBncJIcklwQSz5IoI4gh+UfuIbADWXrMp0YEVbot8NJLdRijj+BIHEA==", "requires": { "@js-temporal/polyfill": "^0.2.0", "@types/semver": "^7.3.9", @@ -10995,9 +11032,9 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, "twilio": { - "version": "3.71.1", - "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.71.1.tgz", - "integrity": "sha512-P/KFvm33UW15EnpHJKgdTxUa1u6MlR/u+sCVnL4ie2TDRv6t7kX+ieIGQMpH7bP/z7FXkTjEt0lz4M+XJ/XWOg==", + "version": "3.71.2", + "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.71.2.tgz", + "integrity": "sha512-aHyq0ofeD0M9O8WbV4ASs9JglkwlnLRWQRLF+9GnKDMoerXKewOLYPhQXhEm1ZydywiGjhgBu7fqEpIbnP/3PA==", "requires": { "axios": "^0.21.4", "dayjs": "^1.8.29", diff --git a/package.json b/package.json index 2b1dbdff2..3fcd424ee 100644 --- a/package.json +++ b/package.json @@ -39,12 +39,12 @@ "actions-on-google": "^2.14.0", "argparse": "^2.0.0", "asn1.js": "^5.4.1", - "aws-sdk": "^2.1023.0", + "aws-sdk": "^2.1031.0", "body-parser": "^1.18.3", "cacheable-middleware": "^1.0.0", "color-scheme": "^1.0.0", "connect-flash": "^0.1.1", - "cookie-parser": "^1.4.3", + "cookie-parser": "^1.4.6", "csurf": "^1.9.0", "csv-parse": "^4.16.3", "csv-stringify": "^5.6.5", @@ -57,8 +57,8 @@ "express-session": "^1.17.2", "express-ws": "^5.0.2", "express-xml-bodyparser": "^0.3.0", - "genie-toolkit": "github:stanford-oval/genie-toolkit#wip/misc-fixes", - "gettext-parser": "^4.0.4", + "genie-toolkit": "github:stanford-oval/genie-toolkit", + "gettext-parser": "^4.2.0", "gm": "^1.23.1", "highlight.js": "^10.7.3", "http-proxy": "^1.18.1", @@ -77,12 +77,12 @@ "markdown-it-table-of-contents": "^0.5.2", "microsoft-cognitiveservices-speech-sdk": "^1.19.0", "mmap-io": "^1.1.7", - "moment-timezone": "^0.5.33", + "moment-timezone": "^0.5.34", "morgan": "^1.9.1", "multer": "^1.4.3", "mysql": "^2.16.0", "node-gettext": "^3.0.0", - "nodemailer": "^6.7.0", + "nodemailer": "^6.7.1", "notp": "^2.0.3", "oauth2orize": "^1.11.0", "on-finished": "^2.3.0", @@ -97,7 +97,7 @@ "passport-totp": "^0.0.2", "prom-client": "^13.2.0", "pug": "^3.0.2", - "redis": "^4.0.0-rc.2", + "redis": "^4.0.0-rc.4", "rss": "^1.2.2", "sanitize-filename": "^1.6.2", "seedrandom": "^3.0.0", @@ -107,7 +107,7 @@ "sockaddr": "^1.0.0", "tar": "^6.1.11", "thingpedia": "^2.10.0-alpha.5", - "thingtalk": "github:stanford-oval/thingtalk#master", + "thingtalk": "~2.1.0-alpha.10", "thirty-two": "^1.0.2", "tmp-promise": "^3.0.3", "transparent-rpc": "^1.1.0", @@ -118,7 +118,7 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/argparse": "^2.0.10", - "@types/body-parser": "^1.19.1", + "@types/body-parser": "^1.19.2", "@types/connect-flash": "0.0.37", "@types/cookie-parser": "^1.4.2", "@types/csurf": "^1.11.2", @@ -134,7 +134,7 @@ "@types/gettext-parser": "^4.0.1", "@types/gm": "^1.18.10", "@types/http-proxy": "^1.17.7", - "@types/jsonwebtoken": "^8.5.5", + "@types/jsonwebtoken": "^8.5.6", "@types/markdown-it": "^12.2.3", "@types/markdown-it-highlightjs": "^3.3.1", "@types/morgan": "^1.9.3", @@ -165,7 +165,7 @@ "apidoc": "^0.29.0", "browserify": "^17.0.0", "byline": "^5.0.0", - "cli-table": "^0.3.6", + "cli-table": "^0.3.7", "codemirror": "^5.63.3", "coveralls": "^3.1.1", "eslint": "^7.32.0", From 7e06198060e3b94e86b8a6c70771bb59bffd5cfc Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 13:27:19 -0800 Subject: [PATCH 2/8] travis: ensure python is available before npm ci --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ecac9235..e84a208f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,7 @@ jobs: name: "Unit Tests" install: - nvm install 12 + - pyenv global 3.8.1 - travis_retry npm ci script: - npm run lint @@ -46,7 +47,6 @@ jobs: - name: "GO Unit Tests" install: - - nvm install 12 - go get golang.org/x/tools/cmd/cover - go get github.com/mattn/goveralls before_script: cd go @@ -56,6 +56,7 @@ jobs: name: "Web Almond Integration Tests" install: - nvm install 12 + - pyenv global 3.8.1 - ./travis/install-webalmond-deps.sh - travis_retry npm ci - export PATH="`pwd`/geckodriver:$PATH" @@ -65,11 +66,10 @@ jobs: name: "Thingpedia Integration Tests" install: - nvm install 12 + - pyenv global 3.8.1 - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ - curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash && chmod +x kustomize && sudo mv kustomize /usr/local/bin/ - go get sigs.k8s.io/kind - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - travis_retry npm ci - mkdir -p geckodriver/ && wget https://github.com/mozilla/geckodriver/releases/download/v0.22.0/geckodriver-v0.22.0-linux64.tar.gz && tar xvf geckodriver-v0.22.0-linux64.tar.gz -C geckodriver/ - export PATH="`pwd`/geckodriver:$PATH" @@ -88,9 +88,9 @@ jobs: name: "NLP Integration Tests" install: - nvm install 12 + - pyenv global 3.8.1 - ./travis/install-webalmond-deps.sh - travis_retry npm ci - - pyenv global 3.8.1 - ./tests/install-nlp-deps.sh - export GENIENLP_EMBEDDINGS=`pwd`/tests/embeddings - export PATH="`pwd`/geckodriver:$PATH" From ca9ef0e9130137e13ec097435095347a1704dc38 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 13:33:53 -0800 Subject: [PATCH 3/8] travis: try fixing missing python --- .python-version | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .python-version diff --git a/.python-version b/.python-version deleted file mode 100644 index f1bad8f9d..000000000 --- a/.python-version +++ /dev/null @@ -1 +0,0 @@ -3.9.7/envs/stanford-oval-almond-cloud From d1df07e0ce1968c590a6bbcbef82256e02ff6161 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 14:18:37 -0800 Subject: [PATCH 4/8] Fix build with latest version of redis library Which broke the hack we were using --- src/util/redis.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/util/redis.ts b/src/util/redis.ts index 70e822ee8..025162a6b 100644 --- a/src/util/redis.ts +++ b/src/util/redis.ts @@ -19,11 +19,9 @@ // Author: Neil Souza import { createClient } from "redis"; -import { RedisClientType } from "redis/dist/lib/client"; - import * as Config from "../config"; -let clientPromise : null | Promise = null; +let clientPromise : null | Promise = null; function hasRedis() : boolean { return ( @@ -35,7 +33,7 @@ function getURL() : string { let url = "redis://"; if (Config.REDIS_USER !== null) { url += Config.REDIS_USER; - if (Config.REDIS_PASSWORD !== null) + if (Config.REDIS_PASSWORD !== null) url += `:${Config.REDIS_PASSWORD}`; url += "@"; } @@ -43,23 +41,23 @@ function getURL() : string { return url; } -async function createNewClient() : Promise { +async function createNewClient() { console.log(`ENTER redis.createNewClient()`); - + const url = getURL(); - + console.log(`Creating new Redis client...`); const client = createClient({ url }); - + await client.connect(); console.log(`Returning new Redis client.`); return client; } -function getRedisClient() : Promise { +function getRedisClient() : ReturnType { console.log(`ENTER redis.getClient()`); - if (clientPromise === null) + if (clientPromise === null) clientPromise = createNewClient(); return clientPromise; } From b7df313cbd06231553548517a90ea5a0164781f1 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 14:46:05 -0800 Subject: [PATCH 5/8] Fix validating canonical forms --- src/util/validation.ts | 2 +- tests/unit/test_class_validation.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/validation.ts b/src/util/validation.ts index c97061553..820df5e9e 100644 --- a/src/util/validation.ts +++ b/src/util/validation.ts @@ -397,7 +397,7 @@ function validateInvocation(kind : string, // this will handle all the different variations in how the canonical form // is specified (string, array, object with strings, object with arrays, etc.) try { - langPack.preprocessParameterCanonical(arg.nl_annotations.canonical, 'user'); + langPack.preprocessParameterCanonical(arg, 'user'); } catch(e) { throw new ValidationError(`Invalid canonical form for @${fndef.qualifiedName}:${argname}: ${e.message}`); } diff --git a/tests/unit/test_class_validation.js b/tests/unit/test_class_validation.js index 73ea3a54b..2542d1829 100644 --- a/tests/unit/test_class_validation.js +++ b/tests/unit/test_class_validation.js @@ -135,6 +135,7 @@ async function test(i) { console.error(`Test Case #${i+1}: does not match what expected`); console.error('Expected: ' + expected); console.error('Generated: ' + error.message); + console.error(error); if (process.env.TEST_MODE) throw new Error(`testClassValidation ${i+1} FAILED`); } From bbc54fe462b4b9a643a4c131cbd8d56f0bd5bb3a Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 14:49:26 -0800 Subject: [PATCH 6/8] Update web almond tests --- tests/website/test_my_api.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/website/test_my_api.js b/tests/website/test_my_api.js index 3b04c25dd..aacca96c9 100644 --- a/tests/website/test_my_api.js +++ b/tests/website/test_my_api.js @@ -129,22 +129,22 @@ async function testMyApiCreateWhenApp(auth) { if (count === 0) { assert.deepStrictEqual(parsed, { result: { appId: result.uniqueId, - raw: { data: '!!!!!!!!!!', size: 10 }, + raw: { data: '""""""""""', size: 10 }, type: 'org.thingpedia.builtin.test:get_data', formatted: [{ type: 'text', - text: 'Notification from Test: the answer is !!!!!!!!!!', + text: 'Notification from Test: the answer is """""""""".', }], icon: '/download/icons/org.thingpedia.builtin.test.png' } }); } else { assert.deepStrictEqual(parsed, { result: { appId: result.uniqueId, - raw: { data: '""""""""""', size: 10 }, + raw: { data: '##########', size: 10 }, type: 'org.thingpedia.builtin.test:get_data', formatted: [{ type: 'text', - text: 'Notification from Test: the answer is """""""""".', + text: 'Notification from Test: the answer is ##########.', }], icon: '/download/icons/org.thingpedia.builtin.test.png' } }); From 0e7c8ab5f666d756b62d4826b8f74680c9cdd826 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 16:35:59 -0800 Subject: [PATCH 7/8] Try fixing the nlp tests --- tests/nlp-integration.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/nlp-integration.sh b/tests/nlp-integration.sh index c760b9755..3133853d9 100755 --- a/tests/nlp-integration.sh +++ b/tests/nlp-integration.sh @@ -83,6 +83,7 @@ mkdir -p 'models/org.thingpedia.models.default:en' wget --no-verbose -c https://almond-static.stanford.edu/test-data/models/genienlp-v0.6.0a2.tar.xz -O $srcdir/tests/embeddings/genienlp-v0.6.0a2.xz tar xvf $srcdir/tests/embeddings/genienlp-v0.6.0a2.xz -C 'models/org.thingpedia.models.default:en' +sed -i 's/}/,"eval_src_languages":"en"}/' 'models/org.thingpedia.models.default:en/config.json' mkdir -p 'exact' wget --no-verbose -c https://almond-static.stanford.edu/test-data/exact.tsv -O exact/en.tsv @@ -91,6 +92,10 @@ ${srcdir}/dist/main.js compile-exact-btrie -o exact/en.btrie exact/en.tsv ${srcdir}/dist/main.js run-nlp --port $NLP_PORT & inferpid=$! +# kick off a dummy request to the nlp server just to get it ready +sleep 5 +curl "http://127.0.0.1:$NLP_PORT/en-US/query?q=hello" || true + # in interactive mode, sleep forever # the developer will run the tests by hand # and Ctrl+C From 1dbe63e27fd12f02e55c0e4de86a05f24fe6b53f Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 17 Nov 2021 17:38:03 -0800 Subject: [PATCH 8/8] Update tests --- tests/nlp-integration.sh | 4 ++-- tests/thingpedia-integration.sh | 4 ++-- tests/thingpedia-integration/thingpedia-integration.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/nlp-integration.sh b/tests/nlp-integration.sh index 3133853d9..511627fbc 100755 --- a/tests/nlp-integration.sh +++ b/tests/nlp-integration.sh @@ -93,7 +93,7 @@ ${srcdir}/dist/main.js run-nlp --port $NLP_PORT & inferpid=$! # kick off a dummy request to the nlp server just to get it ready -sleep 5 +sleep 10 curl "http://127.0.0.1:$NLP_PORT/en-US/query?q=hello" || true # in interactive mode, sleep forever @@ -103,7 +103,7 @@ if test "$1" = "--interactive" ; then sleep 84600 else # sleep until the process is settled - sleep 30 + sleep 20 ts-node $srcdir/tests/nlp fi diff --git a/tests/thingpedia-integration.sh b/tests/thingpedia-integration.sh index 8ad5719b4..f8b35b969 100755 --- a/tests/thingpedia-integration.sh +++ b/tests/thingpedia-integration.sh @@ -170,8 +170,8 @@ shuf exact.tsv | head sha256sum exact.tsv ./exact/en.btrie sha256sum -c <