Skip to content

chore(codegen): daily schema refresh (2026-08-08) - #116

Draft
timgl wants to merge 1 commit into
mainfrom
posthog-code/schema-refresh-2026-08-08
Draft

chore(codegen): daily schema refresh (2026-08-08)#116
timgl wants to merge 1 commit into
mainfrom
posthog-code/schema-refresh-2026-08-08

Conversation

@timgl

@timgl timgl commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Automated daily refresh of src/generated/api.d.ts from the live PostHog OpenAPI
spec (https://us.posthog.com/api/schema/?format=json, filtered by
openapi-filter.yaml). This run picked up real drift in three managed families.

Why: the generated types had drifted from the live API — endpoints moved to a
new path and dashboard/experiment write schemas were renamed — breaking
typecheck until the managed clients were realigned.

Spec diff size

  • src/generated/api.d.ts: +5,455 / −2,711 lines (regenerated, not hand-edited).
  • Live spec now exposes 1,840 operationIds; the filter manages 77.

New operationIds added to the filter

Adopted the relocated endpoints family (same resource, new path — see drift below):

  • endpoints_list, endpoints_create, endpoints_retrieve, endpoints_update,
    endpoints_partial_update, endpoints_destroy

No brand-new resource families were adopted. The remaining 1,769 unmanaged
operationIds are the rest of PostHog's API across dozens of separate products
(top families: llm_analytics, error_tracking, warehouse, signals, mcp,
tasks, hog_*, logs, data_warehouse, vision, …). These are intentionally
outside this IaC allowlist; onboarding any of them is a per-product design
decision (via the add-resource skill) and out of scope for an automated refresh.

Resources touched

  • endpoints — PostHog moved the API from /api/environments/{id}/endpoints/
    (environments_endpoints_*) to /api/projects/{id}/endpoints/ (endpoints_*).
    Repointed the endpoint client's paths/params (the client already passed
    config.projectId, so the sent value is unchanged) and added endpoints_* to
    the filter.
  • dashboard — PATCH body schema renamed PatchedDashboard
    PatchedPatchedDashboardOpenApi; updated the type reference in client.ts.
  • experiment — schemas renamed ExperimentExperimentWrite,
    PatchedExperimentPatchedExperimentWrite, PaginatedExperimentList
    PaginatedExperimentBasicList; updated the type references in client.ts.

typecheck and the full test suite (291 tests) pass.

Unresolved drift / for human review

  • Dead operationIds not removed (per policy — flagged, not deleted): the six
    environments_endpoints_* operationIds no longer exist in the live spec (they
    were relocated to endpoints_*). They remain in openapi-filter.yaml with a
    comment and now match nothing during filtering. A human should delete them once
    they confirm the relocation is permanent.
  • Experiment list shape/experiments/ list now returns the lighter
    ExperimentBasic shape (PaginatedExperimentBasicList) rather than the full
    Experiment. ExperimentBasic still carries feature_flag_key, and the
    managed-list Zod parse defaults cover the dropped fields, so no behavior change
    is expected — noted for awareness.

Notes

  • src/generated/api.d.ts was regenerated via pnpm codegen only (never hand-edited).
  • Pre-existing repo lint/format warnings in unrelated files were left untouched.

TaskRun: df4b51bd-59b5-4119-a965-d48965acf98c


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and
realign managed resources to upstream schema/path changes.

- endpoints: PostHog moved the API from /api/environments/{id}/endpoints/
  (environments_endpoints_*) to /api/projects/{id}/endpoints/ (endpoints_*).
  Added endpoints_* CRUD to the filter and repointed the endpoint client.
- dashboard: PATCH body schema renamed PatchedDashboard -> PatchedPatchedDashboardOpenApi.
- experiment: schemas renamed Experiment->ExperimentWrite, PatchedExperiment->
  PatchedExperimentWrite, PaginatedExperimentList->PaginatedExperimentBasicList.

Generated-By: PostHog Code
Task-Id: df4b51bd-59b5-4119-a965-d48965acf98c
@timgl
timgl requested a review from pl August 8, 2026 07:27
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