Skip to content

docs(coding): add the feature flags rule - #378

Merged
daniel-kindl merged 5 commits into
mainfrom
docs/377-feature-flags
Nov 25, 2026
Merged

daniel-kindl merged 5 commits into
mainfrom
docs/377-feature-flags

Conversation

@daniel-kindl

Copy link
Copy Markdown
Owner

Closes #377

Summary

coding/feature-flags.md is the owner page for feature flags. Before, only review-blast-radius named them.

  • Each flag has an owner and a linked issue that removes it.
  • Tests cover each state that can reach production.
  • A flag has a safe default. Do not nest flags.
  • Remove the flag and the dead path after the full rollout.
  • A flag is not configuration and not a permission.

Evidence

  • Verified: test/feature-flags.test.mjs came first and failed on all three tests. It pins the key phrases, the examples and the index link. npm run check passes. check:title passes.
  • Unverified: none.
  • Known risk: none.
  • NOT RUN: actionlint, which runs only in validate.
  • Observability: none, docs only.

Risk and rollback

Low. A new page (MINOR). Revert the commit to roll back.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Review of PR #378

Verdict: CHANGES-REQUESTED
Head SHA: 9a0c803

Summary

Standards: 2 findings (worst: Medium). Specification: 1 finding (worst: Medium). Blast radius: no confirmed risk.

Standards

  • M1, coding/feature-flags.md:17, the safe default rule and the bad example disagree. The rule says the code uses the default when the source is not available. The good example sets the default to "off" (line 35). The bad example (lines 42-43) fails because the code reads beta2 as "off" when the service is down, which is the same default. So "off" is safe in one example and the cause of the failure in the other. The page does not say that the safe default is the state that is correct today (off while the flag rolls out, on after the full rollout, and the old path removed). Rule: architecture/stewardship.md, coherence. Why: a reader cannot tell which default to pick. Fix: state that the default is the state that is safe for users now, and change the bad example so that the failure is a missing owner and a stale default, not "reads as off".
  • L1, coding/feature-flags.md:24, the page says a flag is not configuration, but architecture/configuration.md says values that change "over time", and a configuration service that changes values "without a new deployment", belong in configuration. A run-time flag service fits that text. Not a contradiction, because lines 24-30 give the split, but configuration.md has no link back. Fix: add one sentence on the difference (a flag is temporary and removed; configuration stays), or add "Related" in configuration.md in a follow-up.

Specification

  • M2, test/feature-flags.test.mjs:15-25, the criterion "A flag is not configuration and not a permission. Link architecture/configuration.md" and "A good and a bad example" are only partly pinned. The issue says "A test pins the key phrases". Quote: "A test pins the key phrases." The test checks the substring permission (also present in other lines) and the link text. Mutation: replacing the sentence "A flag is not configuration and not a permission." with "A flag is configuration." leaves all 3 tests green. Removing the sentence "Tests run the checkout with the flag on and off." also stays green. Fix: pin the phrase A flag is not configuration and not a permission and the good example sentence about both states.

All other criteria are met: owner and linked issue (line 11), each state tested (15), removal of flag and dead path (20), configuration link (26), safe default (17), good and bad example (32-43), index entry (coding/index.md:15), one CHANGELOG line (CHANGELOG.md:30).

Blast radius

Safety fact: the diff adds one Markdown page, one index line, one CHANGELOG line and one test. No code, workflow or script changes. Level 4, Run: npm run check passes (1002 tests, 0 fail) and validate is green on the head. Cleared: the links to naming.md, small-steps.md and reversibility.md exist and check-links passes. No contradiction with reversibility.md or review-blast-radius. A consumer reads a new page only (MINOR).

Tests

The tests check phrases and headings, so they prove the page content exists, not that the page is correct. Mutations tried on a throwaway checkout (each reverted):

  • Replace "Do not nest": test fails.
  • Replace "safe default": fails.
  • Replace the removal rule: fails.
  • Replace "linked issue": fails.
  • Break the index link: fails.
  • Replace "Test each state": fails.
  • Replace the "not configuration" sentence: survives (see M2).
  • Delete the good example's test sentence: survives (see M2).

Verification

  • npm run check on a detached checkout of the head, Node v24.19.0, Linux: pass, 1002 of 1002. Level 4, Run, for Linux only. npm ci printed an error, but the check ran with the installed state.
  • Required check validate: pass on the head.
  • PR text: the title is a conventional commit, the body links docs(coding): add the feature flags rule #377 and has Evidence and Observability. The body says that the tests "pin the examples". The tests pin only the two headings (see M2).
  • NOT RUN: actionlint (runs only in validate).

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Re-review of PR #378

Verdict: APPROVE-RECOMMENDED
Head SHA: 713a1aa

Summary

0 open findings on the standards axis, the specification axis and the blast radius.

Earlier findings

  • M1, safe default and examples disagree: fixed. coding/feature-flags.md:17-22 now says the safe default is the state that is correct for users now, off during rollout, then on before the flag is removed. The good example changes the default to on after the rollout. The bad example keeps beta2 at off after full rollout, so the failure follows from the rule.
  • L1, flag versus configuration: fixed. coding/feature-flags.md:27 says a flag is temporary and has a removal issue, and configuration stays for the life of the product. The link to architecture/configuration.md remains.
  • M2, phrases not pinned: fixed. test/feature-flags.test.mjs:26-32 pins 7 more phrases.

Delta

The delta from 9a0c803 is ea7dee4 (page and test) plus a merge of main. The merge adds test/gitignore.test.mjs from main and is out of scope for this PR. The new page text has no conflict with architecture/configuration.md or architecture/reversibility.md.

Tests

Mutations that survived before, run again at the new head:

  • Replace "A flag is not configuration and not a permission.": a test fails.
  • Delete "Tests run the checkout with the flag on and off.": a test fails.
  • Delete "The default of beta2 is still off.": a test fails.

Blast radius

Safety fact: only Markdown, one CHANGELOG line and tests change. Level 4, Run: npm run check on a detached checkout of the head passes, 1004 of 1004 tests, Node v24.19.0, Linux. Required check validate is green on the head.

Verification

NOT RUN: actionlint, which runs only in validate.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Re-review of PR #378

Verdict: APPROVE-RECOMMENDED
Head SHA: 3f9d3e5

Summary

0 open findings. M1, L1 and M2 stay fixed (see the earlier comment at 713a1aa).

Delta

The delta from 713a1aa to 3f9d3e5 is one merge of main (#370, #374, #375, #376). It changes only files that come from main: AGENTS.md, README.md, CONTRIBUTING.md, tips, coding/types.md and coding/quality.md, and their tests. The diff against origin/main shows only this PR's 4 files: CHANGELOG.md, coding/feature-flags.md, coding/index.md and test/feature-flags.test.mjs.

Blast radius

Safety fact: the PR adds only docs and one test. Level 4, Run: required check validate is green on 3f9d3e5 and GitHub shows the PR as clean.

Verification

I did not re-run npm run check locally on this head. NOT RUN: the head differs from the checked one only by the merge of main, and validate ran the same check on it.

@daniel-kindl
daniel-kindl merged commit de1ff39 into main Nov 25, 2026
1 check passed
@daniel-kindl
daniel-kindl deleted the docs/377-feature-flags branch November 25, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(coding): add the feature flags rule

1 participant