Skip to content

feat(flags): evaluate dynamic offline rules (FFL-2837 PR2) - #1347

Draft
btthomas wants to merge 2 commits into
blake.thomas/FFL-2837-PR1from
blake.thomas/FFL-2837-PR2
Draft

feat(flags): evaluate dynamic offline rules (FFL-2837 PR2)#1347
btthomas wants to merge 2 commits into
blake.thomas/FFL-2837-PR1from
blake.thomas/FFL-2837-PR2

Conversation

@btthomas

@btthomas btthomas commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Pull request stack

  1. Plan PR (#1345)
  2. PR1: Rules engine boundary (#1346)
  3. PR2: Dynamic offline evaluation (feat(flags): evaluate dynamic offline rules (FFL-2837 PR2) #1347) <- you are here
  4. PR3: Provider API and documentation (#1348)

Summary

This PR adds dynamic and mixed offline evaluation to FlagsClient.

  • It stores precomputed and rules branches separately.
  • It keeps a valid branch when its sibling is invalid.
  • It accepts each context when valid rules are available.
  • It preserves a missing targeting key.
  • It selects the evaluation path for each resolution.
  • It uses matching precomputed data first.
  • It uses valid rules data second.
  • It maps rules results to FlagDetails.
  • It tracks only real rules assignments.
  • It keeps online and precomputed behavior.

Reason

A mixed configuration can contain assignments for one context and rules for other contexts.
FlagsClient selects the path when it resolves each flag.
This check prevents a mismatched precomputed assignment from being used.

Tracking

A successful rules assignment uses the existing native assignment bridge. The bridge reports evaluations through the same Datadog path as online and precomputed assignments.

The rules response does not contain extraLogging. The bridge still requires this field on Android, so the SDK supplies an empty object.

The SDK calls the bridge for every real assignment. A false doLog value does not stop the bridge call.

Temporary upstream code

This PR has one PR2-only TODO(FFL-2837) item.

The temporary rulesBased compatibility type remains until a flagging-core release contains the rules branch from openfeature-js-client#344.

The targeting-key policy is final. Missing and empty targeting keys are different. The deterministic fake remains as a permanent unit-test boundary.

User impact

The existing offline client can now evaluate rules after a context change.
It does not fetch data.
Matching precomputed data still has priority.

The provider does not pass its effective resolution context yet.
PR3 adds that connection and the customer documentation.

Checks

  • yarn tsc --noEmit -p packages/core/tsconfig.json
  • Targeted ESLint for the changed TypeScript files
  • 103 flags tests

@btthomas
btthomas force-pushed the blake.thomas/FFL-2837-PR2 branch from cb5597d to 932c87b Compare July 27, 2026 20:13
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