Skip to content

fix: warn about empty and personal API keys without debug and log rejected batches - #909

Merged
turnipdabeets merged 1 commit into
fix/v4-v1-rubric-followupsfrom
fix/v4-terminal-status-log
Oct 29, 2026
Merged

turnipdabeets merged 1 commit into
fix/v4-v1-rubric-followupsfrom
fix/v4-terminal-status-log

Conversation

@turnipdabeets

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Follow-up to #903, agreed with the capture v1 spec author on sdk-specs#146:

  • Empty and personal API key (phx_...) setup errors print without debug. They now use logWarning in PostHog and PostHogStateless, so an app whose SDK is disabled at setup sees why.
  • A batch PostHog rejects outright is logged. A terminal status (for example 400, 401, 402, or a 413 on a single event) deleted the batch without any log line. It now logs Flushing failed with <status>, dropping <n> records. (debug-only, like the other per-flush lines, since it can repeat during an outage).
  • The 4.0 changeset mentions both.

💚 How did you test it?

  • The setup tests now assert the warnings, and delete files if errored asserts the new line.
  • ./gradlew :posthog:test --tests 'com.posthog.internal.PostHogQueueTest' --tests 'com.posthog.PostHogTest' --tests 'com.posthog.PostHogStatelessTest' spotlessCheck pass.

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file (updated the existing 4.0 major changeset)

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Claude Code checked the setup and flush logging on the iOS, Android and Flutter v1 branches to answer the spec thread, then made this change.

🤖 Generated with Claude Code

@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 29, 2026 14:29
@turnipdabeets turnipdabeets self-assigned this Oct 29, 2026
@turnipdabeets
turnipdabeets force-pushed the fix/v4-terminal-status-log branch from c5be9ca to 62d0812 Compare October 29, 2026 14:53

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. Startup configuration errors use the existing warning channel, while terminal-batch diagnostics remain debug-only and preserve retry/split behavior.

AI-assisted review.

@turnipdabeets
turnipdabeets merged commit da7aac0 into fix/v4-v1-rubric-followups Oct 29, 2026
11 checks passed
@turnipdabeets
turnipdabeets deleted the fix/v4-terminal-status-log branch October 29, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants