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

Data can be pushed to GitHub without creating a Commit record. #85

Open
alloy opened this issue May 23, 2014 · 3 comments
Open

Data can be pushed to GitHub without creating a Commit record. #85

alloy opened this issue May 23, 2014 · 3 comments
Labels
Milestone

Comments

@alloy
Copy link
Member

alloy commented May 23, 2014

There’s a bug that makes it that a POST to github actually succeeds, but no Commit record is ever created. Looking at PodVersion#push! it would seem that the this might occur because response.success? is returning false when it actually did succeeded.

Because the user thinks the push failed, they might try again and run into an issue with the UPDATE variant of GitHub’s contents API (opposed to CREATE) requiring a SHA. This returns a 422 to us and we return a 500 to the user.

An example, which I have since fixed manually:

irb(main):001:0> Pod::TrunkApp::Pod.find(:name => 'DB5-Live')
I, [2014-05-23T21:25:24.179119 #2]  INFO -- : (0.004418s) SELECT * FROM "pods" WHERE ("name" = 'DB5-Live') LIMIT 1
=> #<Pod::TrunkApp::Pod @values={:id=>5066, :name=>"DB5-Live", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil}>
irb(main):002:0> p = _
=> #<Pod::TrunkApp::Pod @values={:id=>5066, :name=>"DB5-Live", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil}>
irb(main):003:0> p.versions
I, [2014-05-23T21:25:30.309944 #2]  INFO -- : (0.003187s) SELECT * FROM "pod_versions" WHERE ("pod_versions"."pod_id" = 5066)
=> [#<Pod::TrunkApp::PodVersion @values={:id=>15510, :name=>"0.1.4", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil, :pod_id=>5066}>]
irb(main):004:0> p.versions.first
=> #<Pod::TrunkApp::PodVersion @values={:id=>15510, :name=>"0.1.4", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil, :pod_id=>5066}>
irb(main):005:0> v = _
=> #<Pod::TrunkApp::PodVersion @values={:id=>15510, :name=>"0.1.4", :created_at=>2014-05-23 17:16:04 UTC, :updated_at=>nil, :pod_id=>5066}>
irb(main):006:0> v.commits
I, [2014-05-23T21:26:33.659066 #2]  INFO -- : (0.002274s) SELECT * FROM "commits" WHERE ("commits"."pod_version_id" = 15510) ORDER BY ("updated_at", "created_at") ASC
=> []
@alloy alloy added this to the Post-Launch milestone May 23, 2014
@alloy alloy added the bug label May 23, 2014
@alloy
Copy link
Member Author

alloy commented May 23, 2014

A second thing to consider is that the GitHub commit web hook POST, which is meant to check and fix the integrity of the DB, did not do its job.

@floere
Copy link
Member

floere commented May 24, 2014

Good point. So there was a new version pushed and the GH hook did not add the commit for it?

We should definitely add a test case for this scenario!

@alloy
Copy link
Member Author

alloy commented May 25, 2014

Yep, I still don’t understand how that could happen, though.

It might make sense to start by adding a search field to /manage/log_messages so that we can search for all the pushes that have had this issue. E.g. search for status code ‘422’.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants