Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRemove Hypothesis client from service #4399
Conversation
robertknight
added some commits
Mar 3, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
codecov-io
Mar 3, 2017
Codecov Report
Merging #4399 into master will increase coverage by
<.01%.
The diff coverage is100%.
@@ Coverage Diff @@
## master #4399 +/- ##
==========================================
+ Coverage 94.26% 94.26% +<.01%
==========================================
Files 320 320
Lines 18173 18124 -49
Branches 1074 1071 -3
==========================================
- Hits 17130 17084 -46
+ Misses 935 929 -6
- Partials 108 111 +3| Impacted Files | Coverage Δ | |
|---|---|---|
| tests/h/views/main_test.py | 97.89% <ø> (-0.09%) |
|
| h/assets.py | 86.27% <ø> (+4.13%) |
|
| tests/h/routes_test.py | 100% <ø> (ø) |
|
| h/routes.py | 100% <ø> (ø) |
|
| h/models/feature.py | 93.1% <ø> (ø) |
|
| h/views/client.py | 77.27% <100%> (-5.78%) |
|
| tests/h/views/client_test.py | 100% <100%> (ø) |
|
| h/stats.py | 83.33% <0%> (ø) |
|
| src/memex/search/init.py | 38.88% <0%> (ø) |
|
| h/session.py | 91.83% <0%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update 78e9b08...c6a0c34. Read the comment docs.
codecov-io
commented
Mar 3, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #4399 +/- ##
==========================================
+ Coverage 94.26% 94.26% +<.01%
==========================================
Files 320 320
Lines 18173 18124 -49
Branches 1074 1071 -3
==========================================
- Hits 17130 17084 -46
+ Misses 935 929 -6
- Partials 108 111 +3
Continue to review full report at Codecov.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
nickstenning
Mar 3, 2017
Contributor
There's also stuff in the Dockerfile which can be simplified now.
|
There's also stuff in the Dockerfile which can be simplified now. |
robertknight
referenced this pull request
Mar 3, 2017
Merged
Remove unnecessary _app_html_context function #4400
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
robertknight
Mar 6, 2017
Contributor
There's also stuff in the Dockerfile which can be simplified now.
Just this line or is there anything else?
Just this line or is there anything else? |
seanh
self-assigned this
Mar 6, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 6, 2017
Contributor
There's still some mentions of <script src="https://hypothes.is/embed.js" async></script> in the docs directory. Looks like this 302s to cdn.hypothes.is/hypothesis now. Do we want to leave it like that or we we want to change the docs to say <script src="cdn.hypothes.is/hypothesis" directly?
|
There's still some mentions of |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
robertknight
Mar 6, 2017
Contributor
I think we can leave it like that for now and reconsider whether to change the publicly advertised entry point in future. cdn.hypothes.is is an "implementation detail" for most users at the moment, unless they have strict CSP policies.
|
I think we can leave it like that for now and reconsider whether to change the publicly advertised entry point in future. cdn.hypothes.is is an "implementation detail" for most users at the moment, unless they have strict CSP policies. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 6, 2017
Contributor
So it's deliberate that we ourselves even continue to use the /embed.js URL that 302s to the CDN, instead of just using the CDN URL directly? For example in /app.html it's still <script src="/embed.js"></script> and not <script src="https://cdn.hypothes.is/hypothesis"></script>
I understand that we might want to keep the /embed.js URL around and have it 302, and maybe even leave our public docs still saying /embed.js, but it seems that, given that h.client_url is configurable, things like app.html could just use client_url directly instead of going via /embed.js?
(I see that /embed.js is cached though)
|
So it's deliberate that we ourselves even continue to use the I understand that we might want to keep the (I see that |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Should |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Can the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 6, 2017
Contributor
I think I share the concern that you mentioned in Slack about potential confusion with dev envs. It looks like by default https://localhost:5000/docs/help will make a request to localhost/embed.js which will 302 to https://cdn.hypothes.is/hypothesis. For some reason I'm also seeing a second embed.js request, this time to hypothes.is/embed.js, as well. And then the sidebar gets loaded from cdn.hypothes.is, I login to it with my production hypothesis account and it sends annotations to the production hypothesis API, even though I'm on a page of my development web service that happens to have an embedded client on the page. Definitely seems a bit confusing.
We could just set h.client_url to http://localhost:3001/hypothesis in development-app.ini? This of course would not work if you didn't have a dev client installed and running gulp watch. But it seems less bad than embedding the prod client in a dev web service. You just get a broken /docs/help page (and any other page that embeds), and in the network logs you can see why, rather than a working client that you won't notice is a prod client.
|
I think I share the concern that you mentioned in Slack about potential confusion with dev envs. It looks like by default We could just set |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 6, 2017
Contributor
Hmm, I think I'm gonna have to figure out how to run the client repo's gulp watch over HTTPS :). I still can't run the local dev web service over HTTP (it still looks up Chrome horrifically due to gunicorn running out of workers), and when running h over HTTPS pages like /docs/help can't embed my local dev client unless that is also HTTPS. (For now I can run h over HTTP and just increase the number of gunicorn workers so it doesn't lock up.)
|
Hmm, I think I'm gonna have to figure out how to run the client repo's |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 6, 2017
Contributor
Regarding the /embed.js URL vs the CDN URL - I wonder if it might be worth coming up with two distinct names for these two URLs and using them consistently?
For example in views/client.py there's DEFAULT_CLIENT_URL = 'https://cdn.hypothes.is/hypothesis' (and also the h.client_url setting and env var that can override this), so it seems like "the client URL" is the CDN URL. But then further down in the file there is client_url = request.route_path('embed'), another variable named client url but holding a different URL (a URL which, when loaded, 302s to the first client URL).
I think it might be a little confusing.
I think "client url" is a good name for the CDN URL and the DEFAULT_CLIENT_URL / h.client_url settings, and maybe just "embed url" should be used consistently as the name for the embed.js URL (and its associated route and view callable). The embed URL is the one that people embed into pages, the client URL is the one where the client is actually served.
|
Regarding the For example in I think it might be a little confusing. I think "client url" is a good name for the CDN URL and the |
robertknight
added some commits
Mar 7, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
robertknight
Mar 7, 2017
Contributor
Should use_client_boot_script be added to FEATURES_PENDING_REMOVAL?
Done.
Can the assets_client route be removed from routes.py?
Done.
But it seems less bad than embedding the prod client in a dev web service
The plan for this is that the /docs/help page will by default load the production client but use the local service for storage. This means that you can develop the web service without needing to set up a build of the client. The way this will be done is by having pages such as /docs/help include a config script tag which causes the client to load app.html from the local service (which includes the API endpoints from the local service) but use the production client assets. Does this make sense to you?
I'd like to implement this as a separate change from this PR however.
Done.
Done.
The plan for this is that the I'd like to implement this as a separate change from this PR however. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
robertknight
Mar 7, 2017
Contributor
Hmm, I think I'm gonna have to figure out how to run the client repo's gulp watch over HTTPS
It is possible to make an express server use SSL. For the purposes of testing this out I suggest just configuring gunicorn to use a different type of worker locally.
It is possible to make an express server use SSL. For the purposes of testing this out I suggest just configuring gunicorn to use a different type of worker locally. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 7, 2017
Contributor
The plan for this is that the
/docs/helppage will by default load the production client but use the
local service for storage. This means that you can develop the web service without needing to set up a
build of the client. The way this will be done is by having pages such as/docs/helpinclude a config
script tag which causes the client to loadapp.htmlfrom the local service (which includes the API
endpoints from the local service) but use the production client assets. Does this make sense to you?
Yeah, that makes sense. So you want to merge it as is (dev site embeds prod client that talks to prod service) for now?
Yeah, that makes sense. So you want to merge it as is (dev site embeds prod client that talks to prod service) for now? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
robertknight
Mar 7, 2017
Contributor
So you want to merge it as is (dev site embeds prod client that talks to prod service) for now?
Yes please, I'll follow up with a small PR to resolve the issue for /docs/help separately.
Yes please, I'll follow up with a small PR to resolve the issue for |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 7, 2017
Contributor
Ok, this sounds good to me, just waiting for a response to my question about whether we ourselves want to be using embed.js or just using the CDN URL directly? And to my suggestion about naming the embed.js and the CDN URLs more distinctly in the code.
|
Ok, this sounds good to me, just waiting for a response to my question about whether we ourselves want to be using embed.js or just using the CDN URL directly? And to my suggestion about naming the embed.js and the CDN URLs more distinctly in the code. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 7, 2017
Contributor
I'm still seeing references to app_js in some tests, though I guess they don't do any harm
|
I'm still seeing references to |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
seanh
Mar 7, 2017
Contributor
Ok, looks good to me. Great code surgery @robertknight, loads of code and complexity removed here, and also releasing, deploying and setting up dev envs for everything is becoming steadily simpler and more decoupled
|
Ok, looks good to me. Great code surgery @robertknight, loads of code and complexity removed here, and also releasing, deploying and setting up dev envs for everything is becoming steadily simpler and more decoupled |
robertknight commentedMar 3, 2017
•
edited
Do not merge until Monday 2017-03-06Go for it!This PR removes the ability for the service to serve the Hypothesis client directly in favor of always loading the client from an external URL, defaulting to cdn.hypothes.is
The changes are: