PostHog plugin#94
Open
adamkinniburgh wants to merge 3 commits into
Open
Conversation
Contributor
📝 WalkthroughWalkthroughAdds the PostHog v1 plugin configuration, authentication flow, indexed object streams, HogQL analytics streams, result transformations, scopes, documentation, and default dashboards. ChangesPostHog plugin
Sequence Diagram(s)sequenceDiagram
participant Dashboard
participant DataStream
participant PostHogAPI
participant TransformScript
Dashboard->>DataStream: Request scoped analytics data
DataStream->>PostHogAPI: POST project query with HogQL and timeframe
PostHogAPI->>TransformScript: Return columnar results
TransformScript->>Dashboard: Return typed row objects
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/PostHog/v1/dataStreams/eventVolume.json`:
- Line 16: Escape interpolated HogQL literals in the query predicates, using
variables_override or the existing SQL string-escaping mechanism, so event and
object.name values cannot break or alter filtering. Apply the same fix at
plugins/PostHog/v1/dataStreams/eventVolume.json:16,
plugins/PostHog/v1/dataStreams/flagEvaluations.json:16, and
plugins/PostHog/v1/dataStreams/flagVariants.json:16.
In `@plugins/PostHog/v1/dataStreams/members.json`:
- Around line 8-13: Configure nextUrl pagination in the stream definitions:
update plugins/PostHog/v1/dataStreams/members.json at lines 8-13 and
plugins/PostHog/v1/dataStreams/featureFlags.json at lines 8-13 to consume each
response’s documented next URL, ensuring all organization members and project
feature flags pages are imported.
In `@plugins/PostHog/v1/dataStreams/scripts/hogqlQuery.js`:
- Around line 5-8: Update the row transformation around cols and
Object.fromEntries to disambiguate duplicate column names before constructing
each object, preserving every returned cell while retaining unchanged names for
unique columns. Ensure the same disambiguated column keys are applied
consistently across all rows.
In `@plugins/PostHog/v1/defaultContent/featureFlag.dash.json`:
- Line 83: Update the tile titles in the feature flag dashboard configuration:
change “Evaluations over time” to “Evaluations Over Time” and the title at the
corresponding second tile entry to “Variant Split,” preserving all other
dashboard configuration.
- Around line 29-31: Update the tile object identified by "id":
"datastream-properties" to use the generated data-stream GUID reference pattern
used by the other dashboard tiles instead of the fixed non-GUID ID, while
preserving its existing name and pluginConfigId values.
In `@plugins/PostHog/v1/defaultContent/Project/webAnalytics.dash.json`:
- Line 24: Update the tile titles in the dashboard definition, including the
entries corresponding to “Unique visitors” and the other referenced title
fields, to use title case consistently. Preserve the existing titles’ meaning
while capitalizing each significant word according to the project’s naming
convention.
In `@plugins/PostHog/v1/ui.json`:
- Around line 23-29: Update the personalApiKey help text in the PostHog UI
configuration to explicitly include the Users read scope alongside Organization,
Project, Feature flag, and Query. Preserve the existing authentication and
validation settings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: b4748998-0b98-46a6-be7c-3eee2f45565e
⛔ Files ignored due to path filters (1)
plugins/PostHog/v1/icon.svgis excluded by!**/*.svg
📒 Files selected for processing (44)
plugins/PostHog/v1/configValidation.jsonplugins/PostHog/v1/custom_types.jsonplugins/PostHog/v1/dataStreams/activeHours.jsonplugins/PostHog/v1/dataStreams/activeUsers.jsonplugins/PostHog/v1/dataStreams/currentUser.jsonplugins/PostHog/v1/dataStreams/eventBreakdown.jsonplugins/PostHog/v1/dataStreams/eventVolume.jsonplugins/PostHog/v1/dataStreams/featureFlags.jsonplugins/PostHog/v1/dataStreams/flagEvaluations.jsonplugins/PostHog/v1/dataStreams/flagVariants.jsonplugins/PostHog/v1/dataStreams/frustratingPages.jsonplugins/PostHog/v1/dataStreams/hogqlQuery.jsonplugins/PostHog/v1/dataStreams/members.jsonplugins/PostHog/v1/dataStreams/organizations.jsonplugins/PostHog/v1/dataStreams/projects.jsonplugins/PostHog/v1/dataStreams/scripts/activeHours.jsplugins/PostHog/v1/dataStreams/scripts/activeUsers.jsplugins/PostHog/v1/dataStreams/scripts/currentUser.jsplugins/PostHog/v1/dataStreams/scripts/eventBreakdown.jsplugins/PostHog/v1/dataStreams/scripts/eventVolume.jsplugins/PostHog/v1/dataStreams/scripts/featureFlags.jsplugins/PostHog/v1/dataStreams/scripts/flagEvaluations.jsplugins/PostHog/v1/dataStreams/scripts/flagVariants.jsplugins/PostHog/v1/dataStreams/scripts/frustratingPages.jsplugins/PostHog/v1/dataStreams/scripts/hogqlQuery.jsplugins/PostHog/v1/dataStreams/scripts/members.jsplugins/PostHog/v1/dataStreams/scripts/webBreakdown.jsplugins/PostHog/v1/dataStreams/scripts/webPaths.jsplugins/PostHog/v1/dataStreams/scripts/webVisitors.jsplugins/PostHog/v1/dataStreams/webBreakdown.jsonplugins/PostHog/v1/dataStreams/webPaths.jsonplugins/PostHog/v1/dataStreams/webVisitors.jsonplugins/PostHog/v1/defaultContent/Project/manifest.jsonplugins/PostHog/v1/defaultContent/Project/overview.dash.jsonplugins/PostHog/v1/defaultContent/Project/webAnalytics.dash.jsonplugins/PostHog/v1/defaultContent/account.dash.jsonplugins/PostHog/v1/defaultContent/featureFlag.dash.jsonplugins/PostHog/v1/defaultContent/manifest.jsonplugins/PostHog/v1/defaultContent/organization.dash.jsonplugins/PostHog/v1/defaultContent/scopes.jsonplugins/PostHog/v1/docs/README.mdplugins/PostHog/v1/indexDefinitions/default.jsonplugins/PostHog/v1/metadata.jsonplugins/PostHog/v1/ui.json
- Escape single quotes in interpolated HogQL string literals (event name, feature flag key) to prevent broken/altered queries - Paginate members and feature-flag imports via nextUrl so all pages load - Disambiguate duplicate column names in the HogQL query transform - Use title case for web-analytics and feature-flag tile titles - Document the required User read scope in the API-key help text Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧩 Plugin PR Summary📦 Modified Plugins
📋 Results
🔍 Validation Details✅
|
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.
🔌 Plugin overview
🖼️ Plugin screenshots
Plugin configuration
Default dashboards
Too revealing of sensitive info for a public repo
🧪 Testing
npx squaredup validate— passes (hybrid plugin, 16 data streams, 1 import definition, UI config, icon, default content, config validation and custom types all present).query:readscope; without it those streams return an auth error while imports still succeed.📚 Checklist
🤖 Generated with Claude Code