ux+fix: rename Network Identity → Device Address (UI) + redundancy authors

#6: UI rename — Network Identity → Device Address.
Just labels/wording, no backend changes. Tauri command names
(list_identities, create_identity, etc.) and DTO fields stay as-is;
the rename is purely user-facing. Settings labels, lightbox titles,
toasts, danger-zone text, and welcome-screen "Import an Identity"
button all updated. Distinguishes more clearly from Personas (which
ARE the posting identity peers see).

#7: Bug fix — redundancy showed 0 for new posts.
Root cause: get_redundancy_summary queried
  SELECT p.id FROM posts WHERE p.author = ?1
with ?1 = self.node_id (the device's network NodeId). After the
v0.6.0 network/posting-ID split, posts are authored by posting
identities (personas), not the network NodeId — so the query
returned 0 of my posts and the redundancy panel showed all zeros.

Fix: storage::get_redundancy_summary now takes &[NodeId] and uses
WHERE author IN (?, ?, ...) over every persona on the device.
Node::get_redundancy_summary gathers them via
list_posting_identities() before delegating.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scott Reimers 2026-05-14 22:49:54 -06:00
parent 83fd30753f
commit 100ea55a15
4 changed files with 50 additions and 29 deletions

View file

@ -3442,7 +3442,12 @@ impl Node {
pub async fn get_redundancy_summary(&self) -> anyhow::Result<(usize, usize, usize, usize)> {
let storage = self.storage.get().await;
storage.get_redundancy_summary(&self.node_id, 3_600_000)
// Posts are authored by posting identities (personas), not the
// network NodeId. Use every persona on this device so the
// summary counts all of my posts across personas.
let author_ids: Vec<NodeId> = storage.list_posting_identities()?
.into_iter().map(|p| p.node_id).collect();
storage.get_redundancy_summary(&author_ids, 3_600_000)
}
// ---- Networking ----

View file

@ -3129,17 +3129,30 @@ impl Storage {
/// Get a summary of redundancy across all our authored posts.
/// Returns (total, zero_replicas, one_replica, two_plus_replicas).
/// Redundancy summary across every post authored by ANY of the
/// device's posting identities (personas). Pre-v0.6.0 this matched
/// on the device's network NodeId, but the network/posting-ID
/// split moved authorship to the posting identity — so the old
/// query returned 0 of my posts and the UI showed 0 redundancy
/// for new posts.
pub fn get_redundancy_summary(
&self,
our_node_id: &NodeId,
author_ids: &[NodeId],
staleness_ms: u64,
) -> anyhow::Result<(usize, usize, usize, usize)> {
if author_ids.is_empty() {
return Ok((0, 0, 0, 0));
}
let cutoff = now_ms() - staleness_ms as i64;
let mut stmt = self.conn.prepare(
"SELECT p.id FROM posts p WHERE p.author = ?1",
)?;
let placeholders: Vec<&str> = (0..author_ids.len()).map(|_| "?").collect();
let sql = format!(
"SELECT p.id FROM posts p WHERE p.author IN ({})",
placeholders.join(","),
);
let mut stmt = self.conn.prepare(&sql)?;
let params_iter = rusqlite::params_from_iter(author_ids.iter().map(|n| n.to_vec()));
let post_ids: Vec<PostId> = {
let mut rows = stmt.query(params![our_node_id.as_slice()])?;
let mut rows = stmt.query(params_iter)?;
let mut ids = Vec::new();
while let Some(row) = rows.next()? {
ids.push(blob_to_postid(row.get(0)?)?);