Skip to content

fix(SDK): Track locally evaluated environment flags in analytics - #305

Draft
pvarshh wants to merge 2 commits into
Flagsmith:mainfrom
pvarshh:codex/fix-local-analytics-304
Draft

pvarshh wants to merge 2 commits into
Flagsmith:mainfrom
pvarshh:codex/fix-local-analytics-304

Conversation

@pvarshh

@pvarshh pvarshh commented Oct 9, 2026

Copy link
Copy Markdown

Local environment flag evaluations were silently missing from analytics because the returned flags did not receive the configured analytics processor. Forward the same options as the local identity path so cached evaluations are counted and missing flags retain the configured fallback handler.

  • I have read the Contributing Guide.
  • I have added documentation if required (no public API change).
  • I have filled in Changes and testing below.

Changes

Contributes to #304.

Restore analytics and default-handler behavior for locally evaluated environment flags. Regression coverage includes remote/local parity, cached evaluations, analytics disabled, and the configured fallback.

Two development prerequisites surfaced while running the required hooks: the current context schema references evaluation-result.json after the result-generation step has deleted it, so context generation now downloads its referenced schema and cleans both inputs afterward. The generated optional context types are included. Also route the test suite's default global fetch through its existing fixture; previously several tests issued real network requests and intermittently timed out. No hooks were skipped.

How did you test this code?

  • Frozen regression before the implementation: 2 failures / 12 passes; after: 14 passes.
  • npm test: 459 passes, with coverage.
  • npm run test:esm-build: TypeScript builds pass, 449 tests pass / 10 intentionally skipped by ESM configuration.
  • Code generation: reproduced the missing-reference failure, then both generators pass after the script repair.
  • Normal pre-commit hook runs code generation, formatting and the full test suite successfully.
  • git diff --check passes.

Graphify local AST query getEnvironmentFlagsFromDocument analyticsProcessor Flags fromEvaluationResult and method explanation traced the factory/cache path; source inspection confirmed the missing options. Additional package and test-setup graph queries covered the hook prerequisites. Graph artifacts are excluded.

AI assistance: openai/gpt-oss-120b through Nodus inference generated the SDK options fix. Codex authored tests, repaired the code-generation prerequisite and network fixture, reviewed changes and ran checks. PR text and follow-up may be AI-assisted.

Review effort: 2/5.

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