Skip to main content
A flag is a value your app reads and your team changes. Turn a feature on for some users, stop something that’s misbehaving, or tune a limit without a deploy.
Without value, a flag is on or off and starts off. With a schema, it holds any value the schema accepts, starting at default, and pult build checks the default is valid.

Reading a flag

The type comes from the flag, and so do the attributes you can pass. Pass a key, usually the id of the user or account the answer is for, or just the key as a string, and Pult picks the value in this order:
  1. A value set for that record, if the flag has a target.
  2. The first rule whose conditions match the attributes you passed.
  3. A rollout, for on and off flags: a share of keys that get it, always the same ones, so raising the share only adds people and lowering it only takes away the most recent.
  4. The environment’s value.
  5. The flag’s default, if nothing’s been set or the stored value no longer fits the schema.
Rollouts are decided per key. Code that reads an on and off flag without a key sees it on only once its rollout reaches everyone, so a rollout never switches everybody at once. Flags are read in your app, from a copy the SDK keeps. With pult.listen(), changes arrive over the connection within a moment. Without it, on serverless platforms, the SDK checks at most every ten seconds, and the check costs almost nothing when nothing changed. If Pult can’t be reached, your app keeps the last values it saw, or the defaults.

Rules

attributes describes what your app can tell Pult about whoever’s asking: their plan, their country, how many seats they have. Your team then writes rules in the console, like “plan is pro or team: on” or “seats above 50: on for 20%”. Rules are checked in order and the first match wins. A condition on an attribute your app didn’t pass doesn’t match, except “is not”. Pult never sees these attributes. They’re compared in your app, against rules it already has.

Changing gradually

Any on and off flag, and any flag holding a number, can move to a new value over time instead of all at once. Pick where it should end up and how:
  • Over a period: “to 100% over 5 days”, moving smoothly or in steps, like once a day.
  • Step by step: “10% more every hour” until it gets there.
It works in both directions. Turn maintenance on for everyone, then let people back a tenth at a time; raise a signup limit from 500 to 2,000 over a week. The console shows how it’ll move before you save, and where it is while it runs. Stop it at any point and it stays where it got to. A change can also start later, or happen all at once at a set time: turn maintenance on at 2 on Sunday morning, before anyone’s awake to do it.

Guards

guard ties a flag to an inbox. While the flag is moving, if that inbox gets perHour items or occurrences within an hour, Pult stops the ramp where it is, or with then: "revert" puts it back where it started. The audit log says what happened and why. With a guard on your crashes inbox, a rollout that starts breaking things stops itself before it reaches everyone. Your app works out where a ramp is from the clock, so nothing has to reach it at each step. A ramp that needs approval starts once it’s approved.

In the console

Flags have their own page in the sidebar. On and off flags have a switch; others show their value with a button to change it. More opens rollouts, gradual changes and values for specific records, picked by search like any record. danger and approval work as they do for actions: a confirmation, a fresh sign-in, or a second person before the change happens. Every change is in the audit log with its before and after. Each environment has its own values. Changing a flag in staging doesn’t touch production. Every flag shows how often your app read it and when it last did, so flags nobody reads any more are easy to spot and remove. To put a flag on a page or a record, use b.flag(newEditor).

Who can change a flag

Everyone can see flags and their values. Changing one is granted in roles with flags, and admins can change all of them.