Repository navigation
feat(#347): timeline event tracking — per-memory audit log - #388
Merged
Merged
Conversation
Add an append-only event log per memory (created, updated, recalled,
consolidated, tagged, forgot) in a new timeline_events table (schema v9).
Core (uteke-core):
- New timeline.rs module:
- TimelineEventType enum (6 variants)
- TimelineEvent struct (id, memory_id, event_type, event_data, created_at)
- Store::add_timeline_event / list_timeline_events / count_timeline_events
- Uteke::timeline / count_timeline_events / try_timeline_event
- Schema migration v8 → v9: timeline_events table + 3 indices (idempotent,
no data backfill — timeline starts from this version forward)
- remember_precomputed() now emits a 'created' event (best-effort)
CLI (uteke-cli):
- New 'uteke timeline <id> [--limit N]' command (default 20, JSON support)
Tests (+5 new):
- TimelineEventType roundtrip
- timeline_add_and_list (with JSON event_data)
- timeline_limit + count
- empty for missing memory
- migration_dispatcher_reaches_v9
Existing schema-version assertions updated (v8 → v9).
Closes #347
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (1)
Review powered by cora-cli · BYOK · MIT |
CodeCora #388 questioned whether the 'created' timeline event covers all remember paths. The hook is correctly placed in remember_precomputed (the single shared creation path called by remember(), remember_typed(), remember_with_contradiction(), and the consolidate path). Comment now makes that explicit. Also emits a 'consolidated' event when remember_with_contradiction supersedes an older memory, with the deprecated id in event_data.
CodeCora #388 found two issues: 1. Consolidated timeline event was attached to the NEW replacement memory, but semantically it should be on the OLD (superseded) memory — that's the one being retired. Fix: attach to deprecated_id, with metadata 'replaced_by' pointing to the new memory. 2. Timeline events ordered by created_at DESC only, but RFC3339 strings from to_rfc3339() omit fractional seconds when zero. Events created in the same second had undefined relative order. Fix: add 'id DESC' as a secondary sort key (AUTOINCREMENT ensures insertion order). Also: handle deprecated_id being Option<String> properly.
…ring CodeCora #388: add_timeline_event used serde_json::to_string(v) .unwrap_or_default() which stored empty string "" on serialization failure, silently corrupting event data. Fix: on serialization failure, log a warning and store 'null' as a detectable sentinel value instead of masking it as empty.
| fn map_timeline_row(r: &rusqlite::Row) -> rusqlite::Result<TimelineEvent> { | ||
| Ok(TimelineEvent { | ||
| id: r.get(0)?, | ||
| memory_id: r.get(1)?, |
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
* feat(#347): timeline event tracking — per-memory audit log Add an append-only event log per memory (created, updated, recalled, consolidated, tagged, forgot) in a new timeline_events table (schema v9). Core (uteke-core): - New timeline.rs module: - TimelineEventType enum (6 variants) - TimelineEvent struct (id, memory_id, event_type, event_data, created_at) - Store::add_timeline_event / list_timeline_events / count_timeline_events - Uteke::timeline / count_timeline_events / try_timeline_event - Schema migration v8 → v9: timeline_events table + 3 indices (idempotent, no data backfill — timeline starts from this version forward) - remember_precomputed() now emits a 'created' event (best-effort) CLI (uteke-cli): - New 'uteke timeline <id> [--limit N]' command (default 20, JSON support) Tests (+5 new): - TimelineEventType roundtrip - timeline_add_and_list (with JSON event_data) - timeline_limit + count - empty for missing memory - migration_dispatcher_reaches_v9 Existing schema-version assertions updated (v8 → v9). Closes #347 * fix(#347): clarify timeline hook placement + emit Consolidated event CodeCora #388 questioned whether the 'created' timeline event covers all remember paths. The hook is correctly placed in remember_precomputed (the single shared creation path called by remember(), remember_typed(), remember_with_contradiction(), and the consolidate path). Comment now makes that explicit. Also emits a 'consolidated' event when remember_with_contradiction supersedes an older memory, with the deprecated id in event_data. * fix(#347): Consolidated event on superseded memory + tiebreaker sort CodeCora #388 found two issues: 1. Consolidated timeline event was attached to the NEW replacement memory, but semantically it should be on the OLD (superseded) memory — that's the one being retired. Fix: attach to deprecated_id, with metadata 'replaced_by' pointing to the new memory. 2. Timeline events ordered by created_at DESC only, but RFC3339 strings from to_rfc3339() omit fractional seconds when zero. Events created in the same second had undefined relative order. Fix: add 'id DESC' as a secondary sort key (AUTOINCREMENT ensures insertion order). Also: handle deprecated_id being Option<String> properly. * fix(#347): log JSON serialization failures instead of silent empty string CodeCora #388: add_timeline_event used serde_json::to_string(v) .unwrap_or_default() which stored empty string "" on serialization failure, silently corrupting event data. Fix: on serialization failure, log a warning and store 'null' as a detectable sentinel value instead of masking it as empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #347. See CHANGELOG entry for full details. All tests pass, clippy + fmt clean.