Skip to content

fix: write an update's validity only after its other fields went through - #1686

Merged
ajianaz merged 1 commit into
developfrom
fix/update-validity-order
Nov 5, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/update-validity-order

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

What

PUT /memory, MCP uteke_update and uteke update now check a caller validity first (new Uteke::check_validity: the checks of set_validity without the write), then update the other fields, and write valid_from / valid_until last. Before, set_validity ran first, so a request refused for another field (for example importance: 5.0, an unknown memory_type, or content forgotten as wrong) returned an error but had already changed the validity.

Why

Cora blocked the v0.23.0 release PR (#1685) on this partial write (crates/uteke-server/src/handlers/memory.rs:531); the MCP and CLI paths had the same order. The validity columns (#1598, #1649, #1658) are unreleased, so this goes into 0.23.0 before the tag. After the change, the only way the last write can fail is a database error: every check it makes has already passed.

Testing

  • New regression case in remember_and_update_store_validity_in_the_columns: a PUT /memory with a new valid_until and importance: 5.0 returns 400 and leaves valid_until unchanged; the same request with importance: 0.9 writes both. The case fails on the old handler (checked by stashing the fix) and passes now.
  • cargo clippy -p uteke-core -p uteke-mcp -p uteke-server -p uteke-cli --all-targets -- -D warnings: clean.
  • Validity tests: uteke-mcp (2), uteke-cli --test validity_flags (3), uteke-core (9): pass.

PUT /memory, MCP uteke_update and uteke update called set_validity before update_memory_detailed, so a request refused for another field still changed valid_from/valid_until. Check the interval first with the new Uteke::check_validity, then update the fields, then write the validity. Found by the Cora review of the v0.23.0 release PR (#1685).
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

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