Repository navigation
Description
From the third agent workflow trial (credits wallet task: pay by recipient lookup). Follows #929 item 3.
What you were trying to do
Pay another user by looking up their wallet. Per #929 this uses a projected readers directory: readers: {mount: /api/directory, properties: [name]}, with filterable: [name], then POST /api/wallets/transfers/pay to the id found.
Where it broke down
The directory answers the lookup, but a name identifies nobody. Wallet names are chosen by each owner and can't be unique: key is "Not allowed with ownership: owner", and there is no other uniqueness constraint. Another user can open a wallet with the same name and appear in the same lookup:
- bob opens wallet
bob;GET /api/directory?name=bobanswerstotal: 1. - mallory opens a wallet also named
bob(201); the same lookup now answerstotal: 2. A payer can't tell which one is bob's.showOwnerwould add_owner, but with Better Auth that is an opaque user id the payer doesn't know.
So "pay by recipient lookup" is spoofable. The safe version needs a handle that is unique across owners, or bound to the owner's identity, which can't be declared on an owned collection.
Expected, one of:
- a unique property on an owned collection (unique across owners,
409on a duplicate), for exampleunique: [handle]; - or a transfer addressed to an owner's verified identifier (for example the recipient's email via the auth extension) instead of a record id.
Code or YAML you had to write by hand
wallets:
mount: /api/wallets
ownership: owner
idempotency: {maxKeys: 1000}
schema:
type: object
additionalProperties: false
required: [name, balance]
properties:
name: {type: string, minLength: 1, maxLength: 40}
balance: {type: integer}
defaults: {balance: 0}
readOnlyProperties: [balance]
filterable: [name]
readers: {mount: /api/directory, properties: [name]}
transfers:
pay: {amount: balance}
issue: {amount: balance, min: -1000000, members: issuers}These steps pass. They record the observed behavior:
{"path": "/api/directory?name=bob", "status": 200, "expectJson": {"/items/0/id": "{{bob}}", "/items/0/name": "bob", "/total": 1}},
…sign in as mallory…
{"path": "/api/wallets", "method": "POST", "headers": {"origin": "{{origin}}", "content-type": "application/json"}, "body": "{\"name\":\"bob\"}", "status": 201, "expectJson": {"/name": "bob"}},
{"path": "/api/directory?name=bob", "status": 200, "expectJson": {"/total": 2}}npm test → {"total":32,"failed":0}.
What you could not verify
Whether an operator-assigned name (a readOnlyProperties name set by a transition) was intended as the answer. It can't work: transitions set constants only.
Runtime revision and environment
main f850492a (0.6.5), packed install, macOS, Node 26.10.0.
Activity
feat(store): editable/deletable states and unique values across owners (
Store recipes: store-approval; booking and credits on slot grids, cre…