Repository navigation
fix(server): honor explicit memory type on plain /remember - #1303
Conversation
POST /remember never passed the caller's `type` to the core on the default (non-contradiction) path — it only copied the value into metadata and fell through to remember_detailed (auto-inference), so every explicit type was silently stored as fact: a contract break for typed writers (tole #143, repro in #1302). The handler now validates `type` against the MemoryType vocabulary before any write — unknown values get a loud 400 listing the valid types — and routes explicit types through remember_typed_detailed (parity with the room path), leaving the no-type auto-inference path and the contradiction path unchanged. Registry description, request-schema doc comment, and generated docs updated to match the contract.
| 0.65, | ||
| ) | ||
| .map(|(outcome, _)| outcome) | ||
| } else if let Some(t) = req_data.r#type.as_deref() { |
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…1302) Review follow-up: add a CI-safe contract test proving the #1302 type validation runs before the branch, so detect_contradiction requests are equally covered against unknown types. Honoring a valid explicit type on the contradiction arm was verified by live E2E (the arm forwards the type to remember_with_contradiction, which uses it as-is).
|
Re: the contradiction-arm finding — investigated and refuted with a live repro; the contradiction arm is not affected. The arm forwards the caller's type to the core:
Live verification against a freshly built binary (throwaway store,
Additionally pushed No code change was needed for this finding; the new test documents the invariant so it can't regress silently. |
* chore(release): v0.19.1 - version bump, changelog, docs sync - Workspace + internal dependency versions 0.19.0 -> 0.19.1 (Cargo.lock synced) - CHANGELOG: [0.19.1] entry - upgrade-path reliability (#1307 via #1308/#1309/#1310), plain /remember explicit-type fix (#1303), committed Hermes plugin package (#1301) - Bundled uteke-memory skill + .agents canonical copy bumped in lockstep - README/README.id current-version line synced * chore(release): regenerate core-contract.json for 0.19.1 docgen embeds the workspace version; the API Docs Fresh gate caught the stale generated artifact. --------- Co-authored-by: ajianaz <[email protected]>
What
POST /remember(plain namespace path) now honors the caller's explicittype: whentypeis present, the handler routes throughremember_typed_detailed(the same core path the room path uses) instead of only copying the value into metadata and falling through to auto-inference.typeis validated before any write: unknown values get a loud400listing the valid vocabulary (fact, procedure, preference, decision, context, note, insight, reference, event) instead of a silent default tofact.detect_contradictionpath (which already forwarded the type) is unchanged./remember,RememberRequest.typeschema doc comment, regenerateddocs/api-reference.md.Fixes #1302
Why
A caller that asks for a specific type must be able to trust what it reads back. On the plain path the requested type never reached the core on the default branch of the handler — every explicit type (e.g.
decision, unit-pinned in tole #143's argv contract) was silently stored asmemory_type: fact, breaking typed recall queries and the write-side data-model contract. The mismatch was invisible at write time (the write reported success). The room path already behaved correctly, so this also removes a path inconsistency. Loud rejection over silent fallback matches the house pattern already used forauthor_typevalidation (#1083).Testing
cargo test -p uteke-server: 55 passed, 0 failed (includes 3 new contract tests inplain_remember_type_tests: explicitdecisionstored verbatim + metadata back-compat; unknown type → 400 with vocabulary; no-type → auto-inference unchanged).UTEKE_HOME, isolated port — not prod): issue repro case now storesmemory_type: decisionverbatim; unknown type returns 400Unknown memory type 'journal'. Valid types: ...; auto-infer control returnsdecisionfor 'we decided ...'; room-path control still honorsdecision. All 4 checks pass.cargo clippy -p uteke-server --all-targets -- -D warningsclean;cargo fmt --all -- --checkclean;cargo run -p docgenregenerated (CI docs-fresh gate).