guorbit / obc-model

Functional/Architectural Capella 6.0 model for the ASTRAEUS-01 spacecraft system and all its subsystems.
https://guorbit.github.io/obc-model/
10 stars 1 forks source link

Model Validation Workflow #25

Closed chgio closed 1 year ago

chgio commented 1 year ago

We've set up a very nice docgen pipeline and, as it turns out, it also includes a model validation step.

However, as long as there's no bug in the workflow code, the validation step would pass regardless of model quality, as its success comes from the generation of the validation log and not from the absence of errors in the model. So, it would be nice to turn this into a workflow that propagates any error in the validation log to a pipeline failure: this way, we don't have to check the validation log just to see if the model is alright.

Eventually the pipeline should work like this:

stateDiagram-v2
direction LR

val     : Validate Model
dg      : Build Docs
dpl     : Deploy to Pages

[*] --> val
val --> dg : pass
val --> [*] : fail
note left of val : validation report
dg  --> dpl: main
note left of dg: HTML export
dg  --> [*] : model/*
dpl --> [*]

It should be fairly straightforward to parse the HTML validation report with something like BeautifulSoup (docs here) in :b:ython -- I'm thinking about this instead of a quick grep as we'll probably want some logic:

Here are some sample validation runs and their expected outcome for testing:

The test dataset isn't by any means comprehensive but the requirements are fairly simple and I'm basically giving you the test logic, so you can TDD it if you want :wink:


The validation step was originally included as a hack to get the Capella CLI to work and might not be needed in the future but, worst-case scenario, we can always make our own by spawning the following issue:

chgio commented 1 year ago

For the moment, the logic can be placed into the current Build step, which still includes validation; in the future, if they get split either upstream or by ourselves, it should be moved to the Validation-only step.

Also, you may want to work on this kind of stuff on a merger of ci-test into cd-test (called cid-test or something like that)

chgio commented 1 year ago

you know me -- a further step could be turning it into one of my beloved pre-commit git hook (for the pre-commit framework, not a pure git hook):

:wink: