Skip to content

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

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

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

Conversation

@timgl

@timgl timgl commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily OpenAPI schema refresh. Keeps src/generated/api.d.ts in sync
with the live PostHog spec and repairs the managed clients when the upstream
spec drifts (renamed operations / renamed component schemas), so the typed
client and apply/pull keep working.

Spec diff size

  • src/generated/api.d.ts: +6174 / −2034 lines (17,571 → 21,262).
  • openapi-filter.yaml: 6 operationIds swapped (endpoints rename).
  • 3 client files touched for schema-name drift.

New operationIds added to the filter

The endpoints resource was renamed upstream, moving from
/api/environments/{environment_id}/endpoints/ to
/api/projects/{project_id}/endpoints/. The six managed CRUD operations were
re-pointed to the new ids (existing managed resource family):

  • endpoints_list, endpoints_create, endpoints_retrieve,
    endpoints_update, endpoints_partial_update, endpoints_destroy
    (replacing environments_endpoints_*)

No brand-new resource families were adopted this run.

Resources touched

  • endpointclient.ts path + path-param updated (environment_id
    project_id) to match the moved route.
  • dashboard — patch-body type PatchedDashboardPatchedPatchedDashboardOpenApi.
  • experiment — body/patch/list types Experiment / PatchedExperiment /
    PaginatedExperimentListExperimentWrite / PatchedExperimentWrite /
    PaginatedExperimentBasicList.

pnpm typecheck and pnpm test (291 tests) both pass.

Removed upstream (flagged, not deleted)

  • environments_endpoints_list/create/retrieve/update/partial_update/destroy
    disappeared from the live spec. Handled here as a rename to endpoints_*
    (same resource, same schemas EndpointResponse / PaginatedEndpointResponseList),
    so nothing was left dangling. No other managed operationId disappeared.

Unresolved drift / intentionally left out

The live spec now exposes ~2,000 operationIds; the filter is a curated
allowlist for the 12 managed resource families. Everything new outside that set
was left out on purpose:

  • ~133 extra sub-actions on already-managed families we deliberately don't
    manage (e.g. cohorts_activity_retrieve, dashboards_collaborators_*,
    insights_activity_retrieve, actions_bulk_update_tags_create,
    feature_flags_status_retrieve). We only manage plain CRUD for these.
  • Many brand-new product surfaces out of IaC scope (accounts, alerts,
    billing, error_tracking, llm_analytics, tasks, warehouse, vision, logs,
    etc.). Not adopted — no resource module exists and they aren't
    dashboard/insight/flag-style declarative config.

Full-PUT variants we already exclude by design (e.g. experiments_update,
cohorts_update, event_definitions_update) were also left out — no scope
change.

TaskRun

Generated by the daily schema-refresh agent · Task-Id 1ac77e24-f646-48b6-8091-e3c6c43cb44f.


Created with PostHog Desktop

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and
adjust the operation allowlist + affected Zod-facing client types for drift.

- Endpoints resource moved from /api/environments/{environment_id}/endpoints/
  (environments_endpoints_*) to /api/projects/{project_id}/endpoints/
  (endpoints_*). Updated openapi-filter.yaml and endpoint/client.ts paths.
- Patched drifted component schema names:
  - dashboard: PatchedDashboard -> PatchedPatchedDashboardOpenApi
  - experiment: Experiment/PatchedExperiment/PaginatedExperimentList ->
    ExperimentWrite/PatchedExperimentWrite/PaginatedExperimentBasicList

Generated-By: PostHog Desktop
Task-Id: 1ac77e24-f646-48b6-8091-e3c6c43cb44f
@timgl
timgl requested a review from pl August 28, 2026 10:41
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