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

fix: 73 - add 2.0.0 to the recognized FE versions #74

Merged
merged 4 commits into from
Sep 21, 2021

Conversation

ebezzi
Copy link
Member

@ebezzi ebezzi commented Sep 21, 2021

Reviewers

Functional:
@tihuan

Issue #73

Changes

  • Required, otherwise newly uploaded datasets will show a weird behavior (namely, the title is wrong).

@ebezzi ebezzi requested a review from tihuan September 21, 2021 16:05
@codecov
Copy link

codecov bot commented Sep 21, 2021

Codecov Report

Merging #74 (a09a2ea) into main (47b206a) will not change coverage.
The diff coverage is n/a.

❗ Current head a09a2ea differs from pull request most recent head 6b33a7e. Consider uploading reports for the commit 6b33a7e to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main      #74   +/-   ##
=======================================
  Coverage   71.72%   71.72%           
=======================================
  Files         126      126           
  Lines       10030    10030           
=======================================
  Hits         7194     7194           
  Misses       2836     2836           
Flag Coverage Δ
frontend 71.72% <ø> (ø)
javascript 71.72% <ø> (ø)
smokeTest ?
unitTest 71.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47b206a...6b33a7e. Read the comment docs.

Copy link
Contributor

@tihuan tihuan left a comment

Choose a reason for hiding this comment

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

Love the extraction! Thanks so much for fixing this, @ebezzi 🙏 Just two tiny nits!

const correctVersion =
["1.0.0", "1.1.0"].indexOf(corporaProps?.version?.corpora_schema_version) >
-1;
const correctVersion = checkValidVersion(corporaProps);
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer prefix with is 🙏 const isCorrectVersion = ...

Copy link
Contributor

Choose a reason for hiding this comment

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

or maybe const isValidVersion = checkValidVersion(corporaProps); ?

@@ -0,0 +1,11 @@
export function checkValidVersion(corporaProps: any) {
const isValidVersionOne =
["1.0.0", "1.1.0"].indexOf(corporaProps?.version?.corpora_schema_version) >
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit:

Hoist constants out of the function declaration, so we don't need to create new arrays every time:

const VERSION_ONES = ["1.0.0", "1.1.0"];
const VERSION_TWOS = ["2.0.0"];

export function checkValidVersion(corporaProps: any) {
  if (!corporaProps) return false;

  const { version, schema_version } =  corporaProps;

  const isValidVersionOne = VERSION_ONES.includes(version?.corpora_schema_version);
  const isValidVersionTwo = VERSION_TWOS.includes(schema_version);

  return isValidVersionOne || isValidVersionTwo; 
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, thanks!

@atolopko-czi atolopko-czi self-requested a review September 21, 2021 16:44
Copy link
Contributor

@atolopko-czi atolopko-czi left a comment

Choose a reason for hiding this comment

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

When the CXG is created, why isn't the Schema 2.0.0-provided title being put into the CXG at cxg_group_metadata | cxg_properties | title? It would seem cleaner to simply read it from a single CXG location unconditionally. More generally, it would be cleaner if Explorer never needed to care about the Schema version and instead could just rely upon the CXG file version. So I'm questioning whether this fix should actually be a Data Portal CXG transformer fix. Are there other places in the Explorer that we the Schema version is depended upon?

(Similarly, when we fix the missing X_approx_dist property, it would be best if we added this to cxg_group_metadata | cxg_properties, rather than under the cxg_group_metadata | cxg_properties | corpora dictionary, to avoid coupling CXG and H5AD Schema versions).

@ebezzi
Copy link
Member Author

ebezzi commented Sep 21, 2021

@atolopko-czi The title is there. I believe this check was to prevent legacy datasets (the /d/ nodes) from breaking, since they didn't have a title. There is no difference in behavior between 1.1 and 2.0 with respect to this change.

Copy link
Contributor

@tihuan tihuan left a comment

Choose a reason for hiding this comment

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

Amazinggg! LGTM 🚀 🚀 🚀 Thanks so much again, @ebezzi 🌟

@atolopko-czi
Copy link
Contributor

Discussed w/ @ebezzi that we should in fact be able to eliminate h5ad schema version checks in this code, but we'll merge this as is for. I'll file a followup story to replace the version check with a robust read of cxg_group_metadata | cxg_properties | title, since the CXGs for Schema-compliant H5AD files also put the title there.

@ebezzi ebezzi merged commit a16acc9 into main Sep 21, 2021
@ebezzi ebezzi deleted the ebezzi/73-add-2-0-0-to-recognized-versions-in-fe branch September 21, 2021 18:55
@seve
Copy link
Contributor

seve commented Sep 21, 2021

@tihuan Shouldn't this have typed the files?

@tihuan
Copy link
Contributor

tihuan commented Sep 22, 2021

@tihuan Shouldn't this have typed the files?

Hmm what do you mean specifically? What needs to type what files?

@seve
Copy link
Contributor

seve commented Sep 22, 2021

@tihuan I thought our stance going forward with TS was that any changed files would also check in typings for the files at some level. In this case at the least renderContributors and client/src/components/util/version.ts would be typed.

We're actually intoducing untyped code in this PR

@tihuan
Copy link
Contributor

tihuan commented Sep 22, 2021

Ahh I see what you mean now! Thanks for bringing this up 👍
Given that the PR was written by a BE engineer and was time sensitive, I didn't want typing to block the merge. But I'll add typings in a follow up PR tomorrow!

Thank you!

@tihuan
Copy link
Contributor

tihuan commented Sep 22, 2021

Follow up PR: #81 Thank you!

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.

4 participants