Skip to content

Add local feature flag system and a feature-flags skill#10

Merged
GordonBeeming merged 3 commits into
mainfrom
gb/7-feature-flags
Jun 10, 2026
Merged

Add local feature flag system and a feature-flags skill#10
GordonBeeming merged 3 commits into
mainfrom
gb/7-feature-flags

Conversation

@GordonBeeming

Copy link
Copy Markdown
Owner

Summary

  • Adds a typed feature-flag registry (src/featureFlags.ts) with default/override resolution; only user overrides persist, and the Rust backend prunes unknown or retired ids on load.
  • Surfaces user-facing preview flags under a new Preview Features settings category, seeded with a gitAttribution sample flag (default off) that reserves the id for that future feature.
  • Updates the new-feature planning skill to require a feature-flag recommendation per feature, documents the flag lifecycle in docs/development.md, and adds a feature-flags repo skill covering how to add, gate, remove, and promote flags.

Test plan

  • ./run-tests.sh (npm 274 tests, build, bundle budget, smoke, npm audit, cargo fmt/clippy/test/check)
  • Toggle the gitAttribution flag in Settings → Preview Features, restart the app, confirm it persists
  • Add a bogus flag id to ui-state.json, restart, confirm it is pruned
  • Confirm internal-only flags never render in Settings

Closes #7

GordonBeeming and others added 2 commits June 10, 2026 22:48
Introduce a typed feature-flag registry so larger work can ship behind a
flag, then graduate into a normal setting or become always-on. Flags carry
metadata and defaults in src/featureFlags.ts; only user overrides persist,
and the Rust backend prunes unknown or retired ids on load. User-facing
preview flags surface under a new Preview Features settings category, and a
sample gitAttribution flag reserves the id for that future feature. The
new-feature planning skill now requires a flag recommendation per feature.

Closes #7

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
Document the add, gate, remove, and promote-to-setting procedures for the
feature-flag system as a repo skill, and point AGENTS.md at it.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming marked this pull request as ready for review June 10, 2026 12:50
Copilot AI review requested due to automatic review settings June 10, 2026 12:50

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a local feature-flag system allowing larger or riskier features to ship behind a flag before graduating to normal settings or becoming always-on. It adds a typed registry in the frontend, persists overrides in the Rust backend, and provides a 'Preview Features' tab in the Settings UI for user opt-in. A review comment suggests optimizing isFeatureEnabled to perform a direct O(1) lookup instead of a full sanitization and resolution on every check, which avoids unnecessary object allocations on hot paths.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/featureFlags.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a local, typed feature-flag system (with persisted user overrides) and surfaces user-toggleable preview flags in Settings, alongside documentation and agent-skill guidance for managing the flag lifecycle.

Changes:

  • Adds a typed feature flag registry with override sanitization and default/override resolution (src/featureFlags.ts) plus unit tests.
  • Persists feature-flag overrides in UI state (frontend + Rust backend) and prunes unknown/retired ids during backend sanitization.
  • Adds a Preview Features Settings category for user-visible preview flags and documents the flag lifecycle + adds/updates agent skills.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tauri.ts Extends persisted view settings to include featureFlags override map and seeds defaults.
src/tauri.test.ts Updates hosted Tauri transport test fixtures to include featureFlags.
src/styles.css Adds styling for preview feature flag rows in Settings.
src/featureFlags.ts Introduces the typed registry, sanitization, and resolution helpers for feature flags.
src/featureFlags.test.ts Adds unit coverage for defaults, overrides, sanitization, and preview visibility filtering.
src/App.tsx Adds Preview Features settings tab and wires persisted featureFlags overrides into app state + persistence.
src/App.test.tsx Adds rendered-shell coverage ensuring preview flags render and toggles persist/restore.
src-tauri/src/lib.rs Persists feature flag overrides, prunes unknown ids on load, and adds backend tests for pruning/round-trip.
docs/development.md Documents the local feature-flag system, lifecycle, and promotion/removal guidance.
AGENTS.md Adds guidance to use $feature-flags when operating the feature-flag lifecycle.
.agents/skills/new-feature/SKILL.md Requires a per-feature feature-flag recommendation in new-feature artifacts/issues.
.agents/skills/feature-flags/SKILL.md Adds a repo skill with step-by-step procedures for adding/gating/removing/promoting flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/featureFlags.ts
Resolve a hot-path check without resolving the whole registry or allocating,
per review feedback. A non-boolean override still falls back to the default.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: GitButler <gitbutler@gitbutler.com>
@GordonBeeming GordonBeeming merged commit 6769329 into main Jun 10, 2026
2 of 4 checks passed
@GordonBeeming GordonBeeming deleted the gb/7-feature-flags branch June 10, 2026 13:11
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.

Manage Feature Flags And Their Promotion To Settings

2 participants