Skip to content

fix(flags): load shared definitions without a secret key - #851

Open
dustinbyrne wants to merge 2 commits into
mainfrom
fix/flag-cache-without-secret-key
Open

dustinbyrne wants to merge 2 commits into
mainfrom
fix/flag-cache-without-secret-key

Conversation

@dustinbyrne

@dustinbyrne dustinbyrne commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Like PostHog/posthog-python#1039, a worker consuming shared feature flag definitions should not need a privileged secret key. Existing initialization gates prevent that supported cache-consumer configuration from evaluating flags locally.

Changes

  • Permit the configured definition cache provider to supply definitions without a secret/personal API key.
  • Keyless consumers read the shared cache directly, without invoking the fetch-decision callback or publishing definitions. They cannot claim fetch leadership they are unable to use.
  • With privileged credentials, retain the existing decision flow: false reads the cache; true fetches definitions and publishes them. Direct definition requests remain authenticated.
  • Add public-entry regressions, update active credential/provider docs, and include scoped patch release metadata.

Cache-only readers bypass the shared loader specification's decision-first provider step; credentialed consumers retain that step.

Only posthog-server changes. Provider-only setups still require .localEvaluation(true); the provider setter retains the existing explicit opt-in. Android/client-core defaults and behavior are unchanged.

💚 How did you test it?

  • ./gradlew :posthog-server:test spotlessCheck :posthog-server:lint :posthog-server:apiCheck: passed.
  • Server suite: 586 tests, zero failures/errors/skips; focused public provider/loader suites: 96 tests passed.
  • Public tests cover startup, local evaluation, reload/polling, explicit opt-out, provider shutdown and snapshot/matching-version preservation.
  • Shared-leadership and reader regressions fail against the prior loader and pass with the fix.
  • Server-only local validation on JDK 17; Android/Compose suites were not run locally.

Release scope

Patch release for posthog-server. Existing signatures, capture defaults and wire formats are unchanged.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with Pi worker agents and reviewed by separate fresh-context Pi reviewers. A simplify pass covered the scoped source/tests/docs before final local validation. Human review remains required.

@dustinbyrne
dustinbyrne requested a review from a team as a code owner October 9, 2026 15:33
@dustinbyrne dustinbyrne self-assigned this Oct 9, 2026
Comment thread posthog-server/src/main/java/com/posthog/server/PostHogConfig.kt
@turnipdabeets
turnipdabeets requested a review from a team October 9, 2026 20:05

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants