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

Abierto Apto para principiantes
#1,725 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 10 días

@akhilmodi29 ya está trabajando en esto.

Desde el 15/11/2026.

  • #1726 de @akhilmodi29 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
83/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend, data

Línea de trabajo

Empieza por backend/app/utils/memory_curator.py y lee _semantic_surface_date() junto con la configuración EVENT_ANNIVERSARY_LOOKAHEAD_DAYS. Reproduce el caso del 30 de diciembre del issue y después comprueba el comportamiento de la función para el 29 de febrero en un año no bisiesto. Se considera terminado cuando ambos casos devuelven la próxima fecha de aniversario esperada y se conserva el margen de tres días.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
Python
Estrellas
320
Forks
771
Merge medio
9 d 5 h
PR fusionados (30 d)
15

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de AOSSIE-Org/PictoPy

Todos los issues de AOSSIE-Org/PictoPy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.