{"action":"created","comment":{"url":"https://api.github.com/repos/databrary/databrary/pulls/comments/192547826","pull_request_review_id":125287447,"id":192547826,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjU0NzgyNg==","diff_hunk":"@@ -83,47 +83,38 @@ maybeAction (Just a) = return a\n maybeAction Nothing = result =<< peeks notFoundResponse\n \n newtype WaiRouteApp = WaiRouteApp Application\n+newtype ActionRouteApp = ActionRouteApp Application\n \n--- | Create a server to serve the ServantAPI.\n-apiServer :: WaiRouteApp -> Server ServantAPI\n-apiServer (WaiRouteApp app') = Tagged app'\n-\n--- Build a Wai.Application out of our Servant server plus the Wai Route escape\n--- hatch.\n-servantApp :: WaiRouteApp -> Application\n-servantApp waiRouteApp =\n-    serve servantAPI (apiServer waiRouteApp)\n-\n--- | The lowest level of the Databrary 'web framework'. Makes a Wai Application\n--- given a route map, a hatch into the Wai Route fallback, and the\n+-- | The second level of the Databrary 'web framework'. Makes a (wrapped) Wai\n+-- Application given a route map, a hatch into the Wai Route fallback, and the\n -- already-generated system capabilities.\n+--\n+-- Most routes are served by web-inv-route—style ActionRoutes, but some (~30%)\n+-- have been converted to Wai Routes.\n actionRouteApp\n     :: Invertible.RouteMap Action\n-    -- ^ The original route map. Now partially replaced by Servant and Wai\n-    -- Routes\n+    -- ^ The original route map. Now partially replaced by Wai Routes\n     -> WaiRouteApp\n     -- ^ The newer Wai Route-based Application\n     -> Service\n     -- ^ System capabilities\n-    -> Wai.Application\n+    -> ActionRouteApp\n     -- ^ The actual web app\n-actionRouteApp invMap waiRouteApp routeContext req =\n-    -- Route lookup\n-    let eMatchedAction :: Either (Status, ResponseHeaders) Action\n-        eMatchedAction = Invertible.routeWai req invMap\n-    in\n-      case eMatchedAction of\n-        Right act ->\n-            -- Still handled by invertible routes\n-            actionApp routeContext act req\n-        Left (st,hdrs) ->\n-            if st == notFound404 -- currently, this might be only possible error result?\n-            then\n-                -- Our hatch to the WaiRouteApp is Servant!\n-                servantApp waiRouteApp req\n-            else\n-                actionApp routeContext (err (st,hdrs)) req\n+actionRouteApp invMap (WaiRouteApp waiRouteApp) svc = ActionRouteApp\n+    (\\req resp ->\n+        -- Use the original Action if it still exists\n+        either\n+            (waiRouteFallback req resp)\n+            (\\act -> actionApp svc act req resp)\n+            (Invertible.routeWai req invMap)\n+    )\n   where\n+    waiRouteFallback req resp (st,hdrs)\n+        -- Currently, this might be only possible error result?","path":"src/Databrary/Action.hs","position":78,"original_position":78,"commit_id":"589b76f4f35f0cba1e4a4614b3552efd62e8c7db","original_commit_id":"589b76f4f35f0cba1e4a4614b3552efd62e8c7db","user":{"login":"kanishka-azimi","id":1385802,"node_id":"MDQ6VXNlcjEzODU4MDI=","avatar_url":"https://avatars3.githubusercontent.com/u/1385802?v=4","gravatar_id":"","url":"https://api.github.com/users/kanishka-azimi","html_url":"https://github.com/kanishka-azimi","followers_url":"https://api.github.com/users/kanishka-azimi/followers","following_url":"https://api.github.com/users/kanishka-azimi/following{/other_user}","gists_url":"https://api.github.com/users/kanishka-azimi/gists{/gist_id}","starred_url":"https://api.github.com/users/kanishka-azimi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kanishka-azimi/subscriptions","organizations_url":"https://api.github.com/users/kanishka-azimi/orgs","repos_url":"https://api.github.com/users/kanishka-azimi/repos","events_url":"https://api.github.com/users/kanishka-azimi/events{/privacy}","received_events_url":"https://api.github.com/users/kanishka-azimi/received_events","type":"User","site_admin":false},"body":"I think I guessed this from reading the web-inv-route source code","created_at":"2018-06-02T03:23:40Z","updated_at":"2018-06-02T03:38:14Z","html_url":"https://github.com/databrary/databrary/pull/573#discussion_r192547826","pull_request_url":"https://api.github.com/repos/databrary/databrary/pulls/573","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/databrary/databrary/pulls/comments/192547826"},"html":{"href":"https://github.com/databrary/databrary/pull/573#discussion_r192547826"},"pull_request":{"href":"https://api.github.com/repos/databrary/databrary/pulls/573"}}},"pull_request":{"url":"https://api.github.com/repos/databrary/databrary/pulls/573","id":192095086,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMDk1MDg2","html_url":"https://github.com/databrary/databrary/pull/573","diff_url":"https://github.com/databrary/databrary/pull/573.diff","patch_url":"https://github.com/databrary/databrary/pull/573.patch","issue_url":"https://api.github.com/repos/databrary/databrary/issues/573","number":573,"state":"open","locked":false,"title":"Begin Servant, Part II","user":{"login":"chreekat","id":538538,"node_id":"MDQ6VXNlcjUzODUzOA==","avatar_url":"https://avatars3.githubusercontent.com/u/538538?v=4","gravatar_id":"","url":"https://api.github.com/users/chreekat","html_url":"https://github.com/chreekat","followers_url":"https://api.github.com/users/chreekat/followers","following_url":"https://api.github.com/users/chreekat/following{/other_user}","gists_url":"https://api.github.com/users/chreekat/gists{/gist_id}","starred_url":"https://api.github.com/users/chreekat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chreekat/subscriptions","organizations_url":"https://api.github.com/users/chreekat/orgs","repos_url":"https://api.github.com/users/chreekat/repos","events_url":"https://api.github.com/users/chreekat/events{/privacy}","received_events_url":"https://api.github.com/users/chreekat/received_events","type":"User","site_admin":false},"body":"This is another PR that is mostly just pulling apart the ball of wax. Comments, formatting, and surgical refactors. No change of behavior, and no specific changes to the implementation of individual routes. *Routing* has had a few changes, however. In particular, the order in which route parsing happens has changed. The new order is: Servant -> ActionRoute -> Wai.Routes.\r\n\r\n* [ ] Smoketest run","created_at":"2018-06-01T17:21:00Z","updated_at":"2018-06-02T03:38:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7743696608a1d161688b96e82435fc474411725","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/databrary/databrary/pulls/573/commits","review_comments_url":"https://api.github.com/repos/databrary/databrary/pulls/573/comments","review_comment_url":"https://api.github.com/repos/databrary/databrary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/databrary/databrary/issues/573/comments","statuses_url":"https://api.github.com/repos/databrary/databrary/statuses/589b76f4f35f0cba1e4a4614b3552efd62e8c7db","head":{"label":"databrary:chreekat/begin-servant-2","ref":"chreekat/begin-servant-2","sha":"589b76f4f35f0cba1e4a4614b3552efd62e8c7db","user":{"login":"databrary","id":3430703,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzA3MDM=","avatar_url":"https://avatars3.githubusercontent.com/u/3430703?v=4","gravatar_id":"","url":"https://api.github.com/users/databrary","html_url":"https://github.com/databrary","followers_url":"https://api.github.com/users/databrary/followers","following_url":"https://api.github.com/users/databrary/following{/other_user}","gists_url":"https://api.github.com/users/databrary/gists{/gist_id}","starred_url":"https://api.github.com/users/databrary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/databrary/subscriptions","organizations_url":"https://api.github.com/users/databrary/orgs","repos_url":"https://api.github.com/users/databrary/repos","events_url":"https://api.github.com/users/databrary/events{/privacy}","received_events_url":"https://api.github.com/users/databrary/received_events","type":"Organization","site_admin":false},"repo":{"id":9753621,"node_id":"MDEwOlJlcG9zaXRvcnk5NzUzNjIx","name":"databrary","full_name":"databrary/databrary","owner":{"login":"databrary","id":3430703,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzA3MDM=","avatar_url":"https://avatars3.githubusercontent.com/u/3430703?v=4","gravatar_id":"","url":"https://api.github.com/users/databrary","html_url":"https://github.com/databrary","followers_url":"https://api.github.com/users/databrary/followers","following_url":"https://api.github.com/users/databrary/following{/other_user}","gists_url":"https://api.github.com/users/databrary/gists{/gist_id}","starred_url":"https://api.github.com/users/databrary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/databrary/subscriptions","organizations_url":"https://api.github.com/users/databrary/orgs","repos_url":"https://api.github.com/users/databrary/repos","events_url":"https://api.github.com/users/databrary/events{/privacy}","received_events_url":"https://api.github.com/users/databrary/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/databrary/databrary","description":"behavioral science research media data sharing web application","fork":false,"url":"https://api.github.com/repos/databrary/databrary","forks_url":"https://api.github.com/repos/databrary/databrary/forks","keys_url":"https://api.github.com/repos/databrary/databrary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/databrary/databrary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/databrary/databrary/teams","hooks_url":"https://api.github.com/repos/databrary/databrary/hooks","issue_events_url":"https://api.github.com/repos/databrary/databrary/issues/events{/number}","events_url":"https://api.github.com/repos/databrary/databrary/events","assignees_url":"https://api.github.com/repos/databrary/databrary/assignees{/user}","branches_url":"https://api.github.com/repos/databrary/databrary/branches{/branch}","tags_url":"https://api.github.com/repos/databrary/databrary/tags","blobs_url":"https://api.github.com/repos/databrary/databrary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/databrary/databrary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/databrary/databrary/git/refs{/sha}","trees_url":"https://api.github.com/repos/databrary/databrary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/databrary/databrary/statuses/{sha}","languages_url":"https://api.github.com/repos/databrary/databrary/languages","stargazers_url":"https://api.github.com/repos/databrary/databrary/stargazers","contributors_url":"https://api.github.com/repos/databrary/databrary/contributors","subscribers_url":"https://api.github.com/repos/databrary/databrary/subscribers","subscription_url":"https://api.github.com/repos/databrary/databrary/subscription","commits_url":"https://api.github.com/repos/databrary/databrary/commits{/sha}","git_commits_url":"https://api.github.com/repos/databrary/databrary/git/commits{/sha}","comments_url":"https://api.github.com/repos/databrary/databrary/comments{/number}","issue_comment_url":"https://api.github.com/repos/databrary/databrary/issues/comments{/number}","contents_url":"https://api.github.com/repos/databrary/databrary/contents/{+path}","compare_url":"https://api.github.com/repos/databrary/databrary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/databrary/databrary/merges","archive_url":"https://api.github.com/repos/databrary/databrary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/databrary/databrary/downloads","issues_url":"https://api.github.com/repos/databrary/databrary/issues{/number}","pulls_url":"https://api.github.com/repos/databrary/databrary/pulls{/number}","milestones_url":"https://api.github.com/repos/databrary/databrary/milestones{/number}","notifications_url":"https://api.github.com/repos/databrary/databrary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/databrary/databrary/labels{/name}","releases_url":"https://api.github.com/repos/databrary/databrary/releases{/id}","deployments_url":"https://api.github.com/repos/databrary/databrary/deployments","created_at":"2013-04-29T17:20:15Z","updated_at":"2018-05-31T23:34:04Z","pushed_at":"2018-06-01T17:21:01Z","git_url":"git://github.com/databrary/databrary.git","ssh_url":"git@github.com:databrary/databrary.git","clone_url":"https://github.com/databrary/databrary.git","svn_url":"https://github.com/databrary/databrary","homepage":"http://databrary.org","size":217645,"stargazers_count":40,"watchers_count":40,"language":"Haskell","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":13,"open_issues":5,"watchers":40,"default_branch":"master"}},"base":{"label":"databrary:master","ref":"master","sha":"4fddfcb5cd2092fe40261dfe2409f5dee9da93a2","user":{"login":"databrary","id":3430703,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzA3MDM=","avatar_url":"https://avatars3.githubusercontent.com/u/3430703?v=4","gravatar_id":"","url":"https://api.github.com/users/databrary","html_url":"https://github.com/databrary","followers_url":"https://api.github.com/users/databrary/followers","following_url":"https://api.github.com/users/databrary/following{/other_user}","gists_url":"https://api.github.com/users/databrary/gists{/gist_id}","starred_url":"https://api.github.com/users/databrary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/databrary/subscriptions","organizations_url":"https://api.github.com/users/databrary/orgs","repos_url":"https://api.github.com/users/databrary/repos","events_url":"https://api.github.com/users/databrary/events{/privacy}","received_events_url":"https://api.github.com/users/databrary/received_events","type":"Organization","site_admin":false},"repo":{"id":9753621,"node_id":"MDEwOlJlcG9zaXRvcnk5NzUzNjIx","name":"databrary","full_name":"databrary/databrary","owner":{"login":"databrary","id":3430703,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0MzA3MDM=","avatar_url":"https://avatars3.githubusercontent.com/u/3430703?v=4","gravatar_id":"","url":"https://api.github.com/users/databrary","html_url":"https://github.com/databrary","followers_url":"https://api.github.com/users/databrary/followers","following_url":"https://api.github.com/users/databrary/following{/other_user}","gists_url":"https://api.github.com/users/databrary/gists{/gist_id}","starred_url":"https://api.github.com/users/databrary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/databrary/subscriptions","organizations_url":"https://api.github.com/users/databrary/orgs","repos_url":"https://api.github.com/users/databrary/repos","events_url":"https://api.github.com/users/databrary/events{/privacy}","received_events_url":"https://api.github.com/users/databrary/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/databrary/databrary","description":"behavioral science research media data sharing web application","fork":false,"url":"https://api.github.com/repos/databrary/databrary","forks_url":"https://api.github.com/repos/databrary/databrary/forks","keys_url":"https://api.github.com/repos/databrary/databrary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/databrary/databrary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/databrary/databrary/teams","hooks_url":"https://api.github.com/repos/databrary/databrary/hooks","issue_events_url":"https://api.github.com/repos/databrary/databrary/issues/events{/number}","events_url":"https://api.github.com/repos/databrary/databrary/events","assignees_url":"https://api.github.com/repos/databrary/databrary/assignees{/user}","branches_url":"https://api.github.com/repos/databrary/databrary/branches{/branch}","tags_url":"https://api.github.com/repos/databrary/databrary/tags","blobs_url":"https://api.github.com/repos/databrary/databrary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/databrary/databrary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/databrary/databrary/git/refs{/sha}","trees_url":"https://api.github.com/repos/databrary/databrary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/databrary/databrary/statuses/{sha}","languages_url":"https://api.github.com/repos/databrary/databrary/languages","stargazers_url":"https://api.github.com/repos/databrary/databrary/stargazers","contributors_url":"https://api.github.com/repos/databrary/databrary/contributors","subscribers_url":"https://api.github.com/repos/databrary/databrary/subscribers","subscription_url":"https://api.github.com/repos/databrary/databrary/subscription","commits_url":"https://api.github.com/repos/databrary/databrary/commits{/sha}","git_commits_url":"https://api.github.com/repos/databrary/databrary/git/commits{/sha}","comments_url":"https://api.github.com/repos/databrary/databrary/comments{/number}","issue_comment_url":"https://api.github.com/repos/databrary/databrary/issues/comments{/number}","contents_url":"https://api.github.com/repos/databrary/databrary/contents/{+path}","compare_url":"https://api.github.com/repos/databrary/databrary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/databrary/databrary/merges","archive_url":"https://api.github.com/repos/databrary/databrary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/databrary/databrary/downloads","issues_url":"https://api.github.com/repos/databrary/databrary/issues{/number}","pulls_url":"https://api.github.com/repos/databrary/databrary/pulls{/number}","milestones_url":"https://api.github.com/repos/databrary/databrary/milestones{/number}","notifications_url":"https://api.github.com/repos/databrary/databrary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/databrary/databrary/labels{/name}","releases_url":"https://api.github.com/repos/databrary/databrary/releases{/id}","deployments_url":"https://api.github.com/repos/databrary/databrary/deployments","created_at":"2013-04-29T17:20:15Z","updated_at":"2018-05-31T23:34:04Z","pushed_at":"2018-06-01T17:21:01Z","git_url":"git://github.com/databrary/databrary.git","ssh_url":"git@github.com:databrary/databrary.git","clone_url":"https://github.com/databrary/databrary.git","svn_url":"https://github.com/databrary/databrary","homepage":"http://databrary.org","size":217645,"stargazers_count":40,"watchers_count":40,"language":"Haskell","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":13,"open_issues":5,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/databrary/databrary/pulls/573"},"html":{"href":"https://github.com/databrary/databrary/pull/573"},"issue":{"href":"https://api.github.com/repos/databrary/databrary/issues/573"},"comments":{"href":"https://api.github.com/repos/databrary/databrary/issues/573/comments"},"review_comments":{"href":"https://api.github.com/repos/databrary/databrary/pulls/573/comments"},"review_comment":{"href":"https://api.github.com/repos/databrary/databrary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/databrary/databrary/pulls/573/commits"},"statuses":{"href":"https://api.github.com/repos/databrary/databrary/statuses/589b76f4f35f0cba1e4a4614b3552efd62e8c7db"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kanishka-azimi"}}