-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[24.0] Fix History Dataset Association creation so that hid is always set #18036
[24.0] Fix History Dataset Association creation so that hid is always set #18036
Conversation
I think that's the missing piece to find all the instances where we might still be committing HDAs without HIDs, and I think we might have a similar bug for DatasetCollectionElements.
Otherwise we may end up with a history item that either temporarily or permanently lacks a hid. This could currently be encountered via implicit conversion that set `visible=False` in the when calling `datatype.convert_dataset`.
5d6e057
to
badbd3a
Compare
3196da4
to
cedc441
Compare
log.debug("Using strict flush checks") | ||
|
||
def before_flush(session, flush_context, instances): | ||
for obj in session.new: |
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.
Isn't that what versioned_objects_strict()
does? If so, why not do something like this:
for obj in versioned_objects_strict(session.new):
pass
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.
It creates a version, which doesn't make sense for new objects.
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.
Ah, yes, I could do that, though it's not related to versioning objects, which is what threw my off in your comment.
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.
And then, if I'm not mistaken, you wouldn't need this if/then
that checks os.environ
and contains 2 similar function definitions, and just use the existing logic, I think? i.e., setting versioned_objects = versioned_objects_strict
would still work?
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.
I don't think one is better than the other with the exception this one is slightly better since we don't run the os.environ check in the module space ?
cedc441
to
121f27e
Compare
We already had test coverage for this, but we were not running the strict checks on new items. b1333e0 should be the missing puzzle piece to prevent this entirely in testing, however we might discover more bugs in the process.
xref #18014:
Significantly extends test coverage by also checking new items for strict rules, and also fixes serialization of Dataset Collection Elements for collection elements that aren't populated yet.
How to test the changes?
(Select all options that apply)
License