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

[uss_qualifier/scenarios/netrid/common_dictionary_evaluator] Simplify check for UA type #895

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

mickmis
Copy link
Contributor

@mickmis mickmis commented Jan 23, 2025

Changes:

  • If the result checked is from the DP and that it is None, don't perform any additional checks since the DP (through observation API) will never be required to expose any field (case C8).
  • When the injected value is None, expect both SP and DP to expose NotDeclared
    • SP: because it is a required field that must be exposed, so None is not a valid value
    • DP: because the DP must expose what it received from the SP (even though in the observation API the field is nullable)

Those changes simplify the control flow of the check and should also facilitate implementation of generic function in #894.
Notably because there should now only be two cases: whether or not the field is required in SP API. Which is equivalent to whether or not this is a required field by the standard.

Note for #894 (cc @the-glu): the corresponding check for when the field is not required in SP API would look like this:

                if injected_eu_category is None:
                    if observed_eu_category is not None and observed_eu_category != injection.UAClassificationEUCategory.EUCategoryUndefined:  # C6 / C10
                        check.record_failed(
                            "UA classification for 'European Union' type has an invalid category, expected none or 'EUCategoryUndefined' since no value was injected.",
                            details=f"USS returned the category of UA classification for 'European Union' type {observed_eu_category} yet no value was injected. Since 'category' is not a required field of SP API, the SP should omit the value or map this to 'EUCategoryUndefined' and the DP should expose the same value.",
                            query_timestamps=[query_timestamp],
                        )

query_timestamps=[query_timestamp],
)
if dp_observed_flight is not None and observed_val is None:
pass # C8
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this C8 comment ? A more explicit reference seems to be required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the Cn comments refer to the cases listed in common_dictionary_evaluator.md.
The function documentation already mentions:

        Evaluates UA type. Exactly one of sp_observed_flight or dp_observed_flight must be provided.
        See as well `common_dictionary_evaluator.md`.

And the function implementation has such comments all throughout referring to the different cases.
Is it OK as is or would you add something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I will go ahead and merge this PR to unblock #894 and other upcoming changes. I will make a follow-up PR if you'd like an additional change regarding this @barroco.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think mentioning in the comment of the function the explicit location of the cases description would be a good improvement when you have the opportunity.

@mickmis mickmis merged commit 6ebc507 into interuss:main Jan 23, 2025
20 checks passed
@mickmis mickmis deleted the ua_type_simplify branch January 23, 2025 12:36
github-actions bot added a commit that referenced this pull request Jan 23, 2025
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