mateclaw/mateclaw-server/src/test/java/vip/mate/memory/service
倪程伟 3ac73623ee
fix(memory): bound mate_memory_recall.filename to VARCHAR(256) (#461) (#463)
mate_memory_recall.filename is VARCHAR(256), but the snippet-level recall
tracker assembles the key as `path + '#' + H2-heading-slug`. When the LLM
writes an over-long daily-note heading (the summarize prompt placed no
length cap on the `##` title), the CJK-preserving slug pushes the filename
past the column, and writes fail with Data too long / string too long.

Three layers of defence, root cause + hard caps:

1. prompt (source) — summarize-system.txt now asks for short (≤30 chars)
   `##` titles; details go in the body, not the heading.
2. slug cap (close to source) — MemoryRecallTracker.sanitizeSectionKey
   caps the slug at MAX_SECTION_SLUG=200, leaving path+'#' well under 256.
3. write-side cap (catches every path) — MemoryRecallService.recordRecall
   truncates filename to MAX_FILENAME_LENGTH=255 at the entry point, so
   the select/insert/update branches share one value and the dup-key
   concurrency fallback still matches. Covers trackActiveRetrieval too,
   which bypasses sanitizeSectionKey.

Tests: MemoryRecallFilenameTruncationTest covers both caps (over-long CJK
heading, normal heading untouched, ascii slug, date prefix survives) plus
an end-to-end assertion that the stored value fits VARCHAR(256). Existing
memory-suite unit tests still green.
2026-07-01 18:42:20 +08:00
..
AlwaysOnFileBudgetTest.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00
DreamFlagGuardTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
MemoryHilServiceTest.java fix(memory): route long-term memory edits to the file being edited (#148) 2026-05-18 11:28:01 +08:00
MemoryRecallFilenameTruncationTest.java fix(memory): bound mate_memory_recall.filename to VARCHAR(256) (#461) (#463) 2026-07-01 18:42:20 +08:00
MemorySummarizationGateTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
MemorySummarizationStructuredRoutingTest.java test(memory,wecom): align two stale tests with current production behavior 2026-06-09 10:15:36 +08:00
SoulSummarizerServiceTest.java chore(test): backfill mateclaw-server/src/test/ that earlier PRIVATE_ITEMS pattern accidentally excluded 2026-05-12 17:38:08 +08:00
StructuredMemoryConsolidationServiceTest.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00
StructuredMemoryPrefetchTest.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00