vestige/crates
Bot 5d46ebfd30 fix(timeline): push node_type and tags filters into SQL WHERE
memory_timeline ran node_type and tags as Rust-side `retain` after
`query_time_range`, which applied `LIMIT` in SQL before the retain
saw anything. Against a corpus where one tag or type dominates, a
sparse match could be crowded out of the limit window — the tool
reported "no matches" when matches existed.

Fix: thread `node_type: Option<&str>` and `tags: Option<&[String]>`
through `query_time_range` and apply both as `WHERE` predicates so
`LIMIT` kicks in after filtering. Tag matching uses `tags LIKE '%"tag"%'` —
the quoted pattern pins to exact tags and rejects substring false
positives (e.g. `alpha` no longer matches `alphabet`).

Regression tests in `tools/timeline.rs`:
- test_timeline_node_type_filter_sparse: 10 `fact` + 2 `concept`,
  `limit=5`, query `concept` — asserts 2 rows; fails on pre-fix code.
- test_timeline_tag_filter_sparse: 10 rows tagged `common` + 2 tagged
  `rare`, `limit=5`, query `rare` — asserts 2 rows; same shape for tags.
- test_timeline_tag_filter_exact_match: one `alpha` row + one
  `alphabet` row, query `alpha` — asserts exactly 1 row.

Dashboard caller updated to pass `None, None` for the new filter
params. 19/19 timeline tests pass; 1295/1295 workspace tests pass;
clippy clean on vestige-core and vestige-mcp.

Ported from the Unforgettable/Anamnesis fork.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 15:00:20 -05:00
..
vestige-core fix(timeline): push node_type and tags filters into SQL WHERE 2026-04-20 15:00:20 -05:00
vestige-mcp fix(timeline): push node_type and tags filters into SQL WHERE 2026-04-20 15:00:20 -05:00