nasa / ogma

Other
329 stars 24 forks source link

`ogma-core`: Spec2Copilot translator does not sanitize handler names #127

Closed ivanperez-keera closed 6 months ago

ivanperez-keera commented 6 months ago

Description

The Spec to Copilot translator is not sanitizing handler names. This causes the Copilot generated code not to compile if the property identifiers have a hyphen.

Type

Additional context

None.

Requester

Method to check presence of bug

Compiling a specification with a hyphen in a requirement name produces Copilot code that does not compile:

{
  "test_componentSpec": {
    "Functions": [
    ],
    "Internal_variables": [
    ],
    "Other_variables": [
    ],
    "Requirements": [
      {
        "CoCoSpecCode": "true",
        "fretish": "unimportant",
        "name": "testCopilot-001",
        "ptLTL": "TRUE"
      }
    ]
  }
}
Monitor.hs: '-' is not a nondigit
CallStack (from HasCallStack):
  error, called at src/Language/C99/Util/Expr.hs:78:10 in language-c99-util-0.2.0-987ZdxxqOvYC4hudkeZk8i:Language.C99.Util.Expr

Expected result

The execution above should produce a Copilot specification that can be compiled and where - has been converted to an underscore.

Desired result

The execution above should produce a Copilot specification that can be compiled and where - has been converted to an underscore.

Proposed solution

Modify the Spec translator to sanitize handler names the same way that the ROS backend does.

Further notes

None.

ivanperez-keera commented 6 months ago

Change Manager: Confirmed that the issue exists.

ivanperez-keera commented 6 months ago

Technical Lead: Confirmed that the issue should be addressed.

ivanperez-keera commented 6 months ago

Technical Lead: Issue scheduled for fixing in Ogma 1.3.

Fix assigned to: @ivanperez-keera.

ivanperez-keera commented 6 months ago

Implementor: Solution implemented, review requested.

ivanperez-keera commented 6 months ago

Change Manager: Verified that:

ivanperez-keera commented 6 months ago

Change Manager: Implementation ready to be merged.