Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have no idea why this passed on rails 6.1 🤣
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.
FYI, instance_logger is an instance variable coming from the Vmdb::Logging stuff. Not sure why this was coming back previously. Maybe json dump of the class object included the ivars. That's why I'm changing it to return the Class#name as it's weird to store the Class object.
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.
where is v_workflow_class defined?
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.
https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_request.rb#L51
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.
The rescue nil in the class method drives me mad and I think it's related to the NilClass
{}
above. I really have no idea how any of this stuff works but thisinstance_logger
in the test was completely wrong and thankfully rails 7 detected it. Not sure why it worked in 6.1There 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.
Wow, I had so much trouble tracking down where this method was defined
delegate
is not verygrep
friendly. It was added in ManageIQ/manageiq#13441Interestingly, there is a
workflow_class
method that we probably should be using instead.But more importantly, it is declared to return a
String
(which it probably should be), but it returns aClass
. It is possible that our serialization of aClass
may have changed.It appears that the example is not properly creating a workflow, so
nil.class
is returning aNilClass
.I put a
byebug
into the class but getting all sorts of errors:These all work in
rails c
for me, but fail when I'm running this specific spec.I tried redefining the
DialogFieldValidation
to the long style (class MiqProvisionWorkflow; module DialogFieldValidator; end; end
instead ofmodule parent::DialogFieldValidator
) but that did not help.This is a tangent, but this feels a little chicken and egg.
If you want to define the child module, define the parent class (which references the child module)
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.
update:
The MiqProvisionRequest.workflow_class references a class, but
constantize
throws that exception listed above. Match that with arescue nil
and we get anil
coming out.nil.class == NilClass
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.
yeah, is the test and code busted or just the test? I can try to create a proper workflow to fix the test.
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.
Thnx Jason: once I updated all my repos, I was able to load this just fine.
One thing about the code, it compares the
workflow.class
and theworkflow_class
. So if it gets busted (goes from a value to nil), then it will always pass the test.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'm punting on this (see below). We'll tackle this if we determine the correct behavior it should have. Right now, it doesn't make sense why it's ok on rails 6.1 when it's clearly wrong. It's possible no one is using it and not reported a bug. Either way, we can handle it when it's a problem.