Skip to content

v1.0.7 — entitySearch fix + obs_au trigger + 71 new tests

Choose a tag to compare

@madetocreate madetocreate released this 21 Apr 18:44
· 57 commits to main since this release

Correctness patch + test expansion. No API changes.

Fix

memory_entity_search silently lost summary and observation hits.
The primary FTS5 query joined search_fts to entities with an OR that mixed entity-level and observation-level matches. That puts the MATCH subquery behind a derived JOIN, which SQLite rejects with "unable to use function bm25 in the requested context". The try/catch caught it and fell back to WHERE name LIKE ? — so any hit whose match lived in the entity summary or in an observation disappeared.

Rewrite: two MATCH-ed subqueries UNION ALL'd by entity_id, then JOIN entities + GROUP BY with MIN(rank). The fallback LIKE now also covers summary and observations.content via a LEFT JOIN, so an FTS outage still returns sensible rows.

Add

  • obs_au trigger on entity_observations so an UPDATE to an observation's content refreshes the FTS5 row instead of leaving a stale one pointing at the old text. Symmetric with the existing triggers on learnings / decisions / entities.

Tests

Expanded from 12 → 83 tests (+71). New files:

  • src/tools/entity.test.ts — 35 tests covering entity_create, entity_observe, entity_search, entity_open, entity_relate, entity_delete. Exercises the UNION-ALL rewrite, the obs_au trigger, and every zod-schema edge case.
  • src/tools/session.test.ts — 19 tests covering session_start / session_end, same-project ordering, the auto-close-latest-open path, archived-learning exclusion in recentLearnings.
  • src/tools/search.test.ts — 17 tests covering cross-type hits (learning / decision / entity / observation), type filters, the v1.0.6 archived-learning regression guard, bare-LIMIT semantics.

All 83 tests green, tsc --noEmit clean.

Install

npx -y @studiomeyer/local-memory-mcp