Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'

import { IconOpenSidebar } from '@posthog/icons'
import { IconOpenSidebar, IconSparkles } from '@posthog/icons'
import { LemonButton, LemonInput } from '@posthog/lemon-ui'

import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'
import { ReadingHog } from 'lib/components/hedgehogs'
import { AgentBadgeRotator } from 'lib/components/MCPHint/AgentBadgeRotator'
import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
import { Sparkline } from 'lib/components/Sparkline'
import { TZLabel } from 'lib/components/TZLabel'
import ViewRecordingButton from 'lib/components/ViewRecordingButton/ViewRecordingButton'
import { LemonTable } from 'lib/lemon-ui/LemonTable'
import { Link } from 'lib/lemon-ui/Link'
import { useWizardCommand } from 'scenes/onboarding/shared/SetupWizardBanner'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
Expand Down Expand Up @@ -307,6 +311,49 @@ const WARNING_TYPE_RENDERER = {
},
}

/**
* Agent-flavored nudge shown above the warnings table: pushes the
* `npx @posthog/wizard ingestion-warnings` CLI, which finds the code behind each
* warning and fixes the instrumentation producing it. Mirrors the warehouse / MCP
* hint cards.
*/
function IngestionWarningsWizardHint(): JSX.Element | null {
const { wizardCommand, isCloudOrDev } = useWizardCommand('ingestion-warnings')

// The wizard CLI only targets cloud (US/EU) and dev instances — self-hosted has no
// preconfigured endpoint, so hide it rather than show a command that can't work.
if (!isCloudOrDev) {
return null
}

return (
<div className="rounded-lg border border-dashed border-primary bg-bg-light p-4 flex flex-col gap-3">
<div className="flex items-center gap-2">
<IconSparkles className="size-4 shrink-0" />
<h4 className="m-0 text-sm font-semibold">
Let <AgentBadgeRotator /> fix these warnings for you
</h4>
</div>
<div className="text-sm text-default">
Ingestion warnings can't be fixed after the fact — the events are already dropped or degraded. Run this
in your project and the wizard traces each warning back to the code producing it and fixes the
instrumentation.
</div>
<div className="pt-1">
<CommandBlock
command={wizardCommand}
copyLabel="Ingestion warnings wizard command"
ariaLabel="Copy ingestion warnings wizard command"
size="sm"
decoration="rainbow"
className="bg-surface-secondary border border-primary !m-0 hover:border-accent"
onCopy={() => posthog.capture('ingestion warnings wizard hint command copied')}
/>
Comment on lines +343 to +351

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.

P2 The WarehouseWizardHint it mirrors fires posthog.capture('warehouse wizard hint command copied') via the onCopy prop whenever the command is copied. Without a corresponding capture here, there will be no telemetry on whether users are actually running the ingestion-warnings wizard, making it impossible to measure adoption.

Suggested change
<CommandBlock
command={wizardCommand}
copyLabel="Ingestion warnings wizard command"
ariaLabel="Copy ingestion warnings wizard command"
size="sm"
decoration="rainbow"
className="bg-surface-secondary border border-primary !m-0 hover:border-accent"
/>
<CommandBlock
command={wizardCommand}
copyLabel="Ingestion warnings wizard command"
ariaLabel="Copy ingestion warnings wizard command"
size="sm"
decoration="rainbow"
className="bg-surface-secondary border border-primary !m-0 hover:border-accent"
onCopy={() => posthog.capture('ingestion warnings wizard hint command copied')}
/>

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

</div>
</div>
)
}

export function IngestionWarningsView(): JSX.Element {
const { data, dataLoading, summaryDatasets, dates, searchQuery, showProductIntro } =
useValues(ingestionWarningsLogic)
Expand Down Expand Up @@ -344,6 +391,7 @@ export function IngestionWarningsView(): JSX.Element {
/>
) : (
<SceneSection>
<IngestionWarningsWizardHint />
<LemonInput
fullWidth
value={searchQuery}
Expand Down
Loading