Phase 1 (0.6.0-beta): remove direct PostPush for encrypted posts

Encrypted posts now propagate only via the CDN (ManifestPush + neighbor
header updates), eliminating the sender→recipient traffic signal on the
wire. Encrypted DMs are indistinguishable from any other encrypted post.

- Remove push_post_to_recipients entirely from network.rs
- Remove call sites in create_post and re-encrypt-on-revoke
- PostPush handler now ignores non-public visibility (kept for public
  audience push path)

Known gap: non-follower DMs won't reach until Phase 3 (merged pull +
recipient-match). Followers receive via the existing CDN path — new
posts trigger neighbor-manifest updates, ManifestPush fans out to
downstream holders, recipients pull missing post IDs from followed
authors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scott Reimers 2026-04-21 20:46:34 -04:00
parent 921a0ec40a
commit e6265b52b6
3 changed files with 31 additions and 68 deletions

View file

@ -902,50 +902,6 @@ impl Network {
self.send_to_audience(MessageType::PostNotification, &payload).await
}
/// Push a full post directly to recipients (persistent if available, ephemeral otherwise).
pub async fn push_post_to_recipients(
&self,
post_id: &crate::types::PostId,
post: &Post,
visibility: &PostVisibility,
) -> usize {
let recipients: Vec<NodeId> = match visibility {
PostVisibility::Public => return 0,
PostVisibility::Encrypted { recipients } => {
recipients.iter().map(|wk| wk.recipient).collect()
}
PostVisibility::GroupEncrypted { group_id, .. } => {
// Push to all group members
match self.storage.get().await.get_all_group_members() {
Ok(map) => map.get(group_id).cloned().unwrap_or_default().into_iter().collect(),
Err(_) => return 0,
}
}
};
let payload = PostPushPayload {
post: SyncPost {
id: *post_id,
post: post.clone(),
visibility: visibility.clone(),
},
};
let mut pushed = 0;
for recipient in &recipients {
if self.send_to_peer_uni(recipient, MessageType::PostPush, &payload).await.is_ok() {
pushed += 1;
debug!(
recipient = hex::encode(recipient),
post_id = hex::encode(post_id),
"Pushed post to recipient"
);
}
}
pushed
}
/// Push a profile update to all audience members (ephemeral-capable).
pub async fn push_profile(&self, profile: &PublicProfile) -> usize {
// Sanitize: if public_visible=false, strip display_name/bio from pushed profile