From f02023b669b5e92c6f72384a34aa3d9f9e6fc7a8 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sun, 16 Feb 2025 22:01:17 +0000 Subject: [PATCH] FEP-f228: Backfilling conversations (#499) Reviewed-on: https://codeberg.org/fediverse/fep/pulls/499 Co-authored-by: silverpill Co-committed-by: silverpill --- fep/f228/fep-f228.md | 96 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 fep/f228/fep-f228.md diff --git a/fep/f228/fep-f228.md b/fep/f228/fep-f228.md new file mode 100644 index 0000000..98d1d99 --- /dev/null +++ b/fep/f228/fep-f228.md @@ -0,0 +1,96 @@ +--- +slug: "f228" +authors: silverpill <@silverpill@mitra.social> +type: implementation +status: DRAFT +dateReceived: 2025-02-17 +discussionsTo: https://codeberg.org/silverpill/feps/issues +--- +# FEP-f228: Backfilling conversations + +## Summary + +The most common conversation backfill method is based on recursive retrieval of posts indicated by `inReplyTo` property and posts contained in `replies` collections. This is inefficient. + +[FEP-7888: Demystifying the context property][FEP-7888] suggests using the `context` property for grouping related objects (such as posts in a conversation). This property can resolve to a collection, which can be used for efficient backfilling without recursion. + +Two different implementations of `context` collection exist: collection of posts and collection of activities. + +## Requirements + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC-2119]. + +## Collection of posts + +This collection contains all posts in a conversation, according to the conversation owner. + +It is an `OrderedCollection`, and the order of items is chronological. It MUST contain at least one item, the top-level post. This post MUST have a `context` property referring to the collection. Other items might not have this property, + +When `context` property is present on a post, it MUST resolve to a collection of posts. + +There is a difference between contents of this collection and a reply tree defined by `inReplyTo` and `replies` relationships, because conversation owner might choose to not include certain replies. + +## Collection of activities + +This collection contains all activities related to posts in a conversation, including but not limited to: + +- `Create` +- `Update` +- `Delete` +- `Like` + +It is an `OrderedCollection`, and the order of items is chronological. It MUST contain at least one item, the `Create` activity for the top-level post. This activity MUST have a `context` property referring to the collection. Other activities might not have this property. + +When `context` property is present on an activity, it MUST resolve to a collection of activities. + +### Compatibility with Conversation Containers + +In [Conversation Containers][FEP-171b] this collection would coincide with the conversation container. It will contain `Add` activities in addition to other activities. + +### `history` property + +Collections described in this document can be implemented separately. + +If both of them are implemented, the `history` property can be added to a collection of posts, indicating a corresponding collection of activities. This property is defined in [FEP-bad1: Object history collection][FEP-bad1], although the use case here differs from the one described in that proposal. + +### `contextHistory` property + +`contextHistory` property can be used to make a reference from a post to a collection of activities. + +## Reading collections + +After top-level post of a conversation is discovered, the whole conversation can be retrieved using the following algorithm: + +- If `contextHistory` property is present, retrieve collection of activities and stop. +- If `context` property is present, retrieve collection of posts and stop. +- If `replies` property is present, retrieve collection of replies, and repeat this step for every reply. + +## Implementations + +Collection of posts: + +- NodeBB +- Iceshrimp.NET + +Collection of activities: + +- Streams +- Hubzilla + +## References + +- a, [FEP-7888: Demystifying the context property][FEP-7888], 2023 +- S. Bradner, [Key words for use in RFCs to Indicate Requirement Levels][RFC-2119], 1997 +- silverpill, [FEP-171b: Conversation Containers][FEP-171b], 2024 +- a, [FEP-bad1: Object history collection][FEP-bad1], 2023 + +[RFC-2119]: https://tools.ietf.org/html/rfc2119.html +[FEP-7888]: https://codeberg.org/fediverse/fep/src/branch/main/fep/7888/fep-7888.md +[FEP-171b]: https://codeberg.org/fediverse/fep/src/branch/main/fep/171b/fep-171b.md +[FEP-bad1]: https://codeberg.org/fediverse/fep/src/branch/main/fep/bad1/fep-bad1.md + +## Copyright + +CC0 1.0 Universal (CC0 1.0) Public Domain Dedication + +To the extent possible under law, the authors of this Fediverse Enhancement Proposal have waived all copyright and related or neighboring rights to this work.