{"action":"created","comment":{"url":"https://api.github.com/repos/GPII/universal/pulls/comments/38740456","id":38740456,"diff_hunk":"@@ -277,28 +309,59 @@ var gpii = fluid.registerNamespace(\"gpii\");\n     };\n \n     /** Invoked on both \"start\" and \"update\" phases - in addition to forwarding to gpii.lifecycleManager.executeActions,\n-     * it ensures that the session state snapshot is updated with any results and deletes the \"start\" action set to\n-     * ensure this is executed just once (bug here)\n-     * @param toSnapshot {Object} is the structure which will be modified to form the snapshot record (aka. originalSettings) and stashed in sessionState\n-     * @param solutionRecord {Object} is not modified and consists of the original transformer return (doesn't really appear necessary)\n-     * @param isUpdate {boolean} indicates whether we're doing an update - in which case the originalSettings should not be written based on snapshot\n+     * it is responsible for saving the settings that are being set (when the saveSnapshot is true) and storing\n+     * the list of applied solutions to the sessionState\n+     *\n+     * @param solutionId {String} the ID of the solution\n+     * @param solutionRecord {Object} a solution record with settings that are to be applied to the system\n+     * @param sessionState {Object} the object holding the state of the system\n+     * @param lifecycleBlockKeys {Array} Array of ordered strings denoting which lifecycle blocks to run (usually \"configure\", \"start\" and/or \"update\")\n+     * @param saveSnapshot {boolean} indicates whether a snapshot of the original settings should be taken\n+     *     before the new settings are written\n      * @return {Promise} The same promise yielded by executeActions - the stateful construction of the session state is tacked onto this promise\n      * as a side-effect\n      */\n-    gpii.lifecycleManager.applySolution = function (that, toSnapshot, solutionId, solutionRecord, actions, sessionState, isUpdate) {\n-        var promise = that.executeActions(solutionId, solutionRecord.settingsHandlers, actions, sessionState);\n-        sessionState.appliedSolutions = {};\n-        promise.then(function (snapshot) {\n-            // always store the currently applied solutions\n-            sessionState.appliedSolutions[solutionId] = solutionRecord;\n-\n-            if (!isUpdate) {\n-                // store original settings\n-                toSnapshot.settingsHandlers = snapshot;\n+    gpii.lifecycleManager.applySolution = function (that, solutionId, solutionRecord, sessionState, lifecycleBlockKeys, saveSnapshot) {\n+        var promises = [];\n+        fluid.each(lifecycleBlockKeys, function (key) {\n+            promises.push(that.executeActions(solutionId, solutionRecord, sessionState, key));\n+        });\n+        var promiseSequence = fluid.promise.sequence(promises);\n+        // snapshots is an array of snapshotted settingshandler results (one for each lifecycle action block)\n+        promiseSequence.then(function (snapshots) {\n+            if (saveSnapshot) {\n+                var toSnapshot = fluid.copy(solutionRecord);\n+                toSnapshot.settingsHandlers = {};\n+                fluid.each(snapshots, function (snapshot) {\n+                    if (snapshot !== undefined) { // can be removed once everything is settingsHandlers (GPII-1235)\n+                        fluid.each(snapshot, function (handlerBlock, blockKey) {\n+                            toSnapshot.settingsHandlers[blockKey] = handlerBlock;\n+                        });\n+                    }\n+                });\n                 sessionState.originalSettings[solutionId] = toSnapshot;\n             }\n         });\n-        return promise;\n+        return promiseSequence;\n+    };\n+\n+    /**\n+     * Invoked on \"stop\" phase. Will run the relevant entries via the executeActions function.\n+     * The expected outcome is that solution should be restored to it's original state","path":"gpii/node_modules/lifecycleManager/src/LifecycleManager.js","position":224,"original_position":224,"commit_id":"4afe66a5a2383a5ae479f27a348d1005da04fdc0","original_commit_id":"4afe66a5a2383a5ae479f27a348d1005da04fdc0","user":{"login":"amb26","id":561418,"avatar_url":"https://avatars.githubusercontent.com/u/561418?v=3","gravatar_id":"","url":"https://api.github.com/users/amb26","html_url":"https://github.com/amb26","followers_url":"https://api.github.com/users/amb26/followers","following_url":"https://api.github.com/users/amb26/following{/other_user}","gists_url":"https://api.github.com/users/amb26/gists{/gist_id}","starred_url":"https://api.github.com/users/amb26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amb26/subscriptions","organizations_url":"https://api.github.com/users/amb26/orgs","repos_url":"https://api.github.com/users/amb26/repos","events_url":"https://api.github.com/users/amb26/events{/privacy}","received_events_url":"https://api.github.com/users/amb26/received_events","type":"User","site_admin":false},"body":"typo its","created_at":"2015-09-04T10:49:27Z","updated_at":"2015-09-04T10:49:27Z","html_url":"https://github.com/GPII/universal/pull/376#discussion_r38740456","pull_request_url":"https://api.github.com/repos/GPII/universal/pulls/376","_links":{"self":{"href":"https://api.github.com/repos/GPII/universal/pulls/comments/38740456"},"html":{"href":"https://github.com/GPII/universal/pull/376#discussion_r38740456"},"pull_request":{"href":"https://api.github.com/repos/GPII/universal/pulls/376"}}},"pull_request":{"url":"https://api.github.com/repos/GPII/universal/pulls/376","id":39229748,"html_url":"https://github.com/GPII/universal/pull/376","diff_url":"https://github.com/GPII/universal/pull/376.diff","patch_url":"https://github.com/GPII/universal/pull/376.patch","issue_url":"https://api.github.com/repos/GPII/universal/issues/376","number":376,"state":"open","locked":false,"title":"GPII-1107 & GPII-1191: Solution registry format updated","user":{"login":"kaspermarkus","id":167427,"avatar_url":"https://avatars.githubusercontent.com/u/167427?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspermarkus","html_url":"https://github.com/kaspermarkus","followers_url":"https://api.github.com/users/kaspermarkus/followers","following_url":"https://api.github.com/users/kaspermarkus/following{/other_user}","gists_url":"https://api.github.com/users/kaspermarkus/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspermarkus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspermarkus/subscriptions","organizations_url":"https://api.github.com/users/kaspermarkus/orgs","repos_url":"https://api.github.com/users/kaspermarkus/repos","events_url":"https://api.github.com/users/kaspermarkus/events{/privacy}","received_events_url":"https://api.github.com/users/kaspermarkus/received_events","type":"User","site_admin":false},"body":"Fixed the solutions registry format. Still needs a few tests, but most is ready and could use a sanity check/review","created_at":"2015-07-06T00:37:56Z","updated_at":"2015-09-04T10:49:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41e116b4c90ee27c51fa43d0e7dc59106f5ce167","assignee":{"login":"amb26","id":561418,"avatar_url":"https://avatars.githubusercontent.com/u/561418?v=3","gravatar_id":"","url":"https://api.github.com/users/amb26","html_url":"https://github.com/amb26","followers_url":"https://api.github.com/users/amb26/followers","following_url":"https://api.github.com/users/amb26/following{/other_user}","gists_url":"https://api.github.com/users/amb26/gists{/gist_id}","starred_url":"https://api.github.com/users/amb26/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amb26/subscriptions","organizations_url":"https://api.github.com/users/amb26/orgs","repos_url":"https://api.github.com/users/amb26/repos","events_url":"https://api.github.com/users/amb26/events{/privacy}","received_events_url":"https://api.github.com/users/amb26/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GPII/universal/pulls/376/commits","review_comments_url":"https://api.github.com/repos/GPII/universal/pulls/376/comments","review_comment_url":"https://api.github.com/repos/GPII/universal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GPII/universal/issues/376/comments","statuses_url":"https://api.github.com/repos/GPII/universal/statuses/4afe66a5a2383a5ae479f27a348d1005da04fdc0","head":{"label":"kaspermarkus:GPII-1107","ref":"GPII-1107","sha":"4afe66a5a2383a5ae479f27a348d1005da04fdc0","user":{"login":"kaspermarkus","id":167427,"avatar_url":"https://avatars.githubusercontent.com/u/167427?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspermarkus","html_url":"https://github.com/kaspermarkus","followers_url":"https://api.github.com/users/kaspermarkus/followers","following_url":"https://api.github.com/users/kaspermarkus/following{/other_user}","gists_url":"https://api.github.com/users/kaspermarkus/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspermarkus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspermarkus/subscriptions","organizations_url":"https://api.github.com/users/kaspermarkus/orgs","repos_url":"https://api.github.com/users/kaspermarkus/repos","events_url":"https://api.github.com/users/kaspermarkus/events{/privacy}","received_events_url":"https://api.github.com/users/kaspermarkus/received_events","type":"User","site_admin":false},"repo":{"id":3630398,"name":"universal","full_name":"kaspermarkus/universal","owner":{"login":"kaspermarkus","id":167427,"avatar_url":"https://avatars.githubusercontent.com/u/167427?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspermarkus","html_url":"https://github.com/kaspermarkus","followers_url":"https://api.github.com/users/kaspermarkus/followers","following_url":"https://api.github.com/users/kaspermarkus/following{/other_user}","gists_url":"https://api.github.com/users/kaspermarkus/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspermarkus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspermarkus/subscriptions","organizations_url":"https://api.github.com/users/kaspermarkus/orgs","repos_url":"https://api.github.com/users/kaspermarkus/repos","events_url":"https://api.github.com/users/kaspermarkus/events{/privacy}","received_events_url":"https://api.github.com/users/kaspermarkus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaspermarkus/universal","description":"Cross platform, core components of the GPII personalization infrastructure","fork":true,"url":"https://api.github.com/repos/kaspermarkus/universal","forks_url":"https://api.github.com/repos/kaspermarkus/universal/forks","keys_url":"https://api.github.com/repos/kaspermarkus/universal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaspermarkus/universal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaspermarkus/universal/teams","hooks_url":"https://api.github.com/repos/kaspermarkus/universal/hooks","issue_events_url":"https://api.github.com/repos/kaspermarkus/universal/issues/events{/number}","events_url":"https://api.github.com/repos/kaspermarkus/universal/events","assignees_url":"https://api.github.com/repos/kaspermarkus/universal/assignees{/user}","branches_url":"https://api.github.com/repos/kaspermarkus/universal/branches{/branch}","tags_url":"https://api.github.com/repos/kaspermarkus/universal/tags","blobs_url":"https://api.github.com/repos/kaspermarkus/universal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaspermarkus/universal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaspermarkus/universal/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaspermarkus/universal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaspermarkus/universal/statuses/{sha}","languages_url":"https://api.github.com/repos/kaspermarkus/universal/languages","stargazers_url":"https://api.github.com/repos/kaspermarkus/universal/stargazers","contributors_url":"https://api.github.com/repos/kaspermarkus/universal/contributors","subscribers_url":"https://api.github.com/repos/kaspermarkus/universal/subscribers","subscription_url":"https://api.github.com/repos/kaspermarkus/universal/subscription","commits_url":"https://api.github.com/repos/kaspermarkus/universal/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaspermarkus/universal/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaspermarkus/universal/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaspermarkus/universal/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaspermarkus/universal/contents/{+path}","compare_url":"https://api.github.com/repos/kaspermarkus/universal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaspermarkus/universal/merges","archive_url":"https://api.github.com/repos/kaspermarkus/universal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaspermarkus/universal/downloads","issues_url":"https://api.github.com/repos/kaspermarkus/universal/issues{/number}","pulls_url":"https://api.github.com/repos/kaspermarkus/universal/pulls{/number}","milestones_url":"https://api.github.com/repos/kaspermarkus/universal/milestones{/number}","notifications_url":"https://api.github.com/repos/kaspermarkus/universal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaspermarkus/universal/labels{/name}","releases_url":"https://api.github.com/repos/kaspermarkus/universal/releases{/id}","created_at":"2012-03-05T19:15:52Z","updated_at":"2015-04-15T09:45:40Z","pushed_at":"2015-09-01T13:41:26Z","git_url":"git://github.com/kaspermarkus/universal.git","ssh_url":"git@github.com:kaspermarkus/universal.git","clone_url":"https://github.com/kaspermarkus/universal.git","svn_url":"https://github.com/kaspermarkus/universal","homepage":"gpii.net","size":6372,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"GPII:master","ref":"master","sha":"ff31f2dc17b81dda7dd351ffb37675a2796a07d0","user":{"login":"GPII","id":1343050,"avatar_url":"https://avatars.githubusercontent.com/u/1343050?v=3","gravatar_id":"","url":"https://api.github.com/users/GPII","html_url":"https://github.com/GPII","followers_url":"https://api.github.com/users/GPII/followers","following_url":"https://api.github.com/users/GPII/following{/other_user}","gists_url":"https://api.github.com/users/GPII/gists{/gist_id}","starred_url":"https://api.github.com/users/GPII/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GPII/subscriptions","organizations_url":"https://api.github.com/users/GPII/orgs","repos_url":"https://api.github.com/users/GPII/repos","events_url":"https://api.github.com/users/GPII/events{/privacy}","received_events_url":"https://api.github.com/users/GPII/received_events","type":"Organization","site_admin":false},"repo":{"id":3623720,"name":"universal","full_name":"GPII/universal","owner":{"login":"GPII","id":1343050,"avatar_url":"https://avatars.githubusercontent.com/u/1343050?v=3","gravatar_id":"","url":"https://api.github.com/users/GPII","html_url":"https://github.com/GPII","followers_url":"https://api.github.com/users/GPII/followers","following_url":"https://api.github.com/users/GPII/following{/other_user}","gists_url":"https://api.github.com/users/GPII/gists{/gist_id}","starred_url":"https://api.github.com/users/GPII/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GPII/subscriptions","organizations_url":"https://api.github.com/users/GPII/orgs","repos_url":"https://api.github.com/users/GPII/repos","events_url":"https://api.github.com/users/GPII/events{/privacy}","received_events_url":"https://api.github.com/users/GPII/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GPII/universal","description":"Cross platform, core components of the GPII personalization infrastructure","fork":false,"url":"https://api.github.com/repos/GPII/universal","forks_url":"https://api.github.com/repos/GPII/universal/forks","keys_url":"https://api.github.com/repos/GPII/universal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GPII/universal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GPII/universal/teams","hooks_url":"https://api.github.com/repos/GPII/universal/hooks","issue_events_url":"https://api.github.com/repos/GPII/universal/issues/events{/number}","events_url":"https://api.github.com/repos/GPII/universal/events","assignees_url":"https://api.github.com/repos/GPII/universal/assignees{/user}","branches_url":"https://api.github.com/repos/GPII/universal/branches{/branch}","tags_url":"https://api.github.com/repos/GPII/universal/tags","blobs_url":"https://api.github.com/repos/GPII/universal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GPII/universal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GPII/universal/git/refs{/sha}","trees_url":"https://api.github.com/repos/GPII/universal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GPII/universal/statuses/{sha}","languages_url":"https://api.github.com/repos/GPII/universal/languages","stargazers_url":"https://api.github.com/repos/GPII/universal/stargazers","contributors_url":"https://api.github.com/repos/GPII/universal/contributors","subscribers_url":"https://api.github.com/repos/GPII/universal/subscribers","subscription_url":"https://api.github.com/repos/GPII/universal/subscription","commits_url":"https://api.github.com/repos/GPII/universal/commits{/sha}","git_commits_url":"https://api.github.com/repos/GPII/universal/git/commits{/sha}","comments_url":"https://api.github.com/repos/GPII/universal/comments{/number}","issue_comment_url":"https://api.github.com/repos/GPII/universal/issues/comments{/number}","contents_url":"https://api.github.com/repos/GPII/universal/contents/{+path}","compare_url":"https://api.github.com/repos/GPII/universal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GPII/universal/merges","archive_url":"https://api.github.com/repos/GPII/universal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GPII/universal/downloads","issues_url":"https://api.github.com/repos/GPII/universal/issues{/number}","pulls_url":"https://api.github.com/repos/GPII/universal/pulls{/number}","milestones_url":"https://api.github.com/repos/GPII/universal/milestones{/number}","notifications_url":"https://api.github.com/repos/GPII/universal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GPII/universal/labels{/name}","releases_url":"https://api.github.com/repos/GPII/universal/releases{/id}","created_at":"2012-03-05T04:01:44Z","updated_at":"2015-06-03T18:28:28Z","pushed_at":"2015-09-03T11:45:58Z","git_url":"git://github.com/GPII/universal.git","ssh_url":"git@github.com:GPII/universal.git","clone_url":"https://github.com/GPII/universal.git","svn_url":"https://github.com/GPII/universal","homepage":"gpii.net","size":94504,"stargazers_count":21,"watchers_count":21,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":32,"forks":48,"open_issues":32,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GPII/universal/pulls/376"},"html":{"href":"https://github.com/GPII/universal/pull/376"},"issue":{"href":"https://api.github.com/repos/GPII/universal/issues/376"},"comments":{"href":"https://api.github.com/repos/GPII/universal/issues/376/comments"},"review_comments":{"href":"https://api.github.com/repos/GPII/universal/pulls/376/comments"},"review_comment":{"href":"https://api.github.com/repos/GPII/universal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GPII/universal/pulls/376/commits"},"statuses":{"href":"https://api.github.com/repos/GPII/universal/statuses/4afe66a5a2383a5ae479f27a348d1005da04fdc0"}}}}