Repository navigation
feat(#348): citation & source attribution system - #396
Merged
Merged
Conversation
Add provenance tracking to every memory via source + source_type columns.
Core:
- Schema v9→v10 migration: ALTER TABLE memories ADD COLUMN source TEXT,
source_type TEXT NOT NULL DEFAULT 'unknown'
- Memory struct: source: Option<String>, source_type: String fields
- SourceType variants: user, url, file, import, derived, system, unknown
- Uteke::set_source(id, source, source_type) for post-insert updates
- ExportEntry gains optional source field for round-trip preservation
- Import auto-sets source_type='import', source='import:<filename>'
- Default for new memories: source=None, source_type='user'
CLI:
- 'uteke remember --source <URL> --source-type url' flags
- Server mode forwards source/source_type in POST /remember body
Tests: +1 new (set_source round-trip). Schema version assertions
updated from v9 to v10.
Closes #348
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (2)
Review powered by cora-cli · BYOK · MIT |
CodeCora #396: set_source used uteke.list(None, 1, 0, ns) to find the latest memory by namespace. In concurrent contexts, another memory could be inserted between remember() and the lookup, causing source attribution to be applied to the wrong memory. Fix: capture the ID returned by remember() / remember_with_contradiction() in a hoisted stored_id variable, and pass it directly to set_source().
CodeCora #396 r2: 'let _ = uteke.set_source(...)' silently ignored database errors, so the CLI could report success even when --source was never persisted. Fix: use '?;' to propagate the error as a user-facing failure.
| } | ||
| } | ||
| } | ||
|
|
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
* feat(#348): citation & source attribution system Add provenance tracking to every memory via source + source_type columns. Core: - Schema v9→v10 migration: ALTER TABLE memories ADD COLUMN source TEXT, source_type TEXT NOT NULL DEFAULT 'unknown' - Memory struct: source: Option<String>, source_type: String fields - SourceType variants: user, url, file, import, derived, system, unknown - Uteke::set_source(id, source, source_type) for post-insert updates - ExportEntry gains optional source field for round-trip preservation - Import auto-sets source_type='import', source='import:<filename>' - Default for new memories: source=None, source_type='user' CLI: - 'uteke remember --source <URL> --source-type url' flags - Server mode forwards source/source_type in POST /remember body Tests: +1 new (set_source round-trip). Schema version assertions updated from v9 to v10. Closes #348 * fix(#348): use stored ID for set_source, not latest-memory lookup CodeCora #396: set_source used uteke.list(None, 1, 0, ns) to find the latest memory by namespace. In concurrent contexts, another memory could be inserted between remember() and the lookup, causing source attribution to be applied to the wrong memory. Fix: capture the ID returned by remember() / remember_with_contradiction() in a hoisted stored_id variable, and pass it directly to set_source(). * fix(#348): propagate set_source errors instead of ignoring CodeCora #396 r2: 'let _ = uteke.set_source(...)' silently ignored database errors, so the CLI could report success even when --source was never persisted. Fix: use '?;' to propagate the error as a user-facing failure.
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 #348. Adds provenance tracking via source + source_type columns (schema v10).
254 tests pass, clippy clean.