BUG: Memory curator misses upcoming anniversaries across year boundaries and on leap days

Aperta Adatta ai principianti
#1,725 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

@akhilmodi29 ci sta già lavorando.

Dal 15/11/2026.

  • #1726 di @akhilmodi29 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
83/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend, data

Direzione di ricerca

Inizia da backend/app/utils/memory_curator.py e leggi _semantic_surface_date() insieme all’impostazione EVENT_ANNIVERSARY_LOOKAHEAD_DAYS. Riproduci il caso del 30 dicembre dell’issue, quindi verifica il comportamento della funzione per il 29 febbraio in un anno non bisestile. Il lavoro è completato quando entrambi i casi restituiscono la prossima data di anniversario prevista, mantenendo l’anticipo di tre giorni.

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

Descrizione

bug possible-duplicate
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

Description

In backend/app/utils/memory_curator.py, _semantic_surface_date() computes whether a semantic event's anniversary is within EVENT_ANNIVERSARY_LOOKAHEAD_DAYS (3 days) of the reference date.

However, the calculation only evaluates event_start.date().replace(year=reference.year):

  1. Year Boundary: If the reference date is in late December (e.g. Dec 30) and an event happened on January 1, the upcoming anniversary on Jan 1 of the following year (2 days away) is calculated as Jan 1 of the current year (delta = -363). This causes the lookahead condition 0 <= delta <= 3 to evaluate to False, prematurely surfacing the memory today instead of on its upcoming anniversary.
  2. Leap Day (Feb 29): When an event occurred on Feb 29, evaluating it in a non-leap year raises a ValueError, which immediately returns reference.isoformat(), discarding the lookahead window instead of falling back to Feb 28.

Steps to Reproduce

  1. Call _semantic_surface_date(reference=date(2026, 12, 30), event_start=datetime(2024, 1, 1)).
  2. Notice the anniversary is 2 days away (January 1, 2027), which is within the 3-day lookahead window.
  3. Observe output is "2026-12-30" (today) instead of "2027-01-01".

Expected Behavior

The function should evaluate the next upcoming anniversary in reference.year + 1 when the current year's date has passed, and map leap day anniversaries to Feb 28 in non-leap years.

Proposed Fix

Check reference.year + 1 if anniversary < reference, and catch ValueError to map Feb 29 to Feb 28.

Record
  • I agree to follow this project's Code of Conduct
Lingua principale
Python
Stelle
320
Fork
771
Merge medio
9g 5h
PR unite (30g)
15

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 AOSSIE-Org/PictoPy

Tutte le issue di AOSSIE-Org/PictoPy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.