feature-flags

द्वारा redis

RedisInsight की अपनी फीचर फ्लैग प्रणाली है। फ्लैग एक रिमोट JSON कॉन्फ़िग में परिभाषित होते हैं, जिन्हें बैकएंड द्वारा लाया जाता है और API के माध्यम से फ्रंटएंड को प्रदान किया जाता है। यह स्किल फ्लैग जोड़ने, प्रमोट करने और हटाने के तरीके को कवर करता है।

npx skills add https://github.com/redis/redisinsight --skill feature-flags

Feature Flags

RedisInsight has its own feature flag system. Flags are defined in a remote JSON config, fetched by the backend, and served to the frontend via API. This skill covers how to add, promote, and remove flags.

Flag Types

TypeNamingflag valueStrategyPurpose
Dev flagdev-<name> (e.g. dev-browser)falseCommonFlagStrategyHide incomplete features during development
Regular flagcamelCase (e.g. azureEntraId)trueCommonFlagStrategyStandard on/off toggle
Regular with datacamelCasetrueWithDataFlagStrategyFlag + extra config payload in data
Switchable (overridable)camelCasetrueSwitchableFlagStrategyUser can override locally via ~/.redis-insight/config.json

Files to Change

Every new flag touches these files (in order):

Backend (required)

  1. redisinsight/api/config/features-config.json Add the flag entry with flag, perc, optional filters and data. Bump the version number.

  2. redisinsight/api/src/modules/feature/constants/index.ts Add to the KnownFeatures enum.

  3. redisinsight/api/src/modules/feature/constants/known-features.ts Add entry to the knownFeatures record with name and storage (usually FeatureStorage.Database).

  4. redisinsight/api/src/modules/feature/providers/feature-flag/feature-flag.provider.ts Register the flag with its strategy (see Strategy Types below).

Frontend (required if the flag gates UI)

  1. redisinsight/ui/src/constants/featureFlags.ts Add to the FeatureFlags enum.

  2. redisinsight/ui/src/slices/app/features.ts Add default state entry in initialState.featureFlags.features with { flag: false }.

Consuming code

  1. Use the flag in components/hooks to gate functionality.

Strategy Selection

Choose the strategy based on what the flag needs:

CommonFlagStrategy        → Most flags (dev and regular on/off)
WithDataFlagStrategy      → Flag needs to carry extra data payload
SwitchableFlagStrategy    → Flag should be overridable via local config.json

Register in feature-flag.provider.ts:

this.strategies.set(
  KnownFeatures.YourFeature,
  new CommonFlagStrategy(this.featuresConfigService, this.settingsService),
);

Config JSON Structure

Minimal (dev flag)

"dev-myFeature": {
  "flag": false,
  "perc": [[0, 100]]
}

With filters (Electron-only)

"myFeature": {
  "flag": true,
  "perc": [[0, 100]],
  "filters": [
    { "name": "config.server.buildType", "value": "ELECTRON", "cond": "eq" }
  ]
}

Gradual rollout (10% of users)

"myFeature": {
  "flag": true,
  "perc": [[0, 10]]
}

With data payload

"myFeature": {
  "flag": true,
  "perc": [[0, 100]],
  "data": { "strategy": "ioredis" }
}

Filter Conditions

Filters compare a value from server state against the filter value.

ConditionMeaning
eqequals
neqnot equals
gt / gtegreater than / greater or equal
lt / lteless than / less or equal

Common name paths: config.server.buildType (ELECTRON, DOCKER_ON_PREMISE, REDIS_STACK), config.server.packageVersion (uses semver), agreements.analytics, env.<VAR_NAME>.

Filters support and/or composition for complex conditions.

Workflows

Add a dev feature flag

Use for features under active development that should not be visible in production.

  1. features-config.json → add "dev-myFeature": { "flag": false, "perc": [[0, 100]] }
  2. constants/index.ts → add DevMyFeature = 'dev-myFeature' to KnownFeatures
  3. constants/known-features.ts → add record entry
  4. feature-flag.provider.ts → register with CommonFlagStrategy
  5. ui/src/constants/featureFlags.ts → add devMyFeature = 'dev-myFeature'
  6. ui/src/slices/app/features.ts → add default { flag: false }

Promote dev flag to regular flag

When the feature is complete and ready for rollout.

  1. Rename dev-myFeaturemyFeature in all the files above
  2. Set flag: true in features-config.json
  3. Optionally set perc for gradual rollout (e.g. [[0, 10]])
  4. Change strategy if needed (e.g. to SwitchableFlagStrategy for overridable)
  5. Bump config version

Clean up a flag

When a feature is fully rolled out and the flag is no longer needed.

  1. Remove from features-config.json
  2. Remove from KnownFeatures enum
  3. Remove from knownFeatures record
  4. Remove strategy registration from feature-flag.provider.ts
  5. Remove from FE FeatureFlags enum
  6. Remove default state from features.ts
  7. Remove all gating code (conditionals, FeatureFlagComponent wrappers) in consuming components

FE Usage Patterns

Check flag in a component

import { FeatureFlags } from 'uiSrc/constants';
import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features';

const features = useSelector(appFeatureFlagsFeaturesSelector);
const isEnabled = features[FeatureFlags.myFeature]?.flag;

Custom selector for complex logic

export const isMyFeatureEnabledSelector = (state: RootState): boolean => {
  const features = state.app.features.featureFlags.features;
  return features[FeatureFlags.myFeature]?.flag ?? false;
};

redis की और Skills

docs-sync
redis
मास्टर ब्रांच के कार्यान्वयन और कॉन्फ़िगरेशन का विश्लेषण करें ताकि docs/, README.md, और प्रति-पैकेज README में गायब, गलत, या पुराने दस्तावेज़ का पता लगाया जा सके। उपयोग करें…
official
implement-command
redis
Add a new Redis command (or command variant) to node-redis end-to-end — the `<NAME>.ts` Command file, its registration with JSDoc in the package…
official
maintainer-review
redis
GitHub issue या pull request URL की समीक्षा node-redis अनुरक्षक के रूप में करें, जिसमें यह चरणबद्ध मूल्यांकन हो कि दावा वास्तविक है, व्यावहारिक रूप से महत्वपूर्ण है, पहले से...
official
pr-draft-summary
redis
node-redis के लिए आवश्यक PR-तैयार सारांश ब्लॉक, शाखा सुझाव, शीर्षक और ड्राफ्ट विवरण बनाएं। इसका उपयोग अंतिम प्रतिक्रिया से पहले किया जाना चाहिए जब भी...
official
runtime-behavior-probe
redis
रनटाइम व्यवहार जांच की योजना बनाएं और अस्थायी TypeScript प्रोब स्क्रिप्ट, सत्यापन मैट्रिक्स, स्थिति नियंत्रण और निष्कर्ष-प्रथम रिपोर्ट के साथ उन्हें क्रियान्वित करें। उपयोग करें…
official
backend
redis
NestJS बैकएंड विकास पैटर्न RedisInsight API के लिए: मॉड्यूल संरचना, सेवाएँ, नियंत्रक, DTO, निर्भरता इंजेक्शन, और त्रुटि प्रबंधन। उपयोग करें जब...
official
branches
redis
लोअरकेस केबब-केस का उपयोग करें, जिसमें टाइप प्रीफिक्स और इश्यू/टिकट आइडेंटिफायर हो। ब्रांच नाम GitHub Actions वर्कफ़्लो नियमों से मेल खाने चाहिए (.github/workflows/enforce-branch-name-rules.yml देखें)।
official
code-quality
redis
Code-quality standards for RedisInsight: TypeScript strictness, naming conventions (camelCase, PascalCase, UPPER_SNAKE_CASE), linting rules, no `any` without…
official