posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat: Add Redis mutation admin view

Open tomasfarias opened this issue 1 year ago • 1 comments

Problem

Besides displaying Redis values we would also like to mutate them. This introduces a model, admin, and form to interact with redis values via a RedisMutation.

Changes

Create a new model RedisMutation:

The model enforces an approval workflow as illustrated here:

image

(Live editing here)

Notes about approval workflow:

  • Each mutation can have a different approval threshold, this is set on the creation form.
  • Although we allow users to approve a mutation multiple times, they are only counted once (so, only unique approvals count). I opted to not raise an error and instead just not add a user to approved_by, but happy to explore raising an error.

Changes missing:

  • Applying a mutation does nothing. This was left intentionally empty as that's likely quite a complex implementation and each command would need its own logic. Will be tackled in a separate PR.
  • Should we enforce only one mutation per redis_key? Just to guard against potential race conditions between two mutations.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

Ran locally:

image

image

tomasfarias avatar May 03 '24 15:05 tomasfarias

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

posthog-bot avatar May 13 '24 07:05 posthog-bot

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

posthog-bot avatar May 20 '24 07:05 posthog-bot