Skip to content

chore(codegen): daily schema refresh (2026-07-31) - #108

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

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

Conversation

@timgl

@timgl timgl commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily refresh of the typed OpenAPI client. Today's run picked up a
breaking rename in the Endpoints API that would otherwise silently break the
endpoint resource, so it needs a human to land the client changes.

Spec diff size

src/generated/api.d.ts: +3,952 / −1,623 lines (17,571 → 19,900 lines).
Most of the churn is field-level schema updates across the managed resource
types; the substantive structural change is the Endpoints move described below.

New operationIds added to the filter

None added as net-new. The one filter change is a rename of the Endpoints
CRUD operations, which moved in the live spec:

Before (removed) After (added)
environments_endpoints_list endpoints_list
environments_endpoints_create endpoints_create
environments_endpoints_retrieve endpoints_retrieve
environments_endpoints_update endpoints_update
environments_endpoints_partial_update endpoints_partial_update
environments_endpoints_destroy endpoints_destroy

The route also moved from /api/environments/{environment_id}/endpoints/ to
/api/projects/{project_id}/endpoints/.

The daily drift report flagged a large number of other operationIds present in
the live spec but absent from openapi-filter.yaml. These were intentionally
left out
— they are auxiliary/non-CRUD operations on already-managed families
(activity logs, sharing, bulk-tag updates, metadata, etc.) or belong to products
outside this repo's infrastructure-as-code surface. The filter is a deliberate
allowlist of the CRUD operations the resource clients actually use; adding the
rest would bloat the generated types without serving any resource.

Resources touched

  • openapi-filter.yaml — Endpoints operationId rename.
  • src/resources/endpoint/client.ts — path + path-param update
    (environments/{environment_id}projects/{project_id}).
  • src/resources/dashboard/client.ts — schema alias rename
    PatchedDashboardPatchedPatchedDashboardOpenApi.
  • src/resources/experiment/client.ts — schema alias renames
    Experiment/PatchedExperiment/PaginatedExperimentList
    ExperimentWrite/PatchedExperimentWrite/PaginatedExperimentBasicList.

pnpm typecheck passes and all 291 tests pass.

Unresolved drift / needs a human

  • Endpoints rename is a behaviour change, not just codegen. The six
    environments_endpoints_* operationIds disappeared from the live spec; they
    were treated as a rename to endpoints_* rather than a deletion. Please
    confirm this is the intended API migration and not a transient spec change.
  • No other managed operationIds disappeared from the live spec, so nothing else
    is flagged for human deletion.

TaskRun

Triggered by the daily schema-refresh cloud run —
TaskRun e20fb297.


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI spec.

Substantive drift: the Endpoints API moved from
/api/environments/{environment_id}/endpoints/ (operationIds
environments_endpoints_*) to /api/projects/{project_id}/endpoints/
(operationIds endpoints_*). Updated openapi-filter.yaml and the endpoint
resource client to match.

Also refreshed schema type aliases whose generated names changed:
- dashboard: PatchedDashboard -> PatchedPatchedDashboardOpenApi
- experiment: Experiment/PatchedExperiment/PaginatedExperimentList ->
  ExperimentWrite/PatchedExperimentWrite/PaginatedExperimentBasicList

typecheck + all 291 tests pass.

Generated-By: PostHog Code
Task-Id: e20fb297-ead3-4ac1-8ca0-532f571fe554
@timgl
timgl requested a review from pl July 31, 2026 08:05
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