chore(codegen): daily schema refresh (2026-07-27) - #103
Draft
timgl wants to merge 1 commit into
Draft
Conversation
Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and patch the resource clients for upstream schema drift. - Endpoints resource relocated upstream from /api/environments/.../endpoints/ (environments_endpoints_*) to /api/projects/.../endpoints/ (endpoints_*); updated the filter allowlist and endpoint client paths accordingly. - Experiment write body renamed to ExperimentWrite / PatchedExperimentWrite and list payload to PaginatedExperimentBasicList. - Dashboard PATCH body renamed to PatchedPatchedDashboardOpenApi. Generated-By: PostHog Code Task-Id: 4f17c8b7-a75e-4682-a2d0-d1ae16095720
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Automated daily refresh of the typed PostHog API client. Keeps
src/generated/api.d.tsin sync with the live OpenAPI spec (filtered byopenapi-filter.yaml) so schema drift is caught and fixed the day it lands rather than surfacing as a surprise later.Spec diff size
Regenerated
src/generated/api.d.tsviapnpm codegen: +3,571 / −1,546 lines (net ~19.6k lines). This is mostly upstream field churn on the managed schemas plus the endpoint relocation below.New operationIds added to the filter
The endpoints resource was relocated upstream — it moved out of the
/api/environments/{environment_id}/endpoints/scope into/api/projects/{project_id}/endpoints/, and its operationIds were renamedenvironments_endpoints_*→endpoints_*. The old operationIds no longer exist in the live spec, so the endpoint schemas were being pruned as orphans (breaking typecheck). Swapped the six CRUD operationIds inopenapi-filter.yaml:endpoints_list,endpoints_create,endpoints_retrieve,endpoints_update,endpoints_partial_update,endpoints_destroyNo brand-new resource families were adopted this run. The live spec surfaces a large number of unmanaged operationIds (accounts, agent_applications, conversations, warehouse, error_tracking, vision, signals, etc.) plus many non-lifecycle action endpoints on existing families (
*_activity,*_sharing,*_bulk_*, dashboard tile mutations, experiment lifecycle helpers, cohort person ops). These are intentionally left out — the IaC client only manages the standard CRUD lifecycle (list/create/retrieve/update/partial_update/destroy) of each resource, and pulling in the extra endpoints would bloat the generated types without any client code consuming them.Resources touched
Schema drift required minimal client patches (type-alias renames only, no behavior change):
src/resources/endpoint/client.ts) — repointed all five paths from the/environments/{environment_id}/scope to/projects/{project_id}/(value is stillconfig.projectId).src/resources/experiment/client.ts) — write bodyExperiment→ExperimentWrite,PatchedExperiment→PatchedExperimentWrite, list payloadPaginatedExperimentList→PaginatedExperimentBasicList.src/resources/dashboard/client.ts) — PATCH bodyPatchedDashboard→PatchedPatchedDashboardOpenApi(fields used —restriction_level,tiles,delete_insights— all still present).pnpm typecheckandpnpm test(291 tests) both pass. Managed-resource safety invariants (tag/description prefix filtering) are unchanged.Unresolved drift
None. Every operationId in
openapi-filter.yamlresolves in the current live spec, and no previously-managed operationId disappeared without a replacement (the endpoint relocation is handled above).TaskRun:
4f17c8b7-a75e-4682-a2d0-d1ae16095720Created with PostHog Code