Page MenuHomePhabricator

REST: Audience Designations - functionality sets
Open, Needs TriagePublic5 Estimated Story Points

Description

tl;dr: introduce "functionality sets" that can be associated with REST modules. Other tasks will build on these. In short, functionality sets are groups of behaviors that can be mapped to audience designations. See the parent task for context.

Initial Audience Designations

The following audience designations are currently available:

  • public (indicated in the path by absence of any specific designation)
  • beta

Others designations are planned. One of these ("internal") will be implemented in a followup task under the same parent task.

Required Functionality Sets

The following functionality sets should be implemented as part of this task:

  • disabled (endpoints are not available to be called, spec is not viewable or discoverable, no sandbox entry)
  • hidden (endpoints are callable but spec is not accessible or listed in /discovery, no sandbox entry)
    • spec should still be available within tests, so that things like response schemas can be used to validate endpoint behavior
  • discoverable (endpoints are callable, spec is listed in /discovery, no sandbox entry)
  • opt-in: (endpoints are callable, spec is listed in /discovery, opt-in to view on sandbox)
    • there will be multiple opt-in groups. See below for details.
  • published (endpoints are callable, spec is listed in /discovery, sandbox entry)
Layering

Because audience designations are new and we're still learning exactly how they'll work, we should avoid tightly tying any particular designation to any particular behavior. A layer in the code should translate the behaviors of designations to functionalities. Audience designations should be mapped to the various types of functionality in a way that lets us easily make adjustments.

This mapping could be hard-coded, and may involve creation of constants for each audience designation and each functionality set.

This mapping could live in the existing ModuleManager class, or in a new related class.

Opt-in

(TBD)

Notes

Initially, all audience designations should map to the "discoverable" functionality set. This will avoid inadvertently affecting existing production behavior. Subsequent changes will adjust the mapping, once we're ready for it.

The task author is using the term "functionality set" as a convenient way to talk about these groups of related functionality. That term might or might not be useful in code. If not, there's no need to include it. If the implementing engineer needs a term but comes up with a better one, feel free to use that instead.

There should be no visible production impact on REST module behavior from any of these changes. Visible changes will happen in followup tasks.

Event Timeline

HCoplin-WMF set the point value for this task to 5.Thu, Apr 9, 3:31 PM

Notes from Estimation:

  • Would this done before or after audience designations?
    • Right now, assume every audience would be mapped to 'discoverable'. We will include the detailed mappings for the functionality sets + audience designations in a future task. This part is considered a blocker for the rest of the pieces that need to go in.
  • High level information about the expected audiences and what they mean for stability here: https://www.mediawiki.org/wiki/Wikimedia_APIs/Stability_policy#Module_audiences
  • The purpose of this work from a meta level is simplifying and standardizing API publishing and availability. This is the body of work that will enable both clearer definitions of the default behaviors, as well as overrides of the defaults for specific audiences or modules (eg: hidden for Site module).