Skip to content

refactor(core): typed list request shared by HTTP, MCP and CLI (#1343) - #1424

Merged
ajianaz merged 1 commit into
developfrom
refactor/typed-list-1343
Oct 12, 2026
Merged

ajianaz merged 1 commit into
developfrom
refactor/typed-list-1343

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Refs #1343 (list slice; the recall slice is #1423 and is the template).

What

New uteke-core::list_request module: ListInput (raw, per-surface decode), ListPolicy (HTTP, MCP), ListRequest::decode, ListInput::to_http_body (CLI-via-server body) and ListRequest::{wants_envelope, page_meta} (the #1188 envelope arithmetic).

  • HTTP /list: the 1000 cap (security: untrusted project config, CORS off by default, list limit caps #1321) and the at RFC3339 parse now go through ListParams::decode (ListPolicy::HTTP). Envelope has_more/next_offset use page_meta.
  • MCP uteke_list: new decode_list_args (ListPolicy::MCP); exec_list uses it.
  • CLI via server: the /list body is built by ListInput::to_http_body.
  • MAX_LIST_LIMIT now aliases uteke_core::LIST_HTTP_MAX_LIMIT (same value, still used by the other list-style endpoints).

Extraction only: no change to routes, request/response shapes, defaults, caps or error texts. docs/ is byte-identical after cargo run -p docgen.

Why

Each surface parsed, defaulted and clamped its own list arguments. #1343 moves that logic to one typed request per operation, encoding where surfaces disagree as explicit policy values rather than resolving them.

Surface disagreements (owner decisions, none unified here)

aspect HTTP /list MCP uteke_list CLI via server
limit default 5 (default_limit, shared with recall) 20 20 (clap), always sent
limit cap 1000 (#1321) none none (server caps)
wrong-typed fields (limit: "5", -1, null) 400 serde error silently falls back to default n/a (clap-typed)
at (time travel) honoured, RFC3339 checked not exposed --at forwarded
include_meta (#1188) honoured (not combined with at) not exposed not sent
namespace omitted all namespaces all namespaces CLI sends its own (default)
entity / category ignored (unknown fields) not exposed CLI flags are not forwarded on the server path

HTTP default limit (5) differing from the MCP/CLI default (20) is the one most likely to surprise a client.

Testing

  • New unit tests in uteke-core (list_request::tests, 6): per-policy defaults, cap boundaries (0/1/999/1000/1001/usize::MAX), at UTC normalisation and exact error text, envelope vs at, page_meta arithmetic, CLI body shape. They fail without the change (the module does not exist).
  • Cross-surface tests in uteke-server (list_request_cross_surface_tests, 8): the same logical request through the HTTP and MCP decoders gives equal typed requests where behaviour agrees; each disagreement above is pinned.
  • Differential check: uteke-serve built from origin/develop and from this branch, fresh UTEKE_HOME, identical seed (15 memories, 3 namespaces, via /remember; embeddings unavailable so rows are FTS-only, which /list does not need). 62 /list cases (default, limit 0/1/999/1000/1001/u64::MAX/overflow/negative/string/float/null/bool, offsets, tag, namespace, include_meta pages and edges, at valid/offset/invalid/combined, unknown fields, malformed bodies): status codes and normalised bodies (ids and timestamps masked): 62 cases, 0 differences.
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace, cargo test -p uteke-core --no-default-features --features "onnx,vecq" --lib: all pass. cargo run -p docgen leaves docs/ clean.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit d811c93 into develop Oct 12, 2026
15 checks passed
@ajianaz
ajianaz deleted the refactor/typed-list-1343 branch October 12, 2026 06:22
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