feat(chat): mark outgoing messages that fail to send
Outgoing echoes were recorded optimistically regardless of whether the broadcast was actually submitted. Now broadcastChatMemos / broadcastChatMemosLite return whether the send was submitted (false on immediate failures: not connected, no spendable z-address, or a lite send already in progress), and the echo records a ChatDelivery status (Sent / Failed). The Chat tab shows a "not sent" marker in the error color on failed messages. The status persists in the DB (backward- compatible: old rows deserialize as Sent). (A later async failure — an opid that fails after submission — still surfaces via the existing send-progress notification; only the submit gate is reflected here.) Also removes the now-unused chat_readonly_note string (the composer replaced the read-only footer). Test: delivery status round-trips through the DB. Verified: Linux + Windows build with chat ON, ctest 100%, hygiene clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5846,6 +5846,19 @@ void testHushChatDatabase()
|
||||
}
|
||||
}
|
||||
|
||||
// Delivery status persists (a failed outgoing echo round-trips as Failed).
|
||||
{
|
||||
ChatDatabase db(dbPath);
|
||||
EXPECT_TRUE(db.unlockWithSecret("delivery-seed"));
|
||||
ChatMessage m = makeMsg("tD", 1, "cD", "not-sent one", ChatMessageKind::Message, 555);
|
||||
m.direction = ChatDirection::Outgoing;
|
||||
m.delivery = ChatDelivery::Failed;
|
||||
EXPECT_TRUE(db.append(m));
|
||||
std::vector<ChatMessage> loaded = db.load();
|
||||
EXPECT_EQ((int)loaded.size(), 1);
|
||||
EXPECT_TRUE(loaded[0].delivery == ChatDelivery::Failed);
|
||||
}
|
||||
|
||||
scrub(dbPath); scrub(dbPath2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user