notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit e8a3fb4eb9e5355b76297e94627ead4f90dabb76
parent dcf5423e42cdf38bcdfa0eb29704319cce3b7389
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 17 Feb 2026 13:09:27 -0800

skip old JSON-content session state events during restore

Old kind-31988 events used JSON in the content field. Filter these
out in the fold predicate so they do not create ghost sessions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_dave/src/session_loader.rs | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/crates/notedeck_dave/src/session_loader.rs b/crates/notedeck_dave/src/session_loader.rs @@ -249,11 +249,19 @@ pub fn load_session_states(ndb: &Ndb, txn: &Transaction) -> Vec<SessionState> { .tags(["ai-session-state"], 't') .build(); - let not_deleted = |note: &nostrdb::Note| { - get_tag_value(note, "status") != Some("deleted") + let is_valid = |note: &nostrdb::Note| { + // Skip deleted sessions + if get_tag_value(note, "status") == Some("deleted") { + return false; + } + // Skip old JSON-content format events + if note.content().starts_with('{') { + return false; + } + true }; - let note_keys = query_replaceable_filtered(ndb, txn, &[filter], not_deleted); + let note_keys = query_replaceable_filtered(ndb, txn, &[filter], is_valid); let mut states = Vec::new(); for key in note_keys {