Skip to content

Extending Asset with Contract or Clause causes Archive error #791

@martinhalford

Description

@martinhalford

Bug Report 🐛

The cicero archive command requires a valid package.json file which must contain either:

    "accordproject": {
      "template": "clause",
      "cicero": "^0.24.0",
      "runtime": "ergo"
    },

-- OR --

    "accordproject": {
      "template": "contract",
      "cicero": "^0.24.0",
      "runtime": "ergo"
    },

Note: Without this object in the package.json file, the cicero archive command throws the following expected error:

ERROR: /Users/martin/hello-world is not a valid cicero template. Make sure that package.json exists and that it has a cicero entry.

Assume you have the following grammar.tem.md file:

namespace hello@1.0.0

@template
concept HelloWorld {
    o String name
}

Attempting to execute cicero archive as a Clause template with this grammar.tem.md will result in the error:

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.

Attempting to execute cicero archive as a Contract template with this grammar.tem.md will result in the error:

ERROR: Failed to find an asset that extends org.accordproject.contract.Contract. The model for the template must contain a single asset that extends org.accordproject.contract.Contract.

Attempted Fix 1:

Attempt to fix the issue by adding extends Contract or extends Clause to concept, like so:

namespace hello@1.0.0

@template
concept HelloWorld extends Contract {
    o String name
}

This results in the error:

ERROR: Could not find super type Contract File '/Users/martin/hello-world/model/model.cto': line 3 column 1, to line 6 column 2.

-- OR --

namespace hello@1.0.0

@template
concept HelloWorld extends Clause {
    o String name
}

This results in the error:

ERROR: Could not find super type Clause File '/Users/martin/hello-world/model/model.cto': line 3 column 1, to line 6 column 2.

Attempted Fix 2:

Add contract import to model.cto like so:

namespace hello@1.0.0

import org.accordproject.contract@0.2.0.Contract from https://models.accordproject.org/accordproject/contract@0.2.0.cto

@template
concept HelloWorld extends Contract {
    o String name
}

This results in the error:

ERROR: ConceptDeclaration (HelloWorld) cannot extend AssetDeclaration (Contract) File '/Users/martin/hello-world/model/model.cto': line 5 column 1, to line 8 column 2.

Context (Environment)

  • Cicero Version: 0.24.1-20230722135139
  • Concerto Version: 3.12.0

Summary

It seems that cicero archive requires an asset to extend either Contract or Clause but the concerto syntax no longer considers this as valid syntax.

Note: Also tried concerto compile --model ./hello-world/model/model.cto --target Rust and got same error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions