Skip to content

Integrate feature flags into cellix packages - #319

Open
aaron-rabinowitz wants to merge 7 commits into
mainfrom
integrate-feature-flags-into-cellix-packages
Open

Integrate feature flags into cellix packages#319
aaron-rabinowitz wants to merge 7 commits into
mainfrom
integrate-feature-flags-into-cellix-packages

Conversation

@aaron-rabinowitz

@aaron-rabinowitz aaron-rabinowitz commented Aug 13, 2026

Copy link
Copy Markdown

Summary by Sourcery

Integrate optional, validated feature-flag support across Blob storage, API services, and portal UIs while hardening affected dependencies.

New Features:

  • Add validated Blob-backed feature-flag access to Cellix and OCOM storage services, including fallback handling for missing documents.
  • Provide shared UI feature-flag context, hooks, caching, retries, and application configuration for the Community and Staff portals.

Bug Fixes:

  • Apply dependency and package-version overrides to address reported security vulnerabilities, including brace-expansion and related transitive packages.

Enhancements:

  • Expose blob text downloads and feature-flag-aware service contracts across API and application layers.
  • Configure API bootstrap and application services to consume feature flags with local fallback values.

Build:

  • Add feature-flag schema/configuration support and required runtime dependencies.

CI:

  • Pin the Azure Functions Core Tools version used by the build pipeline.

Documentation:

  • Document Blob-backed feature flags, new storage capabilities, exports, and OCOM integration.

Tests:

  • Add coverage for Blob text downloads, feature-flag validation and fallback behavior, API registration, UI provider behavior, and portal defaults.

Chores:

  • Update TypeScript configuration to include JSON configuration assets.

@aaron-rabinowitz
aaron-rabinowitz requested a review from a team August 13, 2026 18:43
@aaron-rabinowitz
aaron-rabinowitz requested a review from a team as a code owner August 13, 2026 18:43
@sourcery-ai

sourcery-ai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Introduces a framework-level feature flag service in Cellix, wires it into OCOM API and UI applications via blob-backed configuration, and adds a React provider + hook for consuming feature flags in the portals, along with supporting blob storage, build, and dependency changes.

Sequence diagram for UI feature flag loading and consumption

sequenceDiagram
  actor User
  participant FeatureFlagProvider
  participant LRUCache
  participant fetch
  participant FeatureFlagsContext
  participant Component as useFeatureFlags

  User->>FeatureFlagProvider: mount with FeatureFlagConfig
  FeatureFlagProvider->>LRUCache: fetch("featureFlagsKey")
  alt config.url is non-empty
    LRUCache->>fetch: fetch(url?timestamp, { cache: "no-store" })
    fetch-->>LRUCache: JSON FeatureFlags
    LRUCache-->>FeatureFlagProvider: FeatureFlags
    FeatureFlagProvider->>FeatureFlagsContext: provide FeatureFlagList
  else config.url is empty or fetch fails
    FeatureFlagProvider->>FeatureFlagsContext: provide fallbackFlagValues
  end

  User->>Component: render
  Component->>FeatureFlagsContext: useFeatureFlags()
  Component->>FeatureFlagsContext: GetFeatureFlagByName(name)
  FeatureFlagsContext-->>Component: flag Value
  Component-->>User: UI rendered with flag-controlled behavior
Loading

File-Level Changes

Change Details Files
Add a Cellix feature flag infrastructure service and OCOM wrapper for validated, blob-backed flag documents.
  • Define feature flag document, text source, options, and service interfaces with JSON schema validation via Ajv.
  • Implement ServiceFeatureFlags that reads UTF-8 text from an injected source, validates or falls back to a default document, and exposes lifecycle + getFeatureFlags.
  • Add tests, vitest configs, tsconfig, manifest, and README for the new feature flag service and its OCOM re-export wrapper.
packages/cellix/service-feature-flags/src/interfaces.ts
packages/cellix/service-feature-flags/src/service-feature-flags.ts
packages/cellix/service-feature-flags/src/index.ts
packages/cellix/service-feature-flags/src/index.test.ts
packages/cellix/service-feature-flags/src/feature-flags.schema.json
packages/cellix/service-feature-flags/README.md
packages/cellix/service-feature-flags/manifest.md
packages/cellix/service-feature-flags/package.json
packages/cellix/service-feature-flags/tsconfig.json
packages/cellix/service-feature-flags/vitest.config.ts
packages/cellix/service-feature-flags/tsconfig.vitest.json
packages/ocom/service-feature-flags/src/index.ts
packages/ocom/service-feature-flags/src/index.test.ts
packages/ocom/service-feature-flags/package.json
packages/ocom/service-feature-flags/tsconfig.json
packages/ocom/service-feature-flags/vitest.config.ts
packages/ocom/service-feature-flags/tsconfig.vitest.json
Extend blob storage services to support downloading UTF-8 text documents for use by the feature flag service.
  • Add downloadText to the BlobStorage interface and ServiceBlobStorage implementation, returning undefined for BlobNotFound and rethrowing other errors.
  • Introduce an isBlobNotFoundError helper to distinguish missing blobs from other failures.
  • Add unit tests validating downloadText behavior for existing and non-existing blobs, and enable JSON module resolution in the OCOM blob package.
packages/cellix/service-blob-storage/src/interfaces.ts
packages/cellix/service-blob-storage/src/service-blob-storage.ts
packages/cellix/service-blob-storage/src/download-text.test.ts
packages/ocom/service-blob-storage/src/index.ts
packages/ocom/service-blob-storage/tsconfig.json
packages/ocom/service-blob-storage/readme.md
Wire feature flags into the API bootstrap using blob storage, with local JSON fallback configuration and updated tests.
  • Import ServiceFeatureFlags and feature flag config, construct a shared blobStorageService, and register both BlobStorageService and FeatureFlagsService in Cellix.initializeInfrastructureServices.
  • Add local JSON-backed feature flag config module that reads FEATURE_FLAG_BLOB_NAME, sets containerName, and exposes a fallback document.
  • Update API tsconfig references and includes to handle JSON modules and the new service, and extend index.test.ts mocks/assertions for FeatureFlagsService registration and behavior.
apps/api/src/index.ts
apps/api/src/index.test.ts
apps/api/src/service-config/feature-flags/index.ts
apps/api/src/service-config/feature-flags/feature-flags.local.json
apps/api/tsconfig.json
apps/api/package.json
apps/api/local-settings.e2e.json
Add a UI-level feature flag provider, context, and hook in @ocom/ui-shared and integrate it into community and staff portals with JSON default values.
  • Create FeatureFlagsContext, FeatureFlagProvider, and useFeatureFlags hook with LRU-based caching, async-retry fetching, TTL-based refresh, Storybook detection, and fallback behavior.
  • Export feature flag types and provider from ui-shared organisms index, and add async-retry, lru-cache, and types as dependencies.
  • Add per-app feature-flag-config modules using VITE_COMMON_FEATURE_FLAG_URL and JSON default values; wrap portal roots in FeatureFlagProvider and add tests that enforce required maintenance flags and provider behavior.
packages/ocom/ui-shared/src/components/organisms/feature-flag/feature-flag-context.tsx
packages/ocom/ui-shared/src/components/organisms/feature-flag/feature-flag-provider.tsx
packages/ocom/ui-shared/src/components/organisms/feature-flag/use-feature-flags.tsx
packages/ocom/ui-shared/src/components/organisms/feature-flag/is-in-storybook-env.ts
packages/ocom/ui-shared/src/components/organisms/feature-flag/index.tsx
packages/ocom/ui-shared/src/components/organisms/index.tsx
packages/ocom/ui-shared/src/components/organisms/feature-flag/feature-flag-provider.test.tsx
packages/ocom/ui-shared/package.json
apps/ui-community/src/config/feature-flag-config.ts
apps/ui-community/src/config/feature-flag-default-values.json
apps/ui-community/src/config/feature-flag-default-values.test.ts
apps/ui-community/src/main.tsx
apps/ui-community/package.json
apps/ui-community/tsconfig.json
apps/ui-staff/src/config/feature-flag-config.ts
apps/ui-staff/src/config/feature-flag-default-values.json
apps/ui-staff/src/config/feature-flag-default-values.test.ts
apps/ui-staff/src/main.tsx
apps/ui-staff/package.json
apps/ui-staff/tsconfig.json
Update workspace tooling, dependency overrides, and Azure Functions tooling for compatibility and security while supporting the new feature flag and blob capabilities.
  • Extend pnpm-workspace audit ignore list and overrides for image-size, brace-expansion, js-yaml, fast-uri, nanoid, protobufjs, and related packages.
  • Pin azure-functions-core-tools to 4.2.1 in the monorepo build stage to stabilize Azure Functions tooling.
  • Add JSON includes and resolveJsonModule settings where needed for new JSON configs and schemas.
pnpm-workspace.yaml
build-pipeline/core/monorepo-build-stage.yml

Possibly linked issues

  • #(unknown): PR introduces backend service, frontend provider, local JSON configs, Azure blob loading, and tests matching the feature flag issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've reviewed your changes and they look great!

Fixed security issues:


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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