[Task]: Expose waffle flags/switches and django settings to pinguino

Open
#16,567 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
django, python
Domain
api, backend

Research direction

Start by reading the existing api/v5/site endpoint and its serializers, including how they expose READ_ONLY and site notice Configs. Then trace how waffle switches, flags, Django settings, and admin Configs are defined and how Pinguino consumes site data. The issue leaves the endpoint and exposure design open; done means Pinguino can access the needed configuration values through a consistent implementation.

Written by the indexing model from the issue text.

Description

Description

We have the capability to turn off features, which are implemented either as:

  • waffle switches (off/on per site; real-time toggle)
  • waffle flags (off/on -potentially- per user; real-time toggle)
  • django settings (set/unset per site; redeploy needed)
  • connected: there are also admin Configs, which are strings or other non-boolean values (set/unset per site; real-time setting)

Pinguino, by default, has no way of knowing any of these values, but it does sometimes need to know if, for example, a waffle switch is enabled if an api endpoint is gated by that waffle switch, so a user isn't allowed to submit an api request that will fail (e.g. the support form).

Currently we expose some of these values via the api/v5//site endpoint - the READ_ONLY setting, plus the Configs for the site-wide notice, and submission notice. We need a consistent implementation for other settings/flags/switches.

Options:

  1. Don't expose them - assume everything is available until the api request fails. cons: bad developer experience, and sometimes we do need to expose values.
  2. Add more values to the /site endpoint. cons: this is used by frontend already, so gets requested a lot, so we probably don't want to add additional database requests and increase the payload size.
  3. Add a developer-hub focused /site-developer or similar for non-frontend values. cons: yet another api call.
  4. Insert the waffle/settings values into the index.html as we serve it via django (similar to how we insert the auth token). cons: bit hacky, and would only get updated on a full page refresh - no client side javascript updates.
  5. _variant on 1|2 - return these values as additional data on the user profile serializer, similarly as we do for /site on the user profile response, to save the extra api call . cons: the user profile response is called by frontend, so still a lot of inefficiency for every user who is logged on frontend but isn't using pinguino (and may not be an add-on developer at all); also isn't an option for values we need for logged-out users too.
Acceptance Criteria
  • various flavours of configuration in django are exposed to pinguino

┆Issue is synchronized with this Jira Task

Dominant language
Makefile
Stars
135
Forks
52
Avg merge
6d 18h
Merged PRs (30d)
7

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/addons

All issues in mozilla/addons

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.