Skip to content

.tip

ยท one of the small things

Give every flag a removal date and let a test enforce it

A flag left on past its rollout is a second code path nobody reads and nobody tests. Put the removal date in the definition beside the owner, and let the suite tell you when it is due.

export const flags = {
  newCheckout: { on: true, owner: "ahmet", removeAfter: "2026-12-15" },
} as const;
 
const today = new Date().toISOString().slice(0, 10);
test.each(Object.entries(flags))("%s is not overdue", (_, f) => {
  expect(f.removeAfter >= today).toBe(true);
});

The failure is the reminder to delete the flag and the dead branch under it, while the author still knows which side stays.

feature-flagsmaintenance