Skip to content

Conversation

@haacked
Copy link
Contributor

@haacked haacked commented Aug 26, 2025

@haacked haacked requested review from a team and Copilot August 26, 2025 17:29
@dmarticus dmarticus moved this to In Review in Feature Flags Aug 26, 2025

This comment was marked as outdated.

@haacked haacked force-pushed the haacked/local-evaluation-flag-dependencies branch from 688b756 to 9d9d69c Compare August 26, 2025 17:39
haacked and others added 3 commits August 26, 2025 11:30
Update FeatureFlag.php

Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
@haacked haacked force-pushed the haacked/local-evaluation-flag-dependencies branch from 4ac3e4e to 42821f4 Compare August 26, 2025 18:30
@haacked haacked requested a review from Copilot August 26, 2025 18:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Implements local evaluation of feature flag dependencies in the PostHog PHP SDK, enabling complex conditional flags where one flag can depend on the value of another flag. This feature allows for more sophisticated feature rollout strategies and ensures flags can be evaluated locally without additional API calls.

  • Adds comprehensive flag dependency evaluation logic with cycle detection
  • Implements multivariate flag dependency support for complex chains
  • Provides extensive test coverage for all dependency scenarios

Reviewed Changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/FeatureFlag.php Core implementation of flag dependency evaluation with recursion and cycle detection
lib/Client.php Integration of flag dependency context into client evaluation methods
test/FlagDependencyTest.php Unit tests for flag dependency evaluation logic and edge cases
test/MultivariateIntegrationTest.php Integration tests for multivariate flag dependencies
test/FlagDependencyIntegrationTest.php End-to-end integration tests with client API
test/FeatureFlagLocalEvaluationTest.php Updates existing tests to handle new flag dependency behavior
example.php Enhanced examples demonstrating flag dependencies with interactive menu
README.md Updated feature list to highlight flag dependencies
.env.example Configuration template for running examples

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

public static function matchesDependencyValue($expectedValue, $actualValue)
{
// String variant case - check for exact match or boolean true
if (is_string($actualValue) && strlen($actualValue) > 0) {
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

The empty string check using strlen($actualValue) > 0 is less readable than $actualValue !== ''. Consider using the more explicit comparison for better code clarity.

Suggested change
if (is_string($actualValue) && strlen($actualValue) > 0) {
if (is_string($actualValue) && $actualValue !== '') {

Copilot uses AI. Check for mistakes.
@github-project-automation github-project-automation bot moved this from In Review to Approved in Feature Flags Aug 26, 2025
@haacked haacked merged commit cfafebc into master Aug 26, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Feature Flags Aug 26, 2025
@haacked haacked deleted the haacked/local-evaluation-flag-dependencies branch August 26, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants