Skip to content
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

fix issues #1120 #1256 from NSS5.1.6 ressource-mapper #1282

Closed
wants to merge 8 commits into from
Closed

fix issues #1120 #1256 from NSS5.1.6 ressource-mapper #1282

wants to merge 8 commits into from

Conversation

bourgeoa
Copy link
Member

@bourgeoa bourgeoa commented Aug 5, 2019

recreate all for tests each step

@bourgeoa
Copy link
Member Author

bourgeoa commented Aug 5, 2019

@RubenVerborgh
As you can see a full clean NSS master has the same ACL time outs. Not related from any modification I introduced except may be from my process :
clone NSS master on github --> my github --> git on my server --> PR to my github --> PR to NSS github

I can try to suppress the my github in between.

What shall I do with my PR : wait until master succeed tests or represent it so you can approve it ?

@RubenVerborgh
Copy link
Contributor

OK, thx, will need to involve the NSS team then.

@bourgeoa
Copy link
Member Author

bourgeoa commented Aug 6, 2019

This takes back PR #1280 after passing tests on clean master.

The fix works on NSS multiuser under docker and solid-ide
On solid-ide create/update file gives as expected $.unknown (until solid-file-client update)
It also allow slug with extension.

I join tests result on my server git and node with completely different errors (I suppose related to my server port usage)

  1. API
    "before all" hook:
    Uncaught Error: listen EADDRINUSE :::5000
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1351:14)
    at listenInCluster (net.js:1392:12)
    at Server.listen (net.js:1476:7)
    at Promise (test/integration/capability-discovery-test.js:37:11)
    at new Promise ()
    at startServer (test/integration/capability-discovery-test.js:36:12)
    at Context.before (test/integration/capability-discovery-test.js:43:7)
  1. Header handler
    WAC-Allow
    a resource that is read/write/append/control for the user, nothing for the public
    "before all" hook:
    Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/volume1/homes/admin/github/bourgeoa/node-solid-server/test/integration/header-test.js)

  2. HTTP COPY API
    "before all" hook:
    Uncaught Error: listen EADDRINUSE :::8443
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at Server.setupListenHandle [as _listen2] (net.js:1351:14)
    at listenInCluster (net.js:1392:12)
    at Server.listen (net.js:1476:7)
    at Context. (test/integration/http-copy-test.js:22:26)

=============================== Coverage summary ===============================
Statements : 79.43% ( 2499/3146 )
Branches : 69.02% ( 791/1146 )
Functions : 76.06% ( 483/635 )
Lines : 79.7% ( 2454/3079 )

npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! [email protected] nyc: cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 nyc --reporter=text-summary mocha
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the [email protected] nyc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@bourgeoa
Copy link
Member Author

I have redone tests on my server for last NSS4.4.2 and NSSv5.1.1, v5.1.4, v5.1.6 and my PR.
To adapt to my server i had to :

  • Has my server is using port 5000, I changed in test port 5000 to 3456 as it used to be in NSSv4.4.2
  • stop my docker instance of solid on 8443 to free the port 8443
    The results are :
  • only NSSv4.4.2 passes all tests
  • all tested NSSv5 version including my PR had only one error left and the same for all NSSv5 version tested. (exemple of test results for PR fix issues #1120 #1256 from NSS5.1.6 ressource-mapper #1282)

805 passing (1m)
22 pending
1 failing

  1. Header handler
    WAC-Allow
    a resource that is read/write/append/control for the user, nothing for the public
    "before all" hook:
    Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/volume1/homes/admin/github/awwright/node-solid-server/test/integration/header-test.js)

As a conclusion there is no regression with PR #1282 and it appears to be a long awaited solution to solve problems introduced by NSSv5.1.6 with the new resource-mapper.js.

The actual NSSv5.1.6 version has stopped a lot of developers in their work.

@bourgeoa
Copy link
Member Author

I'd like to add a comment on a process that could be introduced to upgarde versions :
create a upgrade community user panel

  1. ask for validation on personal server on a tagged version proposal
  2. after validation push to dev.inrupt.net or an other dedicated server to prereleases and ask for validation to a group of developers/users
  3. push the new version to solid.community. That could be the official release

If preferred step 1. and 2. couId be in only one step.The main purpose being a validation process on step 2.
It is just a proposal and I don't know where to propose it.

@michielbdejong
Copy link
Member

@bourgeoa as discussed on the phone, I'll have a look on Monday!

@bourgeoa
Copy link
Member Author

@michielbdejong
I pushed the last change but I have this conflicting file package-lock.json and I don't know how to resolve the conflicts. I hope you can push the PR to a new NSS version.

  • I tested all the changes on my server for NSSv5.1.6 and the new NSSv5.1.7 (multiuser and docker ) and everything is OK no new test error.
  • The server in NSSv5.1.7 seems to works OK and solid-ide with the old solid-file-client works as expected. The new databrowser is a nice improvement.

for information I filled an issue # 94 on solid-UI on a nasty bug that allow to delete .acl from /public (and you cannot recreate it) and worse from /(root) (you loose access to your pod).

@bourgeoa
Copy link
Member Author

I pushed the solid/node-solid-server/package-lock.json and it solved the conflict.
All test passes

@michielbdejong
Copy link
Member

Great, I'll have a look, maybe I can find time tonight, otherwise I'll do it tomorrow.

@michielbdejong
Copy link
Member

@bourgeoa I had a look as promised, and must say this whole situation feels way too scary to touch without refactoring the resource-mapper to split out its different functions:

  • store content-type in $. extension on disk when storing, and retrieve it from there serving
  • deal with serving index.html if present and text/html is requested for a container
  • choosing whether the on-disk folder structure should include the host or not
  • setting a default Content-Type if missing
  • there are two separate and seemingly different code paths for mapping a URL to a file, one which creates resources if they don't exist, and one that doesn't

What further complicates this is that there seem to be three competing PRs open:

I wouldn't know which one to pick, or where to start to even review your PR with confidence, sorry! The last time we touched the resource mapper it took us several weeks to recover from the fallout so I want to be conservative here.

As I said, please start testing your code against https://github.com/inrupt/pod-server which is the rewrite of NSS in TypeScript, and which already has a much higher compliance level on https://github.com/solid/test-suite. Sorry I couldn't be of more help to you - I did try!

// create a new file
if (!(!searchIndex && isFolder)) {
// Append index filename if needed
if (searchIndex && isFolder) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sequence of those two if conditions is weird; we can do better

Copy link
Member Author

@bourgeoa bourgeoa Aug 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already had a discussion about that in PR #1280 that begun this PR #1282
I initially proposed :

  // create a new container
 if (!searchIndex && isFolder) {
// else create a new resource
 } else {
   if (searchIndex && isFolder) {

for me it was clearer but you tell me you did not like void if statement.
It was for me the clearest way. The logic being explicit.
Would you prefer this :

  // create a new container
 if (!searchIndex && isFolder) {
   return { path }             // (do I need the {} around path)
// else create a new resource
 }
 if (searchIndex && isFolder) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I might have not expressed myself clearly.

What I mean is that

if (!(!searchIndex && isFolder)) {
  if (searchIndex && isFolder) {

is equivalent to

if (searchIndex !! !isFolder) {
  if (isFolder) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An other proposal will be : (symbolic code)

// create a fileIndex
if (searchIndex && isFolder) -- > path += this.fileIndex and check contentType or throw error
// if create a resource check extension
if (!isFolder) --> check extension against contentType as actually

as before (create a folder will be implicit), then

return { path, contentType : contentType || this._defaultContentType }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fine with me. Just not the repeated conditions.

@RubenVerborgh
Copy link
Contributor

RubenVerborgh commented Aug 19, 2019

without refactoring the resource-mapper to split out its different functions:

Those listed are actually already split out, with the exception of the second one (because that is content negotiation and does not belong in the ResourceMapper, which is just an implementation of https://www.w3.org/DesignIssues/HTTPFilenameMapping.html).

So I'm fine with the ResourceMapper changes and functionality (minus the comment I placed). It's well tested and under control.

It's not competing, it's complementary.


// Create the path for a new file
// Create the path for a new ressource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@bourgeoa
Copy link
Member Author

bourgeoa commented Aug 19, 2019

@RubenVerborgh @michielbdejong

If you check the travis test only the version under node 10 fails.

hope you like better the if sequence that has disappeared.
Tests made locally on NSSv5.1.7 with no difference to previous ones.
on my server under docker NSSv5.1.7 with the patch runs normally and solid-ide with solid-file-client too.
PR # 1260 from @jaxoncreed was taken in consideration as from the beginning in my PR.

Copy link
Contributor

@jaxoncreed jaxoncreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think this looks okay. Given the number of pull requests that have been made on this issue, I think it should be merged in.

@@ -45,7 +45,7 @@ async function handler (req, res, next) {

let ret
try {
ret = await ldp.get(options)
ret = await ldp.get(options, req.accepts('html'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better handled as

req.accepts(['text/turtle', 'application/ld+json', 'html']) === 'html'

so that we can handle requests where rdf has a higher weighted q value.

Copy link
Member Author

@bourgeoa bourgeoa Aug 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall I push your proposal (might be better ?) or do we keep it like it is ?
__
Just tried your proposal locally and npm run test, it fails on :

  1. formats
    turtle
    should return turtle when listing container with an index page:
    Error: expected "content-type" matching /text/html/, got "text/turtle"

So I propose to leave it like it is for node-solid-server EOL

@jaxoncreed
Copy link
Contributor

Closing because fixed by a different pr

@jaxoncreed jaxoncreed closed this Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants