Qikuyueser.com

Write a Rollback-Safe Feature Flag

Added 2026-11-02

A flag is more than an if: default value, scope and a removal plan.

I am adding a flag to a new feature (details below). Design: 1) the default value and how it is read; 2) scope — per user, tenant or percentage — and why; 3) three metrics to watch once enabled, with abnormal thresholds; 4) the rollback action and expected recovery time; 5) the flag's lifecycle — what triggers removal and who owns it; 6) where this design is most likely to leave technical debt. No code, design only.
Site original

Chinese original

Open in ChatGPT
How to use

功能开关的债,来自「上了就忘了删」。

Try tweaking it

  • Have it restate requirements and constraints before writing code.
  • Ask for the smallest change plus a rollback path, not a full-file rewrite.

What you should get

  • A minimal, runnable change with copy-ready code
  • Impact list: which files and call sites must follow

Common mistakes

  • Asking it to touch ten files at once, then losing track of what broke what.
  • Pasting only the error, with no code or version, and getting an unfixable answer.

How to check the output

  • The change runs, can be rolled back, and touches nothing unrelated.
  • Edge cases (empty, oversized, concurrent) are covered or explained.

Where it works

  • Good for: having it restate requirements and constraints, then propose the smallest runnable change.
  • Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.

More in this topic