oficina / memoria Public

Clone
git clone https://amadan.net/oficina/memoria

Plain git — no account needed to clone.

Download

Download this file

1package memoria
2
3import (
4 "context"
5
6 "amadan.net/oficina/suite"
7)
8
9// testAsker is the person every store-level test searches as.
10//
11// §4.1's typed subject in lone shape: a lowercased address, with the kind
12// on the value so a receiver keyed on person refs answers UNKNOWN for the
13// whole call rather than guessing.
14var testAsker = suite.Subject{Kind: suite.SubjectAddress, Value: "reader@example.com"}
15
16// searchAsReader runs a search as an ordinary signed-in reader and returns
17// the passages that survived §4.1's ruling.
18//
19// **It is not a way around the ruling and must never become one.** It
20// calls Store.Search like everything else does; all it supplies is the
21// asker the test would otherwise have to spell out at thirty call sites,
22// and all it drops is the notices, which these tests are not about. A
23// helper that reached past Search to the raw hits would be the seam
24// AGENTS.md warns about — the guard that exists only in a comment.
25func searchAsReader(s *Store, ctx context.Context, q string, n int) ([]Result, error) {
26 p, err := s.Search(ctx, testAsker, q, n)
27 return p.Results, err
28}
29