Open christianbundy opened 4 years ago
Might be remark-ssb-mentions's fault (to which I can gladly put a fix), but help me understand, what is the actual disagreement with this schema and Manyverse? Can you put a diff or an expected-versus-actual?
Totally, I've just pushed f09bc49482b11d362d1550b9b2928fed18ee020e with a failing test:
not ok 8 manyverse link mention
---
operator: ok
expected: true
actual: false
at: Test.t (/home/christianbundy/src/ssbc/ssb-schema-definitions/tests/mentions.js:43:9)
stack: |-
Error: manyverse link mention
at Test.assert [as _assert] (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:225:54)
at Test.bound [as _assert] (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:77:32)
at Test.assert (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:343:10)
at Test.bound [as true] (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:77:32)
at Test.t (/home/christianbundy/src/ssbc/ssb-schema-definitions/tests/mentions.js:43:9)
at Test.bound [as _cb] (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:77:32)
at Test.run (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:93:10)
at Test.bound [as run] (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/test.js:77:32)
at Immediate.next [as _onImmediate] (/home/christianbundy/src/ssbc/ssb-schema-definitions/node_modules/tape/lib/results.js:81:19)
at runCallback (timers.js:705:18)
...
[
{
"field": "data.mentions",
"message": "referenced schema does not match",
"value": [
{
"link": "https://github.com/ssbc/ssb-db/blob/6c0cdd580b6166b106283e3f1745585e189252ce/create.js#L46",
"name": "https://github.com/ssbc/ssb-db/blob/6c0cdd580b6166b106283e3f1745585e189252ce/create.js#L46"
}
],
"schemaPath": [
"properties",
"mentions"
]
}
]
The schema expects each item of the mentions
array to be one of these values, and since mentions[].link
isn't a message/feed/blob it's failing the schema.
Putting it another way, this schema only expects message/feed/blob links in mentions[].link
, so it fails when you pass a URL.
yeah @staltz it's seems like that mention is kinda not adding anything
link
and name
... Aside from redundancy, I think we're bumping up against an assumption here that mentions are expected to be cypherlinks - because we're looking for contexts which might need notifications?
Mentions was originally used to do nicer @mentioning like :
{
text: 'hey @mix nice to see you '
mentions: [
{ name: '@mix', link: '@ye+4......sha256' }
]
}
So there could be an argument that you would use this to make nicer looking links ... but you're using markdown ... so ....
I'm treating it as a bug in remark-ssb-mentions, because looking at the code it seemed I missed an obvious array.filter(isLinkSSBMention)
.
Released remark-ssb-mentions 2.0.0 and began using that in Manyverse, a new version of the app to be released soon.
Can this issue be closed?
I think so. I'm still curious about:
Also, what should we do when we notice that messages from a popular client are failing a schema? Maybe there's a way to fix (or hide) the properties that are acting unexpectedly? Hiding would work fine here, but we wouldn't want to hide
recps
or similar. :grimacing:
But maybe I should open another thread?
In general, because SSB is decentralized and permissionless, all message types should never be trusted to be in the correct shape and should always be checked.
Totally. My question is moreso: what options do we have when we find a message with an invalid schema? When publishing a message, we can fail loudly if we see a message that doesn't pass the schema, but when building thread graphs it's less clear.
Concrete example: for Oasis I'm recursively building a thread graph by starting with a node and finding its ancestors:
root
.root
and fork
.
Example post:
%Mcs+W3JW6xLSAB/isERCWsCJhziY9MZjrGDfDIH6RD0=.sha256
:It looks like there's a disagreement between this schema and how Manyverse is publishing links. My guess is that the schema definition is "correct", but I'm not 100% sure. Also, what should we do when we notice that messages from a popular client are failing a schema? Maybe there's a way to fix (or hide) the properties that are acting unexpectedly? Hiding would work fine here, but we wouldn't want to hide
recps
or similar. :grimacing:cc: @mixmix @staltz
See also: #2