Skip to content

Feature flags live where they are read - #85

Merged
Force67 merged 1 commit into
mainfrom
structure-phase5b
Sep 29, 2026
Merged

Force67 merged 1 commit into
mainfrom
structure-phase5b

Conversation

@Force67

@Force67 Force67 commented Sep 29, 2026

Copy link
Copy Markdown
Owner

Phase 5b of docs/STRUCTURE.md.

  • foundation/features/features.def, FeatureId, FeatureEnabled() and Features() are gone. A module declares a flag as a base::Feature at namespace scope in the file that reads it (base::Feature ClothFeature{"physics.cloth", true}; in physics_world.cc) and reads it as a bool. Adding a flag no longer edits a shared file.
  • InitFeatures() applies RX_FEATURES by walking base::Feature's chain. Since Shared build links and runs: exports, one option registry, per-DSO volk, linux-dev #84 that chain is one per process, so a flag in rx_physics is reachable from rx_foundation in the component build too. Unknown names still warn.
  • The old reason for a central table (the linker dropping an unreferenced object and its registration with it) doesn't apply when the flag sits next to its only reader: the flag is dropped exactly when the code that reads it is.
  • Removed: render.pathtracer, render.mesh_shader_lod and render.distant_lod, which were declared but never read anywhere. RX_FEATURES naming them now warns instead of silently doing nothing.

Verified, static and shared:

  • ctest 155/155 in both; lint 0 violations
  • RX_FEATURES=-physics.cloth cloth_sim_test --feature-off logs "feature 'physics.cloth' off by RX_FEATURES" and the gate holds in both builds; a bogus name warns and leaves cloth on

Downstream: replace FeatureEnabled(FeatureId::kX) with a base::Feature declared next to its reader.

@Force67
Force67 merged commit 793c435 into main Sep 29, 2026
@Force67
Force67 deleted the structure-phase5b branch September 29, 2026 08:26
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.

1 participant