-
Notifications
You must be signed in to change notification settings - Fork 123
Lu file's content altered and wrong error when using unavailable features #1292
Description
Versions
What CLI version are you using: 4.14.1
What Nodejs version are you using: 14.17.1
What command-line interpreters are you using: CMD (Windows' command prompt)
What OS are you using: Win10 x64
Describe the bug
TL;DR (details and possible fixes in first comment)
-
Content of
.lufile is altered based on result of this method call during loading of file content, causing wrong error on subsequent passes ifBuilderclass (defined here) is constructed passing a log function -
This call passes empty
luis_culturetobuildfunction (defined here) and the value is never updated down the road (thus, remaining empty).
This may cause unexpected behavior inparseLuAndQnaWithAntlrbecause culture falls back toen-us
Notice that this bug affects BotFramework Composer that outputs a wrong error in cases like this one
To Reproduce
First one is easily reproducible following the steps below, while to address the second issue you must enter debug mode and go along the path until you'll find the bug
- Create a
.lufile (e.g.:MyLUISFile.lu)
Notice that I explicitly inserted an error: I usedgeographyV2with cultureit-iteven if it isn't available for Italian (Italy) at the time I'm writing the issue> LUIS application information > !# @app.versionId = 0.1 > !# @app.culture = it-it > !# @app.luis_schema_version = 7.0.0 > # Intent definitions # MyIntent - ciao > # Entity definitions @ ml MLEntity - @ ml MLSubEntity usesFeature geographyV2 > # PREBUILT Entity definitions @ prebuilt geographyV2 - Install @microsoft\botframework-cli@4.14.1, create the following
.jsfile and execute it using Node:const {Builder} = require('@microsoft/bf-lu/lib/parser/lubuild/builder'); async function run() { const builder = new Builder((message) => { console.log(message); }); const luContents = await builder.loadContents(['MyLUISFile.lu'], { culture: 'it-it', log: console.log }) const buildResult = await builder.build(luContents, 'AUTHORING_KEY', 'BOT_NAME', { endpoint: 'AUTHORING_ENDPOINT' }); } run().then(console.log).catch(console.log)
- You will have the following exception logged in console:
Luis build failed: [ERROR] line 20:0 - line 20:1: Invalid child entity definition found. No definition found for "geographyV2" in child entity definition "- @ ml MLSubEntity usesFeature geographyV2". Features must be defined before they can be added to a child.
Expected behavior
It should throw an error saying the feature isn't available and stop the execution, as it does if log function isn't passed in Builder constructor.
Screenshots
Not applicable
Additional context
Not applicable
[bug]