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

Allow <let/> in <constraint/> without requiring a sibling constraint #552

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

aj-stein-nist
Copy link
Collaborator

@aj-stein-nist aj-stein-nist commented Feb 22, 2024

Committer Notes

Closes #548.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you squashed any non-relevant commits and commit messages? [instructions]
  • Do all automated CI/CD checks pass?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them? In issue linked to PR.
  • Have you written new tests for your core changes, as applicable? Not sure if that is in scope for work item, feedback requested from reviewers.
  • Have you included examples of how to use your new feature(s)?
  • Have you updated all website](https://pages.nist.gov/metaschema) and readme documentation affected by the changes you made? Changes to the website can be made in the website/content directory of your branch. N/A for this change

@aj-stein-nist aj-stein-nist self-assigned this Feb 22, 2024
@aj-stein-nist aj-stein-nist linked an issue Feb 22, 2024 that may be closed by this pull request
5 tasks
@aj-stein-nist aj-stein-nist marked this pull request as ready for review February 22, 2024 13:42
@aj-stein-nist aj-stein-nist changed the title Allow let in <constraint/> without requiring a sibling constraint Allow <let/> in <constraint/> without requiring a sibling constraint Feb 22, 2024
@aj-stein-nist
Copy link
Collaborator Author

So I tested the XML Schema by using the merged metaschema module change in #542 (comment) (the source of the issue reported and this PR) with the current XSD file via GH URL in xsi:schemaLocation (a.k.a before) and locally binding to the version in this PR (a.k.a after) and the VS Code XML Schema plugin validation and code completer properly work. See screenshots below.

Before:

image

After:

image

image

I am not sure if we want to include and integrate formal testing into this PR or a related issues for such things moving forward. Let me know.

Copy link
Collaborator Author

@aj-stein-nist aj-stein-nist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked to @david-waltermire for informal review and we need to park this pragmatic and low-effort approach (I can be honest about my work 😄) and discuss different approaches to allow interweaving lets with all the constraint types of having them separate. This could and likely will have implications on backwards compatibility on whether we allow interleaving or keeping them separate.

I am going to work on some examples to move forward discussion in our Element/Gitter chat and in upcoming community discussions.

@aj-stein-nist aj-stein-nist force-pushed the 548-permit-let-variable-declarations-without-require-sibling-constraint branch 3 times, most recently from 0299d0a to 06403a8 Compare February 23, 2024 22:55
@aj-stein-nist
Copy link
Collaborator Author

Discussion of this today was postponed, see #548 (comment) for more info. Converting this to draft for now as final reviews are not happening until proper discussion and longer feedback window.

@aj-stein-nist aj-stein-nist removed the request for review from david-waltermire February 23, 2024 23:00
@aj-stein-nist aj-stein-nist marked this pull request as draft February 23, 2024 23:01
@aj-stein-nist aj-stein-nist force-pushed the 548-permit-let-variable-declarations-without-require-sibling-constraint branch from 06403a8 to 27c7a2b Compare March 15, 2024 13:55
@aj-stein-nist aj-stein-nist marked this pull request as ready for review March 15, 2024 22:43
@@ -200,7 +200,9 @@ A `let` statement has a REQUIRED `@var` flag, which defines the variable name.

A `let` statement has a REQUIRED `@expression` flag, which defines an [Metapath expression](/specification/syntax/metapath), whose result is used to define the variable's value in the evaluation context.

During constraint evaluation, each `let` statement MUST be evaluated in encounter order. If a previous variable is bound with the same name in the evaluation context, the new value MUST bound in a sub-context to avoid side effects. This sub-context MUST be made available to any constraints following the `let` statement declaration, and to any constraints defined on child nodes of the current context.
During constraint evaluation, each `let` statement MUST be evaluated in encountered order. If a previous variable is bound with the same name in the evaluation context, the new value MUST bound in a sub-context to avoid side effects. This sub-context MUST be made available to any constraints following the `let` statement declaration, and to any constraints defined on child nodes of the current context.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is blocking and/or material to this PR or not.

This is technically out of scope for #548, but given today's conversation, do want to address this concern within this PR and adjust given discussion and around processing order here and now as it has been decided with scope rebinding being disallowed or defer that? Note, the diff on this paragraph is the result of me correcting encounter to encountered to be more grammatical. I think this was the intent.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, I had a comment here, somehow I dropped it.

Can we codify a rule that no two let element siblings have the same name?

Can we write a constraint for that?

@david-waltermire also grateful for your input here.

@iMichaela
Copy link
Collaborator

@wendellpiez - My understanding from the comment above stating that "we need to park this pragmatic and low-effort approach [...] and discuss different approaches to allow interweaving lets with all the constraint types of having them separate. This could and likely will have implications on backwards compatibility on whether we allow interleaving or keeping them separate." is that this PR must be closed.
Can you please provide any background info you might have on this topic?
Thank you

@iMichaela iMichaela added closable Issue is n/a or satisfied Unfinished labels Aug 25, 2024
@wendellpiez
Copy link
Collaborator

Since OSCAL does not currently use let TMK, this problem will not have any impact on OSCAL until it decides it wishes to do so.

This being the case I think @aj-stein-nist and @david-waltermire might prefer to drive the issue for now (assuming they need it to move) - while in principle I'm amenable to accepting this PR as soon as they say it is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closable Issue is n/a or satisfied Unfinished
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Permit let variable declarations without require sibling constraint
3 participants