Skip to content

feat: include enabled rails in PostHog identify#2512

Merged
jjramirezn merged 1 commit into
devfrom
feat/posthog-enabled-rails
Jul 24, 2026
Merged

feat: include enabled rails in PostHog identify#2512
jjramirezn merged 1 commit into
devfrom
feat/posthog-enabled-rails

Conversation

@jjramirezn

Copy link
Copy Markdown
Contributor

What

Adds the user's enabled rails to the PostHog identify call in authContext.tsx:

  • enabledRails — human-readable PROVIDER:METHOD codes (e.g. MANTECA:PIX_BR) for easy cohorting
  • enabledRailIds — catalog rail.id uuids for joins against the rails table

Only rails with status === 'ENABLED' are included.

Why

Person profiles had no rail info, so cohorting by payment capability (who can PIX, who has ACH, etc.) was impossible in PostHog.

Cross-repo

Mirrors the server-side identify in peanut-api-ts src/log/identifyUser.ts — same property names, added on the open PR peanutprotocol/peanut-api-ts#1131 (its contract test now pins the extended property set).

Testing

  • pnpm typecheck clean
  • npm test — only pre-existing worktree-environment failures (missing generated flag assets, add-money limits copy); nothing touching this change

🤖 Generated with Claude Code

Cohorting by payment capability (who has PIX, who has ACH) was
impossible — person profiles carried no rail info. Adds enabledRails
(PROVIDER:METHOD codes) and enabledRailIds (catalog rail ids) from the
user's ENABLED rails. Mirrors the server-side identify in peanut-api-ts
src/log/identifyUser.ts (PR #1131) — property names kept in sync.
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Jul 24, 2026 9:15pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 77c3c6cd-fb27-44c0-ab9f-7da987e94c47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/posthog-enabled-rails

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

@github-actions

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6268.24 → 6267.78 (-0.46)
Findings: +1 net (+7 new, -6 resolved)

🆕 New findings (7)

  • high hotspot — src/context/authContext.tsx — 31 commits, +252/-185 lines since 6 months ago
  • medium high-mdd — src/context/authContext.tsx:64 — AuthProvider: MDD 77.3 (uses across many lines from declarations)
  • medium complexity — src/context/authContext.tsx — CC 29, MI 57.6, SLOC 202
  • medium high-mdd — src/context/authContext.tsx:199 — : MDD 23.5 (uses across many lines from declarations)
  • low high-dlt — src/context/authContext.tsx:199 — : DLT 23 (calls 23 distinct functions — high context load)
  • low high-mdd — src/context/authContext.tsx:133 — addAccount: MDD 16.0 (uses across many lines from declarations)
  • low high-mdd — src/context/authContext.tsx:85 — : MDD 11.3 (uses across many lines from declarations)

✅ Resolved (6)

  • src/context/authContext.tsx — 30 commits, +247/-185 lines since 6 months ago
  • src/context/authContext.tsx:64 — AuthProvider: MDD 81.5 (uses across many lines from declarations)
  • src/context/authContext.tsx — CC 26, MI 56.23, SLOC 191
  • src/context/authContext.tsx:194 — : MDD 23.5 (uses across many lines from declarations)
  • src/context/authContext.tsx:194 — : DLT 23 (calls 23 distinct functions — high context load)
  • src/context/authContext.tsx:128 — addAccount: MDD 16.0 (uses across many lines from declarations)

@github-actions

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2137 ran, 0 failed, 0 skipped, 35.9s

📊 Coverage (unit)

metric %
statements 60.8%
branches 44.3%
functions 49.9%
lines 61.2%
⏱ 10 slowest test cases
time test
3.3s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
1.2s src/utils/__tests__/demo-api.test.ts › isDemoMode() is false when not running under Capacitor
0.5s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.4s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.4s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in validateInviteCode
0.3s src/app/(mobile-ui)/withdraw/__tests__/withdraw-states.test.tsx › Bank withdrawal keeps the $1 minimum for sub-$1 amounts
0.2s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › keeps stickers off the username pill (final pass respects the keep-out)
0.2s src/utils/__tests__/demo-balance.test.ts › starts at the full balance on a fresh install and stamps a timestamp
0.1s src/utils/__tests__/demo-balance.test.ts › keeps a spent-down balance across a cold start within the TTL
0.1s src/utils/__tests__/demo-balance.test.ts › auto-refills a stored balance that has no timestamp (legacy install)
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@jjramirezn
jjramirezn marked this pull request as draft July 24, 2026 21:14
@jjramirezn
jjramirezn marked this pull request as ready for review July 24, 2026 21:39
@jjramirezn
jjramirezn merged commit 07bda55 into dev Jul 24, 2026
18 of 20 checks passed
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.

1 participant