Push activity should contain a list of commits pushed. In a simple trivial scenario, this list simply be the value of the standard
object property. But there’s a use case I have, that isn’t just such a single list.
Suppose you push 1000 commits at once. This may not be common, but it happens. For example perhaps when creating a new branch, or a new repo that is a clone/fork with existing commits. Should the Push activity have all those 1000 commits?
I checked what forges do with web hooks. Pushing a web hook with 1000 commits means a huge payload, and it’s very likely the web hook handler doesn’t really need all those commits. One forge, IIRC Gitea, simply trims the list to 20 commits at most. Whoever needs more, can just
git pull from the repo.
For a long time now, I’ve been doing IRC commit reports like this: If there are many commits, above some number, then display some of the first ones, then an ellipsis, then some of the latest ones. So, instead of displaying the last 20 commits, we could e.g. list the latest 10 commits pushed and the earliest 10. Or, say, the latest 9 and the 1 earliest commit pushed.
When you just see a list of some 3/5/10/20/whatever last commits, it’s not clear exactly what got pushed. Often people just guess, “oh this looks like many commits, including ones I’ve already seen, it’s likely someone just force-pushed or made a new branch/fork” etc. But instead of guessing, I want that info to be really provided, even if 1000 commits got pushed. What’s the earliest commit pushed, and what’s the latest? Also, specify how many commits got omitted in the middle.
So, I’m wondering how to model this in ActivityPub. In the simple list case, I’m doing this as follows:
object maps to an
OrderedCollection object, where
items is a list of commits and
totalItems says how many really got pushed, e.g.
items could list 20 commits but
totalItems could be 1000, letting you know that stuff got omitted for performance reasons etc.
How do I do it with multiple lists? I can’t come up with any sane way. Ideally, keep having
object map to an
OrderedCollection, but somehow have 2 lists of items in there. Here’s one idea:
- Suppose 1000 commits got pushed, but our limit to send is 20, so we’ll include the first 10 and the last 20, and we’ll omit the 980 in between
- To support
totalItemsworking the standard way,
itemswill contain the latest 10 commits and
totalItemswill be set to 1000
- An additional custom property
earlyItemswill contain the first 10 commits
- Whoever wants to get the number 980 will need to grab the 1000, subtract the length of the
itemslists, and conclude “oh cool I have 10 first and 10 last, and in between 980 that I didn’t receive”
This is weird, but I think it’s what I’ll do for now, just to get the implementation going.
Ideas very very welcome!!
I wish Collections had some built-in mechanism to specify first-items and last-items and how-many-omitted-in-between