-
Notifications
You must be signed in to change notification settings - Fork 37
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
Adjust handling of unknown properties #456
base: develop
Are you sure you want to change the base?
Adjust handling of unknown properties #456
Conversation
Co-authored-by: Antanas Vaitkus <antanas.vaitkus90@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @rartino, thanks for writing this up.
I have one outstanding question before we merge: we focus here on filtering, but I think response_fields
has the same problem.
If I ask for structure_origin
from my own implementation (100% standards compliant, I'm sure...) at the moment (https://optimade.odbx.science/v1/structures?response_fields=structure_origin) then I get an error. Should I instead return null
for the field (with a warning) after this PR?
@ml-evs Excellent point. Actually, I don't see anything in the specification right now about returning or not returning errors for unknown But, yes, should we force returning |
I think returning |
I think the thought with suppressing that warning was that it is a somewhat expected situation even with databases all at the latest version, and thus shouldn't trigger warnings. This exception wasn't written by me and I don't feel strongly either way. But, can we remove it now? Strictly speaking this is actually a backwards-breaking change in that a clients written to the older specification do not expect to get a warning in these cases, and may now start breaking. |
@ml-evs Ok, I've updated the text to handle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rartino, this looks clear to me now!
@ml-evs Sorry for re-editing this after approval, but I have given this some more thought. First, I think you are right that we should (and can) remove the differences in handling between "recognized" and "unrecognized" prefixes as they complicate the specification, implementation, and the difference may be confusing for users. I also really didn't like the sentence referring to putting a note in "diagnostic output" since we do not have a place for such output, and it is not good if there is no information whatsoever to the client that an unrecognized property has been given a I also realized that to be able to handle the future-proofing properly, we ought to strengthen the interaction between future properties and Finally, since I'm already editing this quite heavily and "Unknown properties" is a term we use for other things, I've systematically changed the term for this to "unrecognized property names", including renaming the whole section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the important clarifications @rartino! A few minor comments:
@ml-evs Is there anything still blocking the approval? I looked over your final set of comments again, but I don't see anything to act on. You argue that the features flag should be named the same as the field; but to reiterate the argument from above, the point is that a "feature" doesn't need to map cleanly to a single field; it could possibly even involve using keys or values in otherwise defined fields with unusual meaning. A client that understands what |
Co-authored-by: Antanas Vaitkus <antanas.vaitkus90@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely formatting changes -- I think these are uncontroversial so will commit them and then add an additional commit that adds actually went with "field-val" for the warning code, I think this is appropriate but will leave it for @rartino to confirm.:warning-code:
to the registered tags.
Co-authored-by: Matthew Evans <7916000+ml-evs@users.noreply.github.com>
I am sorry, but I still do not see why we need to add special values to Could you perhaps remove lines 2858, 2859, 435 and 436 And place those in a separate PR? |
|
||
When an implementation receives a request with a query filter that refers to an unknown property name it is handled differently depending on the database-specific prefix: | ||
When an implementation receives a request with a query filter or other mechanism (e.g., :query-param:`response_fields`) that refers to a property name that is not recognized, it MUST NOT treat this as an error but rather MUST issue a warning with :field:`code` set to :field-val:`unrecognized_property`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to understand this better, does "unrecognized property" now mean unsupported OPTIMADE properties too? I recall that prior this PR "unknown" stood for properties with database-specific prefixes. So now for example an implementation can choose to "not recognize" structures' chemical_formula_anonymous
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this change is the most vital part of this PR to improve forwards compatibility in OPTIMADE.
The point is, when we add, e.g., spacegroup
to the standard, and you send a query to two databases asking to include spacegroup
among the response fields (or referencing it in the filter), you do not want an error; you want it treated as null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so the client will have to inspect the warnings to make sure that the empty return list means the database does not implement spacegroup
, not that it does not contain any structures with the queried space group.
Workshop: no agreement if this is the right protocol for futureproofing requestes. An argument made is that this can be handled on the client side by rewriting filters and requested fields dynamically for the version of each server the client communicates with. |
@ml-evs: I suggest we reiterate this discussion at the release web meet? We need to do something to improve forward compatibility. Perhaps some general "tags" field in all endpoints to do something like what you suggested for structure_features. |
After some discussions: lets remove all parts except the way for old servers to handle references to unknown fields from newer clients and see if we can get consensus for that. The handling with structure_features for older clients to handle newer servers (with fields that alter the data interpretation) can instead use the major version number. |
In discussions related to issue #406 we've found that the current handling of unknown properties in OPTIMADE is not optimal for interoperability, as queries using a new property will generate errors in databases that implement an older version of the standard.
This PR is a suggestion for fixing this issue for providers implementing 1.2 and forward. (However, queries to databases that remain on 1.1 will still generate errors)."