Tests the retrieval and context guarantees from spec/retrieval.md and spec/context.md. Requires the core capability.
Given: 25 stored records in one scope
When: retrieval runs with limit=10, offset=0, then limit=10, offset=10
Then: the two pages are disjoint and together cover 20 distinct records.
Given: 25 stored records
When: retrieval runs with limit=5
Then: total is 25 and truncated is true.
Given: 5 stored records
When: retrieval runs with offset=100
Then: records is empty, total is 5, and no error is returned.
Given: a mix of fact and decision records
When: retrieval runs with types:["decision"]
Then: only decision records are returned.
Given: records retrieved from scope {project: "x"}
When: a context is assembled
Then: context.scope equals {project: "x"}.
Given: retrieved records with provenance
When: a context is assembled
Then: each record in context.records retains its provenance, and the
context itself has assembly provenance.agent.
Given: a query matching nothing
When: a context is assembled from it
Then: a context with records: [] is returned — not an error.
Given: a record with a custom metadata object
When: stored then retrieved
Then: metadata is returned unchanged.
Given: records tagged infra and ui
When: retrieval runs with tags:["infra"]
Then: only infra-tagged records are returned (per the implementation’s
documented AND/OR semantics).
Given: an implementation with a max retrieve limit
When: capability discovery is invoked
Then: limits.max_records_per_retrieve is reported (or the limit is
unbounded and documented).