fix: deduplicate embedded Tags footer in compaction restore - #249
fix: deduplicate embedded Tags footer in compaction restore#249phil-lipp wants to merge 1 commit into
Conversation
Auto-capture embeds a "Tags: ..." footer inside the memory body (added in tickernelz#131); compaction restore appends its own canonical Tags line, duplicating the tags in the restored context. Strip the embedded footer when a canonical line follows. Regression from tickernelz#131.
lindixu6-hash
left a comment
There was a problem hiding this comment.
The duplication fix is valid for auto-captured records, and the submitted tests are failure-sensitive, but the current regex removes any trailing Tags: line whenever structured tags exist, even when the footer is user-authored and does not match those tags.
For example, a memory ending in Tags: user-authored evidence with structured tags ["canonical"] is rendered without that original line and only Tags: canonical remains. Manual/API/imported memories can store arbitrary content plus structured tags, so this is observable content loss.
Please strip the footer only when its normalized value matches the canonical structured tags (or when another reliable auto-capture provenance condition proves it is the generated footer), and add a regression showing a non-matching trailing Tags: line is preserved.
Local verification at 9ad5b8e with an isolated HOME:
- frozen root and web installs
- compaction target: 10/10 passed
- full suite after build: 409/409 passed
- typecheck, Prettier check, and production build passed
- mutation check: reverting only the implementation while retaining the tests produced the expected duplicate-footer failure
So the existing duplication regression is covered; the remaining blocker is preserving unrelated user content.
Auto-capture embeds a "Tags: ..." footer inside the memory body (added in #131); compaction restore appends its own canonical Tags line, duplicating the tags in the restored context. Strip the embedded footer when a canonical line follows.
Regression from #131.