Skip to content

feat: connect PostHog projects through browser OAuth - #116

Merged
justinhelmer merged 1 commit into
mainfrom
codex/posthog-cli-connect
Sep 29, 2026
Merged

justinhelmer merged 1 commit into
mainfrom
codex/posthog-cli-connect

Conversation

@justinhelmer

@justinhelmer justinhelmer commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Add PostHog to the product analytics picker and route its connection through the console's existing /cli/connect?flow=posthog browser flow.
  • Open consent on every PostHog invocation so a workspace can add a second project or reconnect the same project. Keep existing singleton shortcuts for other integrations.
  • Reuse integration baseline polling for a new row or an updated row after consent.
  • Document the command and browser handoff in the CLI README and agent skill.

Verification

  • Red-first command test reproduced the already-connected bug from review F1; the same test now proves the browser handoff with zero or one existing PostHog project (F2).
  • Focused tests: 23 passed. Full npm run test: 536 passed.
  • npm run typecheck, npm run lint, npm run build, and git diff --check passed.
  • Live browser consent and connection readback remain required before U5 acceptance. No new PostHog consent or connection was initiated by this PR.

Delivery

This is U5 of the PostHog integration plan. It requires current-head review, a person merge, then a separate CLI package release. Nominal 3.44.0 does not publish the CLI.

@justinhelmer
justinhelmer force-pushed the codex/posthog-cli-connect branch from f8d10d5 to 5b1ca20 Compare September 29, 2026 08:06

@coreplane-switchboard coreplane-switchboard Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: PostHog's per-project flow is blocked for additional projects, and the new tests do not exercise the command path.

Warning

Changes requested · head 5b1ca20 · 2 findings: 1 major, 1 minor

Severity Finding Where
major F1 Already-connected shortcut prevents adding another PostHog project src/commands/integration/connect.ts:1138
minor F2 Test the actual PostHog command dispatch and browser handoff test/integration-connect-posthog.test.ts:18
Full review

F1 (major, high confidence): PostHog connects one project at a time, but once any PostHog integration exists, integration connect --type posthog returns “already connected” without opening the project-selection flow. A user trying to add a second project must discover and pass --reconnect. Do not apply the singleton shortcut to PostHog; let the browser flow offer another project.

F2 (minor, high confidence): The new URL test calls cliConnectUrl directly, so it passes even if integration connect --type posthog stops dispatching to the browser flow. Add a command-level test that covers the PostHog handoff and the existing-project case.

@justinhelmer
justinhelmer force-pushed the codex/posthog-cli-connect branch from 5b1ca20 to 45ed82a Compare September 29, 2026 08:16

@coreplane-switchboard coreplane-switchboard Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: PostHog always enters the browser flow, including when another project is already connected, and the command-level test covers both handoffs.

Note

Approved · head 45ed82a · no findings

Full review

No findings at 45ed82a. The command-level test covers browser handoff with zero or one existing PostHog project, and the code no longer skips consent when one is connected. Adding a second project through live consent remains unverified.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: coreplane-switchboard[bot] reviewed this PR and posted an LGTM verdict (see its review). A repo admin enabled this via the auto-approve workflow.

@justinhelmer
justinhelmer merged commit 03f34fb into main Sep 29, 2026
4 checks passed
@justinhelmer
justinhelmer deleted the codex/posthog-cli-connect branch September 29, 2026 08:28
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