Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ APP_FULL_URL=
QDRANT_FULL_URL=
ADDITIONAL_CORS_ORIGINS=

# Posthog Configuration
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Inconsistent brand casing; use "PostHog" capitalization to match docs and env var names.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Inconsistent brand casing; use &quot;PostHog&quot; capitalization to match docs and env var names.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration
Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

Use correct PostHog capitalization in the section heading for consistency and branding.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Use correct PostHog capitalization in the section heading for consistency and branding.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Use correct brand capitalization "PostHog" in the comment header for consistency and clarity.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Use correct brand capitalization &quot;PostHog&quot; in the comment header for consistency and clarity.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 10/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Use correct brand capitalization "PostHog" for consistency and clarity.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Use correct brand capitalization &quot;PostHog&quot; for consistency and clarity.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Brand capitalization inconsistency: use "PostHog" for the comment header to match docs and variable naming.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Purely stylistic branding/capitalization; no functional or maintainability impact. Too minor to report.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Brand capitalization inconsistency: use &quot;PostHog&quot; for the comment header to match docs and variable naming.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Purely stylistic branding/capitalization; no functional or maintainability impact. Too minor to report.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 10/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Brand capitalization inconsistency in comment; use "PostHog" to match documentation and project style.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Capitalization in a comment is stylistic and low impact; not worth reporting.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Brand capitalization inconsistency in comment; use &quot;PostHog&quot; to match documentation and project style.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Capitalization in a comment is stylistic and low impact; not worth reporting.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Correct brand capitalization to PostHog for clarity and consistency.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Correct brand capitalization to PostHog for clarity and consistency.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 10/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Brand capitalization inconsistency. Use "PostHog" for consistency across docs and code comments.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact, documentationImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Capitalization in a comment is stylistic with no functional impact; too minor to report.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Brand capitalization inconsistency. Use &quot;PostHog&quot; for consistency across docs and code comments.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact, documentationImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Capitalization in a comment is stylistic with no functional impact; too minor to report.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 10/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration

Copy link
Author

Choose a reason for hiding this comment

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

Brand casing is inconsistent; use "PostHog" for clarity and consistency in comments.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact, objectivity.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Stylistic comment casing inconsistency ('Posthog' vs 'PostHog'); low functional impact and not worth reporting.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Brand casing is inconsistent; use &quot;PostHog&quot; for clarity and consistency in comments.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact, objectivity.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Stylistic comment casing inconsistency (&#39;Posthog&#39; vs &#39;PostHog&#39;); low functional impact and not worth reporting.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 10/10

[internal] Posted by: General AI Review Agent

Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

Spelling/casing inconsistency: use "PostHog" (capital H) for brand consistency across docs and code.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

Prompt for AI agents
Address the following comment on .env.example at line 56:

<comment>Spelling/casing inconsistency: use &quot;PostHog&quot; (capital H) for brand consistency across docs and code.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 QDRANT_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
# Posthog Configuration
# PostHog Configuration
Fix with Cubic

POSTHOG_API_KEY=phc_your_api_key_here
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Non-empty placeholder enables analytics unintentionally and triggers failed PostHog calls; leave API key blank in example to avoid accidental enablement.

Prompt for AI agents
Address the following comment on .env.example at line 57:

<comment>Non-empty placeholder enables analytics unintentionally and triggers failed PostHog calls; leave API key blank in example to avoid accidental enablement.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Suggested change
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_API_KEY=
Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

Avoid real-looking secret prefixes in example values to prevent false-positive secret scanning and confusion. Prefer empty or a neutral placeholder.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Placeholder matches project docs and established pattern; no secret scanning tooling present in repo. Risk is speculative and low impact.

Prompt for AI agents
Address the following comment on .env.example at line 57:

<comment>Avoid real-looking secret prefixes in example values to prevent false-positive secret scanning and confusion. Prefer empty or a neutral placeholder.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Placeholder matches project docs and established pattern; no secret scanning tooling present in repo. Risk is speculative and low impact.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
</file context>

[internal] Confidence score: 7/10

[internal] Posted by: General AI Review Agent

Suggested change
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_API_KEY=

Copy link
Author

Choose a reason for hiding this comment

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

Avoid plausible-looking secret placeholders; leave the example value empty to reduce confusion and accidental misuse.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Minor placeholder style; no functional/security impact. Not important enough to report.

Prompt for AI agents
Address the following comment on .env.example at line 57:

<comment>Avoid plausible-looking secret placeholders; leave the example value empty to reduce confusion and accidental misuse.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Minor placeholder style; no functional/security impact. Not important enough to report.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Suggested change
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_API_KEY=

Copy link
Author

Choose a reason for hiding this comment

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

Non-empty placeholder enables analytics with an invalid key when ANALYTICS_ENABLED=true, causing unnecessary PostHog initialization and failing requests. Use a blank value in the example to avoid accidental enablement.

Prompt for AI agents
Address the following comment on .env.example at line 57:

<comment>Non-empty placeholder enables analytics with an invalid key when ANALYTICS_ENABLED=true, causing unnecessary PostHog initialization and failing requests. Use a blank value in the example to avoid accidental enablement.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_API_KEY=

Copy link
Author

Choose a reason for hiding this comment

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

Use an empty value for the example API key to match existing style and avoid false-positive secret scans.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.

Prompt for AI agents
Address the following comment on .env.example at line 57:

<comment>Use an empty value for the example API key to match existing style and avoid false-positive secret scans.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: functionalImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_API_KEY=

Copy link
Author

Choose a reason for hiding this comment

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

Non-empty placeholder API key enables analytics by default when copying .env.example, causing initialization with an invalid key and noisy event attempts. Use an empty value to avoid unintended enablement.

Prompt for AI agents
Address the following comment on .env.example at line 57:

<comment>Non-empty placeholder API key enables analytics by default when copying .env.example, causing initialization with an invalid key and noisy event attempts. Use an empty value to avoid unintended enablement.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
 ADDITIONAL_CORS_ORIGINS=
 
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_API_KEY=

POSTHOG_HOST=https://app.posthog.com
ANALYTICS_ENABLED=true
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Analytics enabled by default in example may lead to unintended telemetry from local/test; consider defaulting to false in the sample env.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Intentional default per docs/PR; with a blank API key analytics won’t enable even if true. Preference-level, not a clear issue.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>Analytics enabled by default in example may lead to unintended telemetry from local/test; consider defaulting to false in the sample env.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Intentional default per docs/PR; with a blank API key analytics won’t enable even if true. Preference-level, not a clear issue.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 6/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

Defaulting analytics to true in the example .env risks unintentionally sending local/dev data to PostHog. Prefer disabling by default to avoid unintended telemetry.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Enabling analytics by default aligns with project documentation and PR description (default: true). The example template won’t send telemetry without a real API key; this is a policy preference, not a bug.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>Defaulting analytics to true in the example .env risks unintentionally sending local/dev data to PostHog. Prefer disabling by default to avoid unintended telemetry.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Enabling analytics by default aligns with project documentation and PR description (default: true). The example template won’t send telemetry without a real API key; this is a policy preference, not a bug.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 7/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Default analytics to disabled in the example to follow privacy-by-default and avoid accidental telemetry in local/dev.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Default true is documented and appears intentional. Privacy-by-default is a preference, not a defect here.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>Default analytics to disabled in the example to follow privacy-by-default and avoid accidental telemetry in local/dev.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Default true is documented and appears intentional. Privacy-by-default is a preference, not a defect here.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 6/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Default analytics to disabled to prevent unintentional data capture in local/test environments; developers can opt-in by setting it to true.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>Default analytics to disabled to prevent unintentional data capture in local/test environments; developers can opt-in by setting it to true.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.*</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 7/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Analytics enabled by default in the example env may cause unintended telemetry in local/test. Prefer defaulting to false in .env.example to minimize accidental data collection.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Default true is documented and intentional per README and PR description; not a technical issue. Telemetry requires a valid API key.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>Analytics enabled by default in the example env may cause unintended telemetry in local/test. Prefer defaulting to false in .env.example to minimize accidental data collection.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: documentationImpact.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Default true is documented and intentional per README and PR description; not a technical issue. Telemetry requires a valid API key.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 7/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Defaulting analytics to true in the example env can unintentionally emit analytics from local/test environments; set false by default to avoid accidental event leakage.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>Defaulting analytics to true in the example env can unintentionally emit analytics from local/test environments; set false by default to avoid accidental event leakage.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
ANALYTICS_ENABLED=true
ANALYTICS_ENABLED=false

Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

ANALYTICS_ENABLED is set to true in the example while ENVIRONMENT=local; this likely enables analytics in local dev with a placeholder key, causing noisy errors and unintended telemetry. Set to false by default for local/test to match docs and reduce risk.

Prompt for AI agents
Address the following comment on .env.example at line 59:

<comment>ANALYTICS_ENABLED is set to true in the example while ENVIRONMENT=local; this likely enables analytics in local dev with a placeholder key, causing noisy errors and unintended telemetry. Set to false by default for local/test to match docs and reduce risk.</comment>

<file context>
@@ -53,6 +53,11 @@ APP_FULL_URL=
+# Posthog Configuration
+POSTHOG_API_KEY=phc_your_api_key_here
+POSTHOG_HOST=https://app.posthog.com
+ANALYTICS_ENABLED=true
+
 # Other Settings
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Suggested change
ANALYTICS_ENABLED=true
ANALYTICS_ENABLED=false
Fix with Cubic


# Other Settings
PROJECT_NAME=Airweave
LOG_LEVEL=INFO
Expand Down
293 changes: 293 additions & 0 deletions backend/airweave/analytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
# Airweave Analytics Module

This module provides PostHog analytics integration for Airweave, enabling comprehensive tracking of user behavior, business metrics, and system performance.

## 🏗️ Architecture

The analytics module is organized into several components:

- **`service.py`**: Core PostHog integration service
- **`decorators/`**: Decorators for automatic tracking of API endpoints and operations
- **`events/`**: Business event tracking classes for high-level metrics
- **`config.py`**: Analytics configuration (integrated into core config)
Copy link
Author

Choose a reason for hiding this comment

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

Incorrect component listed: no config.py in analytics; configuration resides in airweave.core.config.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 12:

<comment>Incorrect component listed: no `config.py` in analytics; configuration resides in `airweave.core.config`.</comment>

<file context>
@@ -0,0 +1,293 @@
+- **`service.py`**: Core PostHog integration service
+- **`decorators/`**: Decorators for automatic tracking of API endpoints and operations
+- **`events/`**: Business event tracking classes for high-level metrics
+- **`config.py`**: Analytics configuration (integrated into core config)
+
+## 🚀 Quick Start
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent


## 🚀 Quick Start

### 1. Environment Setup

Add these variables to your `.env` file:

```bash
# PostHog Configuration
POSTHOG_API_KEY=phc_your_api_key_here
POSTHOG_HOST=https://app.posthog.com
ANALYTICS_ENABLED=true
```

### 2. Basic Usage

```python
from airweave.analytics import analytics, business_events

# Track a custom event
analytics.track_event(
event_name="custom_event",
distinct_id="user_123",
properties={"key": "value"}
)

# Track business events
business_events.track_organization_created(
organization_id=org_id,
user_id=user_id,
properties={"plan": "trial"}
)
```

### 3. Using Decorators

```python
from airweave.analytics import track_api_endpoint, track_search_operation

@track_api_endpoint("create_collection")
async def create_collection(ctx: ApiContext, ...):
Copy link
Author

Choose a reason for hiding this comment

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

Examples should make ctx keyword-only so decorators reliably detect it via kwargs.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Suggesting keyword-only ctx is a minor documentation preference. In practice (FastAPI), ctx is provided via kwargs and detected; not a clear, high-impact issue.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 53:

<comment>Examples should make `ctx` keyword-only so decorators reliably detect it via kwargs.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Suggesting keyword-only `ctx` is a minor documentation preference. In practice (FastAPI), ctx is provided via kwargs and detected; not a clear, high-impact issue.</comment>

<file context>
@@ -0,0 +1,293 @@
+from airweave.analytics import track_api_endpoint, track_search_operation
+
+@track_api_endpoint(&quot;create_collection&quot;)
+async def create_collection(ctx: ApiContext, ...):
+    # Your endpoint logic
+    pass
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Decorator expects ctx in kwargs, but the example uses positional ctx; events may not be tracked.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: FastAPI injects params as keyword args; decorators read kwargs, so ctx is detected and events tracked. Example signature is fine.

Libraries consulted: PostHog events timestamp, Posthog.com

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 53:

<comment>Decorator expects ctx in kwargs, but the example uses positional ctx; events may not be tracked.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: FastAPI injects params as keyword args; decorators read kwargs, so ctx is detected and events tracked. Example signature is fine.

• **Libraries consulted**: PostHog events timestamp, Posthog.com</comment>

<file context>
@@ -0,0 +1,293 @@
+from airweave.analytics import track_api_endpoint, track_search_operation
+
+@track_api_endpoint(&quot;create_collection&quot;)
+async def create_collection(ctx: ApiContext, ...):
+    # Your endpoint logic
+    pass
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

Passing ctx positionally (as shown) will prevent the decorator from capturing context, so events won’t be tracked. Make ctx a keyword-only parameter.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 53:

<comment>Passing ctx positionally (as shown) will prevent the decorator from capturing context, so events won’t be tracked. Make ctx a keyword-only parameter.</comment>

<file context>
@@ -0,0 +1,293 @@
+from airweave.analytics import track_api_endpoint, track_search_operation
+
+@track_api_endpoint(&quot;create_collection&quot;)
+async def create_collection(ctx: ApiContext, ...):
+    # Your endpoint logic
+    pass
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

# Your endpoint logic
pass

@track_search_operation()
async def search_collection(ctx: ApiContext, query: str, ...):
Copy link
Author

Choose a reason for hiding this comment

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

Make ctx keyword-only in the search example to ensure it’s detected by the decorator.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Same as #2; low-impact suggestion without demonstrated failure. Decorators detect ctx via kwargs in typical usage.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 58:

<comment>Make `ctx` keyword-only in the search example to ensure it’s detected by the decorator.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Same as #2; low-impact suggestion without demonstrated failure. Decorators detect ctx via kwargs in typical usage.</comment>

<file context>
@@ -0,0 +1,293 @@
+    pass
+
+@track_search_operation()
+async def search_collection(ctx: ApiContext, query: str, ...):
+    # Your search logic
+    pass
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Decorator expects ctx in kwargs, but the example uses positional ctx; search events may not be tracked.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Same as #0: ctx is passed via kwargs; decorator finds it in kwargs, so search events are tracked.

Libraries consulted: PostHog events timestamp, Posthog.com

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 58:

<comment>Decorator expects ctx in kwargs, but the example uses positional ctx; search events may not be tracked.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Same as #0: ctx is passed via kwargs; decorator finds it in kwargs, so search events are tracked.

• **Libraries consulted**: PostHog events timestamp, Posthog.com</comment>

<file context>
@@ -0,0 +1,293 @@
+    pass
+
+@track_search_operation()
+async def search_collection(ctx: ApiContext, query: str, ...):
+    # Your search logic
+    pass
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

# Your search logic
pass
```

## 📊 Complete Analytics Events Overview

### API Events
- **`api_call`**: Successful API calls with timing and context
- **`api_call_error`**: Failed API calls with error details and status codes

**Covered Endpoints:**
- `create_organization` - Organization creation
- `list_collections` - Collection listing
- `create_collection` - Collection creation
- `create_source_connection` - Source connection setup
- `run_sync` - Sync execution
- `search` - Basic search queries
- `search_advanced` - Advanced search queries

### Search Events
- **`search_query`**: Successful search operations with query analysis
- **`search_query_error`**: Failed search operations with error details

### Business Events
- **`organization_created`**: New organization signup
- **`collection_created`**: New collection creation
- **`source_connection_created`**: New source integration

### Sync Events
- **`sync_completed`**: Successful sync job completion with entity counts
- **`entities_synced_by_type`**: Granular entity tracking per sync and entity type
Copy link
Author

Choose a reason for hiding this comment

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

README lists entities_synced_by_type sync event, but no such event is implemented anywhere in the codebase.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 89:

<comment>README lists `entities_synced_by_type` sync event, but no such event is implemented anywhere in the codebase.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+### Sync Events
+- **`sync_completed`**: Successful sync job completion with entity counts
+- **`entities_synced_by_type`**: Granular entity tracking per sync and entity type
+
+## 🎯 Dashboard Strategy
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
- **`entities_synced_by_type`**: Granular entity tracking per sync and entity type
- **`entities_synced_by_type`**: Granular entity tracking per sync and entity type (planned; not yet implemented)


## 🎯 Dashboard Strategy

### Dashboard 1: Airweave Overview
**Purpose:** High-level business metrics and system health
**Key Metrics:**
- Query volume over time (weekly/monthly)
- Query response times
- Popular data sources
- Error rates by endpoint
- Total entities in sync
- Query volume per organization

### Dashboard 2: User Journey
**Purpose:** Track user progression and identify drop-off points
**Key Metrics:**
- User funnel: org created → collection created → source added → first search
- Time to first search ("time to wow")
- Feature adoption rates
- User retention metrics

### Dashboard 3: Syncing & Storage
**Purpose:** Monitor sync performance and storage usage
**Key Metrics:**
- Sync success/error rates
- Entities synced per sync configuration
- Storage usage by organization
- Sync performance trends
- Entity type distribution

### Dashboard 4: Performance & Errors
**Purpose:** System reliability and performance monitoring
**Key Metrics:**
- API error rates by endpoint
- Search error rates
- Sync error rates
- Performance trends
- Error patterns and troubleshooting

### Dashboard 5: Advanced Analytics
**Purpose:** Deep insights and custom analysis
**Key Metrics:**
- Query patterns and complexity
- User behavior analysis
- Integration health scores
- Custom business metrics

## 📈 PostHog Widget Configurations

### Overview Dashboard Widgets
1. **Query Volume Over Time**
- Event: `search_query`
- Type: Line Chart
- Property: Count
- Time Range: Last 30 days

2. **Query Response Times**
- Event: `search_query`
- Type: Line Chart
- Property: `duration_ms` (Average)
- Time Range: Last 7 days

3. **Error Rate by Endpoint**
- Event: `api_call_error`
- Type: Bar Chart
- Property: Count
- Breakdown: `endpoint`
- Time Range: Last 7 days

### User Journey Dashboard Widgets
1. **User Funnel**
- Events: `organization_created``collection_created``source_connection_created``search_query`
- Type: Funnel
- Time Range: Last 30 days

2. **Time to First Search**
- Event: `search_query`
- Type: Histogram (if supported) or Line Chart
Copy link
Author

Choose a reason for hiding this comment

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

Unverified feature support: "Histogram (if supported)" is ambiguous. Specify supported chart types per PostHog docs or remove the uncertain claim.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Phrasing is imprecise but not a confirmed technical error; lacks documentation evidence and is low impact. Too minor to report.

Libraries consulted: PostHog histogram chart support, Posthog.com

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 167:

<comment>Unverified feature support: &quot;Histogram (if supported)&quot; is ambiguous. Specify supported chart types per PostHog docs or remove the uncertain claim.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Phrasing is imprecise but not a confirmed technical error; lacks documentation evidence and is low impact. Too minor to report.

• **Libraries consulted**: PostHog histogram chart support, Posthog.com</comment>

<file context>
@@ -0,0 +1,293 @@
+
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
</file context>

[internal] Confidence score: 7/10

[internal] Posted by: General AI Review Agent

- Property: `searched_at`
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Widget references searched_at property that is never emitted; this configuration will not work.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>Widget references `searched_at` property that is never emitted; this configuration will not work.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

The widget suggests using a searched_at property that is never emitted by the code; use the event timestamp or an existing field instead.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>The widget suggests using a `searched_at` property that is never emitted by the code; use the event timestamp or an existing field instead.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Inaccurate property reference: searched_at isn't emitted. Use event timestamps or an actual emitted property for the widget.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>Inaccurate property reference: `searched_at` isn&#39;t emitted. Use event timestamps or an actual emitted property for the widget.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

README references searched_at property for search events, but the code does not emit this property. Align docs with actual event properties (use event timestamp or remove this property).

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>README references `searched_at` property for search events, but the code does not emit this property. Align docs with actual event properties (use event timestamp or remove this property).</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Widget config references a searched_at property that is not emitted; use event timestamp or document how to add this property.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>Widget config references a `searched_at` property that is not emitted; use event timestamp or document how to add this property.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Property searched_at is not emitted; use the event timestamp for “Time to First Search.”

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>Property `searched_at` is not emitted; use the event timestamp for “Time to First Search.”</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Widget configuration references a non-existent searched_at property for search_query events. Use the event timestamp or an existing property.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>Widget configuration references a non-existent `searched_at` property for `search_query` events. Use the event timestamp or an existing property.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Widget configuration references searched_at property for search_query, but this property is not emitted. Use the event timestamp or an existing property.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>Widget configuration references `searched_at` property for `search_query`, but this property is not emitted. Use the event timestamp or an existing property.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

search_query event does not include a searched_at property; update docs to use event timestamps or add this property in code.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 168:

<comment>`search_query` event does not include a `searched_at` property; update docs to use event timestamps or add this property in code.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Time to First Search**
+   - Event: `search_query`
+   - Type: Histogram (if supported) or Line Chart
+   - Property: `searched_at`
+   - Time Range: Last 30 days
+
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

- Time Range: Last 30 days

### Syncing Dashboard Widgets
1. **Sync Success Rate**
- Event: `sync_completed`
- Type: Line Chart
- Property: Count
- Time Range: Last 30 days

2. **Entities Synced per Sync**
- Event: `sync_completed`
- Type: Bar Chart
- Property: `total_entities` (Sum)
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Widget uses property total_entities, but emitted property is entities_processed; dashboards will show zero/incorrect values.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: False positive: The emitted sync_completed event in sync_job_service includes total_entities; the README widget aligns with what is actually emitted even if another helper mentions entities_processed.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 181:

<comment>Widget uses property `total_entities`, but emitted property is `entities_processed`; dashboards will show zero/incorrect values.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: False positive: The emitted `sync_completed` event in sync_job_service includes `total_entities`; the README widget aligns with what is actually emitted even if another helper mentions `entities_processed`.</comment>

<file context>
@@ -0,0 +1,293 @@
+2. **Entities Synced per Sync**
+   - Event: `sync_completed`
+   - Type: Bar Chart
+   - Property: `total_entities` (Sum)
+   - Breakdown: `sync_id`
+   - Time Range: Last 7 days
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

- Breakdown: `sync_id`
- Time Range: Last 7 days

3. **Storage Usage by Organization**
- Event: `entities_synced_by_type`
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Widget recommends using entities_synced_by_type, which is not implemented; the dashboard will not populate.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: False positive: The referenced widget uses an event that is emitted (entities_synced_by_type) with entity_count and organization_name, so it will populate.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 186:

<comment>Widget recommends using `entities_synced_by_type`, which is not implemented; the dashboard will not populate.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: False positive: The referenced widget uses an event that is emitted (`entities_synced_by_type`) with `entity_count` and `organization_name`, so it will populate.</comment>

<file context>
@@ -0,0 +1,293 @@
+   - Time Range: Last 7 days
+
+3. **Storage Usage by Organization**
+   - Event: `entities_synced_by_type`
+   - Type: Bar Chart
+   - Property: `entity_count` (Sum)
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

- Type: Bar Chart
- Property: `entity_count` (Sum)
- Breakdown: `organization_name`
- Time Range: Last 7 days

## 🔧 Configuration

The analytics module respects these configuration options:

- `POSTHOG_API_KEY`: Your PostHog API key (required)
- `POSTHOG_HOST`: PostHog host URL (default: https://app.posthog.com)
- `ANALYTICS_ENABLED`: Enable/disable analytics (default: true)
- `ENVIRONMENT`: Deployment environment - added as property to all events

**Important**: Analytics events are emitted when `ANALYTICS_ENABLED=true`. Each event includes an `environment` property allowing you to filter by environment in PostHog dashboards. Control which environments emit events via their respective environment files.
Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

Events are emitted only when both ANALYTICS_ENABLED is true and POSTHOG_API_KEY is set; current statement is misleading.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 201:

<comment>Events are emitted only when both ANALYTICS_ENABLED is true and POSTHOG_API_KEY is set; current statement is misleading.</comment>

<file context>
@@ -0,0 +1,293 @@
+- `ANALYTICS_ENABLED`: Enable/disable analytics (default: true)
+- `ENVIRONMENT`: Deployment environment - added as property to all events
+
+**Important**: Analytics events are emitted when `ANALYTICS_ENABLED=true`. Each event includes an `environment` property allowing you to filter by environment in PostHog dashboards. Control which environments emit events via their respective environment files.
+
+### Environment Configuration Examples
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
**Important**: Analytics events are emitted when `ANALYTICS_ENABLED=true`. Each event includes an `environment` property allowing you to filter by environment in PostHog dashboards. Control which environments emit events via their respective environment files.
**Important**: Analytics events are emitted when `ANALYTICS_ENABLED=true` and `POSTHOG_API_KEY` is set. Each event includes an `environment` property allowing you to filter by environment in PostHog dashboards. Control which environments emit events via their respective environment files.
Fix with Cubic


### Environment Configuration Examples

```bash
# Production environment (.env.prod)
ANALYTICS_ENABLED=true
ENVIRONMENT=prd

# Development environment (.env.dev)
ANALYTICS_ENABLED=true
ENVIRONMENT=dev

# Local development (.env.local)
ANALYTICS_ENABLED=false
ENVIRONMENT=local

# Testing (.env.test)
ANALYTICS_ENABLED=false
ENVIRONMENT=test
```

### PostHog Dashboard Filtering

- **Production Only**: `environment = "prd"`
- **All Environments**: No filter
- **Exclude Local**: `environment != "local"`
- **Development Only**: `environment = "dev"`

## 💡 Best Practices

### 1. Use Decorators for Automatic Tracking
```python
@track_api_endpoint("endpoint_name")
async def my_endpoint(ctx: ApiContext, ...):
# Automatically tracks timing, errors, and context
pass
```

### 2. Track Business Events at Key Milestones
```python
# Track when user completes onboarding
business_events.track_first_sync_completed(ctx, sync_id, entities_count)
```

### 3. Include Rich Context
```python
analytics.track_event(
event_name="custom_event",
distinct_id=user_id,
properties={
"organization_name": ctx.organization.name,
"plan": ctx.organization.plan,
"feature": "advanced_search"
},
groups={"organization": str(ctx.organization.id)}
)
```

### 4. Handle Errors Gracefully
The analytics service automatically handles PostHog errors and logs them without affecting your application.

## 🔒 Privacy & Compliance

- All user data is sent to PostHog (ensure compliance with your privacy policy)
Copy link
Author

Choose a reason for hiding this comment

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

Overbroad privacy statement: "All user data is sent to PostHog" is inaccurate; only event-specific properties are sent. Clarify scope to avoid misleading compliance guidance.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 265:

<comment>Overbroad privacy statement: &quot;All user data is sent to PostHog&quot; is inaccurate; only event-specific properties are sent. Clarify scope to avoid misleading compliance guidance.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Documentation claims user IDs are hashed/obfuscated, but the implementation sends raw IDs via distinct_id. Update the privacy statement to reflect actual behavior.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 265:

<comment>Documentation claims user IDs are hashed/obfuscated, but the implementation sends raw IDs via `distinct_id`. Update the privacy statement to reflect actual behavior.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

- User IDs are hashed/obfuscated as needed
Copy link
Author

Choose a reason for hiding this comment

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

Documentation states user IDs are hashed/obfuscated, but code sends raw IDs; clarify that IDs are un-hashed by default or implement hashing.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>Documentation states user IDs are hashed/obfuscated, but code sends raw IDs; clarify that IDs are un-hashed by default or implement hashing.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
- User IDs are hashed/obfuscated as needed
- User IDs are not hashed by default; ensure your privacy policy allows sending internal IDs to PostHog or implement hashing if required

Copy link
Author

Choose a reason for hiding this comment

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

Documentation inaccurately states user IDs are hashed/obfuscated; code sends raw IDs. Clarify that IDs are not hashed by default and advise hashing only if required.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>Documentation inaccurately states user IDs are hashed/obfuscated; code sends raw IDs. Clarify that IDs are not hashed by default and advise hashing only if required.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Documentation states user IDs are hashed, but code sends raw IDs to PostHog. Update docs or implement hashing to avoid misleading privacy claims.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>Documentation states user IDs are hashed, but code sends raw IDs to PostHog. Update docs or implement hashing to avoid misleading privacy claims.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

README claims user IDs are hashed/obfuscated, but the implementation sends raw IDs as distinct_id. Update docs or implement hashing to match.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>README claims user IDs are hashed/obfuscated, but the implementation sends raw IDs as `distinct_id`. Update docs or implement hashing to match.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
- User IDs are hashed/obfuscated as needed
- User IDs should not be hashed/obfuscated by default; ensure compliance via configuration and avoid sending sensitive identifiers in properties

Copy link
Author

Choose a reason for hiding this comment

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

User IDs are not hashed by default; documentation should not claim obfuscation.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>User IDs are not hashed by default; documentation should not claim obfuscation.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

README claims user IDs are hashed/obfuscated, but code sends raw IDs via distinct_id. Align documentation or implement hashing to avoid misleading privacy assurances.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>README claims user IDs are hashed/obfuscated, but code sends raw IDs via `distinct_id`. Align documentation or implement hashing to avoid misleading privacy assurances.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Documentation states user IDs are hashed/obfuscated, but code sends raw user/organization IDs to PostHog. Update wording or implement hashing to avoid misleading guidance.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>Documentation states user IDs are hashed/obfuscated, but code sends raw user/organization IDs to PostHog. Update wording or implement hashing to avoid misleading guidance.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

Documentation claims user IDs are hashed/obfuscated, but code sends raw IDs; this is inaccurate and may mislead compliance expectations.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 266:

<comment>Documentation claims user IDs are hashed/obfuscated, but code sends raw IDs; this is inaccurate and may mislead compliance expectations.</comment>

<file context>
@@ -0,0 +1,293 @@
+## 🔒 Privacy &amp; Compliance
+
+- All user data is sent to PostHog (ensure compliance with your privacy policy)
+- User IDs are hashed/obfuscated as needed
+- Sensitive data should not be included in event properties
+- Consider data retention policies in PostHog
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Suggested change
- User IDs are hashed/obfuscated as needed
- User IDs are sent as raw strings; hash or obfuscate if required by your policy
Fix with Cubic

- Sensitive data should not be included in event properties
- Consider data retention policies in PostHog

## 🚨 Troubleshooting

### Common Issues

1. **Events not appearing in PostHog**
- Check `POSTHOG_API_KEY` is set correctly
- Verify `ANALYTICS_ENABLED=true`
- Check logs for PostHog errors

2. **High event volume**
- PostHog free tier: 1M events/month
Copy link
Author

Choose a reason for hiding this comment

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

Avoid hard-coding PostHog pricing limits in docs; the “1M events/month” free tier may change and isn’t enforced by code. Link to pricing/docs instead.

DEV MODE: This violation would have been filtered out by screening filters. Failing filters: futureIssue.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Pricing note (“PostHog free tier: 1M events/month”) is a minor, non-functional documentation detail. While it can become outdated, it does not affect code behavior; low severity.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 280:

<comment>Avoid hard-coding PostHog pricing limits in docs; the “1M events/month” free tier may change and isn’t enforced by code. Link to pricing/docs instead.

*DEV MODE: This violation would have been filtered out by screening filters. Failing filters: futureIssue.*

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Pricing note (“PostHog free tier: 1M events/month”) is a minor, non-functional documentation detail. While it can become outdated, it does not affect code behavior; low severity.</comment>

<file context>
@@ -0,0 +1,293 @@
+   - Check logs for PostHog errors
+
+2. **High event volume**
+   - PostHog free tier: 1M events/month
+   - Consider sampling for high-volume events
+   - Use `ANALYTICS_ENABLED=false` to disable
</file context>

[internal] Confidence score: 7/10

[internal] Posted by: General AI Review Agent

- Consider sampling for high-volume events
- Use `ANALYTICS_ENABLED=false` to disable

3. **Performance impact**
- Analytics calls are async and non-blocking
- Errors are logged but don't affect application flow
- Consider batching for high-frequency events

## 📚 Additional Resources

- [PostHog Documentation](https://posthog.com/docs)
- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
- [Airweave Analytics Examples](analytics_integration_example.py)
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

README links to analytics_integration_example.py which is not present; broken link.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>README links to analytics_integration_example.py which is not present; broken link.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

Broken documentation link to analytics_integration_example.py; the file does not exist. Replace with a valid path to existing examples.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Broken documentation link to analytics_integration_example.py; the file does not exist. Replace with a valid path to existing examples.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Broken documentation link to analytics_integration_example.py; the file does not exist in the analytics module.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Broken documentation link to analytics_integration_example.py; the file does not exist in the analytics module.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Broken link to analytics_integration_example.py; add the file or update the link.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Broken link to `analytics_integration_example.py`; add the file or update the link.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Broken documentation link: analytics_integration_example.py does not exist. Update the reference or add the file.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Broken documentation link: `analytics_integration_example.py` does not exist. Update the reference or add the file.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Additional resource link points to a non-existent file analytics_integration_example.py. Replace with a valid path or remove.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Additional resource link points to a non-existent file `analytics_integration_example.py`. Replace with a valid path or remove.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Copy link
Author

Choose a reason for hiding this comment

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

Broken reference: analytics_integration_example.py does not exist in the repository. Update the link to a valid file or remove it.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Broken reference: `analytics_integration_example.py` does not exist in the repository. Update the link to a valid file or remove it.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Copy link
Author

@cubic-dev-local cubic-dev-local bot Sep 24, 2025

Choose a reason for hiding this comment

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

Linked example file does not exist in the repository; update the link or remove it to avoid broken documentation.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/README.md at line 293:

<comment>Linked example file does not exist in the repository; update the link or remove it to avoid broken documentation.</comment>

<file context>
@@ -0,0 +1,293 @@
+
+- [PostHog Documentation](https://posthog.com/docs)
+- [PostHog Python SDK](https://posthog.com/docs/libraries/python)
+- [Airweave Analytics Examples](analytics_integration_example.py)
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

13 changes: 13 additions & 0 deletions backend/airweave/analytics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Analytics module for PostHog integration."""

from .decorators.api import track_api_endpoint
from .decorators.search import track_search_operation
from .events.business_events import business_events
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Importing business_events here eagerly instantiates BusinessEventTracker on package import. Consider lazy-loading or exporting the class/module to avoid import-time side effects.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Intentional convenience instance; no meaningful init side effects; negligible impact.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/__init__.py at line 5:

<comment>Importing business_events here eagerly instantiates BusinessEventTracker on package import. Consider lazy-loading or exporting the class/module to avoid import-time side effects.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Intentional convenience instance; no meaningful init side effects; negligible impact.</comment>

<file context>
@@ -0,0 +1,13 @@
+
+from .decorators.api import track_api_endpoint
+from .decorators.search import track_search_operation
+from .events.business_events import business_events
+from .service import analytics
+
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

from .service import analytics
Copy link

@cubic-dev-ai cubic-dev-ai bot Sep 19, 2025

Choose a reason for hiding this comment

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

Importing analytics here triggers AnalyticsService instantiation at import time, causing side effects (configuration/logging) on package import. Prefer lazy initialization or exporting the class/module instead.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: Intentional singleton; minimal, env-gated import-time side effects per module design/docs. Low impact.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/__init__.py at line 6:

<comment>Importing analytics here triggers AnalyticsService instantiation at import time, causing side effects (configuration/logging) on package import. Prefer lazy initialization or exporting the class/module instead.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: Intentional singleton; minimal, env-gated import-time side effects per module design/docs. Low impact.</comment>

<file context>
@@ -0,0 +1,13 @@
+from .decorators.api import track_api_endpoint
+from .decorators.search import track_search_operation
+from .events.business_events import business_events
+from .service import analytics
+
+__all__ = [
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: General AI Review Agent

Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

Import-time optional dependency: init re-exports analytics, forcing immediate import of service.py which imports posthog; missing posthog causes ImportError on package import.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: PostHog is a declared backend dependency; analytics toggling is via env vars, not by omitting the dependency. Importing service.py via init won’t raise ImportError in expected environments. Not actionable.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/__init__.py at line 6:

<comment>Import-time optional dependency: __init__ re-exports analytics, forcing immediate import of service.py which imports posthog; missing posthog causes ImportError on package import.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: PostHog is a declared backend dependency; analytics toggling is via env vars, not by omitting the dependency. Importing service.py via __init__ won’t raise ImportError in expected environments. Not actionable.</comment>

<file context>
@@ -0,0 +1,13 @@
+from .decorators.api import track_api_endpoint
+from .decorators.search import track_search_operation
+from .events.business_events import business_events
+from .service import analytics
+
+__all__ = [
</file context>

[internal] Confidence score: 9/10

[internal] Posted by: Functional Bugs Agent

Copy link
Author

Choose a reason for hiding this comment

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

Re-exporting a symbol named "analytics" from within the airweave.analytics package creates a name collision with the package itself, leading to confusing and error-prone imports. Consider aliasing to a distinct name like analytics_service for clarity.

    DEV MODE: This violation would have been filtered out by GPT-5.

Reasoning:
GPT-5: In Python, exposing a package attribute named "analytics" inside airweave.analytics does not create a technical name collision with the package/module itself. Imports like "from airweave.analytics import analytics" and "import airweave.analytics as analytics" are distinct and valid. This is a stylistic concern with low impact, not a correctness or maintainability bug.

Prompt for AI agents
Address the following comment on backend/airweave/analytics/__init__.py at line 6:

<comment>Re-exporting a symbol named &quot;analytics&quot; from within the airweave.analytics package creates a name collision with the package itself, leading to confusing and error-prone imports. Consider aliasing to a distinct name like analytics_service for clarity.

        DEV MODE: This violation would have been filtered out by GPT-5.
Reasoning:
• **GPT-5**: In Python, exposing a package attribute named &quot;analytics&quot; inside airweave.analytics does not create a technical name collision with the package/module itself. Imports like &quot;from airweave.analytics import analytics&quot; and &quot;import airweave.analytics as analytics&quot; are distinct and valid. This is a stylistic concern with low impact, not a correctness or maintainability bug.</comment>

<file context>
@@ -0,0 +1,13 @@
+from .decorators.api import track_api_endpoint
+from .decorators.search import track_search_operation
+from .events.business_events import business_events
+from .service import analytics
+
+__all__ = [
</file context>

[internal] Confidence score: 8/10

[internal] Posted by: General AI Review Agent


__all__ = [
"analytics",
"business_events",
"track_api_endpoint",
"track_search_operation",
]
9 changes: 9 additions & 0 deletions backend/airweave/analytics/decorators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Decorators for analytics tracking."""

from .api import track_api_endpoint
from .search import track_search_operation

__all__ = [
"track_api_endpoint",
"track_search_operation",
]
Loading