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-language-fret-cs: Improve error message reporting upon requirement parsing errors #96

Closed
ivanperez-keera opened this issue Jul 22, 2023 · 6 comments
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Feature Admin only: Change request pertaining to new features requested
Milestone

Comments

@ivanperez-keera
Copy link
Member

Description

Ogma relies on an existing library for error message reporting of JSON files.

That library, by default, provides very plain error messages and the line and column number of the error cannot be customized or contextualized. This causes error messages to seem to apply to a line and column in the file, when they really apply to the line and column of a specific requirement (which may be hard to indentify).

Type

  • Feature: improve error reporting messages in parsing of FRET CS JSON files.

Additional context

None.

Requester

  • Ivan Perez

Method to check presence of bug

Not applicable (new feature).

Expected result

An error in a requirement in a FRET CS file indicates which requirement it applies to.

Desired result

An error in a requirement in a FRET CS file indicates which requirement it applies to.

Proposed solution

Modify parser to produce name of requirement on parsing errors.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Feature Admin only: Change request pertaining to new features requested labels Jul 22, 2023
@ivanperez-keera ivanperez-keera changed the title ogma-language-fret-cs: Error message information is insufficient ogma-language-fret-cs: Improve error message reporting upon requirement parsing errors Jul 22, 2023
@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 Jul 22, 2023
@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 Jul 22, 2023
@ivanperez-keera
Copy link
Member Author

Technical Lead: Issue scheduled for Ogma 1.0.10.

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 Jul 22, 2023
@ivanperez-keera ivanperez-keera self-assigned this Jul 22, 2023
@ivanperez-keera ivanperez-keera added this to the 1.0.10 milestone Jul 22, 2023
@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 Jul 22, 2023
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
Ogma relies on an existing library for error message reporting of JSON
files. That library, by default, provides very plain error messages and
the line and column number of the error cannot be customized or
contextualized. This causes error messages to seem to apply to a line
and column in the file, when they really apply to the line and column of
a specific requirement (which may be hard to indentify).

This commit modifies the JSON parser for component specification files
so that, if a parsing error in a temporal logic formula is found, the
parser reports the name of the requirement that failed to parse.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
.

The test case tests/fret_good.json contains no value in the CoCoSpec
field, which makes the test fail even though that field is not used.

This commit modifies the example to have a vacuous value in the CoCoSpec
field.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
The test case tests/fret_good.json contains no value in the CoCoSpec
field, which makes the test fail even though that field is not used.

This commit modifies the example to have a vacuous value in the CoCoSpec
field.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
The file ogma-cli/examples/fret.json is used as a test, and contains no
value in the CoCoSpec field, which makes the test fail even though that
field is not used.

This commit modifies the example to have a vacuous value in the CoCoSpec
field.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Jul 22, 2023
@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 Jul 22, 2023
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles passes the tests. Details:
      Docker image:

      FROM ubuntu:trusty
      
      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
      
      # We install the application first and then test it, in case any tests need to
      # run the tool.
      CMD git clone $REPO && \
          cd $NAME && \
          git checkout $COMMIT && \
          cd .. && \
          cabal v1-install $NAME/$PAT**/ --enable-tests && \
          cabal v1-install $NAME/$PAT**/ --enable-tests --run-tests -j1

      Command:

      $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e PAT="ogma-" -e "COMMIT=b1e29d0b43f179331ac1998b3f2822c5bb4e43e0" -it ogma-test
    • The solution proposed fixes the issues described. Details:
      The issue is with error messages, so it is hard to automate; it is therefore verified by visual inspection.

  • Implementation is documented. Details:
    No changes needed.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    The implementation is no longer "lazy", which makes examples that contain no expressions for some temporal logic fields in the CS file fail. Those examples are adjusted to contain vacuous properties (true).
  • Required version bumps are evaluated. Details:
    Bump not needed (change affects result, but there's no expectation that an incorrect FRET file --one with no value for one of the formula fields-- should parse correctly).

@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 Jul 22, 2023
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:Feature Admin only: Change request pertaining to new features requested
Projects
None yet
Development

No branches or pull requests

1 participant