Apologies for coming back to this after six months but I only found out this ever got a response today.
The reason I was trying to make a custom helper (or two of them, that’s not an issue) is that I want to be able to link to “the post that shows up first in the list” and “the post that shows up last in the list” regardless of what the sort option actually is—the goal is to switch how it behaves behind the scenes so for the non-techie intended user the experience is seamless.
If said list was already sorted by ID, then a custom helper based off #getPostsByTags might work (I’m trying to calculate this for the entire site listing, not a specific tag, so out of the box it won’t work), but take this example of post IDs ordered by date: 5, 1, 2, 4, 3. So, posts 4 and 5 are backdated. For my use case this is extremely likely. If posts on the page are ordered by date, but the helper is ordering posts by ID, it will return the second post as “first” and the first post as “last”, which is erroneous. This is why I was asking for clarification on how Publii determines post order, so that I can use that to inform a helper that can check how posts are ordered and behave accordingly.