Context Constraint Handling - DevOps-MBSE/AaC GitHub Wiki

During the development of enhanced unit tests for check_aac_impl.py under < ๐Ÿ“‹ [TASK] - Plugins/check_aac_impl Location Returns ยท Issue #924 ยท DevOps-MBSE/AaC > it was discovered that none of the exceptions thrown by context.parse_and_load(aac_file) were being handled. This results in some concerns regarding:

Unclear code. If, rather, the exceptions were handled, or at least acknowledged, in catch blocks the code would be more properly descriptive. The resultant messages list from the check method should include the message, source, and location information from their exceptions. Clearer unit tests in test_check_aac_impl.py, since some of those test methods could leverage the messages from #2 above and/or the handled exceptions from #1 above. One specific challenge to this idea is that the current tests all run within a CliRunner so the ability to access the exceptions from that would be needed if the handling of the exceptions is determined solution. It may be desirable to create a set of unit tests which bypass the CliRunner but mimic the existing tests. The CliRunner is currently utilized as what more closely matches the nominal usage of check. If the exception messages are added, as per #2, several of the existing tests should be updated to look for specific message text that is not currently accessible.

A quick attempt at adding in some basic try except blocks around the call was not successful in accomplishing the desired output. The message list was not behaving in the expected manner with our quick attempt. Due to the need to close the existing effort https://github.com/DevOps-MBSE/AaC/issues/924 in a timely manner it was decided to document in both check_aac_impl.py and test_check_aac.py these unhandled exceptions. This note is additional documentation and a linkage between the two source code files (check_aac_impl.py and test_check_aac_impl.py) and the task < ๐Ÿ“‹ [TASK] - Plugins/check_aac_impl Location Returns ยท Issue #924 ยท DevOps-MBSE/AaC >.

A beginning attempt at establishing a new implementation pattern for handling the context constraints is being worked within these two tasks: https://github.com/DevOps-MBSE/AaC/issues/968 https://github.com/DevOps-MBSE/AaC/issues/969