this bug snuck in because of our special case handling of Fake and OtherFake in Protocol.targets. ugh. need to get rid of that, and elsewhere, eg ids.*.
fixes#1179
for #1166, #1151, maybe others. #1151 is the big motivation here: that we're currently generating and sending Bluesky a ton of reposts with blank subject cid/URL, which afaict is the main reason bridging is getting stuck for some accounts and the relay is constantly calling `getRepo`. I'm hoping this will reduce or eliminate that.
this isn't a big behavior change, but it is a kind of big change to routing logic. it's tested pretty well, but I still expect something to break. we'll see.
For https://github.com/snarfed/bridgy-fed/issues/1047#issuecomment-2195298955 . This is a bit of a YOLO, I'm a bit apprehensive about it: I'm jettisoning much of the reply-specific logic in Protocol.receive and instead delivering replies across protocols more often. Still only delivering self-replies to followers though, not other replies.
🤞🤞🤞
this contributed to hiding the root cause of #1121. log:
```
Running send task 6251425858687873358
Params: [('obj', 'ahBicmlkZ3ktZmVkZXJhdGVkclYLEgZPYmplY3QiSmh0dHBzOi8vaW5kaWV3ZWIuc29jaWFsL3VzZXJzL3NuYXJmZWQvc3RhdHVzZXMvMTEyNTgyNzgwNzcwODQzNjQ1L2FjdGl2aXR5DA'), ('orig_obj', ''), ('protocol', 'atproto'), ('url', 'https://atproto.brid.gy'), ('user', 'ahBicmlkZ3ktZmVkZXJhdGVkcjYLEgtBY3Rpdml0eVB1YiIlaHR0cHM6Ly9pbmRpZXdlYi5zb2NpYWwvdXNlcnMvc25hcmZlZAw')]
Sending https://indieweb.social/users/snarfed/statuses/112582780770843645/activity AS1: ...
Using server at https://api.bsky.app
Determining protocol for id https://indieweb.social/users/snarfed/statuses/112582780770843645
Key('Object', 'https://indieweb.social/users/snarfed/statuses/112582780770843645') owned by source_protocol activitypub
Can't translate object id https://indieweb.social/users/snarfed/statuses/112582780770843645 to atproto , haven't copied it there yet!
Determining protocol for id https://indieweb.social/users/snarfed
Key('Object', 'https://indieweb.social/users/snarfed') owned by source_protocol activitypub
Using server at https://bsky.social/
"name 'link_length' is not defined
Traceback (most recent call last):
File "/workspace/protocol.py", line 1611, in send_task
sent = PROTOCOLS[protocol].send(obj, url, from_user=user, orig_obj=orig_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/atproto.py", line 423, in send
record = to_cls.convert(base_obj, fetch_blobs=True, from_user=from_user)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/protocol.py", line 540, in convert
converted = cls._convert(obj, from_user=from_user, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/atproto.py", line 610, in _convert
ret = bluesky.from_as1(cls.translate_ids(obj.as1), blobs=blobs,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "granary/bluesky.py", line 577, in from_as1
text = src.truncate(full_text, None, OMIT_LINK)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "granary/source.py", line 908, in truncate
truncated = brevity.shorten(content, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "brevity.py", line 247, in shorten
base_length = total_length(tokens)
^^^^^^^^^^^^^^^^^^^^
File "brevity.py", line 188, in total_length
return sum(token_length(t) for t in tokens)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "brevity.py", line 188, in <genexpr>
return sum(token_length(t) for t in tokens)
^^^^^^^^^^^^^^^
File "brevity.py", line 183, in token_length
return link_length
^^^^^^^^^^^
NameError: name 'link_length' is not defined"
```