Skip to content

fix(posthog): align tool params with subBlock canonical to fix missing-field error#4455

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/taipei-v3
May 5, 2026
Merged

fix(posthog): align tool params with subBlock canonical to fix missing-field error#4455
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/taipei-v3

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Tool params were named personalApiKey while the subBlock resolves to canonical apiKey, so canonical-group resolution wrote the value to params.apiKey while the validator looked up params.personalApiKey and reported it as missing
  • Renames personalApiKeyapiKey in get_person, query, list_persons, delete_person, and types.ts
  • Tightens check-block-registry.ts so a subBlock with canonicalParamId no longer satisfies a tool param lookup by its raw id (the raw id is deleted during extraction)
  • SubBlock id personalApiKey is unchanged, so persisted user workflows are unaffected

Type of Change

  • Bug fix

Testing

Tested manually. Serializer suite + canonical-id audit pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…g-field error

Tool params were named `personalApiKey` but the subBlock resolves to canonical
`apiKey`, so canonical-group resolution wrote the value to params.apiKey while
the validator looked up params.personalApiKey and reported it missing.

Renames `personalApiKey` -> `apiKey` in get_person, query, list_persons,
delete_person, and types.ts. Also tightens check-block-registry.ts so a
subBlock with canonicalParamId no longer satisfies a tool param lookup by its
raw id (the raw id is deleted during extraction).
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 5, 2026 9:21pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 5, 2026

PR Summary

Medium Risk
Renaming required tool parameters can break any workflows or callers still providing personalApiKey instead of apiKey, and it affects authentication headers for multiple PostHog tools. The additional registry validation is CI-only but may block future block/tool changes if canonical IDs are misconfigured.

Overview
Fixes a mismatch between PostHog block inputs using canonical apiKey and several PostHog tools expecting personalApiKey, which caused required-field validation failures.

This renames the PostHog tool param/key from personalApiKey to apiKey across get_person, list_persons, query, delete_person, and shared types.ts, and updates the Authorization header construction accordingly.

Updates check-block-registry.ts so subBlocks with canonicalParamId only satisfy tool-param lookups via the canonical key (not the raw id), matching how extractParams removes the raw key during canonical-group resolution.

Reviewed by Cursor Bugbot for commit f08cde0. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Greptile Summary

This PR fixes a missing-field validation error in PostHog tools caused by a mismatch between the subBlock's canonicalParamId (apiKey) and the tool param key (personalApiKey). The serializer wrote the user's API key into params.apiKey during canonical-group resolution, but the four affected tools looked up params.personalApiKey, which was always empty.

  • Renames personalApiKeyapiKey in the params interface and headers builder for get_person, list_persons, delete_person, and query, bringing them in line with the canonical already resolved by the serializer.
  • Updates PostHogPrivateParams in types.ts to match and tightens check-block-registry.ts so a subBlock with canonicalParamId no longer satisfies a lookup by its raw id, preventing silent recurrence of the same class of bug.

Confidence Score: 5/5

Safe to merge — the fix is complete, the rename is consistent across all affected tools, and the hardened registry check prevents the same class of mismatch from going undetected in the future.

All four affected tools and the shared type now agree on apiKey, matching the canonical written by the serializer. The registry-check improvement correctly restricts subBlock lookup to the canonical only (not the raw id), closing the loophole that allowed the original mismatch to pass validation silently. All other PostHog private-API tools were already using apiKey and are unaffected. The subBlock id personalApiKey is preserved, so existing user workflows retain their saved credentials.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/scripts/check-block-registry.ts Tightens canonical-id contract check: now only the canonicalParamId (not the raw id) is added to subBlockKeys when a canonicalParamId is present, correctly reflecting the serializer's extraction behavior and preventing false-positive passes.
apps/sim/tools/posthog/types.ts Renames personalApiKeyapiKey in PostHogPrivateParams for consistency; the interface is not directly extended by the changed tools but the rename keeps it aligned with the canonical.
apps/sim/tools/posthog/get_person.ts Renames param key and header reference from personalApiKey to apiKey, aligning with the canonical resolved by the serializer.
apps/sim/tools/posthog/delete_person.ts Same personalApiKeyapiKey rename as get_person; params and Authorization header corrected.
apps/sim/tools/posthog/list_persons.ts Same personalApiKeyapiKey rename; no other changes.
apps/sim/tools/posthog/query.ts Same personalApiKeyapiKey rename; no other changes.

Sequence Diagram

sequenceDiagram
    participant User as User (UI)
    participant SB as SubBlock (id: personalApiKey, canonicalParamId: apiKey)
    participant Ser as Serializer / extractParams
    participant Tool as PostHog Tool (get_person / query / etc.)
    participant PH as PostHog API

    User->>SB: enters Personal API Key
    SB->>Ser: { id: "personalApiKey", value: "key" }
    Note over Ser: canonicalParamId present → write to params["apiKey"]
    Ser->>Tool: params = { apiKey: "key", ... }
    Note over Tool: Before fix: looked up params.personalApiKey → undefined
    Note over Tool: After fix: looks up params.apiKey → key
    Tool->>PH: Authorization: Bearer key
    PH-->>Tool: 200 OK
Loading

Reviews (1): Last reviewed commit: "fix(posthog): align tool params with sub..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 1baa580 into staging May 5, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/taipei-v3 branch May 7, 2026 05:13
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