-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
This can be reviewed for now, no need to wait until we fix the bitswap issues. |
@dignifiedquire can you add more description. It says that it fixes |
@diasdavid added a description on what happened^^ |
thank you @dignifiedquire, left a bunch of comments :) |
not seeing any in this PR |
@@ -43,6 +43,7 @@ | |||
"aegir": "^8.0.1", | |||
"buffer-loader": "0.0.1", | |||
"chai": "^3.5.0", | |||
"execa": "^0.4.0", |
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.
what's this for?
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.
To spawn the cli in a consistent and nice way.
@@ -23,8 +23,7 @@ module.exports = { | |||
stats.Wantlist = stats.Wantlist || [] | |||
stats.Peers = stats.Peers || [] | |||
|
|||
console.log(` | |||
bitswap status | |||
console.log(`bitswap status |
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.
Are we happy with the new "Printer" by @victorbjelkholm? Wanna use that?
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.
As I mentioned in another PR I would rather do that change as a single PR on its own, there are already too many things mixed in here.
@@ -24,7 +23,7 @@ module.exports = { | |||
throw err | |||
} | |||
|
|||
console.log('Key:', bs58.encode(stats.key).toString()) | |||
console.log('Key:', stats.key) |
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.
Isn't this a multihash?
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.
Not currently
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.
if (err) { | ||
throw err | ||
} | ||
|
||
ipfs.files.cat(path, onFile) | ||
file.pipe(process.stdout) |
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.
These are not changes to get
- I believe we have agreed during a js-ipfs sprint call that we would start settling on async, since not is is modular, more battle tested and the documentation is just great. If we bring on new deps like
run-waterfall
, better just do theasync/waterfall
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.
I don't remember making that decision, but happy to move all these run-*
to modular async.
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.
These are not changes to get
As mentioned in the description, fixes all over including files cat
;)
const dirPath = path.join(dir, file.path) | ||
// Check to see if the result is a directory | ||
if (file.dir === false) { | ||
if (file.content) { |
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.
👍
query: { | ||
arg: Joi.string().required(), // multiaddr to add | ||
default: Joi.boolean() | ||
} |
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.
Why remove the Joi
validation?
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.
- It is the only place in the http api where we have validation.
- It was incorrect as it threw errors on the global
stream
header.
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.
It is the only place in the http api where we have validation
It was a start, a good practice introduced by @xicombd.
It was incorrect as it threw errors on the global stream header.
Why exactly? That sounds like a Joi bug, this is only checking the query param
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.
I don't know why, but it wouldn't allow for any additional query parameters to be passed along except for the ones that were part of this validation.
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.
IRC log
11:04 <@daviddias> I don't believe we can break the user API in multihashing, have been thinking about it and the best option ( given that having both API would multiply deps) is to have multihashing-async module
11:04 <@daviddias> And recommend devs to use it in multihashing, explaining why
11:14 <@daviddias> On the first PR, my last comment is to Lee Joi validation, if there are more optional Args, then so be it :)
11:14 <@daviddias> s/Lee/lets keep
11:17 <@daviddias> @dignifiedquire: ^ :)
11:18 <dignifiedquire> so you mean creating a new module for multihashing?
11:20 <dignifiedquire> if we recommend devs to use the new version, we can just do a major version bump, with a changelog, that way everyone who wants to not refactor their code can stay on the old version, and we don't have to maintain to different versions
11:21 <dignifiedquire> daviddias: re Joi validation as I said in my comment I wasn't able to get that working, Joi would always throw if js-ipfs-api passed it something it didn't know
11:26 <dignifiedquire> daviddias: ^^
12:17 <@daviddias> dignifiedquire: ACK, what I meant is: the args that will be passed are defined on the spec
12:18 <@daviddias> so we can list them
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.
Actually, the offending parameter is not documented in the HTTP API: http://docs.ipfs.apiary.io/#reference/bootstrap/add/add does not list stream-channels
, which is always set to true by js-ipfs-api: https://github.com/ipfs/js-ipfs-api/blob/master/src/request-api.js#L92
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.
Let's add that as an issue in the http spec and add that rule here
arg: Joi.string().required(), // multiaddr to rm | ||
all: Joi.boolean() | ||
} | ||
} |
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.
same as above
const bs58 = require('bs58') | ||
|
||
const HttpAPI = require('../../src/http-api') | ||
const createTempNode = require('../utils/temp-node') | ||
const repoPath = require('./index').repoPath | ||
const ipfs = require('../utils/ipfs')(repoPath) |
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.
Is there a better name for that ipfs
file?
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.
I couldn't come up with one, happy to hear suggestions.
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.
ipfs-exec
or ipfs-run
?
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.
I like ipfs-exec
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.
done
}) | ||
return ipfs('bitswap wantlist').then((out) => { | ||
expect(out).to.be.eql(key) | ||
}) |
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.
This should be happening inside of the callback of the .inject
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.
Look closely, the inject
call is just so we get the right response, but the actual command shouldn't happen inside, otherwise it would hang forever.
done() | ||
}) | ||
it('stat', () => { | ||
return ipfs('bitswap stat').then((out) => { |
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.
In this new CLI library, if an exit code is different than 0, where do we get that error? Also, where is stderr?
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.
If you look into test/utils/ipfs.js
you see it asserts that the exitcode is 0
and that stderr is ''
. It returns a promise and will reject that promise when an error happens which will in turn display the failed things like exitcode and stderr.
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.
stderr
might not always be ''.
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.
If we want the command to success it will, for when you want it to fail, there is ipfs.fail('my cmd')
which expects failure and allows you to assert agains stderr
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.
sweet!
Can you document all of that in that ipfs-exec
module? :)
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.
done
@dignifiedquire, my bad, I used the review tool and forgot to click submit |
2ccd14d
to
e8b2c3c
Compare
Seems that Joi is the last bit fo make this happen: Also, want to squash commits? |
When CI is green and you gave your thumbs up |
16e48f6
to
028a98c
Compare
@dignifiedquire rebased, tests pass on CI, but fail locally:
Does it work on your machine? |
@diasdavid try running them again, they pass for me |
Got them running (had to do 2 fresh npm installs) |
- Change bullet formatting to make it possible to use the markdown headers to link specifically to the MFS portion of this document. - Link out from MFS section to the ProtoSchool tutorial as part of Q3 IPFS Docs initiative (see issue ProtoSchool/protoschool.github.io#260)
files get
files cat
block stat
bootstrap add
bootstrap rm
Ref #498