-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds new file custom-preload that is loaded in a different order than custom.js before the main.js script is executed #155
Conversation
@lneves12 Thx for opening this. The first thought while reviewing this is about the name you have chosen |
Thanks for the quick reply @echarles I am not sure I understood the
I am not an expert in require.js though. Did you mean to change the define name to something else ? To fix this I kinda got inspired on this old PR: https://github.com/jupyter/notebook/pull/1732/files More about the use case: In order to use the iframe we need to extend some of the behavior. One of the examples (there are more thing) is to inject a couple of security headers. The problem is that the current Therefore doing things like:
will not work, because not all the requests will have the injected token. |
Regarding the Linux JS Tests job failure, I am not sure yet what's going on, not sure if it's related. All the tests are failing with I am trying to run the tests locally, but not luck yet. Even though I can run
|
You are right, thx for pointing to that content in the html page.
Could it be that other cases do need custom.js to be run after the notebook loading?
The CI is not 100% green, but no test is failing with that error. I would say that it is related to these changes.
You can follow the needed steps to run the tests in |
I would say no, in my opinion if there are cases like that they are probably badly written, because they can write code depending on jupyter triggered events (load, killed, etc). btw this is how custom.js was being loaded in jupyter V4, it was just never backported to master. At least that's what i understood by reading the git history. 4.4.1 tag code: https://github.com/jupyter/notebook/blob/4.4.1/notebook/static/notebook/js/main.js#L27
thanks, I will try again to make them run locally |
We have just discussed that during the community call and we came to a conclusion that it would be preferable to not merge such change to avoid the risk to break any existing extensions.
... we did not have that information while discussing during the community meeting. mmh would it be possible to hide that feature behind a flag on the command line. This will complexify quite a lot your PR, but it may be the safest way to move forward. WDYT? |
I really doubt that loading custom.js before would be a big deal. It will just make the custom.js load more consistently. If something breaks, even if rare, it should be easy to fix. It doesn't seem like a breaking change, at least to me. If your custom code depends on the events triggered by the core, nothing should break. Also this change was already in the code in previous versions. Anyway, I understand the concern. What do you think of having 2 files ? custom.js and custom-preload.js ? Introducing a feature flag seems to be quite complex. I would probably need to inject extra information in every handler from a quick look. I will start implementing that solution, but let me know what you think and if that approach is reasonable. Thanks! |
Thank you for your understanding.
That sounds to me like a brilliant idea. Looking forward your PR. |
4e0d3c2
to
ee63b51
Compare
@echarles done! just updated the PR with the new file solution. I also updated the description with a new demo video showing the new file behavior. Can you rerun the CI tests again? I don't seem to have permissions to do that. |
Kicked the CI job and this one is failing https://github.com/jupyter/nbclassic/actions/runs/3197888375/jobs/5222141888 |
Those seem to be failing as well in other PR: https://github.com/jupyter/nbclassic/actions/runs/3181760673/jobs/5186881765 There are 2 tests failing though in Selenium Tests only in Macos. I am still investigating why and how they can be related with my changes. Could they be flaky ? Or my change made them being more flaky? I will keep investigating, but any insight or help would be very welcoming! I am still very new to this project Thanks! |
Oh, maybe I have not looked correctly. Indeed, you just need to ensure that there are no regressions. We will work to make the CI 100% green, but for now we have some small failures that we know of. So if you could first double check that no regression is introduced, I can review. |
ee63b51
to
8c9aebf
Compare
@echarles could you try to rerun the tests? I rebased my branch. I already reviewed a lot of code and the test and I can't understand why the test |
Done |
Some tests were failing, so I have rerun the failing ones. They still show issues which I think were not there before, like on https://github.com/jupyter/nbclassic/actions/runs/3206644310/jobs/5260741971, there is
|
@echarles I think I see the same errors happening in last master commit. jstests -> https://github.com/jupyter/nbclassic/actions/runs/3207336103/jobs/5242111041 selenium -> https://github.com/jupyter/nbclassic/actions/runs/3207336100/jobs/5242110926 =========================== short test summary info ============================ let me know if I overlooked something |
That's true. I'd like first to investigate what is wrong with the regression in main branch. How urgent is this for you? |
@echarles it's a blocker for us, so it has some priority for us. However I guess you will not release a new version until the tests are green anyway. I would be surprise if this change breaks any test. How can I help ? I can try to look at the js tests in master, but I haven't been able to run them locally yet, so it's a bit annoying to fix them. I will try again. The selenium tests seem to be failing only in macos, not sure if I will be able to replicate them. (I have linux) |
I am investigating #156 which is I think the cause of the test regression. |
thanks! @echarles let me know if there is anything I can do to help I don't mind helping fixing some of the tests and make the main branch green! |
#159 on its way to fix the test in main branch. Once merged, you can rebase your PR. PS: Sometimes it will be completely green, sometiimes you may have a few failures like |
…re the main.js script is executed
8c9aebf
to
85c68b1
Compare
@echarles nice! My branch is rebased on top of latest master. You can retry the tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thx @lneves12
I have merged. Are you looking for a new release? |
@echarles thanks for all the help and quick replies! yeah, that would be very helpful. One question: it seems only the notebook version > 6.5.X relies on nbclassic. Do you know if there is an official release of 6.5 happening soon? or should we build our own docker images depending on the new release of nbclassic using the 6.5 branch? I am still new in the jupyter notebooks ecosystem, so any hint would be very helpful :) We have been using the official docker hub images: https://hub.docker.com/u/jupyter |
Will cut a new nbclassic tomorrow.
@ericsnekbytes and @RRosio are preparing that. They can give you more details on the plan.
The docker image release is not managed in this repo. I will add this question to the agenda of the next notebook community meeting. |
@lneves12 nbclassic 0.4.6 is just released with these changes. |
Adds new file custom-preload that is loaded in a different order than custom.js before the main.js script is executed.
Relying on the existing file custom.js has some limitation because it gets loaded after the main.js script is executed. That makes it hard to extend some behaviors like injecting security headers:
example:
Here is a demo video demonstrating the new behavior:
fix.mp4