Repository navigation
fix: write an update's validity only after its other fields went through - #1686
Merged
Merged
Conversation
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).
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 13, 2026
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.
What
PUT /memory, MCPuteke_updateanduteke updatenow check a caller validity first (newUteke::check_validity: the checks ofset_validitywithout the write), then update the other fields, and writevalid_from/valid_untillast. Before,set_validityran first, so a request refused for another field (for exampleimportance: 5.0, an unknownmemory_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
remember_and_update_store_validity_in_the_columns: aPUT /memorywith a newvalid_untilandimportance: 5.0returns 400 and leavesvalid_untilunchanged; the same request withimportance: 0.9writes 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.uteke-cli --test validity_flags(3), uteke-core (9): pass.