test(find): a vector-leg find is projected too — the answer is uniform

The seam hydrates the metadata and graph page paths; a vector or text leg builds
its own entities and is trimmed after the integrity guard instead. That is a
COST difference, and this pin exists so it can never quietly become an ANSWER
difference.
This commit is contained in:
David Snelling 2026-09-02 13:50:19 -07:00
parent be77a10bfe
commit 69bda5b7cb

View file

@ -198,6 +198,20 @@ describe('find/get({ fields }) — projection', () => {
expect(reads).toBe(0)
})
it('projects a vector-leg find too — the ANSWER is uniform, only the cost is not', async () => {
// The seam hydrates the metadata and graph page paths. A vector or text leg
// builds its own entities, so those rows are trimmed after the integrity
// guard instead. That difference is a COST difference, and this pin exists
// so it can never quietly become an ANSWER difference.
const rows = await brain.find({ query: 'post', fields: ['title'], limit: 3 })
for (const r of rows) {
const meta = (r.entity.metadata ?? {}) as Record<string, unknown>
expect(Object.keys(meta)).toEqual(['title'])
expect(meta.body).toBeUndefined()
expect(r.entity.id).toBe(r.id)
}
})
it('get({ fields }) projects a single row through the same seam', async () => {
const full = await brain.get(ids[0])
const projected = await brain.get(ids[0], { fields: ['title', 'slug'] })