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

Metaschema Doc Generator Marks Certain Assemblies Empty When They Aren't #225

Closed
aj-stein-nist opened this issue Aug 17, 2022 · 8 comments · Fixed by #234
Closed

Metaschema Doc Generator Marks Certain Assemblies Empty When They Aren't #225

aj-stein-nist opened this issue Aug 17, 2022 · 8 comments · Fixed by #234
Assignees
Labels
bug Something isn't working XSLT Implementation Issue relates to the XSLT implementation of Metaschema.

Comments

@aj-stein-nist
Copy link
Collaborator

aj-stein-nist commented Aug 17, 2022

Describe the bug

During development in usnistgov/OSCAL#1160, we were running the generate-model-documentation.

Who is the bug affecting?

NIST OSCAL developers working on model updates.

What is affected by this bug?

Proper documentation generation for model reference docs.

When does this occur?

Consistently

How do we replicate the issue?

  1. Check out snapshot backup of this branch on the relevant commit: aj-stein-nist/OSCAL@290b497 in the issue-1058-rules-metaschema-draft-backup-bug-report-metaschema-225 branch of my fork
  2. Open docs directory cd path/to/OSCAL/docs
  3. Check docker-compose container and dev environment is up to date: docker-compose down -v and docker-compose build
  4. Run docker-compose run docs /oscal/build/ci-cd/generate-schema.sh -v
  5. Run docker-compose run docs /oscal/build/ci-cd/generate-model-documentation.sh -v
  6. Run local copy of web site hugo server --enableGitInfo=false --verbose --minify --bind 0.0.0.0

image

Expected behavior (i.e. solution)

Per usnistgov/OSCAL#1365, it was working before and the assemblies are properly filled out and not empty.

image

Other Comments

N/A

@aj-stein-nist aj-stein-nist added bug Something isn't working XSLT Implementation Issue relates to the XSLT implementation of Metaschema. labels Aug 17, 2022
@aj-stein-nist aj-stein-nist changed the title Metaschema Doc Generator Marks Certain Assemblies When They Aren't Metaschema Doc Generator Marks Certain Assemblies Empty When They Aren't Aug 17, 2022
@aj-stein-nist
Copy link
Collaborator Author

We need to do further testing on this but there was only a slight model change so it is not clear what is happening but as of now on develop it seems to be that lots of assemblies are marked [Empty] that shouldn't be. It could be a model error but all of the recent changes pass with validate-metaschema.sh and other common testing/validation approaches we use as a team. Further investigation is needed.

@aj-stein-nist
Copy link
Collaborator Author

aj-stein-nist commented Aug 18, 2022

@wendellpiez, I brought this up in a weekly status update as a potential blocker, but not confirmed yet. @david-waltermire-nist asked Wendell and I sync up. I will move this along in the triage progression to "Further Analysis Needed" and determine if it is in fact a bug and prioritize it.

aj-stein-nist added a commit to usnistgov/OSCAL that referenced this issue Aug 31, 2022
It appears whatever was reported and was happening reliably when I was
using the current commit for usnistgov/OSCAL develop branch module[0]
has now gone away when updating a few commits to current develop commit
in the submodule[1], ahead of usnistgov/OSCAL check-in. It appears it
was maybe fixed between the following commit range.

[0] https://github.com/usnistgov/metaschema/tree/f28a588f0e9ac013125ed0f118f0fcaef4d1a6e2
[1] usnistgov/metaschema@a11515b

Can attempt to do `git blame` or further analysis at a later date.
aj-stein-nist added a commit to usnistgov/OSCAL that referenced this issue Aug 31, 2022
It appears whatever was reported and was happening reliably when I was
using the current commit for usnistgov/OSCAL develop branch module[0]
has now gone away when updating a few commits to current develop commit
in the submodule[1], ahead of usnistgov/OSCAL check-in. It appears it
was maybe fixed between the following commit range.

[0] usnistgov/metaschema@f28a588
[1] usnistgov/metaschema@a11515b

Can attempt to do `git blame` or further analysis at a later date.
@aj-stein-nist
Copy link
Collaborator Author

Per the above commit message in the rules feature branch of OSCAL at usnistgov/OSCAL@6a134f0, this may be fixed. Can bring this up during the next triage meeting tomorrow or Tuesday of next week and determine a resolution state. 🤷

@aj-stein-nist
Copy link
Collaborator Author

We discussed this in our sprint planning. Dave pointed out it is not entirely resolved. At a11515b in my rules branch, it does still show [Empty] specifically when an assembly recursively points to itself, not as general as before, so part in catalog and condition in CDEF and SSP document instance assemblies (scattered across).

@aj-stein-nist
Copy link
Collaborator Author

I think I need to do more digging because it appears the recursive definition terminating with [Emtpy] approach has been around far longer than I noticed. I am not sure this case as relayed from Dave by me in #225 (comment) is a bug? Need to discuss more with the team.

@aj-stein-nist
Copy link
Collaborator Author

OK, @wendellpiez and I paired this afternoon, and I learned a lot will be able to commit a fix shortly. So, here is a quick write-up of [Empty], where it is valid, where it is not valid, how the bug occurs, and how we can fix (pending some local testing).

When is [Empty] valid in model docs?

It was not clear to me when something is "valid" when it is empty, but in correct OSCAL, there actually is use-case, such as in v1.0.3 current v1.0.4 in the OSCAL profile model is flat. In XML this field even if it acts like a flag and has no empty model. (I was struggling to find a valid example, there are probably others, but I can use this test pending changes).

When is [Empty] invalid in model docs?

The team appears to have cleaned up other edge cases, but as it stands for this bug, recursive model definitions (so in current catalog model: //control/part/part, the nested part definition is not empty, it is just recursive and the model is not repeated in the first nested example. A summary line (currently: (recursive: model like parent part) is left in the summary as a clue to the reader.

So how do we have an extraneous empty?

Why do we have an extraneous , invalid [Empty] in model docs?

We are not checking for the recursive flag on expanded debug Metaschema superset in the XSLT pipeline in triggered by the pipeline as currently defined generated by the model map builder transform and handle in the element map to HTML builder transform.

How do we fix it?

An additional template with higher priority that checks for the recursive attribute on the debug superset element and generates only <div/> with the summary of that element status (that's it's recursive), short-circuit and do not write an expandable/collapsible <details/> block.

PR forthcoming!

@aj-stein-nist
Copy link
Collaborator Author

Wendell and I did some further asynchronous debugging and he recommended a more optimal fix where we tighten an existing template in the element map to HTML builder. This original template match of m:element[empty(* except (m:attribute|m:value))] had actually shifted in how correct it was, separate of the analysis above in #225 (comment) because of the additions of formal-name and description of Metaschema definitions are interpreted through the pipeline.

aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Sep 6, 2022
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Sep 6, 2022
See more details about analysis and PR changes below:

usnistgov#225 (comment)
usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
david-waltermire pushed a commit that referenced this issue Sep 19, 2022
See more details about analysis and PR changes below:

#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
@aj-stein-nist
Copy link
Collaborator Author

Per discussion in status meeting, we intend for this to bubble from develop to main for document generation, but that requires merging all of develop to main and that is not agreeable or desirable. The preferred way forward, per Dave, is usnistgov/OSCAL#1463. Pointing from here to that issue for continuity.

david-waltermire pushed a commit that referenced this issue Dec 7, 2022
See more details about analysis and PR changes below:

#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Jan 9, 2023
See more details about analysis and PR changes below:

usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Jan 10, 2023
See more details about analysis and PR changes below:

usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Jan 10, 2023
See more details about analysis and PR changes below:

usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Jan 10, 2023
See more details about analysis and PR changes below:

usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Jan 10, 2023
See more details about analysis and PR changes below:

usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
aj-stein-nist added a commit to aj-stein-nist/metaschema that referenced this issue Jan 10, 2023
See more details about analysis and PR changes below:

usnistgov#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
david-waltermire pushed a commit that referenced this issue Mar 9, 2023
See more details about analysis and PR changes below:

#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
nikitawootten-nist pushed a commit to nikitawootten-nist/metaschema-xslt that referenced this issue Jul 21, 2023
See more details about analysis and PR changes below:

usnistgov/metaschema#225 (comment)

Co-authored-by: Wendell Piez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working XSLT Implementation Issue relates to the XSLT implementation of Metaschema.
Projects
Status: Done
3 participants