jsmestad / pivotal-tracker

Ruby gem that provides an AR-style interface for the Pivotal Tracker API
http://github.com/jsmestad/pivotal-tracker
MIT License
352 stars 184 forks source link

Story parsing broken between 0.5.6 and 0.5.10 #67

Open forest opened 11 years ago

forest commented 11 years ago
PivotalTracker::Client.token = "<token>"
project = PivotalTracker::Project.find(29317) # this is a public project
done = PivotalTracker::Iteration.done(project, { offset: -10 })
iteration = done[0]
stories = iteration.stories
story = stories[0]
story.inspect

#<PivotalTracker::Story:0x007f916dfed138 @id=nil, @url=nil, @created_at=nil, @accepted_at=nil, @project_id=nil, @name=nil, @description=nil, @story_type=nil, @estimate=nil, @current_state=nil, @requested_by=nil, @owned_by=nil, @labels=nil, @jira_id=nil, @jira_url=nil, @other_id=nil, @integration_id=nil, @deadline=nil, @attachments=[#<PivotalTracker::Attachment:0x007f916dc72b70 @id=10617349, @filename=\"BadgeAchRecord.xls\", @description=\"\", @uploaded_by=\"Dave Christiansen\", @uploaded_at=Sun, 05 Aug 2012 18:07:34 -0700, @url=\"https://www.pivotaltracker.com/resource/download/10617349\", @status=nil>, #<PivotalTracker::Attachment:0x007f916e4afc20 @id=10617347, @filename=\"Badge_Achievement_Record.docx\", @description=\"\", @uploaded_by=\"Dave Christiansen\", @uploaded_at=Sun, 05 Aug 2012 18:07:30 -0700, @url=\"https://www.pivotaltracker.com/resource/download/10617347\", @status=nil>, #<PivotalTracker::Attachment:0x007f916da8f678 @id=11837889, @filename=\"TroopTrack.com_-_Scout_Troop_Management_for_the_21st_Century-1.png\", @description=\"\", @uploaded_by=\"Dave Christiansen\", @uploaded_at=Wed, 19 Sep 2012 11:47:11 -0700, @url=\"https://www.pivotaltracker.com/resource/download/11837889\", @status=nil>, #<PivotalTracker::Attachment:0x007f916d80a218 @id=11737533, @filename=\"TroopTrack.com_-_Scout_Troop_Management_for_the_21st_Century.png\", @description=\"\", @uploaded_by=\"Dave Christiansen\", @uploaded_at=Sun, 16 Sep 2012 19:04:37 -0700, @url=\"https://www.pivotaltracker.com/resource/download/11737533\", @status=nil>]>

This same code works just fine in 0.5.6. The story should be:

#<PivotalTracker::Story:0x007fb160977d18 @id=32808269, @url=\"http://www.pivotaltracker.com/story/show/32808269\", @created_at=Sun, 15 Jul 2012 16:56:27 -0700, @accepted_at=Mon, 16 Jul 2012 12:12:32 -0700, @project_id=29317, @name=\"Inactive members in various lists\", @description=\"\", @story_type=\"bug\", @estimate=nil, @current_state=\"accepted\", @requested_by=\"Dave Christiansen\", @owned_by=\"Dave Christiansen\", @labels=nil, @jira_id=nil, @jira_url=nil, @other_id=nil, @integration_id=nil, @deadline=nil, @attachments=[]>
JeanMertz commented 11 years ago

I'm having the same issue. It seems tags v0.5.4 to v0.5.6 are missing. When I do a compare view from 0.5.3 to master I can't really see anything out of the ordinary.

edit

I just looked into this some more. It seems the problem starts at version v0.5.8, again, looking at the compare view, the only thing I see that could be causing this is the bundle update that happened between 0.5.8 and 0.5.10. I was unable to test 0.5.9, it failed to load for me.

jasonnoble commented 11 years ago

Can you get the story by doing the following:

PivotalTracker::Client.token = "<token>"
project = PivotalTracker::Project.find(29317) # this is a public project
project.stories.find(32808269)

It could be that Pivotal changed how the Iteration.done API call returns data.

I worked on this this weekend by working on updating our Fakeweb to use VCR instead of StaleFish. It's a work in progress, but hopefully I can get some time to look at it next weekend.

You guys should be able to use an earlier version (0.5.6 or 0.5.8), as there were no urgent changes between those versions and 0.5.10.

sbleon commented 11 years ago

I've got the same problem. Project.find returns the story correctly, but Iteration.current.stories returns a story with empty attributes.

sbleon commented 11 years ago

The most significant changes between 0.5.8 and 0.5.10 are in Gemfile.lock. It switched from using happymapper to using nokogiri-happymapper. This is not showing up in the compare view (!?) but if you look at the Gemfile.lock in 0.5.8 and in master you can see the difference.

I'm not 100% sure this is the issue, but it seems like something work investigating.

sbleon commented 11 years ago

Failing spec added here: https://github.com/sbleon/pivotal-tracker/blob/iteration_stories/spec/pivotal-tracker/iteration_spec.rb#L29

I'm switching back to 0.5.8 for now.

jsmestad commented 11 years ago

Going to take a look at this today. Will keep you updated if I can figure out what happened.

jasonnoble commented 11 years ago

@jsmestad Some background, I think the 0.5.9 version was a failed attempt to add jruby support, and the nokogiri-happymapper change was not properly reverted.

JunichiIto commented 11 years ago

I'm having the same problem. When will it be fixed??

sbleon commented 11 years ago

It will get fixed when a motivated user of the gem decides to fix it :-) . 0.5.8 works well enough for my purposes at the moment.

If I were going to tackle this, I'd probably start by looking at the specs to see which features were introduced between 0.5.8 (which works as far as I can tell) and 0.5.10. If there are useful features, I'd re-implement/backport/cherry-pick them into a new branch based on 0.5.8.

Once that was done, I'd submit a pull request and encourage @jsmestad to make a new release and yank 0.5.10 (removing it from rubygems.org).

On Wed, Mar 27, 2013 at 4:06 AM, Junichi Ito notifications@github.comwrote:

I'm having the same problem. When will it be fixed??

— Reply to this email directly or view it on GitHubhttps://github.com/jsmestad/pivotal-tracker/issues/67#issuecomment-15509624 .

jsmestad commented 11 years ago

I am open to yanking it down once we get this patch in place :)

Regards,

Justin Smestad

justin.smestad@gmail.com

On Thu, Mar 28, 2013 at 11:27 AM, sbleon notifications@github.com wrote:

It will get fixed when a motivated user of the gem decides to fix it :-) . 0.5.8 works well enough for my purposes at the moment.

If I were going to tackle this, I'd probably start by looking at the specs to see which features were introduced between 0.5.8 (which works as far as I can tell) and 0.5.10. If there are useful features, I'd re-implement/backport/cherry-pick them into a new branch based on 0.5.8.

Once that was done, I'd submit a pull request and encourage @jsmestad to make a new release and yank 0.5.10 (removing it from rubygems.org).

On Wed, Mar 27, 2013 at 4:06 AM, Junichi Ito notifications@github.comwrote:

I'm having the same problem. When will it be fixed??

— Reply to this email directly or view it on GitHub< https://github.com/jsmestad/pivotal-tracker/issues/67#issuecomment-15509624>

.

— Reply to this email directly or view it on GitHubhttps://github.com/jsmestad/pivotal-tracker/issues/67#issuecomment-15602181 .

sbleon commented 11 years ago

The pull request #71 is superceded by #88 and should be closed.

JunichiIto commented 10 years ago

This fix(has_many :stories, Story, :xpath => '//stories') seems to be required for activity.rb

https://github.com/jsmestad/pivotal-tracker/blob/master/lib/pivotal-tracker/activity.rb#L42

Otherwise, stories in activities are all empty.