fix(memory-graph): stop painting expired memories as expiring#1335
Open
abhay-codes07 wants to merge 1 commit into
Open
fix(memory-graph): stop painting expired memories as expiring#1335abhay-codes07 wants to merge 1 commit into
abhay-codes07 wants to merge 1 commit into
Conversation
getMemoryBorderColor flagged a memory as "expiring" whenever forgetAfter - now was less than seven days. That comparison is also true when forgetAfter is already in the past, since msLeft goes negative, so a memory whose forget time has elapsed but has not yet been swept to isForgotten kept the expiring border indefinitely instead of reading as a normal or expired node. Require msLeft > 0 so only memories with time actually left are marked expiring; elapsed ones fall through to the recency/default logic. Adds a regression test for the elapsed-forgetAfter case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
getMemoryBorderColordecides the expiring border from the time left untilforgetAfter:msLeft < SEVEN_DAYS_MSis meant to catch "expires within the next week", but it is also true for everyforgetAfterin the past, wheremsLeftis negative. So a memory whose forget time has already elapsed, but which the server has not yet swept toisForgotten, keeps the expiring border forever. It reads as "about to expire" indefinitely instead of as a normal or already-expired node, and the closer to the past it gets the more wrong the signal is.Fix
Require that there is actually time left before marking a memory expiring:
Elapsed memories fall through to the existing recency / default branch, which matches how an unremarkable node is drawn. The
isForgottenearly return above is unchanged, so anything already marked forgotten still gets the forgotten color first.Test
Added a case to
graph-data-utils.test.tsfor a memory with aforgetAftera minute in the past and an oldcreatedAt: it now resolves tomemStrokeDefaultrather thanmemBorderExpiring. Full package suite passes andtsc --noEmitis clean.