[#470] Resolve "record channel size and message volume upon destruction"
Closes #470 (closed)
context
- we would like to test a hypothesis that large channels tend to have longer lifetimes (and learn a bit about how much they are used)
- this MR augments the
CHANNEL_DESTROYED
event to record metadata to allow us to study this question:- (1) how many members did the channel have when destroyed? (admins + subscribers)
- (2) how many messages had been sent on the channel when it was destroyed? (broadcast in/out, command in/out)
- it will maintain the invariant that once destroyed, a channel's phone number is not known to our system
changes
data layer
- add
metadata
jsonb field toevents
table/model- it expects either a json object with
memberCount
(int) andmessageCount
(models.messageCount) fields or an empty object -
@mari NOTE: you can find documentation for how to query the
metadata
field intest/unit/db/event
near the bottom of the test suite
- it expects either a json object with
- return a joined
channel
with nested joinedmemberships
andmessageCounts
in return value from#getMatureDestructionRequests
(so they can be included as metadata when destruction requests are processed) - include metadata in calls from
phoneNumberRepository#destroy
toeventRepository#log
- but omit the
channelPhoneNumber
field!
- but omit the
tooling side-effect
- revert to using the same named volume for postgres data in dev and test docker stacks
- (a prior commit had done the sensible thing of making the test stack use a different named volume, which would be fine if we were starting from scratch, but since this volume has no data to start with, it disrupts the dev env for folks who are in mid-flow for little value, so we abandon the change)