•  
     
    story #20111 change features priority
Summary
Empty
change features priority

I know what should be done first

At this stage, there is only re-order with drag'n drop. Reorder with "arrow-up" and "arrow-down" (like in Planning view) is not supported.

I can reorder:

  • In backlog
  • Inside a Program Increment
  • while assigning a Feature to a Program Increment
  • while moving a Feature from a Program Increment to another Program Increment
  • while moving back a Feature from a Program Increment to Backlog

REST routes to be added, they will follow the same pattern than the route used in agiledashboard The PATCH route depends on prioritization permission

We need to update the route GET projects/{id}/program_backlog and GET program_increment/{id}/content to make them return ordered collections

Changing priority of an element will be done with PATCH /projects/{id}/program_backlog will be updated

Another new REST route will be added: PATCH program_increment/{id}/content. It will also be called when planning features in a Program Increment and will replace the existing call to PUT artifacts/{id}

following payload will be supported :

{
   "order":{
      "ids":[
         123
      ],
      "direction":"before",
      "compared_to":456
   },
   "add":[
      {
         "id":123
      }
   ]
}

123 is added to PI it is added before feature 456

Planning and un-planning of features in Program Increments

Given a Feature already planned in PI A, if I move it by planning it in PI B, the REST route will have to identify that it is planned in PI A and un-plan it from PI A before planning it in PI B.

For such un-planning cases, the following rule must be respected:

If at least one User Story linked from the Feature is already planned in an Iteration (e.g. a Sprint) in one of the Teams, then the Feature can no longer be un-planned. In such a case, the REST route must return an error explaining to the user why the Feature cannot be un-planned.

Existing code does not respect this rule and must be changed to enforce it (instead of allowing Feature un-planning and leaving some User Stories planned).

Multiple drag and drop

"Multiple drag and drop" of features, for example selecting feature 123 and 456 and 789 and dropping them in a PI or reordering them in the top backlog, is not supported. It is not requested and our current drag and drop library does not offer it natively. The REST route technically accepts a list of feature ids to reorder or to plan in a PI in order to be future-proof. But given that "multiple drag and drop" is not supported by the frontend, the REST route will return an error code if more than one feature is given in the payload.

For example:

{"add": [{"id": 123}, {"id": 456}] }

// or

{"order": {"ids": [123, 456],  "direction":"before", "compared_to": 789 } }

The two payloads above are technically correct but will be rejected with an error code in order to simplify the backend logic, given that the frontend is not capable of producing such payloads yet anyway.

Empty
Empty
Status
Empty
Done
Development
  • [ ] Does it involves User Interface? 
  • [ ] Are there any mockups?
  • [ ] Are permissions checked?
  • [ ] Does it need Javascript development?
  • [ ] Does it need a forge upgrade bucket?
  • [ ] Does it need to execute things in system events?
  • [ ] Does it impact project creation (templates)?
  • [ ] Is it exploratory?

During the work on this story, we experimented with trying "design reviews". The idea is that instead of writing all the code first and then doing code review once everything is split into classes and objects, we sat down and tried to write a plan of how we would write the code. We wrote it in plain French (as we communicate in French) but I'll translate it here for an example. Please keep in mind that code has changed since then, some classes have been renamed, etc.

Plan of how to implement the REST route to add features in a Program Increment PATCH program_increment/$id/content

  1. Retrieve a PI with the given $id using the interface RetrieveProgramIncrement
  2. Send an error if no PI matching $id exists. Code 404
  3. Send an error if the current user can't see the PI. Code 404
  4. Retrieve the Program of the PI. Code to be written with interface SearchProgram
  5. Send an error if it can't be found. Code 404
  6. Check current user has prioritize permissions with PrioritizeFeaturesPermissionVerifier. Transform returned false into error code 403
  7. If there is more than one feature in the "add" payload, send an error Code 400
  8. Retrieve the feature matching the id in the "add" payload.
    1. send an error (code 400) if the given id does not exist
    2. send an error (code 400) if the given id is not a feature. Check that it matches an artifact whose Tracker can be planned in the Plan linked to the given PI.
    3. send an error (code 400) if the current user can't see the feature.
    4. Retrieve an object FeatureIdentifier with the given id. Code / SQL query to be written
  9. Start an SQL transaction
  10. Search if the Feature is already planned in a PI.
  11. If that is the case:
    1. Search if at least one User Story linked to this Feature has already been planned in an Iteration (in a Team)
    2. If that is the case, send an error code 400
    3. If not, remove the feature from that PI (un-plan it).
  12. Remove the feature from the Top Backlog
  13. Modify the artifact link of the PI to add the given feature. We need to add it to the list of existing artifact links and create a new tracker Changeset. With ArtifactLinkUpdater ? A bit like MilestoneElementMover
  14. End SQL transaction
  15. Test manually that the new changeset will trigger the hook to replicate planification (plan User Stories linked to the Feature) in Mirrored Milestones.

This plan captures roughly what has been done just to "add" a feature to a Program Increment. Sharing it with other developers helped raise missing points, for example we had first forgotten to check if the Feature was visible for the current user. It also provided opportunity for other developers to point out existing code for certain bullet points, thus avoiding to write them a second time.

Details
#20111
Manuel Vacelet (vaceletm)
2021-05-20 15:53
2021-03-19 15:51
3798

References
Referencing story #20111

Git commit

tuleap/tuleap/stable

Improve PATCH REST route project/$id/program_backlog to move feature from PI to backlog 35ebfe83c2
Feature are removing when it is moving in the same PI cedf037396
Improve REST PATCH project/$id/program_backlog to reorder program backlog elements d17c748bb3
Order features in PI content by their rank d5e3d62c0e
Reorder elements in program backlog f39865471e
Refacto - ProgramManagement/actions.ts will become a catchall file 7342aa31be
FeatureRankOrdrer should be in adapter namespace 55f8af916f
Order features from PI to backlog 852d840764
Cannot unplanned feature with planned US in Sprints f1c6f8f0af
Base of the PATCH PI REST route 1ccc2d717d
Write an ADR to explain the vocabulary in Program Management Plugin 6e180ac0b3
Verify Add payload for patch PI REST route 584ab468c0
PATCH /projects/{id}/program_backlog should only accept a single feature b50ef3ace3
Extract visible feature check 5fa0cff684
Extract Interface before UserStoryLinkedToFeatureChecker 0bc93ba489
Extract FeatureRemovalProcessor de33d2dd22
Verify feature is visible when building FeatureIdentifier 41319983ea
Refacto: Import builder in object class ProgramIncrementTracker 8cba824edc
Refacto: move builder to Team 8fe2dd95d9
Reorder a feature in a PI with PATCH route program_increment/$id/content 91e9637e97
Rename PlanFeaturesInProgramIncrement c2b43b01f6
Refacto: Move builder to ProgramPlannableTracker f61026cde8
Add a feature in a Program Increment de134ebcc0
Refacto: Move builder to ProgramUGroup e86fcb1499
RestException should not be thrown in domain b1aa586268
Refacto: Move builder to Planning 6a29cd57fd
Refacto: move check to ContentChange d2529aea51
Refacto: Move builder to PlannedProgramIncrement a7295e76a8
Use PATCH program_increment/$id/content to Reorganize features in PI 102747e0bc
Call PATCH program_increment/$id/content route instead of PUT artifact links f9bc6c6aee
Add an Exception wrapper arround FeaturesExceptions c2f04d2661
Reorganize feature with planned element only in same PI b1ae67bfda
Refacto: have a dedicated namespace for domain objects 7028c90654
Remove data-artifacts-link-id and data-features-id 9ba6622c3f
Refacto: Move builder to Program 2d3b9d300b
Refacto: Move builder to ProgramForManagement 834b3b2fe7
Refacto: Move builder of ToBeCreatedProgram 137390aadc
In ProgramIdentifier add check that user can access to the program 6f7ebcc76b
Refacto: move builder to FeaturePlanChange 7fb7f755f0
Remove unneeded artifact link field build 2d0d92b5dd
Refacto: UserCanPrioritize instead of plain \PFUser 6f1b9f5c60
Refacto: Add named constructors (like isVisible() / isNotVisible()) to Stub classes 64d4049a63
Move Exception for Adapter to Domain 7a6470b2d9
Remove buildExistingProgramProject, buildExistingProgramProjectForManagement and buildNewProgramProject methods 2781b84c32
Gain performance when planning Feature in PI 81b0a5abb5
Display loading state when planing feature in PI 9f12aa9123

Follow-ups

User avatar
Joris MASSON (jmasson)2021-04-29 15:50
  • Technical informations
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-21 11:12
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-14 17:57
last edited by: Joris MASSON (jmasson) 2021-04-14 17:57

Adjust again the rules about un-planning. Existing code and integration tests are wrong and will have to be changed.


  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-14 16:14

Adjust the rule about un-planning a Feature from a PI. The existing code (and integration tests) have this behaviour.


  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-14 15:44
last edited by: Joris MASSON (jmasson) 2021-04-14 15:44

Removed the "remove_from": id part of the payload. After discussion, it is useless to keep it as Program Management plugin will enforce that the Feature is un-planned from other Program Increments. Whether it is present or not, the backend will un-plan from other PIs, which makes it useless information.

Also added details about this automatic un-planning and the rules that govern un-planning a Feature from a PI (regarding its linked User Stories).


  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-14 10:48

Actually there is no "s" in the existing GET route for program_increment/{id}/content...


  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-14 09:43
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
Joris MASSON (jmasson)2021-04-14 09:42
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes