Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogma-core: Comment is inaccurate #164

Closed
ivanperez-keera opened this issue Nov 21, 2024 · 6 comments
Closed

ogma-core: Comment is inaccurate #164

ivanperez-keera opened this issue Nov 21, 2024 · 6 comments
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Bug Admin only: Change request pertaining to error detected
Milestone

Comments

@ivanperez-keera
Copy link
Member

Description

The Copilot spec generated by Ogma includes the following comment for a spec:

-- | Complete specification. Calls the C function void handler(); when
-- the property is violated.

That comment is inaccurate, since the name of the function executed may not be handler.

Type

  • Bug: Error in comment in generated code.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

Error is in a comment. Check by visual inspection of the Copilot code generated by Ogma.

Expected result

The comment in the code generated by Copilot states that handlers are executed, not that a specific function handler(); is called.

Desired result

The comment in the code generated by Copilot states that handlers are executed, not that a specific function handler(); is called.

Proposed solution

Modify comment in https://github.com/nasa/ogma/blob/develop/ogma-core/src/Language/Trans/Spec2Copilot.hs#L201 to state that handlers are executed upon property violations.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Bug Admin only: Change request pertaining to error detected labels Nov 21, 2024
@ivanperez-keera
Copy link
Member Author

Change Manager: Confirmed that the issue exists.

@ivanperez-keera ivanperez-keera added CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager and removed CR:Status:Initiated Admin only: Change request that has been initiated labels Nov 21, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Confirmed that the issue should be addressed.

@ivanperez-keera ivanperez-keera added CR:Status:Accepted Admin only: Change request accepted by technical lead and removed CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager labels Nov 21, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Issue scheduled for fixing in Ogma 1.5.

Fix assigned to: @ivanperez-keera .

@ivanperez-keera ivanperez-keera added CR:Status:Scheduled Admin only: Change requested scheduled and removed CR:Status:Accepted Admin only: Change request accepted by technical lead labels Nov 21, 2024
@ivanperez-keera ivanperez-keera added this to the 1.5.0 milestone Nov 21, 2024
@ivanperez-keera ivanperez-keera self-assigned this Nov 21, 2024
@ivanperez-keera ivanperez-keera added CR:Status:Implementation Admin only: Change request that is currently being implemented and removed CR:Status:Scheduled Admin only: Change requested scheduled labels Nov 21, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
The Copilot spec generated by Ogma includes the following comment for a spec:

-- | Complete specification. Calls the C function void handler(); when
-- the property is violated.

That comment is inaccurate, since the name of the function executed may
not be handler.

This commit fixes the comment to say that handlers are executed when
properties are violated.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
The Copilot spec generated by Ogma includes the following comment for a spec:

-- | Complete specification. Calls the C function void handler(); when
-- the property is violated.

That comment is inaccurate, since the name of the function executed may
not be handler.

This commit fixes the comment to say that handlers are executed when
properties are violated.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
The Copilot specification generated by Ogma includes the following
comment for the top-level `spec`:

```
-- | Complete specification. Calls the C function void handler(); when
-- the property is violated.
```

The comment is inaccurate, since the name of the function executed may
not be `handler`.

This commit fixes the comment to say that "handlers are executed when
properties are violated".
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
The Copilot specification generated by Ogma includes the following
comment for the top-level `spec`:

```
-- | Complete specification. Calls the C function void handler(); when
-- the property is violated.
```

The comment is inaccurate, since the name of the function executed may
not be `handler`.

This commit fixes the comment to say that *handlers* are executed when
properties are violated.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Nov 21, 2024
@ivanperez-keera
Copy link
Member Author

Implementor: Solution implemented, review requested.

@ivanperez-keera ivanperez-keera added CR:Status:Verification Admin only: Change request that is currently being verified and removed CR:Status:Implementation Admin only: Change request that is currently being implemented labels Nov 21, 2024
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      Evaluated by visual inspection running the spec backend and looking at the output. Additionally, the following dockerfile runs the spec backend and checks that the output no longer contains the fixed string "handler();", in which case it prints the message "Success":
      FROM ubuntu:trusty
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN apt-get install --yes git
      
      SHELL ["/bin/bash", "-c"]
      CMD git clone $REPO \
          && cd $NAME \
          && git checkout $COMMIT \
          && cd .. \
          && cabal v1-sandbox init \
          && cabal v1-install $NAME/$PAT**/ --constraint="aeson>=2.0.3.0" \
          && ./.cabal-sandbox/bin/ogma fret-component-spec --fret-file-name $NAME/ogma-cli/examples/fret.json > Spec.hs \
          && ! grep 'handler();' Spec.hs \
          && echo "Success"
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "PAT=ogma"  -e "COMMIT=69e128c1a71a61ffbb46daf52f0a48826360c80a" -it ogma-verify-164
      
  • Implementation is documented. Details:
    No updates needed. Change is to a comment in the output code.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed.
  • Required version bumps are evaluated. Details:
    No bump needed. Change is to a comment in the output code.

@ivanperez-keera
Copy link
Member Author

Change Manager: Implementation ready to be merged.

@ivanperez-keera ivanperez-keera added CR:Status:Closed Admin only: Change request that has been completed and removed CR:Status:Verification Admin only: Change request that is currently being verified labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Bug Admin only: Change request pertaining to error detected
Projects
None yet
Development

No branches or pull requests

1 participant