Skip to content

Added feature flags system#803

Merged
danditomaso merged 3 commits into
meshtastic:mainfrom
danditomaso:feat/add-feature-flags
Aug 22, 2025
Merged

Added feature flags system#803
danditomaso merged 3 commits into
meshtastic:mainfrom
danditomaso:feat/add-feature-flags

Conversation

@danditomaso

Copy link
Copy Markdown
Collaborator

Description

This PR introduces a feature flag system to the code base, this enables us to add new features to our main branch, without concern of effecting users and can roll out a more throughly tested feature at a later date.

Related Issues

This was added so we can merge a persisted node PR to the main branch, and disable the persistence piece for users.

Changes Made

  • Added a base Feature flag class that accepts environment variables and validates them using Zod
  • Added an override system to set certain flags without requiring each developer add env vars to their system
  • Added useFeature & useFeatures hooks to provide a smooth experience in React

Testing Done

It works

Checklist

  • Code follows project style guidelines
  • Documentation has been updated or added
  • Tests have been added or updated
  • All i18n translation labels have been added (read
    CONTRIBUTING_I18N_DEVELOPER_GUIDE.md for more details)

Copilot AI review requested due to automatic review settings August 22, 2025 16:16
@vercel

vercel Bot commented Aug 22, 2025

Copy link
Copy Markdown

@danditomaso is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a feature flag system to enable controlled feature rollouts without affecting users. The system uses environment variables validated with Zod and provides React hooks for easy integration.

  • Implements a FeatureFlags class with subscription-based updates and override capabilities
  • Adds React hooks (useFeatureFlags, useFeatureFlag) for consuming feature flags in components
  • Creates a development override system that automatically enables certain flags in dev mode

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/web/src/core/services/featureFlags.ts Core feature flag service with Zod validation and subscription system
packages/web/src/core/services/dev-overrides.ts Development environment overrides for feature flags
packages/web/src/core/hooks/useFeatureFlags.ts React hooks for accessing feature flags with automatic re-renders
packages/web/src/components/UI/Footer.tsx Refactors environment variable access to use memoized values
packages/web/src/App.tsx Imports dev overrides and removes commented code

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/web/src/core/hooks/useFeatureFlags.ts
Comment thread packages/web/src/core/services/dev-overrides.ts Outdated
Comment thread packages/web/src/core/services/featureFlags.ts
danditomaso and others added 2 commits August 22, 2025 13:42
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@danditomaso danditomaso force-pushed the feat/add-feature-flags branch from 3375580 to 440dcc4 Compare August 22, 2025 17:45
@vercel

vercel Bot commented Aug 22, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web-test Ready Ready Preview Comment Aug 22, 2025 5:46pm

@danditomaso danditomaso merged commit 449fb3a into meshtastic:main Aug 22, 2025
4 checks passed
@danditomaso danditomaso deleted the feat/add-feature-flags branch August 22, 2025 17:47
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.

2 participants