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

オープン 初心者向け
#1,725 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 10 日以内に返信

@akhilmodi29 がすでに取り組んでいます。

2026年11月15日 から。

  • #1726 @akhilmodi29 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
83/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend, data

調査の方向性

backend/app/utils/memory_curator.pyから始め、EVENT_ANNIVERSARY_LOOKAHEAD_DAYS設定とあわせて_semantic_surface_date()を読みます。issueの12月30日のケースを再現し、その後、うるう年ではない年の2月29日に対する関数の動作を確認します。両方のケースで、3日間の先行期間を維持しながら、期待される次の記念日の日付が返されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Python
スター
320
フォーク
771
平均マージ
9日 5時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AOSSIE-Org/PictoPy のほかの issue

AOSSIE-Org/PictoPy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。