PostHog payload adapter drops false, zero and empty-string payloads

オープン 初心者向け
#601 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nodejs, typescript
領域
backend

調査の方向性

packages/adapter-posthog/src/index.ts から始めます。ここでは (value) => Boolean(value) の述語が decide() と bulkDecide() の両方について snapshot.getFlagPayload(key) に対して実行されます。false、0、空文字列のペイロードは保持し、null と undefined は引き続きフォールバックするように、真偽値チェックを置き換えてください。その後、アダプターのテストに回帰テストケースを追加します。これら6つの値のケースが通り、既存のアダプターテストがすべて緑のままであれば完了です。

索引モデルが issue の本文から書いたものです。

説明

The PostHog adapter uses a truthiness check when reading snapshot.getFlagPayload(key). Consequently, valid payloads false, 0 and "" are treated as absent. decide() returns the fallback instead of the payload, while bulkDecide() omits the entry.

Reproduced on current main 7baf8fc46845f3c5bd5bcad750c367e8db5595a1 with posthog-node 5.45.0, Node 22.23.4. The SDK snapshot preserves these values; the adapter discards them at (value) => Boolean(value) in packages/adapter-posthog/src/index.ts.

A private prototype replaces the predicate with value !== undefined && value !== null, preserving existing null/undefined fallback behavior. Six added value cases fail on unchanged production source; all 36 adapter tests pass with the prototype. The 156 core flags tests, adapter TypeScript check and builds also pass. Biome reports the same pre-existing constructor-mock warning on baseline and patched tests.

Would you welcome a small PR with this change and regression coverage? This was found during source review and tested with constructed examples, not a production incident. AI assistance was used for investigation, the prototype and local validation.

主要言語
TypeScript
スター
629
フォーク
93
平均マージ
1日 15分
マージ済み PR(30日)
25

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel/flags のほかの issue

vercel/flags の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。