How trust relationships enable automatic content approval and efficient message distribution across the federated network.
Auto-Approval for Trusted Connections
When receiving actions from connected users, the system can automatically create approval (APRV) tokens, enabling content to spread through the network via trusted relationships.
Auto-Approval Conditions
For an action to be auto-approved, ALL of the following must be true:
Approvable action type: Action type has approvable=true behavior
Applies to: POST, MSG, REPOST
Addressed to us: action.audience == our_id_tag
From different user: action.issuer != our_id_tag
Setting enabled: profile.auto_approve_actions = true in settings
Connection established: Issuer has bidirectional connection with us
The system checks issuer_profile.connected.is_connected() to determine trust. A connection is established when both parties have sent CONN tokens to each other.
Subscriber Fan-Out
For subscribable actions (like CONV), messages need to be delivered to all subscribers. The fan-out mechanism ensures efficient message distribution across the federated network.
Subscribable Actions
Actions with subscribable=true behavior can have subscribers:
CONV (Conversation) - subscribers receive messages in the group
Fan-Out Algorithm
schedule_subscriber_fanout(action_id, parent_id, issuer):
1. Walk parent chain to find subscribable root:
current = parent_id
while current:
parent_action = get_action(current) // local DB lookup
if is_subscribable(parent_action.type):
subscribable_root = parent_action
break
current = parent_action.parent_id
2. Check if we own the subscribable root:
is_local = (subscribable_root.audience == null
&& subscribable_root.issuer == our_id_tag)
|| subscribable_root.audience == our_id_tag
if not is_local:
return // Remote owner handles fan-out
3. Get subscribers:
subscribers = query_subscriptions(subscribable_root.action_id)
.filter(status = 'A') // Active only
4. Create delivery tasks:
for subscriber in subscribers:
if subscriber != our_id_tag
&& subscriber != issuer: // Exclude self and sender
schedule_delivery_task(
action_id,
subscriber,
key = "fanout:{action_id}:{subscriber}"
)
Local vs Remote Fan-Out
Scenario 1: Local CONV Owner Sends Message
Alice (CONV owner) sends MSG
β
βΌ
βββββββββββββββββββββββββββββββ
β ActionCreatorTask β
β - Creates MSG β
β - Calls schedule_delivery() β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β schedule_subscriber_fanout()β
β - Finds CONV (subscribable) β
β - CONV is local (we own it) β
β - Gets all SUBS β
β - Schedules delivery to eachβ
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
Bob, Charlie receive MSG
(all other subscribers)
Scenario 2: Remote Subscriber Sends Message
Bob (subscriber, not owner) sends MSG
on his instance
β
βΌ
βββββββββββββββββββββββββββββββ
β schedule_subscriber_fanout()β
β - Finds CONV (subscribable) β
β - CONV is NOT local β
β - No local fan-out β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β schedule_delivery() β
β - Deliver to CONV owner β
β (Alice) β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ (federation)
βββββββββββββββββββββββββββββββ
β Alice's instance receives β
β MSG at /inbox β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β schedule_subscriber_fanout()β
β - CONV is local to Alice β
β - Fan out to all except Bob β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
Charlie, others receive MSG
Related Action Bundling
When delivering certain actions (like APRV), related actions are bundled together in a single delivery to provide context.
Bundling Use Cases
APRV + Approved POST: When broadcasting an approval, include the approved content
INVT + Subject CONV: When inviting, include the conversation details
Inbox receives action with related tokens
β
βΌ
βββββββββββββββββββββββββββββββ
β Store related tokens β
β - Status = 'W' (waiting) β
β - ack_token = main action β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β Process main action β
β - Verify signature β
β - Check permissions β
β - Store action β
β - Execute on_receive hook β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β process_related_actions() β
β - Get tokens with β
β ack_token = main action β
β - For each: β
β - Skip permission check β
β - Verify signature β
β - Store action β
βββββββββββββββββββββββββββββββ
Key point: Related actions skip permission checks because they are pre-approved by the main action issuer. The trust flows from the APRV issuer to the related content.
APRV Broadcast Example
Alice approves Bob's POST
β
βΌ
βββββββββββββββββββββββββββββββ
β Create APRV β
β - sub = Bob's post action_idβ
β - Check: subject.broadcast β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β schedule_broadcast_delivery β
β - Get Alice's followers β
β - Include Bob's POST token β
β as related action β
βββββββββββββ¬ββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββ
β For each follower: β
β POST /inbox β
β { β
β token: APRV_token, β
β related: [POST_token] β
β } β
βββββββββββββββββββββββββββββββ