Skip to content

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

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

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

Conversation

@timgl

@timgl timgl commented Aug 1, 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 patches the managed resource clients when upstream renames schemas or moves paths, so the typed client keeps compiling.

Spec diff size

src/generated/api.d.ts: +3,958 / −1,621 lines (17,571 → 19,463). Regenerated via pnpm codegen only — not hand-edited.

Filter changes (new operationIds added)

The Endpoints API was relocated upstream, so its allowlisted operationIds changed:

removed (gone from live spec) added
environments_endpoints_list/create/retrieve/update/partial_update/destroy endpoints_list/create/retrieve/update/partial_update/destroy

Path moved from /api/environments/{environment_id}/endpoints//api/projects/{project_id}/endpoints/.

No brand-new resource families were added. openapi-filter.yaml is an allowlist; the drift report's ~1,000 "new operationIds" are the entire un-managed PostHog API surface (accounts, alerts, logs, warehouse, tasks, vision, …), intentionally out of scope for this repo's curated resource set (insights, dashboards, feature flags, endpoints, event definitions, experiments, cohorts, actions, holdouts, saved metrics, project settings, property groups). Adding any of them is a deliberate feature-work decision, not part of an automated refresh.

Resources touched (schema-drift patches)

Upstream renamed several component schemas referenced by existing clients:

  • endpoint (src/resources/endpoint/client.ts): repointed to the new /api/projects/{project_id}/endpoints/ paths (environment_idproject_id). EndpointResponse / PaginatedEndpointResponseList schema names unchanged.
  • dashboard (src/resources/dashboard/client.ts): PatchedDashboardPatchedPatchedDashboardOpenApi.
  • experiment (src/resources/experiment/client.ts): PatchedExperimentPatchedExperimentWrite, PaginatedExperimentListPaginatedExperimentBasicList.

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

Unresolved drift

  • None blocking. All 71 allowlisted operationIds resolve against the live spec after the endpoint relocation.
  • No managed operationIds were removed from the live spec (nothing for a human to delete). The endpoint ops were renamed rather than dropped, and are handled above.

TaskRun

Generated by the daily schema-refresh agent — Task-Id 9a9aa815-8b9e-40e4-8fb7-d72dd5f361cc.


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and
patch the managed resource clients for upstream schema drift.

Filter changes:
- Endpoints API relocated from /api/environments/{environment_id}/endpoints/
  (environments_endpoints_*) to /api/projects/{project_id}/endpoints/
  (endpoints_*). Updated openapi-filter.yaml operationIds accordingly.

Client fixes for renamed component schemas:
- endpoint: switch to the /api/projects/{project_id}/endpoints/ paths.
- dashboard: PatchedDashboard -> PatchedPatchedDashboardOpenApi.
- experiment: PatchedExperiment -> PatchedExperimentWrite,
  PaginatedExperimentList -> PaginatedExperimentBasicList.

pnpm typecheck and pnpm test both pass.

Generated-By: PostHog Code
Task-Id: 9a9aa815-8b9e-40e4-8fb7-d72dd5f361cc
@timgl
timgl requested a review from pl August 1, 2026 07:50
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