fix(store): bound message event history#72
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3545f26c1a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _, err := tx.ExecContext(ctx, `delete from message_fts`); err != nil { | ||
| return Manifest{}, fmt.Errorf("clear message_fts: %w", err) | ||
| } | ||
| if _, err := tx.ExecContext(ctx, `delete from message_event_heads`); err != nil { |
There was a problem hiding this comment.
Seed event heads after share imports
When a config has git-share auto-update plus live sync, sync runs autoUpdateShare before runSyncTargets (internal/cli/app.go:567-572). This import clears message_event_heads but then imports messages/message_events and never rebuilds the derived heads, so the following sync hits sql.ErrNoRows in appendMessageEvent and appends a duplicate unchanged event for every message it touches; repeated share updates can therefore re-amplify the history this change is meant to bound. Seed the heads after import, or include them in the snapshot, before returning.
Useful? React with 👍 / 👎.
Summary
purge --keep-message-events Ncompaction for retained messages, scoped by workspace and partitioned by source/typeBehavior proof
An isolated built CLI imported the same Slack snapshot twice and retained one event. Changing alpha to beta and back to alpha produced exactly three ordered events. A compaction preview reported two removals without changing the table; the forced command removed exactly two, retained the newest event, and preserved the canonical message. Zero retention was rejected and help exposed the new flag.
Validation
go mod verifygo test -count=1 ./...go vet ./...Closes #68