Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion packages/backfill/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ This package provides ActivityPub conversation backfill support for the
[Fedify] ecosystem. It can retrieve post-like objects from a seed object's
context collection, following the direct FEP-f228-style path where the
context dereferences to a `Collection`, `OrderedCollection`, `CollectionPage`,
or `OrderedCollectionPage`.
or `OrderedCollectionPage`. It can also use an opt-in reply-tree strategy to
walk `inReplyTo` ancestors and `replies` descendants when context collections
are unavailable or incomplete.

[JSR badge]: https://jsr.io/badges/@fedify/backfill
[JSR]: https://jsr.io/@fedify/backfill
Expand Down Expand Up @@ -62,6 +64,10 @@ for await (
The seed object itself is not yielded. If it appears in the discovered
collection, it is skipped by ID.

Configured strategies run in order. They share `maxItems`, `maxRequests`,
abort state, and object ID deduplication; if two strategies discover the same
object, the first strategy keeps its `BackfillItem` metadata.

By default, `backfill()` uses the `context-auto` strategy. In this mode,
collection items are treated as backfillable objects by default. If an item is
recognized as a supported `Create` activity, `backfill()` extracts the
Expand All @@ -82,3 +88,24 @@ for await (

The `context-activities` strategy currently supports `Create` activities and
yields the activity's object, not the activity itself.

To combine the FEP-f228 context collection path with traditional reply-tree
crawling, add the `reply-tree` strategy after `context-auto`:

~~~~ typescript
for await (
const item of backfill({ documentLoader }, note, {
strategies: ["context-auto", "reply-tree"],
maxDepth: 4,
})
) {
console.log(item.origin, item.depth, item.object);
}
~~~~

The `reply-tree` strategy walks `inReplyTo` ancestors and `replies`
descendants. It yields discovered post-like objects only; it does not extract
objects from Activity wrappers. Immediate parents and direct replies have
depth 1, their next-level parents or replies have depth 2, and so on.
Reply-tree traversal defaults to a maximum depth of 10; set `maxDepth` to use a
different limit.
Loading