Repository navigation
fix(server): match Error::Validation instead of string in /memory/importance - #699
Merged
Merged
Conversation
…ortance
The /memory/importance handler classified validation errors via
e.to_string().contains("importance must be"), coupling the 400/500
status to the exact wording of the validation message in store.rs.
If that wording changes, a 400 would silently degrade to a 500.
Match the typed Error::Validation(_) variant instead, mirroring the
pattern already used by PUT /memory.
Closes #697
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-cli · BYOK · MIT |
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
…patch fix(server): match Error::Validation instead of string in /memory/importance
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.
Summary
POST /memory/importanceclassified validation errors by string-matching the error message (e.to_string().contains("importance must be")\)). This couples the400/500status to the exact wording of the validation message instore.rs::set_importance. If that wording ever changes, a400 Bad Requestwould silently degrade to500`.Fix: match the typed
uteke_core::Error::Validation(_)variant instead — the same pattern already used byPUT /memory.Before
After
Behavior is unchanged for current inputs (the validation message still contains "importance must be"), but the coupling is removed.
Closes #697
Checklist
cargo fmtclean