{"action":"created","comment":{"url":"https://api.github.com/repos/w3c/echidna/pulls/comments/28552721","id":28552721,"diff_hunk":"@@ -2,37 +2,32 @@\n \n console.log('Launching…');\n \n+var exec = require('child_process').exec;\n var meta = require('./package.json');\n var express = require('express');\n var compression = require('compression');\n var bodyParser = require('body-parser');\n-var exec = require('child_process').exec;\n var path = require('path');\n var Fs = require('fs');\n-var Promise = require('promise');\n+var Map = require('immutable').Map;\n var Uuid = require('node-uuid');\n \n-var DocumentDownloader = require('./lib/document-downloader');\n-var History = require('./lib/history');\n-var JsonHttpService = require('./lib/json-http-service');\n-var Publisher = require('./lib/publisher');\n+var Job = require('./lib/job');\n+var Orchestrator = require('./lib/orchestrator');\n+var RequestState = require('./lib/request-state');\n var SpecberusWrapper = require('./functions.js').SpecberusWrapper;\n-var ThirdPartyResourcesChecker = require('./lib/third-party-resources-checker');\n-var TokenChecker = require('./functions.js').TokenChecker;\n \n // Configuration file\n require('./config.js');\n \n // Pseudo-constants:\n var STATUS_STARTED = 'started';","path":"app.js","position":31,"original_position":31,"commit_id":"986283d86e9b67c095453ac2608cebc6daec042b","original_commit_id":"986283d86e9b67c095453ac2608cebc6daec042b","user":{"login":"dontcallmedom","id":216410,"avatar_url":"https://avatars.githubusercontent.com/u/216410?v=3","gravatar_id":"","url":"https://api.github.com/users/dontcallmedom","html_url":"https://github.com/dontcallmedom","followers_url":"https://api.github.com/users/dontcallmedom/followers","following_url":"https://api.github.com/users/dontcallmedom/following{/other_user}","gists_url":"https://api.github.com/users/dontcallmedom/gists{/gist_id}","starred_url":"https://api.github.com/users/dontcallmedom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dontcallmedom/subscriptions","organizations_url":"https://api.github.com/users/dontcallmedom/orgs","repos_url":"https://api.github.com/users/dontcallmedom/repos","events_url":"https://api.github.com/users/dontcallmedom/events{/privacy}","received_events_url":"https://api.github.com/users/dontcallmedom/received_events","type":"User","site_admin":false},"body":"this is brittle (strings redefined across modules); I would make it a \"static\" property of RequestState. (i.e. add RequestState.started = \"started\", etc in lib/request-state.js)","created_at":"2015-04-16T21:42:15Z","updated_at":"2015-04-16T21:42:15Z","html_url":"https://github.com/w3c/echidna/pull/84#discussion_r28552721","pull_request_url":"https://api.github.com/repos/w3c/echidna/pulls/84","_links":{"self":{"href":"https://api.github.com/repos/w3c/echidna/pulls/comments/28552721"},"html":{"href":"https://github.com/w3c/echidna/pull/84#discussion_r28552721"},"pull_request":{"href":"https://api.github.com/repos/w3c/echidna/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/w3c/echidna/pulls/84","id":29328126,"html_url":"https://github.com/w3c/echidna/pull/84","diff_url":"https://github.com/w3c/echidna/pull/84.diff","patch_url":"https://github.com/w3c/echidna/pull/84.patch","issue_url":"https://api.github.com/repos/w3c/echidna/issues/84","number":84,"state":"open","locked":false,"title":"Modular orchestrator","user":{"login":"astorije","id":113730,"avatar_url":"https://avatars.githubusercontent.com/u/113730?v=3","gravatar_id":"","url":"https://api.github.com/users/astorije","html_url":"https://github.com/astorije","followers_url":"https://api.github.com/users/astorije/followers","following_url":"https://api.github.com/users/astorije/following{/other_user}","gists_url":"https://api.github.com/users/astorije/gists{/gist_id}","starred_url":"https://api.github.com/users/astorije/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astorije/subscriptions","organizations_url":"https://api.github.com/users/astorije/orgs","repos_url":"https://api.github.com/users/astorije/repos","events_url":"https://api.github.com/users/astorije/events{/privacy}","received_events_url":"https://api.github.com/users/astorije/received_events","type":"User","site_admin":false},"body":":warning: **READY TO BE REVIEWED BUT NO TESTS YET** :warning:\r\n\r\nOne of the ideas here is that `app.js` should get as little intelligence as possible.\r\n\r\nThe result is an `Orchestrator` that controls the process of publication. This class manipulates a frozen (immutable) state, `RequestState`. Basically, everything the `Orchestrator` does is manipulate a state that is given as an argument of the computation so that the outer state is never modified as a side effect. That way, we avoid unexpected changes.\r\n\r\nTo help with this and abstracting, the code makes use of higher-order functions (functions given as arguments or returned by other functions). This separates concerns because the code for a function makes little assumption on what an argument is supposed to do in addition to its type (for example, if as an argument I give a function `f: Int => Promise.<Int>`, I don't really care what `f` is doing, I only care about what I feed it with and what I get in return). I'll keep improving the code to that extent to favor maintainability.\r\n\r\nIn the end, the main entry point is a recursive function that recurses on a function producing a promise until a predicate is reached. This will probably be hidden under the hood in a near future, but at least in the present state it allows us to do *something* (whatever it is, since it's an higher-order function) every time the request state is changed (that is, every time a step in the process makes it change). At the time of writing this, I am just displaying the new state on the console, but it is also a good place to consider persistence support.","created_at":"2015-02-15T00:56:41Z","updated_at":"2015-04-16T21:42:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c11c253a74277ab6ce61aad6eca25128613b0c28","assignee":{"login":"tripu","id":1016538,"avatar_url":"https://avatars.githubusercontent.com/u/1016538?v=3","gravatar_id":"","url":"https://api.github.com/users/tripu","html_url":"https://github.com/tripu","followers_url":"https://api.github.com/users/tripu/followers","following_url":"https://api.github.com/users/tripu/following{/other_user}","gists_url":"https://api.github.com/users/tripu/gists{/gist_id}","starred_url":"https://api.github.com/users/tripu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tripu/subscriptions","organizations_url":"https://api.github.com/users/tripu/orgs","repos_url":"https://api.github.com/users/tripu/repos","events_url":"https://api.github.com/users/tripu/events{/privacy}","received_events_url":"https://api.github.com/users/tripu/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/w3c/echidna/pulls/84/commits","review_comments_url":"https://api.github.com/repos/w3c/echidna/pulls/84/comments","review_comment_url":"https://api.github.com/repos/w3c/echidna/pulls/comments{/number}","comments_url":"https://api.github.com/repos/w3c/echidna/issues/84/comments","statuses_url":"https://api.github.com/repos/w3c/echidna/statuses/986283d86e9b67c095453ac2608cebc6daec042b","head":{"label":"w3c:astorije/modular-orchestrator","ref":"astorije/modular-orchestrator","sha":"986283d86e9b67c095453ac2608cebc6daec042b","user":{"login":"w3c","id":379216,"avatar_url":"https://avatars.githubusercontent.com/u/379216?v=3","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"repo":{"id":26229585,"name":"echidna","full_name":"w3c/echidna","owner":{"login":"w3c","id":379216,"avatar_url":"https://avatars.githubusercontent.com/u/379216?v=3","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/w3c/echidna","description":"New publication workflow at W3C — main component","fork":false,"url":"https://api.github.com/repos/w3c/echidna","forks_url":"https://api.github.com/repos/w3c/echidna/forks","keys_url":"https://api.github.com/repos/w3c/echidna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/w3c/echidna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/w3c/echidna/teams","hooks_url":"https://api.github.com/repos/w3c/echidna/hooks","issue_events_url":"https://api.github.com/repos/w3c/echidna/issues/events{/number}","events_url":"https://api.github.com/repos/w3c/echidna/events","assignees_url":"https://api.github.com/repos/w3c/echidna/assignees{/user}","branches_url":"https://api.github.com/repos/w3c/echidna/branches{/branch}","tags_url":"https://api.github.com/repos/w3c/echidna/tags","blobs_url":"https://api.github.com/repos/w3c/echidna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/w3c/echidna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/w3c/echidna/git/refs{/sha}","trees_url":"https://api.github.com/repos/w3c/echidna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/w3c/echidna/statuses/{sha}","languages_url":"https://api.github.com/repos/w3c/echidna/languages","stargazers_url":"https://api.github.com/repos/w3c/echidna/stargazers","contributors_url":"https://api.github.com/repos/w3c/echidna/contributors","subscribers_url":"https://api.github.com/repos/w3c/echidna/subscribers","subscription_url":"https://api.github.com/repos/w3c/echidna/subscription","commits_url":"https://api.github.com/repos/w3c/echidna/commits{/sha}","git_commits_url":"https://api.github.com/repos/w3c/echidna/git/commits{/sha}","comments_url":"https://api.github.com/repos/w3c/echidna/comments{/number}","issue_comment_url":"https://api.github.com/repos/w3c/echidna/issues/comments{/number}","contents_url":"https://api.github.com/repos/w3c/echidna/contents/{+path}","compare_url":"https://api.github.com/repos/w3c/echidna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/w3c/echidna/merges","archive_url":"https://api.github.com/repos/w3c/echidna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/w3c/echidna/downloads","issues_url":"https://api.github.com/repos/w3c/echidna/issues{/number}","pulls_url":"https://api.github.com/repos/w3c/echidna/pulls{/number}","milestones_url":"https://api.github.com/repos/w3c/echidna/milestones{/number}","notifications_url":"https://api.github.com/repos/w3c/echidna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/w3c/echidna/labels{/name}","releases_url":"https://api.github.com/repos/w3c/echidna/releases{/id}","created_at":"2014-11-05T16:53:27Z","updated_at":"2015-04-14T14:01:03Z","pushed_at":"2015-04-15T03:49:51Z","git_url":"git://github.com/w3c/echidna.git","ssh_url":"git@github.com:w3c/echidna.git","clone_url":"https://github.com/w3c/echidna.git","svn_url":"https://github.com/w3c/echidna","homepage":"","size":4208,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":27,"forks":4,"open_issues":27,"watchers":4,"default_branch":"master"}},"base":{"label":"w3c:master","ref":"master","sha":"0b496bb5c52c06689c701e2a3810bf6342b4534f","user":{"login":"w3c","id":379216,"avatar_url":"https://avatars.githubusercontent.com/u/379216?v=3","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"repo":{"id":26229585,"name":"echidna","full_name":"w3c/echidna","owner":{"login":"w3c","id":379216,"avatar_url":"https://avatars.githubusercontent.com/u/379216?v=3","gravatar_id":"","url":"https://api.github.com/users/w3c","html_url":"https://github.com/w3c","followers_url":"https://api.github.com/users/w3c/followers","following_url":"https://api.github.com/users/w3c/following{/other_user}","gists_url":"https://api.github.com/users/w3c/gists{/gist_id}","starred_url":"https://api.github.com/users/w3c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/w3c/subscriptions","organizations_url":"https://api.github.com/users/w3c/orgs","repos_url":"https://api.github.com/users/w3c/repos","events_url":"https://api.github.com/users/w3c/events{/privacy}","received_events_url":"https://api.github.com/users/w3c/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/w3c/echidna","description":"New publication workflow at W3C — main component","fork":false,"url":"https://api.github.com/repos/w3c/echidna","forks_url":"https://api.github.com/repos/w3c/echidna/forks","keys_url":"https://api.github.com/repos/w3c/echidna/keys{/key_id}","collaborators_url":"https://api.github.com/repos/w3c/echidna/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/w3c/echidna/teams","hooks_url":"https://api.github.com/repos/w3c/echidna/hooks","issue_events_url":"https://api.github.com/repos/w3c/echidna/issues/events{/number}","events_url":"https://api.github.com/repos/w3c/echidna/events","assignees_url":"https://api.github.com/repos/w3c/echidna/assignees{/user}","branches_url":"https://api.github.com/repos/w3c/echidna/branches{/branch}","tags_url":"https://api.github.com/repos/w3c/echidna/tags","blobs_url":"https://api.github.com/repos/w3c/echidna/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/w3c/echidna/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/w3c/echidna/git/refs{/sha}","trees_url":"https://api.github.com/repos/w3c/echidna/git/trees{/sha}","statuses_url":"https://api.github.com/repos/w3c/echidna/statuses/{sha}","languages_url":"https://api.github.com/repos/w3c/echidna/languages","stargazers_url":"https://api.github.com/repos/w3c/echidna/stargazers","contributors_url":"https://api.github.com/repos/w3c/echidna/contributors","subscribers_url":"https://api.github.com/repos/w3c/echidna/subscribers","subscription_url":"https://api.github.com/repos/w3c/echidna/subscription","commits_url":"https://api.github.com/repos/w3c/echidna/commits{/sha}","git_commits_url":"https://api.github.com/repos/w3c/echidna/git/commits{/sha}","comments_url":"https://api.github.com/repos/w3c/echidna/comments{/number}","issue_comment_url":"https://api.github.com/repos/w3c/echidna/issues/comments{/number}","contents_url":"https://api.github.com/repos/w3c/echidna/contents/{+path}","compare_url":"https://api.github.com/repos/w3c/echidna/compare/{base}...{head}","merges_url":"https://api.github.com/repos/w3c/echidna/merges","archive_url":"https://api.github.com/repos/w3c/echidna/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/w3c/echidna/downloads","issues_url":"https://api.github.com/repos/w3c/echidna/issues{/number}","pulls_url":"https://api.github.com/repos/w3c/echidna/pulls{/number}","milestones_url":"https://api.github.com/repos/w3c/echidna/milestones{/number}","notifications_url":"https://api.github.com/repos/w3c/echidna/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/w3c/echidna/labels{/name}","releases_url":"https://api.github.com/repos/w3c/echidna/releases{/id}","created_at":"2014-11-05T16:53:27Z","updated_at":"2015-04-14T14:01:03Z","pushed_at":"2015-04-15T03:49:51Z","git_url":"git://github.com/w3c/echidna.git","ssh_url":"git@github.com:w3c/echidna.git","clone_url":"https://github.com/w3c/echidna.git","svn_url":"https://github.com/w3c/echidna","homepage":"","size":4208,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":27,"forks":4,"open_issues":27,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/w3c/echidna/pulls/84"},"html":{"href":"https://github.com/w3c/echidna/pull/84"},"issue":{"href":"https://api.github.com/repos/w3c/echidna/issues/84"},"comments":{"href":"https://api.github.com/repos/w3c/echidna/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/w3c/echidna/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/w3c/echidna/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/w3c/echidna/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/w3c/echidna/statuses/986283d86e9b67c095453ac2608cebc6daec042b"}}}}