Repository navigation
feat(setup): name the project token environment variable - #214
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The setup spec settles the project token's name on every configuration surface it names, but not on the environment variable an SDK reads when it is initialized without an explicit token. posthog-php now reads POSTHOG_PROJECT_TOKEN with POSTHOG_API_KEY as a deprecated fallback, and @posthog/mcp reads POSTHOG_PROJECT_TOKEN, while posthog-rs and the posthog-rails logs setup read only POSTHOG_API_KEY. Pin POSTHOG_PROJECT_TOKEN as the name, keep POSTHOG_API_KEY as a deprecated fallback under the existing alias rules, and treat a blank value as unset. Tested: openspec validate setup --type spec --strict (no errors; pre-existing length warnings only), then openspec archive. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 3ed34237-1d4d-4d16-b517-7f4622b1c9f5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The SDK watcher loop found drift between the
setupspec and the SDKs: the spec settles what the project credential is called on every configuration surface it names (options object, provider props, manifest /Info.plistkey), but says nothing about the environment variable an SDK reads when it is initialized without an explicit token — and the SDKs that read one disagree.Source changes
PostHog::init()and the Laravel package now readPOSTHOG_PROJECT_TOKEN, falling back to the deprecatedPOSTHOG_API_KEY. The PR calls this a gap in the spec rather than a divergence from it.@posthog/mcp(posthog-js) already readsPOSTHOG_PROJECT_TOKEN.src/lib.rs), the posthog-rails logs setup and install generator template, and the@posthog/aiintegrations still read onlyPOSTHOG_API_KEY.What changed
New Project token environment variable name requirement in
setup:POSTHOG_PROJECT_TOKEN;POSTHOG_API_KEYkeeps it as a deprecated fallback under the existing "Deprecated project credential alias" rules, with the new name winning when both are set;Proposed, applied and archived on this branch per AGENTS.md:
openspec/changes/archive/2026-11-12-name-project-token-env-var/.openspec validate setup --type spec --strictreports no errors (only the pre-existing requirement-length warnings).Uncertain / needs review
@posthog/mcpship the new name today. Adopting this requirement means posthog-rs, posthog-ruby and@posthog/aiaddPOSTHOG_PROJECT_TOKENahead of their old variable — flagged as a follow-up intasks.md, not done here. If the preference is to leave environment variables outside the contract, this change should be dropped rather than narrowed.Created with PostHog Desktop
🤖 Generated with Claude Code