Skip to content

Conversation

@Aymen-Soussi-01
Copy link
Contributor

  • Adding Attribute explanation to the graph checks in the metamodel

  • Extract the explanation attribute and add it to the log when we have errors for graph checks

  • Assert to ensure the explanation attribute is there

  • Adapt the RST Tests to the new log error format output

close: #115

@github-actions
Copy link

github-actions bot commented Jul 17, 2025

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //src:license-check

Status: ✅ Passed

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: ec4b2db3-b488-403a-bf96-7ab82718aca5
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //src:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //src:license-check (70 packages loaded, 9 targets configured)

Analyzing: target //src:license-check (121 packages loaded, 2363 targets configured)

Analyzing: target //src:license-check (121 packages loaded, 2363 targets configured)

INFO: Analyzed target //src:license-check (129 packages loaded, 4428 targets configured).
[2 / 11] [Prepa] Writing repo mapping manifest for @@score_dash_license_checker+//tool/formatters:dash_format_converter [for tool]
INFO: Found 1 target...
Target //src:license.check.license_check up-to-date:
  bazel-bin/src/license.check.license_check
  bazel-bin/src/license.check.license_check.jar
INFO: Elapsed time: 14.556s, Critical Path: 0.47s
INFO: 13 processes: 4 disk cache hit, 9 internal.
INFO: Build completed successfully, 13 total actions
INFO: Running command line: bazel-bin/src/license.check.license_check src/formatted.txt <args omitted>
[main] INFO Querying Eclipse Foundation for license data for 84 items.
[main] INFO Found 58 items.
[main] INFO Querying ClearlyDefined for license data for 26 items.
[main] INFO Found 26 items.
[main] INFO Vetted license information was found for all content. No further investigation is required.

@github-actions
Copy link

The created documentation from the pull request is available at: docu-html

"and": operator.and_,
"or": operator.or_,
"not": operator.not_,
"not": lambda x: not x,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you expaline why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I was checking if there is other changes I need to make in graph_checks.py to make the tests works I found that Python’s operator.not_ actually expects a single operand, but its behavior can be a bit inconsistent with non-boolean types.
Using lambda x: not x is a safer and more explicit way to handle the logical not operation on evaluated conditions.
I’ve replaced operator.not_ with lambda x: not x for clarity and correctness.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give me some examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • 'operator.not_' works only with boolean inputs. It expects a direct boolean value like True or False.
    However, in our function, the evaluated condition might not be a pure boolean — it might be a string, number, or even a None, which Python treats as "falsy" or "truthy" in logical contexts.
    Here are some Examples:
 ```'
# Example 1
print(operator.not_(True))       # ✅ Works → False
print(operator.not_(False))      # ✅ Works → True

# Example 2 - Non-boolean
print(operator.not_("status"))   # ✅ Works → False
print(operator.not_(""))         # ✅ Works → True

# BUT...

# Example 3 - What if we accidentally give a list or dict?
print(operator.not_({"key": "value"}))  # ❌ Technically works (False), but semantically risky

'''
  • 'operator.not_ 'doesn’t do type checking, and in more complex condition trees, it's harder to ensure only boolean values are passed.
    In our recursive eval_need_condition, the return value might not always be strictly boolean, leading to unclear behavior or silent logic errors.

  • 'lambda x: not x' is safer as it ensures you're explicitly controlling the context — Python's native not works on any type and follows standard truthy/falsy semantics just like Python developers expect. It also reads more clearly when debugging or tracing the logic.

Comment on lines +75 to +86
if cond == "not":
if not isinstance(vals, list) or len(vals) != 1:
raise ValueError("Operator 'not' requires exactly one operand.")
return oper["not"](eval_need_condition(need, vals[0], log))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For sure it's a suggestion and I can roll back the changes if needed.

continue

parent_ids = need[parent_relation]
if not isinstance(parent_ids, list):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quiet understand this?

What's the pourpes of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to ensure it's a list, as we are going to loop through it, but I have removed this if statement now

Copy link
Contributor

Choose a reason for hiding this comment

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

Theoretically it makes sense, though if this weren't a list then we have much bigger problems, as that means the Metamodel loaded wrong.
If you truly want you can make this as an 'assert' here.

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 will just keep it simple and remove the if there is no need for an assert I guess

condition: safety == QM
check:
satisfies: safety == QM
explanation: An ASIL requirement must link at least one parent/upstream ASIL requirement for correct decomposition. Please ensure the parent’s safety level is QM and its status is valid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Status valid is not checked here.
Though it will be in the future as far as I know. So I think we should keep this Explanation for now

condition: safety == ASIL_B
check:
satisfies: safety != ASIL_D
explanation: An ASIL requirement must link at least one parent/upstream ASIL requirement for correct decomposition. Please ensure the parent’s safety level is not ASIL_D and its status is valid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing that this only applies when current requirement is ASIL_B, not whne it's QM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

condition: safety == ASIL_B
check:
mitigates: safety != QM
explanation: An ASIL requirement must link at least one parent/upstream ASIL requirement for correct decomposition. Please ensure the parent’s safety level is not QM and its status is valid.
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't make sense.

Suggested change
explanation: An ASIL requirement must link at least one parent/upstream ASIL requirement for correct decomposition. Please ensure the parent’s safety level is not QM and its status is valid.
explanation: An ASIL_B safety requirement must link to a ASIL_B requirement. Please ensure that the linked requirements safety level is not QM and it's status is valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but here also we it can be equal or higher so must link to ASIL_B or ASIL_D

Copy link
Contributor

Choose a reason for hiding this comment

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

ASIL_D is no longer available to be choosen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Choose a reason for hiding this comment

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

Some questions. See Comments

Edit: Also, formatting missing.

Copy link
Contributor

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Choose a reason for hiding this comment

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

Some comments

@AlexanderLanin
Copy link
Member

@Aymen-Soussi-01 can you resolve the conflicts?

  • It seems we can drop req_safety_linkage_asil_b as ASIL_D is now gone
  • In the other conflict change mitigates to mitigated_by
  • Update tests etc for those two changes

@Aymen-Soussi-01 Aymen-Soussi-01 force-pushed the enhance-validation-for-graph-checks-error-messages branch from 9e60df9 to 1c4f656 Compare July 30, 2025 13:27
@AlexanderLanin AlexanderLanin merged commit 2e6cf97 into eclipse-score:main Jul 30, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from Draft to Done in Infrastructure Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Enhance validation error messages to include actionable context for metamodel requirements

3 participants