[TASK] Track \Recent per session instead of clearing it for the selecting session

Aperta
#334 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, sqlite
Ambito
backend, databases

Direzione di ricerca

Read the SELECT, NOOP, and IDLE handling alongside ClientState and the database ClearRecentFlagsPerUser operation. Trace how SEARCH and FETCH FLAGS evaluate recent messages, then run the relevant IMAP tests and add coverage for both the selecting session and a second session. Done means the first session retains \Recent for SEARCH and FETCH while the second does not, and the known-gaps note from #316 is removed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What needs to be done?

Follow-up to #316 (review comment: https://github.com/OpenGovMail/raven/pull/316#discussion_r4708023896).

After #316, a read-write SELECT reports * N RECENT and then removes \Recent from every message in the mailbox in the database (db.ClearRecentFlagsPerUser). This makes the count bounded, but the session that ran SELECT loses the flag immediately. Right after receiving * 1 RECENT, the same client sees:

  • SEARCH RECENT / SEARCH NEW return no results
  • FETCH n FLAGS doesn't include \Recent

RFC 3501 (sections 2.3.2 and 7.3.2) says the session that is first told about a message should keep seeing it as \Recent for as long as it has the mailbox selected, and no other session should see it as recent.

Suggested approach

  • When SELECT clears \Recent, store the affected UIDs in ClientState (for example RecentUIDs map[uint32]bool) for that session.
  • Do the same for messages that first reach this session through NOOP / IDLE, and clear them from the database at that point.
  • Make SEARCH RECENT / NEW / OLD and FETCH FLAGS (including UID variants) check the session set instead of the stored flag.
  • Reset the set on CLOSE, UNSELECT, a new SELECT/EXAMINE, and logout.
  • STATUS should keep using the stored count.

Done when

  • Tests cover: after SELECT, the same session still sees the messages as \Recent in SEARCH and FETCH, and a second session doesn't.
  • The "known gaps" note from #316 can be removed.
Lingua principale
Go
Stelle
12
Fork
13
Merge medio
2g 3h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenGovMail/raven

Tutte le issue di OpenGovMail/raven

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.