Skip to content

fix(server): reject unknown keys in remember payloads with a 400 - #1254

Merged
ajianaz merged 1 commit into
developfrom
fix/http-write-strict-payload
Sep 15, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/http-write-strict-payload

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

What

POST /remember and POST /room/remember now reject payloads containing unknown keys with a 400 that names the offending key (#[serde(deny_unknown_fields)] on both request structs), instead of silently dropping them.

Why

A v1-style payload ({"content": "...", "ns": "repo-vetio"}) was accepted with 200 while ns was silently ignored - the memory landed in the default namespace and was invisible to recalls scoped to repo-vetio, with no error anywhere. This contradicts the otherwise strict validation on the same endpoints (missing required fields already return Invalid JSON: missing field ...). Closes #1251.

Testing

  • New unit tests on read_body: unknown ns (and room) keys are rejected with the key named in the error; a fully valid payload still parses. Verified red before the fix (payload parsed OK) and green after.
  • Full cargo test -p uteke-server: 44 passed / 0 failed across lib + integration suites (incl. 35 HTTP-route handler tests - no internal caller sends extra fields).
  • cargo fmt --check + cargo clippy -p uteke-server --lib -- -D warnings clean.

POST /remember and POST /room/remember silently dropped unrecognized
fields: a payload using the v1-style `ns` key returned 200 while the
memory landed in the default namespace, making it invisible to recalls
scoped to the intended namespace. Align these write endpoints with the
otherwise strict validation (missing required fields already return
"Invalid JSON: missing field ...") by denying unknown fields - the
error now names the offending key.

Closes #1251
@github-actions

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.

HTTP v2 write payloads silently ignore wrong keys (e.g. ns instead of namespace)

1 participant