10.10 milestone name corrupted in JS: 10.1

Bug #581748 reported by Matthew Revell
86
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Launchpad itself
In Progress
Low
Colin Watson
lazr.restful
Triaged
High
Unassigned

Bug Description

Steps to reproduce:

1. In a series of a Launchpad sub-project (e.g. malone) create a milestone named 10.10.
2. Notice the error message "Could not retrieve milestone 10.10" in the Milestones and Releases table.
3. Refresh and the error becomes a link to a new 10.1 milestone, rather than 10.10.

See screen shot.

Related branches

Revision history for this message
Matthew Revell (matthew.revell) wrote :
Revision history for this message
Curtis Hovey (sinzui) wrote :

Looks like the trailing '0' is lost between ajax and the form. The milestone is created as 10.1, which causes the error. The user can then rename the milestone. It is possible for this problem to create another error is the x.1 milestone already exists.

Changed in launchpad-registry:
importance: Undecided → Low
status: New → Triaged
milestone: none → series-future
Revision history for this message
Curtis Hovey (sinzui) wrote :

The problem is type conversion. Code names are strings, "10.10" is a string, but JS thinks it is a float, so it drops the 0.
maybe milestoneoverlay.js can do the string concatenation hack to ensure version is alwaysa string
    code_name: data['field.code_name'][0],
should be
    code_name: '' + data['field.code_name'][0],

Curtis Hovey (sinzui)
summary: - Can't create 10.10 milestone for Launchpad sub
+ 10.10 milestone name corrupted in JS: 10.1
tags: added: javascript
Curtis Hovey (sinzui)
tags: added: milestones
Revision history for this message
Barry Warsaw (barry) wrote :

It's kind of icky, but I guess we'll just have to skip X.10 version numbers. I suppose this affects all X.Y0 versions.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

FYI, I believe I worked around this issue by adding quotes when I entered the version number.

Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 581748] Re: 10.10 milestone name corrupted in JS: 10.1

On Oct 09, 2013, at 03:53 PM, Marc Deslauriers wrote:

>FYI, I believe I worked around this issue by adding quotes when I
>entered the version number.

Indeed!

You'll get an error saying `Couldn't retrieve milestone "1.10"` but if you
refresh the page, the milestone sans quotes will be there just fine.

Thanks for the workaround.

Revision history for this message
Curtis Hovey (sinzui) wrote :

I had contemplated an alternate workaround on the backend. The script
will append "~~" and the backend always strips ~~.

Revision history for this message
William Grant (wgrant) wrote :

Or you can just middle-click the "Create milestone" link to navigate to the non-AJAX form, which isn't affected by the JS bug.

Revision history for this message
William Grant (wgrant) wrote :

The misbehaviour is caused by lazr.restful's SimpleFieldMarshaller.marshall_from_request. It attempts to decode the form value as JSON, using it as a string only if the parsing fails. We probably want to avoid that decoding if we know we're looking for a string and not some other kind of object.

Changed in lazr.restful:
importance: Undecided → High
status: New → Triaged
Colin Watson (cjwatson)
Changed in launchpad:
assignee: nobody → Colin Watson (cjwatson)
status: Triaged → In Progress
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
Colin Watson (cjwatson)
tags: added: qa-ok
removed: qa-needstesting
Colin Watson (cjwatson)
Changed in launchpad:
status: Fix Committed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

This had to be rolled back a couple of times due to breaking other bits of JS and has now been reverted from trunk, so we'll need to fix those up and QA more thoroughly before re-landing this.

Changed in launchpad:
status: Fix Released → In Progress
Revision history for this message
Colin Watson (cjwatson) wrote :

It's been a while, but I think specifically what broke was previewdiff_id. There may be others.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.