Skip to content

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

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

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

Conversation

@timgl

@timgl timgl commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Daily automated OpenAPI schema refresh for 2026-08-07. Regenerates
src/generated/api.d.ts from the live PostHog spec (filtered by
openapi-filter.yaml) and realigns the managed resources with upstream renames.

Why: The generated client must track PostHog's live API. Drift was detected
today — the endpoints resource was relocated on the server and several shared
response schemas were renamed — so the checked-in types and resource clients
needed to be regenerated and patched to keep typecheck/test green.

Spec diff size

src/generated/api.d.ts: +5066 / −1891 lines (one file). Most of this is
routine upstream drift in shared component schemas (new query kinds, additional
enum values) pulled in by the retained operations.

New operationIds added to the filter

The endpoints resource moved on the server, so its six CRUD operationIds were
renamed in openapi-filter.yaml (same resource, new location — not a new
family):

Removed (gone from live spec) 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

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

No brand-new resource families were added. The daily drift report lists ~2000
live operationIds absent from the filter, but the filter is a deliberate
allowlist: this tool manages CRUD (plus a few experiment lifecycle actions) for a
fixed set of resource families. The remaining unlisted operationIds are product,
admin, analytics, and internal/debug endpoints outside the IaC surface and were
intentionally left unmanaged.

Resources touched

  • endpoint (src/resources/endpoint/client.ts) — updated all five request
    paths and their path params (environment_idproject_id) to the relocated
    route.
  • dashboard (src/resources/dashboard/client.ts) — PATCH body type
    PatchedDashboardPatchedPatchedDashboardOpenApi (schema rename upstream).
  • experiment (src/resources/experiment/client.ts) — PatchedExperiment
    PatchedExperimentWrite; list type PaginatedExperimentList
    PaginatedExperimentBasicList (schema renames upstream).

All edits are type-reference/path-only; no logic or behavior changed.
pnpm typecheck and pnpm test (291 tests) pass.

Unresolved drift / for a human to review

  • Removed operationIds: the environments_endpoints_* family no longer
    exists in the live spec. Handled here as a rename (same resource, new route)
    rather than a deletion, since the endpoint resource is actively managed.
  • Pre-existing lint/format state: pnpm lint and pnpm format:check fail
    across ~68 files unrelated to this change (verified present on main). No
    pre-commit hook is configured. Left untouched to avoid churning unrelated
    files; a repo-wide Prettier/ESLint pass should be a separate PR.

TaskRun

Generated by the daily schema-refresh agent — TaskRun 7d925c8f-da3d-47e2-b34b-3a034aeb54f0.


Created with PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema and
realign managed resources with upstream renames.

- endpoints resource relocated: /api/environments/{environment_id}/endpoints/
  → /api/projects/{project_id}/endpoints/ (operationIds environments_endpoints_*
  → endpoints_*). Updated openapi-filter.yaml and endpoint/client.ts paths + params.
- schema renames: PatchedDashboard → PatchedPatchedDashboardOpenApi,
  PatchedExperiment → PatchedExperimentWrite,
  PaginatedExperimentList → PaginatedExperimentBasicList.

typecheck + test (291 tests) green.

Generated-By: PostHog Code
Task-Id: 7d925c8f-da3d-47e2-b34b-3a034aeb54f0
@timgl
timgl requested a review from pl August 7, 2026 07:36
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