Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Lu file's content altered and wrong error when using unavailable features #1292

@MatteoMeil

Description

@MatteoMeil

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 .lu file is altered based on result of this method call during loading of file content, causing wrong error on subsequent passes if Builder class (defined here) is constructed passing a log function

  • This call passes empty luis_culture to build function (defined here) and the value is never updated down the road (thus, remaining empty).
    This may cause unexpected behavior in parseLuAndQnaWithAntlr because culture falls back to en-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

  1. Create a .lu file (e.g.: MyLUISFile.lu)
    Notice that I explicitly inserted an error: I used geographyV2 with culture it-it even 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
    
  2. Install @microsoft\botframework-cli@4.14.1, create the following .js file 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)
  3. 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]

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or an unintended behavior.customer-reportedIssue is created by anyone that is not a collaborator in the repository.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions