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

changed the source of Owner and updated field to be searchable and so… #3095

Merged
merged 6 commits into from
Aug 16, 2024

Conversation

YuliaKrimerman
Copy link
Contributor

…rtable

https://issues.redhat.com/browse/RHOAIENG-7566

Description

Update the source of the Owner - now it's just a field that we get from the API response. I've attached the screenshot that shows where this field on the page now is coming from.
In addition I've made the owner a sortable field as well as a Search option. See screenshots attached.

How Has This Been Tested?

Tested on the Model Registry Cluster

Test Impact

Updated the tests to cover now both field options scenarios( with Author and when "-" )

Request review criteria:

Self checklist (all need to be checked):

  • The developer has manually tested the changes and verified that the changes work
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has added tests or explained why testing cannot be added (unit or cypress tests for related changes)

If you have UI changes:

  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.

After the PR is posted & before it merges:

  • The developer has tested their solution on a cluster by using the image produced by the PR to main

Screenshot 2024-08-15 at 9 00 24 AM
Screenshot 2024-08-15 at 9 00 37 AM
Screenshot 2024-08-15 at 9 02 16 AM

registeredModelRow.findOwner().contains('Author 1');
registeredModelRow.findOwner().should(($owner) => {
const text = $owner.text();
expect(text).to.be.oneOf(['Author 1', '-']);
Copy link
Contributor

@gitdallas gitdallas Aug 15, 2024

Choose a reason for hiding this comment

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

I think we should test both ways independently here (that the author shows up if the author prop is populated, that the '-' shows up if not).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That line of code started failing with the new change, and I wasn't quite able to figure out why ( findOwner has the same textId 'registered-model-owner' so it should be good) . It's complaining that :"Timed out retrying after 10000ms: Expected to find content: 'Author 1' within the element:

but never did". Do you have maybe a suggestion what can be missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you haven't updated the mock types and data. They still have the author in the modelVersion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So if I understood correctly I should delete "mockModelVersion({ author: 'Author 1' })" line 70 in that test file? - I tried, that didn't help. I also tried to delete that field from all the 3 parts within MockModelVersionType but then the test suite didn't even run.

Copy link
Contributor

@gitdallas gitdallas Aug 15, 2024

Choose a reason for hiding this comment

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

You'll need to also add the author prop to the RegisteredModel where your code is looking for it.

As for the tests not running in MockModelVersionType after removing all the model versions. I'm not sure, is that completely removed from everywhere or just within this case? If removed generally and tests fail after mocking that way, then there must be some test that is still falsely depending on that.

Copy link
Contributor

@gitdallas gitdallas Aug 15, 2024

Choose a reason for hiding this comment

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

ah, actually i can't do that as the mockRegisteredModel.ts file wasn't touched yet. but basically:

image

then you could update the calls to mockRegisteredModel in modelRegistry.cy.ts to whatever owner/author you want, and the test to match. could use Author 1 if you want, but i think something with "Owner" would make more sense for the owner field so people don't get the two mixed up in reviewing/making tests.

or is there even an author field? you may have just had a typo below inModelDetailView. Seems odd the detail view would use author for "Owner" while the table row would use owner for "Owner"

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I just wrapped my head around the story and changes a bit more. I think you need to still treat author the same way and keep it in modelVersion and just add owner to the registeredModel. So the RM has an "owner" while the version has an "author".

Maybe @mturley has some input on this

Copy link
Contributor

@mturley mturley Aug 15, 2024

Choose a reason for hiding this comment

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

Yes, it's confusing but the RegisteredModel has an owner but no author and the ModelVersion (and ModelArtifact, though that's not relevant) has an author but no owner. Currently in the UI we are showing "Owner" and under the hood we're using the version's author field.

There are two changes that prompted this story:

  1. The database now has owner on RegisteredModel, which previously didn't have either owner or author (which is why we were fetching the author from the model's latest version).
  2. The UX microcopy is being updated so that we call it in the UI what it is in the database -- for models we call it "Owner" and use the .owner field, and for versions we'll call it "Author" and use the .author field. (edit: the actual microcopy change for using the text "Author" on the versions is part of a separate story).

Copy link
Contributor

@mturley mturley Aug 15, 2024

Choose a reason for hiding this comment

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

That latter change to use "Author" in the UI wasn't originally part of this Jira issue, it was from a followup discussion, but I think making that change in this PR would be least confusing. Is that ok @YuliaKrimerman ?
Ignore this, I was growing the scope of the PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually --- scratch that last point, sorry. We don't have to touch anything with how Versions display the owner/author, that's out of scope here.

Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

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

A couple changes here.

author?: string;
owner?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

we should only have owner here, not author. Same for the other two instances below in this file.

Comment on lines 88 to 89
author?: string;
owner?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't add either of these to ModelRegistryBase - I know I had originally added author here when we were pairing on this @YuliaKrimerman but I was wrong, sorry. I hadn't realized it was called owner for RegisteredModels.

The type updates we need are:

ModelRegistryBase - no change
RegisteredModel - add owner
ModelArtifact - no change (don't remove author)
ModelVersion - no change (don't remove author)

@@ -33,6 +33,7 @@ export const registerModel = async (
name: formData.modelName,
description: formData.modelDescription,
customProperties: {},
author,
Copy link
Contributor

Choose a reason for hiding this comment

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

This line will need to be:

owner: author,

because the property we're adding on RegisteredModel is owner, but we can leave the function argument called author because we're using the same value for the author of the ModelVersion and ModelArtifact in the registerVersion call below.

Alternatively, if you want you can change this registerModel function so it takes an owner instead of author, then this line is just owner, and then when we call registerVersion() below you can pass owner instead of author.

I feel like I'm talking in circles, hopefully this makes sense.

author: 'Author 1',
owner: 'Author 1',
Copy link
Contributor

Choose a reason for hiding this comment

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

Same deal here, we only need owner for models.

@@ -286,9 +288,11 @@ describe('getPatchBody', () => {
);
expect(result).toEqual({
description: 'Description here',
author: 'Author 1',
Copy link
Contributor

Choose a reason for hiding this comment

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

So we'll want to remove author here as well.

registeredModelRow.findOwner().contains('Author 1');
registeredModelRow.findOwner().should(($owner) => {
const text = $owner.text();
expect(text).to.be.oneOf(['Author 1', '-']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually --- scratch that last point, sorry. We don't have to touch anything with how Versions display the owner/author, that's out of scope here.

@YuliaKrimerman
Copy link
Contributor Author

Ready for hopefully final review @mturley @gitdallas

@openshift-ci openshift-ci bot added the lgtm label Aug 15, 2024
Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

/lgtm

Checked with Postman... the owner field gets picked up fine

Copy link
Contributor

@mturley mturley left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

openshift-ci bot commented Aug 16, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gitdallas, manaswinidas, mturley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 8030ed4 into opendatahub-io:main Aug 16, 2024
6 checks passed
@YuliaKrimerman YuliaKrimerman deleted the RHOAIENG-7566 branch October 10, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants