A 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:
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 ^_^
Commits go into an OrderedCollection. items is for the chronologically late commits. I've been using a custom earlyItems for the early ones, but it's not in the spec.
Where should earlyItems go? It's not ForgeFed specific. But so is description, and I did put it in the spec.
I'm adding earlyItems to the spec, and leaving this issue open because we probably need to find a better place for it. Ideas?