Skip to content

feat: PUT /memory endpoint for partial memory updates#665

Closed
ajianaz wants to merge 1 commit into
developfrom
feat/put-memory-endpoint
Closed

feat: PUT /memory endpoint for partial memory updates#665
ajianaz wants to merge 1 commit into
developfrom
feat/put-memory-endpoint

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements #659 β€” PUT /memory endpoint for partial memory field updates.

Changes

crates/uteke-server/src/types.rs

  • Added MemoryUpdateRequest struct with optional fields: id (required), content, tags, metadata, importance, pinned, memory_type

crates/uteke-core/src/memory/crud.rs

  • Added Store::update_fields() β€” dynamic SQL UPDATE that only modifies provided fields
  • Dual-write to memory_tags junction table when tags are updated
  • Returns bool (true if row was found and updated)

crates/uteke-core/src/operations.rs

  • Added Uteke::update_memory() public API
  • Validates: memory exists, content length, tags count, importance range (0.0-1.0), memory_type enum
  • Regenerates embedding when content changes (via retry_embed)
  • Updates vector index with retry persistence
  • Invalidates recall cache for the memory's namespace

crates/uteke-server/src/handlers.rs

  • Added PUT /memory handler
  • UUID format validation
  • Returns 400 for invalid/empty requests, 404 for missing memories
  • Propagates validation errors with proper status codes

Acceptance Criteria

  • Partial update semantics (only provided fields changed)
  • Content update regenerates embedding
  • 404 if memory not found
  • Input validation

Testing

  • CI will verify compilation (local build blocked by missing libssl-dev for ort-sys build dep)
  • Manual API testing recommended after merge

Add PUT /memory endpoint that supports partial field updates:
- content (with automatic embedding regeneration)
- tags (with dual-write to memory_tags junction table)
- metadata, importance, pinned, memory_type

Implementation layers:
- Store::update_fields(): dynamic SQL UPDATE with only provided fields
- Uteke::update_memory(): validation + embedding regeneration + cache invalidation
- Handler: UUID validation, 400 for empty updates, 404 for missing memories

Acceptance criteria:
- Partial update semantics (only provided fields changed)
- Content update regenerates embedding automatically
- 404 if memory not found
- Input validation (content length, tags count, importance range, memory type)

Note: Cannot compile locally (missing libssl-dev). CI will verify.
@github-actions

Copy link
Copy Markdown

πŸ” Cora AI Code Review

⚠️ Review recommended β€” warnings found.

🟑 Warning (1)

  • unknown:? β€” Cora AI review could not complete: failed to parse LLM JSON response: parse failed (original: EOF while parsing a value at line 1 column 0, after repair: EOF while parsing a value at line 1 column 0). Review was skipped; no code quality issues were found by the automated check.

Review powered by cora-cli Β· BYOK Β· MIT

@ajianaz

ajianaz commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

CI Failure Analysis

Error 1: E0283 β€” type annotations needed (Build, Check, Clippy, Test)

Location: crates/uteke-core/src/lib.rs:78 β€” validate_input function

The validate_input function signature uses &[impl AsRef<str>] which requires type inference at the call site. The error is triggered by thiserror v2.0.18 β€” CI is pulling a newer version that changed how Error type inference works.

Root cause: No local Cargo.lock change in this PR, but CI resolved a newer thiserror transitively. This breaks the ? operator's type inference on validate_input return.

Fix options:

  1. Add explicit return type annotation or turbofish at call sites in operations.rs:
    crate::validate_input::<str>(c, &[])?;
  2. Or constrain the impl trait in lib.rs:
    pub fn validate_input(content: &str, tags: &[impl AsRef<str> + ?Sized]) -> ...

Error 2: Format check fail

Schema migration code needs cargo fmt. Run locally before pushing.


develop is clean β€” this is a workspace-wide compile error. Merge #666 (pin/importance) passed CI because it didn't touch operations.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant