fix: analytics harness#232
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
@farming-labs/astro
@farming-labs/astro-theme
@farming-labs/docs
@farming-labs/theme
@farming-labs/next
@farming-labs/nuxt
@farming-labs/nuxt-theme
@farming-labs/svelte
@farming-labs/svelte-theme
@farming-labs/tanstack-start
commit: |
Contributor
There was a problem hiding this comment.
2 issues found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/next/src/config.ts">
<violation number="1" location="packages/next/src/config.ts:286">
P1: Workspace Turbopack aliases now hardcode `dist/*.mjs` paths, which can break local dev when workspace packages are not prebuilt.</violation>
</file>
<file name="packages/fumadocs/src/client-analytics.ts">
<violation number="1" location="packages/fumadocs/src/client-analytics.ts:115">
P2: Keep the identity fields consistent when caller properties override IDs; otherwise `visitorId`/`sessionId` can diverge from `visitor.id`/`session.id` in the same event.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/next/src/config.ts">
<violation number="1" location="packages/next/src/config.ts:2221">
P3: This `if` guard is dead code because the analytics env object is always non-empty.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Comment on lines
+2221
to
+2226
| if (Object.keys(publicDocsCloudAnalyticsEnv).length > 0) { | ||
| nextConfig.env = { | ||
| ...publicDocsCloudAnalyticsEnv, | ||
| ...nextConfig.env, | ||
| }; | ||
| } |
Contributor
There was a problem hiding this comment.
P3: This if guard is dead code because the analytics env object is always non-empty.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/next/src/config.ts, line 2221:
<comment>This `if` guard is dead code because the analytics env object is always non-empty.</comment>
<file context>
@@ -2182,6 +2217,14 @@ export function withDocs(nextConfig: NextConfig = {}): NextConfig {
}
+ const publicDocsCloudAnalyticsEnv = createPublicDocsCloudAnalyticsEnv();
+ if (Object.keys(publicDocsCloudAnalyticsEnv).length > 0) {
+ nextConfig.env = {
+ ...publicDocsCloudAnalyticsEnv,
</file context>
Suggested change
| if (Object.keys(publicDocsCloudAnalyticsEnv).length > 0) { | |
| nextConfig.env = { | |
| ...publicDocsCloudAnalyticsEnv, | |
| ...nextConfig.env, | |
| }; | |
| } | |
| nextConfig.env = { | |
| ...publicDocsCloudAnalyticsEnv, | |
| ...nextConfig.env, | |
| }; |
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.
Summary by cubic
Adds a browser analytics harness that persists anonymous visitor and session IDs, attaches them to client events, exposes the current identity, and only enables the client hook when analytics is on. Adds a configurable Docs Cloud analytics endpoint with a safe default and forwards Docs Cloud env to the client via
withDocs; Turbopack now prefers builtdistentrypoints.New Features
NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENDPOINT/DOCS_CLOUD_ANALYTICS_ENDPOINTwith a default; events post to the configured endpoint and the client falls back to public env when explicit options are stripped.getDocsClientAnalyticsIdentityreturns the current anonymous visitor/session; caller-provided IDs are preserved on events.withDocsserializesDOCS_CLOUD_*toNEXT_PUBLIC_*only when analytics is configured and does not override user-provided env; exportedisDocsClientAnalyticsEnabled.Refactors
dist/*.mjsand fall back tosrcfor@farming-labs/docs,@farming-labs/theme, and@farming-labs/next; addeddocs-client-hooksto build outputs and alias coverage.Written for commit 58928f2. Summary will update on new commits.