-
Notifications
You must be signed in to change notification settings - Fork 31
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
User Objects with wrong source_protocol #558
Comments
cc @tantek , this is why you're not currently seeing likes/reposts. Ugh. |
Looks like this was from intra-BF follows, eg @snarfed.org@snarfed.org currently follows @tantek.com@tantek.com through BF. Ugh. When either of those accounts publishes a new post, BF delivers an AP {
"id": "https://fed.brid.gy/r/https://tantek.com/2023/171/t1/anniversaries-microformats-posse#bridgy-fed-create",
"actor": "https://fed.brid.gy/tantek.com",
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"object": {
"type": "Note",
"id": "https://fed.brid.gy/r/https://tantek.com/2023/171/t1/anniversaries-microformats-posse",
"url": "https://fed.brid.gy/r/https://tantek.com/2023/171/t1/anniversaries-microformats-posse",
"attributedTo": {
"type": "Person",
"id": "https://fed.brid.gy/tantek.com",
"url": "https://fed.brid.gy/r/https://tantek.com/",
"preferredUsername": "tantek.com"
"..."
},
"..."
},
"..."
} OK so, ugh, what do we do. I think I'll just block intra-BF follows and activities entirely for now, try to clean up existing Remaining open questions:
|
We currently have 16 of these intra-BF follows (ie with |
Discovered one possibly relevant issue: when we loaded an |
Wooowwww, also discovered that ndb's in-memory cache has the same bug. And that cache is on by default! I didn't realize that. Oof. Will report that, but not sure what to do. Guess I have to pass |
^ filed an ndb bug |
...so that modifications aren't durable in memory until we put() them. for #558
it has a bug/weird behavior that we want to avoid, at least for now. googleapis/python-ndb#888 #558
I disabled all of those followers with: for f in (
Follower.query(
Follower.to >= ActivityPub(id='https://fed.brid.gy/').key,
Follower.to < ActivityPub(id='https://fed.brid.gz/').key).fetch()
+ Follower.query(
Follower.from_ >= ActivityPub(id='https://fed.brid.gy/').key,
Follower.from_ < ActivityPub(id='https://fed.brid.gz/').key).fetch()
+ Follower.query(Follower.from_ == Web(id='fed.brid.gy').key).fetch()
+ Follower.query(Follower.to == Web(id='fed.brid.gy').key).fetch()
):
f.status = 'inactive'
f.put() |
also other ActivityPub id validation. #558
Similar cleanup for users, only had two of them with >>> webs = Web.query().fetch()
>>> len(webs)
>>> 968
>>> User.load_multi(webs)
>>> len([w for w in webs if w.obj and w.obj.mf2])
254
>>> len([w for w in webs if w.obj and w.obj.as1])
254
>>> len([w for w in webs if w.obj and w.obj.as1 and not w.obj.mf2])
0
>>> len([w for w in webs if w.obj and w.obj.source_protocol in ('web', 'webmention')])
948
>>> len([w for w in webs if w.obj and w.obj.source_protocol in ('ap', 'activitypub')])
2
>>> [w.key for w in webs if w.obj and w.obj.source_protocol in ('ap', 'activitypub')]
[Key('MagicKey', 'evanstoner.com'), Key('MagicKey', 'kandr3s.co')]
>>> w = Web.get_by_id('https://kandr3s.co/'); w.obj.source_protocol = 'web'; w.obj.put()
Key('Object', 'kandr3s.co')
>>> w = Web.get_by_id('evanstoner.com'); w.obj.source_protocol = 'web'; w.obj.put()
Key('Object', 'https://evanstoner.com/') |
More, for posts: >>> ts = Object.query(Object.key >= Object(id='https://tantek.com/').key,
Object.key < Object(id='https://tantek.con/').key).fetch()
...
>>> len(ts)
>>> 152
>>> len([t for t in ts if t.source_protocol in ('ap', 'activitypub')])
17
>>> for t in ts:
if t.source_protocol in ('ap', 'activitypub'):
t.source_protocol = 'web'
t.put()
...
>>> ss = Object.query(Object.key >= Object(id='https://snarfed.org/').key,
Object.key < Object(id='https://snarfed.orh/').key).fetch()
...
>>> len(ss)
709
>>> len([s.key for s in ss if s.source_protocol in ('ap', 'activitypub')])
35
>>> for s in ss:
if s.source_protocol in ('ap', 'activitypub'):
s.source_protocol = 'web'
s.put()
... |
Tested a few AP => wm likes, they all worked. OK, phew, tentatively closing. For now. |
would you have a link for that? |
Yup, googleapis/python-ndb#888, it's visible as a cross-reference link here in the issue just above that comment, hence the Also consider googleapis/python-ndb#765 if you're using ndb, sadly 😢. |
Ah, thanks. Maybe I knew that I'm not using NBD now, but used it back in 2011-2012 for a mobile game high score list, and liked it a lot actually. Recently used postgres on the google cloud, an now we use Firebase, which Google bought many years ago, and which also provides a similar (?) document db. I'm using Pydantic to get like a schema for the otherwise ndb like schemaless firebase use. The Python SDK for Firebase supports async use. |
Personally, I doubt that Regardless, yes! Firebase's db Firestore (in "Datastore mode") is the backend for ndb now too, ndb itself is just a thin client library. Firestore is great! Postgres etc too. |
I don't understand this one yet, collecting data points here.
Protocol.receive
#529/New account types, starting with ActivityPub #512) yesterday, specifically generalizingweb.py
's inbound webmention handling fromWeb
/ActivityPub
-specific toProtocol
-general. It's working, somewhat, but inbound AP responses aren't working.Looks like that's because a number of
Web
users'obj_key
Objects have the wrongsource_protocol
, eg https://tantek.com/ and https://snarfed.org/ are currently both set toactivitypub
. They both haveupdated
before this launch last night though. tantek.com's is 2023-06-20 12:52:24 PDT , snarfed.org's is 2023-06-04 8:26:43 PDT. I haven't found the request that modified tantek.com's, even searching forWrote Object https://tantek.com/
, whichObject._pre_put_hook
should have emitted. Haven't searched for snarfed.org's yet.Next steps:
Web
's storedObject
s tosource_protocol=web
, then retry a response and see what happensreceive
, consider trying multiple possible protocols for each object all the way through. We'd probably need to add protocol toObject
's key id though, which would be a pain.The text was updated successfully, but these errors were encountered: