Skip to content

test(rooms): pin the CORE shape of the rooms field on memory hits (#1713) - #1725

Merged
ajianaz merged 3 commits into
developfrom
test/1713-rooms-core-shape
Nov 11, 2026
Merged

ajianaz merged 3 commits into
developfrom
test/1713-rooms-core-shape

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

What

Pins the shape of the rooms field on memory hits with exact-value tests on every CORE surface that carries it. This is the OSS work left on #1713. There is no code change: tests and one CHANGELOG note.

  • crates/uteke-server/src/handlers/rooms_contract_tests.rs (HTTP), covering:
    • POST /recall plain (fts5 and fusion), unified (search_type: all), pack, explain
    • POST /search
    • POST /room/recall with a query
    • one test reads the generated docs/core-contract.json and requires these three routes to stay CORE
  • rooms_core_mcp_tests in uteke-mcp: the exact (rooms: ...) line on uteke_recall, uteke_search and uteke_room_recall.
  • crates/uteke-cli/tests/rooms_in_hits.rs: the CLI --json of recall, search and room recall <id> <query>.

The six rules from the issue, each asserted with exact values:

  1. rooms: [{room_id, room_name}] on the hit.
  2. Sorted by room_id. The fixture links rooms out of id order (beta, alpha, gamma), and the titles would sort differently.
  3. room_name is the title, or the id when the title is missing or blank (" ").
  4. The key is omitted, not [] and not null, for a memory in no room.
  5. Never on a document item, even when the document is linked to a room.
  6. A hit cut by limit leaks no rooms. Order and scores are already pinned in uteke_core::recall_exec (feat(recall,search,mcp): return the rooms a memory belongs to with each hit #1706).

Why

Owner order 2026-11-10 ("room di core, ya itu perintahku"). Contract amendment 4 point 1 (uteke-cloud #525) makes the field CORE. #1713 asks for a shape test that fails CI if any rule changes. The contract doc already carries the quoted order and its changelog row (kontrak-core-cloud history, 2026-11-10, Amandemen 4 (a)). docs/core-contract.json stays an endpoint list, so the field is recorded in the contract doc only, as the issue says.

Still open outside this repo: the Cloud implementation plan or dated decision on uteke-cloud #525.

Testing

  • cargo test --workspace: all green. New: 5 server tests, 1 MCP test, 1 CLI test.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • Mutation check by hand. Each mutant below makes the new tests fail, and the code was restored after each:
    • ORDER BY rm.memory_id, rm.joined_at: 3 failed
    • COALESCE(r.title, r.id), so a blank title is kept: 3 failed
    • r.id as room_name: 3 failed
    • always serializing rooms on SearchResult: 2 failed
    • dropping skip_serializing_if on UnifiedSearchResult.rooms: 2 failed

)

The rooms field on memory hits is CORE (contract amendment 4 point 1,
uteke-cloud #525). Exact-value tests now pin it on every CORE surface that
carries it: POST /recall (plain, fusion, unified, pack, explain),
POST /search, POST /room/recall with a query, MCP uteke_recall, uteke_search
and uteke_room_recall, and the CLI --json of recall, search and room recall.

They check the list shape, the sort by room_id (rooms are linked out of id
order and the titles would sort differently), room_name as the title or the
id for a missing or blank title, the omitted key for a memory in no room,
no rooms on a document item even when the document is linked to a room, and
that a hit cut by limit leaks nothing. A test reads the generated
docs/core-contract.json so the three routes must stay CORE.

Mutation-checked by hand: ordering by joined_at, keeping a blank title,
using the id as name, and serializing an empty list on either result type
each fail the suite. No code change.
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

…ailure

connect_hooks wrote the payload to a hook started with no uteke on PATH;
the hook exits at once without reading stdin, so the write raced the exit
and failed now and then with a broken pipe (seen on #1725 CI). The helper
now treats BrokenPipe on that write as what the agent would see too, and
still fails on any other error. Exit code and output are asserted as before.
}
}

#[test]
A search_type all response may hold document items, which have no memory
id; assert_hits now checks that such an item carries no rooms and skips it
instead of panicking. Raised by the Cora review on #1725.
@ajianaz
ajianaz merged commit 844d80b into develop Nov 11, 2026
15 checks passed
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.

2 participants