Skip to content

correct versions order and show only indexed versions#1284

Merged
dwradcliffe merged 2 commits into
rubygems:masterfrom
sonalkr132:dep_fixes
Jun 1, 2016
Merged

correct versions order and show only indexed versions#1284
dwradcliffe merged 2 commits into
rubygems:masterfrom
sonalkr132:dep_fixes

Conversation

@sonalkr132
Copy link
Copy Markdown
Member

Looks like I have found more tests which fail only on travis 😓

preserve order test on bunder-api.
Indexed test on bundler-api.

@homu
Copy link
Copy Markdown
Contributor

homu commented May 22, 2016

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

@sonalkr132 sonalkr132 force-pushed the dep_fixes branch 7 times, most recently from 3861aa3 to 3ca7268 Compare May 23, 2016 01:55
@sonalkr132
Copy link
Copy Markdown
Member Author

sonalkr132 commented May 23, 2016

Although test have passed and they are correct, we still need to figure out why they were failing previously.
I had to use different gem names because database is not cleaning between test runs (only on travis). Objects created in unit tests were breaking functional test just cause they used the same name (travis link).

It is exactly what was making #1281 fail (travis build link).

This is all I know so far and I don't know where to go with this.

@homu
Copy link
Copy Markdown
Contributor

homu commented May 24, 2016

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

@dwradcliffe
Copy link
Copy Markdown
Member

The code looks good. I'm not sure about the Travis failures, and we should figure that out, but I think we should proceed with this anyway.

@sonalkr132
Copy link
Copy Markdown
Member Author

sonalkr132 commented May 25, 2016

Here, we are ordering just by number whereas bundler-api orderes versions with created_at, number, platform, and dependencies by name (I hope I got this right!).
Do we need all of that? Do we know someone who can answer it?

@fotanus git blame says its you 🔮

@dwradcliffe
Copy link
Copy Markdown
Member

@indirect @segiddins might know

@fotanus
Copy link
Copy Markdown
Contributor

fotanus commented May 25, 2016

I'm in a run right now, but the orderings should be consistent across both bundler-api and rubygems.org. If is not the case, it is wrong.

@arthurnn
Copy link
Copy Markdown
Member

Regarding data leaking between tests. We should be using transactional fixtures , which should not let data leaky. Can you check if we have a test that disable it, and dont clean the data afterwards?

@arthurnn
Copy link
Copy Markdown
Member

Here, we are ordering just by number whereas bundler-api orderes versions with created_at, number, platform, and dependencies by name (I hope I got this right!).
Do we need all of that?

@sonalkr132 I think it is a good idea to maintain that order.

@fotanus
Copy link
Copy Markdown
Contributor

fotanus commented May 25, 2016

Now with a bit more of time, I think that we should keep the most restrictive order possible, trying to avoid a database update to break the order and cause trouble. So I suggest copy the order from bundler-api. I have something pending already for bundler, so if you guys are in rush feel free to fix this!

@sonalkr132
Copy link
Copy Markdown
Member Author

I suggest copy the order from bundler-api.

I am getting more and more inclined towards using raw sql in fetch_dependency_from_db. That way we can almost copy the exact query from bundler-api. I also ran performance test on dependency end point and fetch_dependency_from_db took 27% of request time with one record in DB(10.96% of 40% request time. 60% was spent in setup).

screenshot from 2016-05-24 17-14-25

report: https://jsfiddle.net/pudg03g7/

@fotanus
Copy link
Copy Markdown
Contributor

fotanus commented May 25, 2016

I think @dwradcliffe can help with the code style. I'm good either way.

@arthurnn
Copy link
Copy Markdown
Member

@sonalkr132 I am totally for it to use raw SQL here.. As long as we sanitize the parameters for security reasons, thats what we should do IMO.

@sonalkr132 sonalkr132 force-pushed the dep_fixes branch 2 times, most recently from 9eaada5 to 6241ec8 Compare May 26, 2016 15:21
@sonalkr132
Copy link
Copy Markdown
Member Author

I have updated it to the exact code of bundler-api, except I have dropped ordering of nested SELECT query. We were ordering again at end so nested ordering didn't make any difference other than slowing the query.

This has one more difference, angle brackets > used in requirements are rendered as ["rake","\u003e= 0.8.3"]. It is not introduced in this PR, rather it was always there. I suppose thats rails default escaping. This stackoverflow answer suggests that it won't make a difference:

The various gsub calls are forcing non-ASCII UTF-8 to the \uXXXX notation that you're seeing. Hex encoded UTF-8 should be acceptable to anything that processes JSON but you could always post-process the JSON (or monkey patch in a modified JSON escaper) to convert the \uXXXX notation to raw UTF-8 if necessary.

@homu
Copy link
Copy Markdown
Contributor

homu commented May 28, 2016

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

@sonalkr132 sonalkr132 force-pushed the dep_fixes branch 3 times, most recently from 9689eae to 0d99580 Compare May 28, 2016 07:43
@sonalkr132 sonalkr132 changed the title Remove reverse order and show only index version correct versions order and show only indexed versions May 28, 2016
@homu
Copy link
Copy Markdown
Contributor

homu commented May 29, 2016

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

raw sql insures ordering consistent with bundler-api, ie
versions are ordered by created_at, number(version) and platform,
and deps are ordered by name.
Add tests for filtering of indexed versions and listing of dependency.
'ruby_version' => '>= 2.0.0',
'checksum' => 'tdQEXD9Gb6kf4sxqvnkjKhpXzfEE96JucW4KHieJ33g=',
'created_at' => '2016-05-24T00:00:00.000Z',
'created_at' => '2016-05-24 00:00:00',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is closer but still not exactly what the current format is.
Currently I'm seeing: 2016-05-24 00:00:00 +0000

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

@dwradcliffe dwradcliffe merged commit 86062c0 into rubygems:master Jun 1, 2016
@dwradcliffe dwradcliffe temporarily deployed to staging June 1, 2016 02:35 Inactive
@dwradcliffe dwradcliffe temporarily deployed to production June 1, 2016 02:58 Inactive
@sonalkr132 sonalkr132 deleted the dep_fixes branch May 20, 2017 10:08
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