Skip to content

fix: pass metadata through remember_with_contradiction (#682 follow-up) - #686

Merged
ajianaz merged 3 commits into
developfrom
fix/metadata-detect-contradiction-drop
Jul 15, 2026
Merged

ajianaz merged 3 commits into
developfrom
fix/metadata-detect-contradiction-drop

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #682 — remember_with_contradiction() was silently dropping all metadata (entity, category, custom key:value, source) because it hardcoded None when calling remember_precomputed().

Problem

After #682 added metadata fields to POST /remember, only the normal path (without contradiction detection) passed metadata through. The detect_contradiction=true branch called remember_with_contradiction() which internally did:

let id = self.remember_precomputed(
    content, tags, None,  // ← metadata hardcoded to None!
    ...
)?;

This affected:

  • HTTP: POST /remember with detect_contradiction: true — all metadata fields ignored
  • CLI: uteke remember --detect-contradiction — entity, category, metadata all dropped

Fix

  • consolidate.rs: Add metadata parameter to remember_with_contradiction(), pass it to remember_precomputed()
  • handlers.rs: Pass built metadata map to remember_with_contradiction() (was only passed to the else branch)
  • remember.rs: Pass metadata to remember_with_contradiction() (was dropped)

Tests

Test Status CI
test_metadata_value_serialization (consolidate) ✅ passes runs
test_contradiction_remembers_metadata (operations) ✅ passes locally #[ignore] (needs ONNX)
All 299 existing core tests ✅ unchanged —

4 pre-existing dream test failures (need onnx feature, unrelated).

Closes #682

remember_with_contradiction() was silently dropping all metadata (entity,
category, custom key:value, source) because it hardcoded None when calling
remember_precomputed(). This affected both the HTTP handler (POST /remember
with detect_contradiction=true) and the CLI (uteke remember --detect-contradiction).

Fix:
- Add metadata parameter to remember_with_contradiction() in consolidate.rs
- Pass metadata from handlers.rs detect_contradiction branch
- Pass metadata from CLI remember.rs detect_contradiction branch
- Add test_metadata_value_serialization (non-ignore, runs in CI)
- Add test_contradiction_remembers_metadata (ignore, needs ONNX embedder)
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-cli · BYOK · MIT

ajianaz added 2 commits July 15, 2026 13:22
metadata is moved into remember_with_contradiction() but also borrowed
later for JSON output. Use .clone() to avoid borrow-after-move error.
- Allow clippy::too_many_arguments on remember_with_contradiction (8 params
  is reasonable for this public API)
- Simplify test_metadata_value_serialization to avoid literal Some/None
  unwrap_or patterns that clippy flags
@ajianaz
ajianaz merged commit