(bopwiki dev) how do I remake mastodon's cached post?

I’m working on an “activitypub” implementation for my program that manages and generates threaded notes / blog posts - Valenoern/bopwiki: experimental 'microwiki implementation' / 'mini CMS' - bopwiki - Codeberg.org
(It might actually be just ActivityStreams, I’m not entirely sure?)

The thing about this program is I wanted it to be a desktop application where you edit all your blog-like data and then put that up statically instead of having any kind of server daemon that processes requests. So I started out with the plan that for activitypub it would be something of a read-only feed where you could register on a more ‘heavyweight’ fediverse platform like mastodon to boost your posts there and take any replies / adding any ‘LRT’ type stuff.

I started coding this and I managed to output static Activity files that came up as posts on mastodon.

But then I ran into a problem.
Sometimes as I’m messing with activitypub, I add or change what fields are added to my Activities, which can lead to “toots” that look entirely different. But mastodon is not very forgiving about mistakes in Activities; it seems to cache the post indefinitely even if I try to delete it by adding a Delete activity to the outbox or replacing the post’s content with a Tombstone and looking these up.
I confirmed what was going on when I pulled up the post on another instance - that instance had the new version of the post, but when I boosted it the first instance saw it as the old incorrect version.

So… I expect this is going to be a bit of a problem for the future.
mastodon and my program have a different set of core assumptions - for mastodon, each post ID always contains the same content and you make new post IDs to edit that content, while with my program the post IDs are meant to mostly stay constant while the content of the post can change. When you look up the html rendering of the page you may find it was edited a bit, more external links or media were attached, replies were moved around places, etc; as implied in its longhand name, bopwiki is meant to be vaguely like a personal mastodon thread you can edit. (and this is why allowing replies directly on it as if it were literally a mastodon thread is a conceptually bad idea even if it were possible.)

That said, the way I usually create posts I often add an excerpt - which I write once and after about maybe its first week of existence am unlikely to edit again - and if there, this becomes the body of the post Activity. So for individual isolated posts I feel like caching is not a huge problem if I could just manually nudge a cached version of a post to update somehow.
(The possible chaos from having to update which posts are connected to which might be a problem for another day.)

Is there any good way to tell a particular fediverse server (especially mastodon ones) that my server with its static-file-based account updated or deleted-and-recreated one of its posts but that the “correct” post still has the same uri? How long do I have to wait for it to update?
I’m perfectly okay with having to use some kind of simple client to send a POST request; the main thing I’m trying to avoid is programs that run all the time.

[edit: I’m not totally sure if Activity is the word I meant or just ActivityStreams Object. I just mean an activity+json object that’s an actor or post]

1 Like

Mastodon does not currently support post editing. We might add it in the future, but for right now the only option is to delete the post (POST a Delete activity) and recreate it with a new ID.

Okay, I guess out of the two questions I had that answers the specific one. I may not really like the answer mastodon had to this - I feel like it makes it a lot harder for developers like me messing with ActivityPub for the first time to test out how it works without worrying that every mistake is permanent - but I can accept it.

Now for the “general” version of the question.

This morning I was thinking about a way to dodge the post uri problem. I’d been assuming the post uri would be the url of the post’s AP/AS file, but I realised I could just add a revision number to uniquely identify which ‘attempt’ to reach the fediverse each post was on (probably always starting at 1).

so the uris become something like:
before - https://distributary.network/bop/reactions/ap-entry/1627115700
after - https://distributary.network/bop/reactions/ap-entry/1627115700_r3

Now I’m left with a more abstract problem of how to interoperate two programs/platforms that have entirely different workflows.
The way bop works, you have a folder of entries which are just simple text files. They have an entry body (the blog post etc) and a block of “meta lines” which can do various semantic things. Example:

# illustration entry

here is the body of the entry

=> 1623643359 external link
<= 1631146517 entry replied to
# pub_distri
; above is a tag to select entries to publish - this is a comment

This entry might live in a file like 1631146746_example.txt, and render to a file like /publish/path/1631146746_example.htm. (htm was a subjective choice just for reasons like the names fitting into columns better when debugging what pages were published with ls.)
When publishing as an AP/AS object it might render to a file like /publish/path/ap-entry/1631146746, or after a near-future update, maybe /.../ap-entry/1631146746_r1.

The problem is, bop is a bit minimalist and sort of aims for a file/folder structure where files are only annotated with information meaningful to the author.
It would be possible on paper to add a meta line type for ‘activitypub revision’ (1, 3, etc) but it seems like an extraneous thing to have to tack on to each entry.
It would also be possible to keep ‘extraneous’ metadata like this in separate files that attach themselves to entries, or in some kind of out-of-the-way place like a .bop directory.

One day, bop is actually intended to have rdf support, where you can specify an rdf triple subject+predicate and use that to define a new meta line or simply add a named metadata value.
But those ‘fancy’ meta lines don’t really exist yet; all the default meta line types are somewhat hardcoded at the moment and it’s been a little while since I was actively working on that part of the program.

So I’m a bit at a loss for how to test bop’s activitypub support when I mostly only use mastodon and it’s not immediately practical to get the Editable Fediverse and the Uneditable Conversation Fediverse to interoperate right now until I do a whole bunch more work on my program (possibly in the form of really ugly duct tape that’s a pain to finish properly as I fix each data folder along with the application code).

Is there another platform I can test with that actually supports updating its cache?
Like for instance, a ‘small’/‘lightweight’ activitypub server I could almost trivially install and self-host that would display the bop posts similarly enough to how mastodon does that I could be confident mastodon would interpret the data about the same way, but I could ‘refresh’ the entries, even if I have to use administrator tools to do it? (I tried looking at the documentation for how to install mastodon once, and I don’t remember the exact reason, but for some reason it was way too much for me to even try and I gave up.)

I think what I mainly mean is things like “if mastodon displays Articles as just a link and ignores the ‘content’ property, this one does too”. Though if it decided to follow the standard better than mastodon in a way that could guide me to create more standards-compliant posts that make even better uses of AP/AS features, I’d take that as well, as long as I’m not stuck using this dangling-in-the-air future version of ActivityPub actually existing platforms don’t support and may never support.

There are a number of ActivityPub servers which support editing and updates. Unfortunately Mastodon isn’t one of them.

Generally all these platforms require is that an updated timestamp be greater than the published timestamp and also greater than any existing updated timestamp (because you can’t guarantee the order that edits arrive, you don’t want to wipe out a later edit with an earlier one). You could get a Friendica or Hubzilla or Zap account if you want to test your update code. There are probably several others but I’m aware of these.

All of these platforms also display ‘Article’ as an article and not a link. I’m fairly certain Eugen implemented that just to piss me off; as he closed a bug I created about supporting multi-media HTML articles in Mastodon with that commit. We can send them as Note or Article and currently send them as Note just because that commit basically destroyed all our existing Article content on Mastodon. I can’t tell you the best way for your own project to work around platform quirks. I’ve been considering encapsulating all of the Mastodon quirk code (hundreds if not thousands of lines) into a custom protocol driver; so it’s highly likely we’ll eventually support ActivityPub and Mastodon as completely different communication stacks.

(note: I feel almost like this should be an edit but the edit button seems to be gone. ironically enough after what topic this was.)

I’ve been working on the “revision numbers” solution and surprisingly, it’s been working fairly well so far. I’ve gotten “later revisions” of a post to properly show up on mastodon, and very interestingly, even got mastodon to display a rel=canonical link to the plain uri I added thinking it would just be a nod to anyone opening my AS file of “you know, bop is actually supposed to work this way”.

So, I’m just going to keep experimenting with this and see how far I can get before the day mastodon’s design thwarts me. I can already see that on things like CWs/“summary” I am probably just going to have to commit to a different decision than mastodon (right now CWs seem to most naturally fit within post excerpts) but at the moment I have a lot of hope.