Skip to content

Newest updated #1931

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

Merged
merged 17 commits into from
Dec 23, 2019
Merged

Newest updated #1931

merged 17 commits into from
Dec 23, 2019

Conversation

bruceadams
Copy link
Contributor

This PR is working toward addressing #310. This is incomplete. There is a relevant test commented out because it fails.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jtgeibel (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@bruceadams
Copy link
Contributor Author

This is pretty far from correct 😞 … some discussion on #310.

@bruceadams
Copy link
Contributor Author

I'm much happier with this code. Pretty much everywhere that used to have some concept of max_version now has top_versions which contains both the highest semver version and the most recently updated version.

What is not yet here is using the most recently updated version in the user interface. (I don't really know where this is in the code, but I haven't really looked either.)

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Love it! So to finish this up, the frontend for the home page will need to be updated:

  • For the Just Updated column, the newest version should be displayed
  • For the Most Downloaded column, no version should be displayed (as discussed in the issue, if you agree)
  • For the New Crates column, the highest version should be displayed (current behavior)

And the search result/crate list pages should also keep the current behavior of showing the highest version.

There's a frontend test for the front page that's very minimal right now but should be updated to test the new logic.

Currently, the home page template calls the crate-list component, which always displays the max version. I'm not sure the best way to change what's displayed in the various cases, but that's where some change will need to be :)

@bors
Copy link
Contributor

bors commented Dec 2, 2019

☔ The latest upstream changes (presumably #1891) made this pull request unmergeable. Please resolve the merge conflicts.

@jtgeibel
Copy link
Member

jtgeibel commented Dec 3, 2019

This looks really good to me so far! A few things I noticed running locally:

  • The Just Updated column isn't showing a version, just empty (). I think this may be causing the test failure as well.
  • Everything still links to the top-level crates/crate_name route. When a version is displayed, it would be nice if the link went directly to that version's page.

To test the end-to-end behavior, I'm looking to publish the following set of crates to staging (Cargo.toml below). Let me know if you think of any additional edge cases that should be covered.

[workspace]

# The comments show the intended publish order
members = [
    "prerelease_only",        # 0.0.1-alpha.0
    "prerelease_then_normal", # 0.0.1-alpha.0, 0.0.1
    "normal_then_prerelease", # 0.0.1, 0.1.0-alpha.0
    "normal_release_only",    # 0.0.1
    "normal_releases",        # 0.0.1, 0.1.0, 0.1.1, 0.2.0
    "normal_and_backport",    # 0.1.0, 0.2.0, 0.2.1, 0.1.1
    "normal_and_backport2",   # 0.1.0, 0.2.0, 0.1.1, 0.2.1
]

@bruceadams
Copy link
Contributor Author

I see the empty version for Just Updated and struggled to understand how max_version worked and newest_version did not. I think I have that detail fixed at this point 🎉. I like suggestion about linking straight to a specific version when we display a specific version. I may not get to that today.

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Just 2 small questions about consistency. Tried it out locally and it's working!

@bruceadams
Copy link
Contributor Author

So… I'm happy with the state of the code and the user interface in this pull request as it currently stands. The main thing I'm uncomfortable about is that the scope of this change has grown well beyond the original issue #310. I am more than willing to trim this back to a narrow scope that only fiddles with the Just Updated column and leaves everything else as it is today. I can imagine some in between places as well. Preferences?

@bruceadams
Copy link
Contributor Author

Sorry about the test failure 😞. Running the front end test locally stopped working and I haven't figured out why.

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

I left a comment for my guess about why the tests might be failing for you locally; if that's not it, I'd be happy to investigate with you (I'll be at Rust Coffee tonight, will you?)

Looking at the failures in Percy, most are expected because of the changes this PR makes to the UI. Are you able to see the Percy diffs? I forget how that works. If not, let me know and I'll post the screenshots here.

The one Percy failure I'm not sure about is for the Acceptance | crate page | is accessible test; the total number of downloads on the homepage is different. That seems brittle to me because this PR didn't change anything about that part of the page. That test is using the factories, though, and this PR did change the factories, so perhaps we've been relying on coincidence.

On further investigation, I'm not really sure why this test exists; it appears to be testing the home page, but we already have this test for the homepage (that uses the fixtures instead of the factories, so it should be more stable).

Are you up for a tiny bit more scope creep on this PR, just deleting that one crate-test? :)

@@ -66,7 +66,7 @@ module('Acceptance | crate page', function(hooks) {
await visit('/');
await click('[data-test-just-updated] [data-test-crate-link="0"]');

assert.equal(currentURL(), '/crates/nanomsg');
assert.equal(currentURL(), '/crates/nanomsg/6.8.9');
Copy link
Member

Choose a reason for hiding this comment

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

Is this test one that's failing for you locally? I think it's because this test uses the factories, and the version number isn't guaranteed to be the same every time the factory gets called?

This can be fixed by explicitly setting a newest_version for this particular instance, sort of like this test explicitly sets a max_version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Running the tests locally crashes fairly badly. I don't have much experience with npm stuffs, so I don't have much clue what is going on. It did work for me. I don't know of having changed anything (although I'm a compulsive brew upgrader and that might've broken something).

Copy link
Member

Choose a reason for hiding this comment

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

Yikes! I have occasional luck with removing node_modules and re-npm installing? We can look at it tonight though :)

Copy link
Member

Choose a reason for hiding this comment

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

Locally, I've replaced this test with the following. This should eliminate the dependence on faker data and make the test more robust to future changes. Would you add a final commit with this or a similar update?

  test('visiting a crate page from the front page', async function(assert) {
    this.server.create('crate', { id: 'nanomsg', newest_version: '0.6.1' });
    this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });

    await visit('/');
    await click('[data-test-just-updated] [data-test-crate-link="0"]');

    assert.equal(currentURL(), '/crates/nanomsg/0.6.1');
    assert.equal(title(), 'nanomsg - crates.io: Rust Package Registry');

    assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
    assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1');
  });

@bruceadams
Copy link
Contributor Author

I will be at the Rust coffee this evening 🎉 @jtgeibel and I looked at the Percy failures. It seems to be related to auto generated stuff that has interesting cross cutting impact. In some bigger picture, it'd be great to stabilize that stuff.

I'm fine with test cleanup. I'm not going to be able to really look at code for several hours.

@bors
Copy link
Contributor

bors commented Dec 20, 2019

☔ The latest upstream changes (presumably #2015) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Dec 21, 2019

☔ The latest upstream changes (presumably #2017) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Dec 22, 2019

☔ The latest upstream changes (presumably #2044) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@jtgeibel jtgeibel left a comment

Choose a reason for hiding this comment

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

@bruceadams thanks for the recent rebases! I've finally had a chance to take another pass at this and things are looking really good. I've added a comment with one final suggestion. I'll also accept the graphical changes in percy.

@@ -66,7 +66,7 @@ module('Acceptance | crate page', function(hooks) {
await visit('/');
await click('[data-test-just-updated] [data-test-crate-link="0"]');

assert.equal(currentURL(), '/crates/nanomsg');
assert.equal(currentURL(), '/crates/nanomsg/6.8.9');
Copy link
Member

Choose a reason for hiding this comment

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

Locally, I've replaced this test with the following. This should eliminate the dependence on faker data and make the test more robust to future changes. Would you add a final commit with this or a similar update?

  test('visiting a crate page from the front page', async function(assert) {
    this.server.create('crate', { id: 'nanomsg', newest_version: '0.6.1' });
    this.server.create('version', { crate: 'nanomsg', num: '0.6.1' });

    await visit('/');
    await click('[data-test-just-updated] [data-test-crate-link="0"]');

    assert.equal(currentURL(), '/crates/nanomsg/0.6.1');
    assert.equal(title(), 'nanomsg - crates.io: Rust Package Registry');

    assert.dom('[data-test-heading] [data-test-crate-name]').hasText('nanomsg');
    assert.dom('[data-test-heading] [data-test-crate-version]').hasText('0.6.1');
  });

@bruceadams
Copy link
Contributor Author

@jtgeibel Your test adjustment makes sense; I added it. The first rebase yesterday took me a while! I was happy the second one was easy!

@bors
Copy link
Contributor

bors commented Dec 22, 2019

☔ The latest upstream changes (presumably #2049) made this pull request unmergeable. Please resolve the merge conflicts.

@jtgeibel
Copy link
Member

Thanks @bruceadams! I hate to say it, but this needs another rebase now, hopeful another easy one though. If you get around to it today, ping me and I'll r+ ASAP. There's been a lot of work on the frontend recently, sorry for the high rate of churn.

This contains far too much repeated code.
It does basically work and the relevant test passes!
I'll refactor the redundant code into a shared function.
Where we used to have max_version, we now have two kinds of top versions:
- the highest semver version
- the most recently updated version.
- For the Just Updated column, the newest version is displayed
- For the Most Downloaded column, no version is displayed
- For the New Crates column, the highest version is displayed (unchanged)
@bruceadams
Copy link
Contributor Author

I learned more about Ember.js, including that the documentation is very good even for a reader like me who barely has a clue about Ember.js.

@jtgeibel
Copy link
Member

Thanks Bruce!

@bors: r+

@bors
Copy link
Contributor

bors commented Dec 23, 2019

📌 Commit fb356c4 has been approved by jtgeibel

bors added a commit that referenced this pull request Dec 23, 2019
Newest updated

This PR is working toward addressing #310. This is incomplete. There is a relevant test commented out because it fails.
@bors
Copy link
Contributor

bors commented Dec 23, 2019

⌛ Testing commit fb356c4 with merge 45b8dbf...

@bors
Copy link
Contributor

bors commented Dec 23, 2019

☀️ Test successful - checks-travis
Approved by: jtgeibel
Pushing 45b8dbf to master...

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.

5 participants