Skip to content

chore(codegen): daily schema refresh (2026-07-24) - #98

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

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

Conversation

@timgl

@timgl timgl commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Why

Daily automated OpenAPI schema refresh. The live PostHog spec drifted from our
generated types (src/generated/api.d.ts), so the typed client needed
regenerating and a few upstream renames patched to keep typecheck/test green.

Spec diff size

src/generated/api.d.ts: +3597 / −1608 lines (17,571 → 19,548). No hand
edits — regenerated via pnpm codegen.

New operationIds added to the filter

The endpoints resource we manage was renamed and re-scoped upstream — from
environment-scoped environments_endpoints_* (/api/environments/{environment_id}/endpoints/)
to project-scoped endpoints_* (/api/projects/{project_id}/endpoints/). Added
to openapi-filter.yaml:

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

Everything else in the daily drift report is non-CRUD action endpoints on
resources we already manage (e.g. insights_activity_retrieve,
dashboards_collaborators_*, experiments_duplicate_create) or brand-new
resource families we deliberately do not manage (accounts, agents, surveys,
logs, warehouse, error-tracking, …). None are needed for the current
declarative resource set, so they're intentionally left out of the filter.

Resources touched

  • endpoint — client repointed to /api/projects/{project_id}/endpoints/
    (path param environment_idproject_id). Detail GET now returns
    EndpointVersionResponse (a structural superset of EndpointResponse), which
    remains compatible with the client's field projection.
  • dashboard — PATCH body type PatchedDashboardPatchedPatchedDashboardOpenApi.
  • experiment — list type PaginatedExperimentListPaginatedExperimentBasicList;
    PATCH body type PatchedExperimentPatchedExperimentWrite.

Unresolved drift (needs a human decision)

  • The old environments_endpoints_* operationIds disappeared from the live
    spec (renamed, not genuinely removed). Per the refresh policy of not
    auto-removing disappeared ids, they were left in openapi-filter.yaml
    (annotated) where they now match nothing. A human should delete these 6
    stale entries
    once satisfied the rename is permanent:
    environments_endpoints_list, environments_endpoints_create,
    environments_endpoints_retrieve, environments_endpoints_update,
    environments_endpoints_partial_update, environments_endpoints_destroy.

Validation

  • pnpm codegen
  • pnpm typecheck
  • pnpm test ✅ (291 passed)

(Pre-existing repo-wide lint/prettier warnings are untouched — not introduced
by this change.)

TaskRun: 666d3e8e-6088-4476-a46b-3376faf8becd


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec and
patch drift caused by upstream schema renames.

- endpoints moved from environment-scoped to project-scoped
  (environments_endpoints_* → endpoints_*); added the new operationIds to the
  filter and repointed the endpoint client at /api/projects/{project_id}/endpoints/
- PatchedDashboard → PatchedPatchedDashboardOpenApi (dashboard PATCH body)
- PaginatedExperimentList → PaginatedExperimentBasicList (experiment list)
- PatchedExperiment → PatchedExperimentWrite (experiment PATCH body)

Generated-By: PostHog Code
Task-Id: 666d3e8e-6088-4476-a46b-3376faf8becd
@timgl
timgl requested a review from pl July 24, 2026 07:54
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