Skip to content

fix(analytics-posthog): preserve failure handling without a registered logger - #2704

Merged
kang-heewon merged 1 commit into
trunkfrom
fix/2596-posthog-optional-logger
Sep 8, 2026
Merged

fix(analytics-posthog): preserve failure handling without a registered logger#2704
kang-heewon merged 1 commit into
trunkfrom
fix/2596-posthog-optional-logger

Conversation

@kang-heewon

@kang-heewon kang-heewon commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

PostHog analytics uses the registered logger when available and console logging otherwise. Missing LOGGER_TOKEN no longer turns provider failures or disabled-operation notices into container errors. Flush failures retain PostHogAnalyticsFlushProblem and existing safe log metadata.

Closes #2596

Validation

Standard profile: one private helper, regression tests, and a patch changeset; no public API or provider transport changes.

  • Negative control: eight regression failures and three unhandled asynchronous rejections against the original helper.
  • Package integration tests: 36 passed, covering missing and registered loggers, synchronous/asynchronous failures, disabled operations, and typed flush rejection.
  • Package lint, typecheck, and build passed. Repository verification passed all 27 applicable checks.
  • Normal pre-push full tests and guarded typecheck passed 243/243 tasks each.
  • Independent code review PASS on 128e00f53b3601818cec565b1d4279a585a4a4a7; final cleanup required no changes.

Merge verification

Head: 128e00f53b3601818cec565b1d4279a585a4a4a7.
Current validated base: 6754896b9dd6035be780c8ccf3197647b480f995.
Validated candidate: 5df531626ac9fa0857495590e1a3969412b83365.

CI 34216375340 checked out this exact candidate and passed all 37 applicable verification-profile checks. All four required checks passed: validate, repository-contracts, docs-sync-check, and benchmark-gate. Core verification, generated apps, package artifacts, coverage/security, and split-validation shadow passed. Review companion and benchmark also passed.

Base drift preserves the reviewed PostHog and logger contracts. The promotion-evidence correction from #2708 resolves #2706 and is covered by the passing candidate CI. Candidate-to-base changes are exactly the three reviewed PR files. No rebase was needed.

CodeRabbit approved; no unresolved review threads or merge conflicts remain. No known residual regression or validation gap remains within this change's scope.

Copilot AI lite review requested due to automatic review settings September 8, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T07:25:59.917200Z 128e00f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 598a5276-1e8e-4d3d-9f17-d065b841420c

📥 Commits

Reviewing files that changed from the base of the PR and between 1d12013 and 128e00f.

📒 Files selected for processing (3)
  • .changeset/posthog-optional-logger.md
  • packages/analytics-posthog/src/libs/PostHogAnalyticsManager.ts
  • packages/analytics-posthog/src/tests/Integration.spec.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

PostHogAnalyticsManager가 등록되지 않은 LOGGER_TOKEN을 콘솔 로거로 대체합니다. 통합 테스트는 오류 전파 방지, typed Problem 유지, 비밀값 비노출, 비활성화 동작을 검증합니다.

Changes

PostHog 로거 안전성

Layer / File(s) Summary
선택적 로거 조회와 콘솔 폴백
.changeset/posthog-optional-logger.md, packages/analytics-posthog/src/libs/PostHogAnalyticsManager.ts
getLoggerContainer.getOptional(LOGGER_TOKEN)을 사용합니다. 로거가 없으면 console을 사용합니다. 패치 릴리스 변경사항을 추가합니다.
로거 미등록 동작 검증
packages/analytics-posthog/src/tests/Integration.spec.ts
로거가 없을 때 capture, identify, group의 실패가 호출자에게 전파되지 않는지 검증합니다. flushPostHogAnalyticsFlushProblem, 오류 메타데이터 로그, 비밀값 비노출을 검증합니다. 분석 비활성화 시 공급자 호출과 콘솔 정보 로그도 검증합니다.

Priority: ➖ Normal — Impact reflects medium issue severity.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 128e0

PostHog analytics now continues safely when no logger is registered while preserving flush error behavior and existing logging safeguards. The change is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed [2596] 변경 사항은 LOGGER_TOKEN을 getOptional로 조회하고 console로 폴백하여 로거 미등록 시 크래시를 방지합니다. 통합 테스트는 실패 로깅, 비활성화 작업, flush의 typed Problem 동작을 검증합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 PostHog 로거 획득의 안전성 개선, 관련 테스트, 패치 릴리스 changeset으로 제한됩니다. PostHog 전송 로직의 무관한 변경은 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 등록된 로거가 없어도 PostHog 오류 처리를 유지하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2596-posthog-optional-logger

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

📊 Benchmark Results

✅ All benchmarks passed

Benchmark p75 Threshold Baseline vs Baseline Status Notes
CrocoApp constructor 46.2μs 30.0ms 8.2μs +465.2% -
CrocoApp lambdaHandler (10 controllers) 2.3ms 50.0ms 258.4μs +808.8% -
Lambda cold-start simulation 2.1ms 80.0ms 418.1μs +394.6% -
Lambda cold-start with headers 1.5ms 80.0ms 369.7μs +298.6% -
Lambda cold-start with binary body 1.5ms 80.0ms 339.1μs +332.2% -
Lambda cold-start with query params 1.4ms 80.0ms 301.3μs +379.4% -
Lambda cold-start with authorizer context 1.5ms 80.0ms 299.8μs +384.1% -
Lambda cold-start realistic scenario 1.5ms 80.0ms 299.2μs +384.9% -
EventBusConfig.start (10 handlers) 1.9μs 10.0ms 1.4μs +29.3% -
EventPublisher.publishNow single event 2.0μs 2.0ms 1.7μs +16.6% -
DefaultHandlerResolver.resolve × 10 0.1μs 5.0ms 0.1μs +0.0% -
Container.get singleton (cold) 69.8μs 5.0ms 70.3μs -0.6% -
Container.register × 50 components 3.2ms 10.0ms 3.2ms -2.0% -
Container.validate (50 components) 3.7ms 20.0ms 3.4ms +8.7% -
Container.get singleton (warm) 1.4μs 500.0μs 1.6μs -12.9% -
TelemetryRuntime.init (lambda preset) 12.4μs 200.0ms 1.1ms -98.9% -
lambdaPreset config creation 1.4μs 2.0ms 1.4μs +1.4% -

Updated: 2026-09-08T10:39:48.678Z · Commit: 128e00f

@kang-heewon kang-heewon closed this Sep 8, 2026
@kang-heewon kang-heewon reopened this Sep 8, 2026
@kang-heewon kang-heewon closed this Sep 8, 2026
@kang-heewon kang-heewon reopened this Sep 8, 2026
@kang-heewon
kang-heewon merged commit f392e75 into trunk Sep 8, 2026
55 of 57 checks passed
@kang-heewon
kang-heewon deleted the fix/2596-posthog-optional-logger branch September 8, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants