Skip to content

Enterprise · Code references

Delete a flag

FluxGate deletes a flag only when no stage, code, evaluation, dependent flag or approval still uses it, and keeps watching your code for the key.

Video coming soon

Delete a flag

Before you start

  • The flag is archived. Archive it from the flag page, or with Archive selected in the cleanup report.
  • You are a system admin System admin or a Team Admin of the flag's team. A system client can never delete a flag, whatever its scopes.
  • Deleting a flag is Core: it works in every edition. Code references make it safer, because FluxGate can then check your code first.

Why delete

Archiving hides a flag and stops it from being changed. The flag still exists: its key is taken, edges still receive it, and its history stays in the database. Deleting removes it for good, so the team's flag list holds only flags that matter.

What blocks a delete

FluxGate refuses the delete with 409 feature_delete_blocked while any of these holds. There is no override.

BlockerHolds whenHow to clear it
Not archivedThe flag is not archivedArchive it
Active stagesA stage is neither not deployed nor rolled back. Archiving with confirmation can leave stages liveRoll back the stage in each environment
Code referencesA default branch still references the keyRemove the code, merge, and let the next scan run
Recent evaluationsThe flag had single evaluations in the last 7 days. OFREP bulk polls do not countFind the caller in the evaluation analytics, or wait
DependentsAnother flag depends on it, archived or notRemove the dependency from that flag
Pending approvalsAn approval request for the flag is pendingApprove, reject or cancel it

Delete the flag

  1. Open Features, then the archived flag, for example one-click-reorder.
  2. Click Delete flag. The button shows only on archived flags, and only for system admins and Team Admins of the team.
  3. Read the dialog. If anything blocks the delete, it lists each blocker, with a link to the code references when code still uses the key.
  4. When nothing blocks it, type the flag key to confirm and click Delete.
Delete flag one-click-reorder dialog: Deleting a flag cannot be undone. The flag cannot be deleted yet: 1 code reference on default branches in 1 repository. The Delete button is disabled (opens full size in a new tab)
one-click-reorder is archived, but PastOrders.tsx still reads it, so the delete is blocked.

If no repository of the team is scanned, the dialog says that code was not checked. FluxGate then cannot know whether code still calls the key.

What the delete removes

The delete answers 204, and the edges drop the key. It removes the flag with its stages, variants, versions, daily evaluation counts, sticky assignments and closed approval requests. It writes a feature_deleted entry with the key to the audit log.

Code references to the key stay, as references to an unknown key. For 90 days, every scan also searches the deleted key, and the cleanup report lists any code that still uses it under Code references to deleted flags. After the delete, apps that still call the key get the default value written in their code.

A key leaves that list when a flag with the same key is created again in the team.

Example: beta-coupons

The Checkout team ran a coupon field for beta testers behind beta-coupons.

  1. The beta ended. priya rolled back the flag in all three environments, and admin archived it.
  2. A developer removed useBooleanFlagValue('beta-coupons', false) from ExpressCheckout.tsx and merged. The next scan of main found no reference.
  3. Delete flag showed no blockers. admin typed beta-coupons and deleted it.
  4. A week later, an old branch with the coupon field was merged back by mistake. The next scan printed 1 references to 1 deleted flags: beta-coupons, and the cleanup report listed the key under Code references to deleted flags. The storefront kept working, because the code's default value is false.

Use the API

Why can this flag not be deleted yet?
curl -s https://flags.junipermarket.example/api/v1/features/<flag ID>/delete-blockers \
  -H "Authorization: Bearer <admin access token>"
json
{
  "blockers": [
    { "kind": "code_references", "count": 1, "repositories": 1 }
  ],
  "codeScanned": true
}

DELETE /api/v1/features/{id} deletes the flag, or answers 409 feature_delete_blocked with the same list in details.blockers, in the order of the table above. Other blocker kinds carry their own details: active_stages names the environments, recent_evaluations has count and days, dependents lists keys, and pending_approvals has count. codeScanned is false when the team has no scanned repository.

Next

Turn the cleanup report into tickets: Open removal issues.