feat: implement WriteMemory gRPC endpoint (#34) #133

Merged
shahondin1624 merged 1 commits from feature/issue-34-write-memory-endpoint into main 2026-03-10 10:55:01 +01:00

Summary

  • Full WriteMemory gRPC handler: validate → assign ID → provenance → sanitize → embed → store → cache invalidate → audit log → respond
  • New db/write.rs with transactional write helper (INSERT OR REPLACE with rollback)
  • Audit client integration following Secrets Service pattern (with_audit_client builder)
  • External content sanitization upgrades trust level from Untrusted to Sanitized
  • Removed #[allow(dead_code)] from provenance_config and sanitizer fields

Test plan

  • 226 tests pass (15 new: 7 db/write unit tests, 8 service-level tests)
  • Tests cover: validation, ID generation, internal/external provenance, sanitization, upsert, rollback, no-audit-client
  • Clippy clean with -D warnings
  • Coverage ≥ 95% on new/modified files

🤖 Generated with Claude Code

## Summary - Full `WriteMemory` gRPC handler: validate → assign ID → provenance → sanitize → embed → store → cache invalidate → audit log → respond - New `db/write.rs` with transactional write helper (INSERT OR REPLACE with rollback) - Audit client integration following Secrets Service pattern (`with_audit_client` builder) - External content sanitization upgrades trust level from Untrusted to Sanitized - Removed `#[allow(dead_code)]` from `provenance_config` and `sanitizer` fields ## Test plan - [x] 226 tests pass (15 new: 7 db/write unit tests, 8 service-level tests) - [x] Tests cover: validation, ID generation, internal/external provenance, sanitization, upsert, rollback, no-audit-client - [x] Clippy clean with `-D warnings` - [x] Coverage ≥ 95% on new/modified files 🤖 Generated with [Claude Code](https://claude.com/claude-code)
shahondin1624 added 1 commit 2026-03-10 10:54:56 +01:00
Full write pipeline: validate request, assign/generate memory ID,
determine provenance and trust level, sanitize external content,
generate embeddings via Model Gateway, store all data atomically
in DuckDB (memory + tags + correlations + embeddings + provenance +
derivation links), invalidate semantic cache, and audit-log the
write via Audit Service (best-effort).

- New db/write.rs: transactional write helper with rollback
- Audit client integration following Secrets Service pattern
- Remove #[allow(dead_code)] from provenance_config and sanitizer
- 15 new tests (7 db/write, 8 service-level)
- All 226 tests pass, clippy clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shahondin1624 merged commit e09be59727 into main 2026-03-10 10:55:01 +01:00
shahondin1624 deleted branch feature/issue-34-write-memory-endpoint 2026-03-10 10:55:01 +01:00
Sign in to join this conversation.