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

add const UID attribute to allow constant IDs #352

Merged
merged 11 commits into from
May 17, 2024

Conversation

nwesem
Copy link
Contributor

@nwesem nwesem commented May 8, 2024

Hi this PR adds constUID attribute to allow overwriting generated static UIDs, as for static UID this is a 4-byte hex identifier. Please see test test_const_id for more details

nwesem added 3 commits May 8, 2024 17:13
Signed-off-by: Niclas Wesemann <[email protected]>
Signed-off-by: Niclas Wesemann <[email protected]>
+ test_file
+ " ./out.vspec --validate-static-uid "
+ "./validation_vspecs/validation.vspec "
+ "--only-validate-no-export"
Copy link
Collaborator

@erikbosch erikbosch May 10, 2024

Choose a reason for hiding this comment

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

To me it is not obvious why you have "--only-validate-no-export" here but not for the overlay alternative. Possibly add a comment.

Updated:

Now I noticed that in one of the overlay tests we actually check output. I suggest that we remove --only-validate-no-export here as well so that the two variants behave in the same way, i.e. both generate files. Or have a separate option to control that.

@erikbosch
Copy link
Collaborator

Should usage possibly be described in https://github.com/COVESA/vss-tools/blob/master/docs/vspec2id.md

@@ -68,6 +68,7 @@ class VSSNode(Node):
"$file_name$",
"fka",
"delete",
"constUID",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should discuss how integrated we want the id-attributes to be in vss-tools. By adding constUID (and previously fka) they will be considered as core attributes and accepted in all tools.

There are two alternatives, one is to consider them as extended attributes and give warning unless they are specified by -e, the other is to refactor vss-tools so that each tool can add their own core attributes. Or alternatively that we consider them as "global core attributes", but then we should possibly mention them in https://github.com/COVESA/vss-tools/blob/master/docs/vspec2x_arch.md

Copy link
Contributor Author

@nwesem nwesem May 14, 2024

Choose a reason for hiding this comment

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

@erikbosch can you please discuss this during the public meeting today? I have been sick yesterday / today, but can finish this tomorrow if you decide on how you want it to work. I would appreciate it, thank you!!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets keep this for now, just add some documentation, then I can do a quick look and if ok I merge

@nwesem
Copy link
Contributor Author

nwesem commented May 14, 2024

Should usage possibly be described in https://github.com/COVESA/vss-tools/blob/master/docs/vspec2id.md

Thanks for the hint! I will add documentation as soon as we decided on how this will be integrated

@erikbosch
Copy link
Collaborator

MoM:

  • Erik and Niklas to sort out remaining steps, then ok to merge

assert node.constUID.startswith(
"0x"
), f"constUID has to begin with '0x': {node.constUID}"
assert len(node.constUID) == 10, f"Invalid constUID: {node.constUID}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am considering to move these two assert statements to a utlils function and also run them on the generation of UIDs as an additional safety measure..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found a better way to solve this here f46dd0c

@erikbosch
Copy link
Collaborator

I assume there is still some work remaining, like documentation. Correct @nwesem?
If possible it would be great if you could finish during the day, as this is the last PR intended to be included in 4.2, so that I could prepare a release candidate tomorrow.

@nwesem
Copy link
Contributor Author

nwesem commented May 16, 2024

thx for letting me know @erikbosch, I'm currently working on the documentation. Will be done soon. Would it be possible to include my suggestion for this issue #354 in the release candidate as well? I can do it for the shown min and max variables and send another PR by the end of the day. It's quite important to make static UID file iteration work.

nwesem added 3 commits May 16, 2024 14:52
Signed-off-by: Niclas Wesemann <[email protected]>
Signed-off-by: Niclas Wesemann <[email protected]>
@nwesem
Copy link
Contributor Author

nwesem commented May 16, 2024

@erikbosch quick question: to fix the bug mentioned in #354 I will branch off from here and merge back into this branch feat/const-id? Otherwise we would probably run into merge conflicts as I would be changing the same files.. do you agree that makes sense?

@erikbosch
Copy link
Collaborator

That works fine, no problem to use the same branch, or to use the "same" commit in multiple branches. Use what is easiest for you, as long as it is understandable what is the intended final result I have no problems fixing minor merge issues when a PR is to be merged.

@nwesem
Copy link
Contributor Author

nwesem commented May 16, 2024

There is an issue. I implemented the default values for min and max and updated everything regarding the static UIDs but setting the default value causes 43 other tests to fail (AssertionErrors) because now min and max values are null or None instead of the empty string "".

@erikbosch Do you have a second to take a look and help me on this? I pushed it to branch https://github.com/nwesem/vss-tools/tree/fix/var-init
The other option is to find a somewhat hacky solution to make static UIDs work for 4.2 release and then properly solve it for 4.3 release. I gave a hacky solution a quick try, I could make it work but yeah that's definitely not good practice 😃
What do you think? It could also be worth spending the second to update the tests according to the new default values for min and max but I cannot estimate how much work that would be..

Also fyi @adobekan

@nwesem
Copy link
Contributor Author

nwesem commented May 17, 2024

Hi @erikbosch I found a decent way to temporarily fix it here ad0b093 which means this PR is ready for 4.2 release.
You can disregard the comment above for the moment. However, I will look into the initialization issue asap, but that needs more time. Let me know if this works for you.. Thx!!

@erikbosch
Copy link
Collaborator

Thanks @nwesem - that works for me. I will take a look at the PR and let you know if I have any concerns.

@erikbosch erikbosch merged commit 363a0a6 into COVESA:master May 17, 2024
5 checks passed
erikbosch pushed a commit that referenced this pull request May 17, 2024
* add const UID attribute to allow constant IDs

---------

Signed-off-by: Niclas Wesemann <[email protected]>
@nwesem nwesem deleted the feat/const-id branch July 3, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants