diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-07 21:35:57 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-07 21:35:57 +0200 |
| commit | f7b1111c250902315e454c155c147e58d69ee9f0 (patch) | |
| tree | c2bfa30464b13b6c5da65c3d702042f2b8f0c491 /poc/spike5_node.py | |
| parent | 3bd31db9d4fa2352f1095dcc630c77915d0774b8 (diff) | |
| download | meshbay-f7b1111c250902315e454c155c147e58d69ee9f0.tar.gz | |
fix(chat): the operator was missing from the roster they host
Found on two live machines within minutes of deploying: every message from the
person running the node arrived at every other member under "this account is
using a key you have not seen before".
An operator's authority is node-wide and is recorded in `members` with an
**empty** group_id — `is_authorized` has always said so, in a clause written for
exactly that. `group_devices` spelled the rule out a second time as
`WHERE m.group_id = ?`, which excludes them. So the operator was absent from the
roster relayed to members, no chain could reach their device key, and Tier 2
reported the most ordinary event there is — the operator talking in their own
group — as a key substitution.
A notice that fires on normal use is worse than no notice: it is the one people
learn to dismiss, and §4.8 budgets exactly one for the whole feature. That makes
this a defect in the property, not only in a query.
The clause now lives once, as `_MEMBER_OF_GROUP`, shared by both callers so they
cannot drift again. `DISTINCT` because an operator who is also an explicit member
of the group matches both halves of it. `get_member` is untouched: it is a raw
lookup and its callers already fall back to `get_member("", user_id)` themselves.
Three tests, and the first fails against the old query with the reported
symptom: the operator appears in the roster of a group they host and
`is_authorized` agrees; an operator who is also a member is listed once; a
revoked one comes back through neither.
No stored state to clean up — nothing was written to a client's pins when the
account was missing, so the notice stops as soon as the node serves the roster
correctly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TZZxYjz8YeWRz13xDi8LJr
Diffstat (limited to 'poc/spike5_node.py')
0 files changed, 0 insertions, 0 deletions