hhmx.de

· Föderation · So 18.06.2023 01:06:33

@feditips @Ralph it's a Pixelfed bug in how it reports notifications, github.com/pixelfed/pixelfed/i.

github.com/tuskyapp/Tusky/issu has technical details on exactly what's wrong.

Föderation · So 18.06.2023 01:24:27

@Tusky thanks for the details!

I've just commented on the ticket and asked @dansup if see he sees it as something that needs to be fixed on Pixelfeds end.

If so, I'm gonna pick it up first thing, tomorrow morning.

Tusky DE So 18.06.2023 09:35:09

@Tusky@mastodon.social @feditips@mstdn.social @Ralph@mstdn.ca

I also tried to get this done with . Made some progress, but still i wouldn't really trust the current situation. Unfortunately the documentation on https://docs.joinmastodon.org/methods/notifications/#get is not very clear, not complete and includes at least one mistake.

So thanks for providing https://docs.joinmastodon.org/api/guidelines/#pagination - as this confirms at least some parts of my implementation now.

Doing some monitoring how a original server responds, i never (!) saw the described link header! The response may include no link header or a header like this: Link: ; rel="next", ; rel="prev"

On my research i saw something in the source, that looks like Tusky as clients seems to generate a link header? If so, why?

"link: ; rel=\"next\", ; rel=\"prev\""

https://github.com/tuskyapp/Tusky/blob/develop/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingSource.kt#L107-L178

Besides of details, if the header should be named "Link:" or "link:", i'm totally missing the information, when the server should provide which links... and also i'm still confused, why i never saw Mastodon (in this case norden.social) to respond with a Link header, that really includes URLs.

For now i provide a filled Link header, if the result is not empty and this empty Link header, if no (new) notifications are retrieved. If it is not able to get notifications at all, no Link header will be included.

Tusky 22 now sometimes reports an array index out of range (-1) or similar (taking this from my memory, for exact message, i have to check it again).

During development i also saw Tusky sending requests for notifications in an endless loop... wondered why.

And obviously the way, Tusky fetches notifications, changes more or less totally from Tusky 21 to 22.

And... could someone clarify the difference between since_id and min_id? If Mastodon will handle this differently?

since_id = String. Return results newer than this ID
min_id = String. Return results immediately newer than this ID

What should be the difference between "newer" and "immediately newer"?

Currently is handling since_id and min_id in the same way.

But i just experienced "Problem 2", not "Problem 1", as described here:
https://github.com/tuskyapp/Tusky/issues/3580#issuecomment-1527198806

Would be nice to get my code working in a stable way for all Mastodon clients, including Tusky in version 21 and 22... and all coming versions... :-)

Have a nice sunny Sunday.

@SuitedUpDev@mastodon.online @dansup@mastodon.social

Föderation · So 18.06.2023 09:40:22

@Tusky @feditips @dansup @SuitedUpDev @Ralph

Sorry, looks like i have to check my URL parsing code again... :-(

Föderation · So 18.06.2023 09:50:41

@nick @Tusky @feditips @dansup @Ralph

Thanks for your report! I am currently going over the code that handles notifications and I've yet to fully make heads or tails out of it.

But I think(!) I found the cause of it. What is basically happening is the following, Pixelfed stores it's notifications id's in Redis, like this;

1
2
3

Then it subsequently asks Redis, for the notifications after id 2.

So it returns;
2
3

But it should be an exclusive after, so it would just return;

3

Whalebird · So 18.06.2023 11:53:09

@nick@norden.social @Tusky@mastodon.social @feditips@mstdn.social @dansup@mastodon.social @SuitedUpDev@mastodon.online @Ralph@mstdn.ca

Btw.: Should be fixed in the lab... was related to the parser.

And it looks like i mixed up my own accounts on replying... ;-)
@nick@norden.social = Me on a instance (as normal user)
@nick@hhmx.de = Me on a single account instance (my dev.)

Whalebird · Di 20.06.2023 07:50:56

@nick@hhmx.de @nick@norden.social @Tusky@mastodon.social @feditips@mstdn.social @dansup@mastodon.social @SuitedUpDev@mastodon.online @Ralph@mstdn.ca

Btw.: Edited the original posts... having hhmx.de updated this morning with the latest version of my code from yesterday evening... URL display should be fixed now.

Föderation · So 18.06.2023 13:34:53

@nick @Tusky @feditips @dansup @SuitedUpDev @Ralph I have some useful info about this, which this post is too short to contain.

So I've written it up at write.as/nikclayton/quick-note.

Hope that helps.

Whalebird · So 18.06.2023 14:14:50

@nikclayton@mastodon.social @nick@hhmx.de @Tusky@mastodon.social @feditips@mstdn.social @dansup@mastodon.social @SuitedUpDev@mastodon.online @Ralph@mstdn.ca

Thanks for your article, Nik.

For example, if i request https://norden.social/api/v1/notifications i got a result with 40 entries (what isn't really the default limit, that i expect) and HTTP headers like this:

[0] => HTTP/1.1 200 OK
[1] => Date: Sun, 18 Jun 2023 12:10:25 GMT
[2] => Content-Type: application/json; charset=utf-8
[3] => Connection: close
[4] => Vary: Accept-Encoding
[5] => Server: Mastodon
[6] => X-Frame-Options: DENY
[7] => X-Content-Type-Options: nosniff
[8] => X-XSS-Protection: 0
[9] => Permissions-Policy: interest-cohort=()
[10] => Referrer-Policy: same-origin
[11] => X-RateLimit-Limit: 300
[12] => X-RateLimit-Remaining: 299
[13] => X-RateLimit-Reset: 2023-06-18T12:15:00.134291Z
[14] => Cache-Control: private, no-store
[15] => Link: ; rel="next", ; rel="prev"
[16] => ETag: W/"a40b00fc16a54a32e86d119d1218d0b9"
[17] => Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; form-action 'none'
[18] => X-Request-Id: 034cd936-ccc4-4379-8a34-f4d5d9988684
[19] => X-Runtime: 0.462379
[20] => Strict-Transport-Security: max-age=63072000; includeSubDomains
[21] => Vary: Origin
[22] => Referrer-Policy: strict-origin-when-cross-origin

And [15] is missing URLs, right?