Skip to content

CLI: cicero get command pulls in obsolete external models. #793

Open
@martinhalford

Description

@martinhalford

Bug Report 🐛

Context

As part of the process of updating the unit tests for the Cicero repo, I am updating the many model.cto files to include the new Concerto syntax (e.g. adding versions to the namespaces, adding @template to assets and updating import statements).

Once these model.cto files have been updated, I am deleting all external model *.cto files from model folder in order to allow Cicero to correctly import the correct external reference files.

This leaves a clean \model folder containing a single model.cto file.

I then run cicero get which, I assumed, would pull the latest reference .cto files from the Model Repository.

Example

For example, starting with the following model file from [here](https://github.com/accordproject/cicero/blob/main/packages/cicero-cli/test/data/helloemit/model/model.cto) I modified it to be as so:

namespace [email protected]

import [email protected].{Clause, Contract} from https://models.accordproject.org/accordproject/[email protected]
import [email protected].{Request, Response, State, Obligation} from https://models.accordproject.org/accordproject/[email protected]

/**
 * The template model
 */
@template
asset TemplateModel extends Clause {
  /**
   * The name for the clause
   */
  o String name
}

transaction MyRequest extends Request {
  o String input
}

transaction MyResponse extends Response {
  o String output
}

event Greeting {
  o String message
}

The cicero get command throws an error and drags in the obsolete @models.accordproject.org.accordproject.contract.cto file.

See command history:

$ cd /Users/martin/Dev/accord/cicero/packages/cicero-cli/test/data/helloemit/     
$ ls -l ./model
total 8
-rw-r--r--@ 1 martin  staff  622  8 Aug 14:49 model.cto
$ cicero get
 INFO: Using current directory as template folder
 ERROR: Failed to find an asset that extends org.accordproject.contract.Clause. The model for the template must contain a single asset that extends org.accordproject.contract.Clause.
$ ls -l ./model                                                              
total 32
-rw-r--r--@ 1 martin  staff   975  8 Aug 15:06 @models.accordproject.org.accordproject.contract.cto
-rw-r--r--@ 1 martin  staff   979  8 Aug 15:06 @[email protected]
-rw-r--r--@ 1 martin  staff  1511  8 Aug 15:06 @[email protected]
-rw-r--r--@ 1 martin  staff   622  8 Aug 14:49 model.cto
 

Expected Behaviour

Context (Environment)

% cicero --version
0.24.1-20230722135139

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions