Skip to content

Update max_version on yank #582

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

Closed
wants to merge 8 commits into from
Closed

Update max_version on yank #582

wants to merge 8 commits into from

Conversation

yodaldevoid
Copy link
Contributor

Fixes #76

@yodaldevoid
Copy link
Contributor Author

One thing to note, these changes have yet to be tested with the front end. The only thing that comes to mind as a possible problem is the fact that max_version can now be expected to be null. It was never restricted to not being null, but it was never a true possibility due to the backend code.

@yodaldevoid
Copy link
Contributor Author

I have looked into testing the frontend response to a null max_value for a crate. The only test I can think of is to start up a local backend and frontend, publish a crate to the local backend, yank the crate from the local backend, and finally try to view it on the frontend. My problem comes from trying to publish to the local backend using cargo. I have added the config block spat out by script/init-local-index.sh, but cargo always fails with a 404 error if --host http://127.0.0.1:8888/ is passed to cargo and an SSL error if --host https://127.0.0.1:8888/ is passed to cargo. Is there something I could be forgetting, or am I simply going about this wrong?

@carols10cents
Copy link
Member

I have added the config block spat out by script/init-local-index.sh, but cargo always fails with a 404 error if --host http://127.0.0.1:8888/ is passed to cargo and an SSL error if --host https://127.0.0.1:8888/ is passed to cargo. Is there something I could be forgetting, or am I simply going about this wrong?

Ugh yeah, --host isn't actually host of the crates server, it wants the location of the index :( When running locally with crates.io setup as recommended in the readme, this value should be something like file:///path/to/your/crates.io/checkout/tmp/index-co/. This has bothered me for a while, I'm going to go file a bug with cargo right now.

The next problem that you'll probably run into is that, unless you've set up an s3 bucket, publishing to your local crates.io will fail trying to upload the code to s3. I get around this by temporarily applying this commit to disable uploads to s3 and just update the database-- this has been bothering me as well and I want to fix it as part of #470.

Basically I'm sorry i'm sorry.

@carols10cents
Copy link
Member

Alternately, I'm happy to test this out on my setup, since I've already gone through this pain. Let me know!! I'm looking at the code now :)

@carols10cents
Copy link
Member

The code is looking great!!

Other than checking out the frontend, the only other thing this change will need is a way to go through existing crates and update those whose max_versions have been yanked to have their next highest non-yanked version used (or set to null if all versions have been yanked) as retep998 reminded me

I should have elaborated in the issue, but we have some one-off tasks in src/bin, such as this task that backfilled users' github IDs (ignore the docs at the top of that file, they're copy-pasted from another binary).

If you don't want to take care of that for whatever reason, I'm happy to, let me know!

@yodaldevoid
Copy link
Contributor Author

Thanks for pointing me in the right direction! Don't worry about the problems, now we know more about what needs to be improved. I'll be honest, whenever I find a place where documentation is lacking when working with Rust I feel a little better as it reminds me that everyone working on this language/project is human.

It's interesting that --host is used for publishing, but --index (which honestly makes more sense) is used for yanking. At any rate, here is the front page of a crate with a null max_version.
null_crate
I don't think the red bar at the top is acceptable, but everything else seems fine to me.

I'll look at writing the one off task. It should be fairly easy to make as most of the logic is already in yank.

@yodaldevoid
Copy link
Contributor Author

Hmmm, this is a little concerning. I tested publishing a newer version of a crate when the max version was null, and it seems that the max version is not being updated. I'll look at adding a test and code to fix this.

A crate's max_version is updated when the version we are yanking is the current max_version and when unyanking a version newer than the current max_version.
This is required for the situation where the final non-yanked version is yanked leaving no non-yanked version.
@carols10cents
Copy link
Member

Everything you've said sounds great! Also I filed a bug with cargo about the --host flag.

I'll be honest, whenever I find a place where documentation is lacking when working with Rust I feel a little better as it reminds me that everyone working on this language/project is human.

We are all very much human :) ❤️

@yodaldevoid
Copy link
Contributor Author

yodaldevoid commented Mar 5, 2017

Everything should be wrapped up. I tested the update task against my local copy and it worked. I don't have tests for it, but can add those if you wish.

@yodaldevoid
Copy link
Contributor Author

yodaldevoid commented Mar 5, 2017

Going through the issues I found a couple more issues that this addresses. #502 is definitely fixed and #510 might be fixed, but there might be some more work to be done there.

@sgrif
Copy link
Contributor

sgrif commented Mar 5, 2017

Just to note, #592 is an alternate solution to this. Even if we do go that route, the tests that this adds are useful and worth keeping.

@carols10cents
Copy link
Member

Oh geez. Before merging either this or #592, I want to hear from alex why max_version was added in the first place. And yes, the tests in here are valuable no matter what ❤️

@yodaldevoid
Copy link
Contributor Author

I have added tests to the one-off.

@carols10cents
Copy link
Member

@yodaldevoid thank you so much for your work on this, and I hate to do this-- I really should have questioned whether we actually need this column like @sgrif did in #592. I'm definitely going to merge your tests in, which will be valuable in making sure the code in #592 works, but if it does and if production performs ok with the max_version column removed, we might not need this code.

But I want to reassure you that your code is great and I'm very grateful!! ❤️

@yodaldevoid
Copy link
Contributor Author

No problem, really! I'm all for simplifying the database.

@carols10cents
Copy link
Member

Thank you for understanding!!!

sgrif pushed a commit to sgrif/crates.io that referenced this pull request Mar 7, 2017
sgrif pushed a commit to sgrif/crates.io that referenced this pull request Mar 7, 2017
sgrif pushed a commit to sgrif/crates.io that referenced this pull request Mar 7, 2017
@yodaldevoid
Copy link
Contributor Author

Closing because #592

@yodaldevoid yodaldevoid closed this Mar 7, 2017
@yodaldevoid yodaldevoid deleted the yank_updates_max_version branch August 22, 2018 14:22
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.

3 participants