LearnNewsExamplesServices
Frontmatter
id7691
titleRefactor: Harden Memory Core DB services against undefined `where` clauses
stateClosed
labels
bugairefactoring
assignees[]
createdAtNov 2, 2025, 5:40 PM
updatedAtNov 2, 2025, 5:44 PM
githubUrlhttps://github.com/neomjs/neo/issues/7691
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 2, 2025, 5:44 PM

Refactor: Harden Memory Core DB services against undefined where clauses

Closed v11.0.0 bugairefactoring
tobiu
tobiu commented on Nov 2, 2025, 5:40 PM

This ticket documents a series of fixes to improve the robustness of our ChromaDB query services within the Memory Core. The ChromaDB client throws an error when a where clause is constructed with an undefined value (e.g., where: { category: undefined }).

To address this, the following changes were made:

  1. SummaryService.mjs (querySummaries):

    • Refactored to conditionally build the query object. The where clause is now only added if a category is provided.
  2. MemoryService.mjs (queryMemories):

    • Applied the same conditional query construction pattern. The where clause is only added if a sessionId is provided.
  3. MemoryService.mjs (listMemories):

    • Added a guard clause to exit early if sessionId is falsy, preventing an invalid query.
  4. SessionService.mjs (summarizeSession):

    • Added a guard clause to exit early if sessionId is falsy. This is a critical safety check to prevent the service from accidentally summarizing the entire memory collection.
  5. SessionService.mjs (findUnsummarizedSessions):

    • Added a .filter(Boolean) to the list of session IDs. This ensures that any null or undefined session IDs are removed at the source, preventing invalid data from being passed to downstream methods.

These changes collectively prevent a class of potential runtime errors and make the data service layer more resilient.

tobiu added the bug label on Nov 2, 2025, 5:40 PM
tobiu added the ai label on Nov 2, 2025, 5:40 PM
tobiu added the refactoring label on Nov 2, 2025, 5:40 PM
tobiu referenced in commit 6874e4e - "Refactor: Harden Memory Core DB services against undefined where clauses #7691" on Nov 2, 2025, 5:44 PM
tobiu closed this issue on Nov 2, 2025, 5:44 PM