Skip to content

fix(server): log when local-only evaluation omits continuity flags - #824

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixserver-warn-when-local-only-eval-03ddf4
Draft

posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixserver-warn-when-local-only-eval-03ddf4

Conversation

@posthog

@posthog posthog Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

  • A backend that serves flags with evaluateFlags(onlyEvaluateLocally = true) loses every flag that has experience continuity on, and nothing tells it why.
  • FlagEvaluator.matchFeatureFlagProperties always throws InconclusiveMatchException for these flags. Local-only mode returns only the flags that resolved locally, so these flags disappear with no specific log. /flags still returns them.
  • This change logs one message per local-only call that names the omitted continuity flags and gives the two workarounds: allow remote evaluation, or turn off continuity for these flags. The Node SDK added a similar warning in PostHog/posthog-js#2883.
  • evaluateFlagsLocally records the continuity flags in LocalEvaluationOutcome. The log fires only on the local-only return path. When remote fallback is allowed, /flags fills these flags, so no log is needed there.

Note

The message goes through config.logger, the only log channel the SDK has. PostHogPrintLogger prints only when debug is on, so a user with debug off still sees nothing. This change does not add a new log level.

Still open (not in this PR): return these flags marked as inconclusive, or throw only when a hash key override would actually apply. The second option needs care for group-aggregated flags. I left both out because each one changes public behavior.

💚 How did you test it?

  • New test local only evaluation logs the experience continuity flags it omits in PostHogFeatureFlagsTest. It loads one plain flag and one continuity flag, runs a local-only evaluateFlags, and checks three things: only the plain flag comes back, no request goes to /flags, and the log names the continuity flag.
  • I confirmed that the test fails when the log message is removed.
  • ./gradlew :posthog-server:test spotlessCheck passes.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Fully autonomous

  • Written by Claude Code (model claude-opus-5-5) from a PostHog inbox report, running in PostHog Desktop.
  • I chose a log only, because it is the smallest change that makes the drop visible. It also does not change the public API or which flags a snapshot contains.

Created with PostHog Desktop from this inbox report.

🤖 Generated with Claude Code

evaluateFlags(onlyEvaluateLocally = true) silently left out every flag with experience continuity on, because local evaluation always treats those flags as inconclusive. Log the omitted flag keys so the caller can see why they are missing.

Generated-By: PostHog Desktop
Task-Id: 0a6e5669-93e4-40ff-b9af-1be7d03de6fb

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant