Skip to content

chore(codegen): daily schema refresh (2026-08-06) - #114

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

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

Conversation

@timgl

@timgl timgl commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily OpenAPI schema refresh. The live PostHog spec drifted from the
committed types, so src/generated/api.d.ts was regenerated and the managed
resource clients were realigned with the new schema/paths.

Spec diff size

src/generated/api.d.ts: +4427 / −1619 lines (17,571 → 20,379).
openapi-filter.yaml: +12 lines (6 new operationIds + a note).

New operationIds added to the filter

The endpoints API was restructured — it moved from
/api/environments/{environment_id}/endpoints/ to
/api/projects/{project_id}/endpoints/, and its operationIds were renamed
environments_endpoints_*endpoints_*. Added the CRUD set for the existing
endpoint resource family:

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

Every other new operationId reported by the drift detector was left out by
design
. openapi-filter.yaml is an allowlist: the vast majority of the
PostHog API is intentionally excluded. The remaining new ids fall into:

  • Sub-actions / analytics / admin endpoints on already-managed resources
    (e.g. insights_activity_retrieve, dashboards_collaborators_*,
    feature_flags_status_retrieve) — not resource lifecycle, not IaC-relevant.
  • PUT (*_update) variants of resources we deliberately manage via PATCH
    (event_definitions_update, experiments_update, cohorts_update,
    schema_property_groups_update, experiment_holdouts_update,
    experiment_saved_metrics_update, event_schemas_update/partial_update).
    These families intentionally expose partial_update only.
  • Brand-new resource families (accounts, conversations, logs, tasks, LLM
    analytics, error tracking, etc.) — none met the bar for an autonomous
    add-resource run in a daily refresh; a human should decide if any are worth
    managing.

Resources touched

File Change
openapi-filter.yaml Added endpoints_* CRUD operationIds
src/resources/endpoint/client.ts Repointed paths …/environments/{environment_id}/endpoints/……/projects/{project_id}/endpoints/… and environment_idproject_id param
src/resources/dashboard/client.ts PatchedDashboardPatchedPatchedDashboardOpenApi
src/resources/experiment/client.ts PatchedExperimentPatchedExperimentWrite; PaginatedExperimentListPaginatedExperimentBasicList

pnpm typecheck and pnpm test (291 tests) pass. Pre-existing repo-wide
lint/format warnings are unrelated and untouched (src/generated is in
.prettierignore).

Unresolved drift (needs a human)

The 6 stale environments_endpoints_* operationIds in openapi-filter.yaml no
longer match anything in the live spec (renamed to endpoints_*, added above).
Per policy this refresh does not delete disappeared operationIds — please
remove the stale environments_endpoints_* block. No other managed
operationIds disappeared.

TaskRun

Task-Id: 25f358ad-c88c-46af-b921-3ad338d45d7e


Created with PostHog Code

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

- Endpoints API moved from /api/environments/{environment_id}/endpoints/ to
  /api/projects/{project_id}/endpoints/ (operationIds renamed
  environments_endpoints_* -> endpoints_*). Added the new ids to
  openapi-filter.yaml and repointed the endpoint client paths/params.
- Schema component renames: PatchedDashboard -> PatchedPatchedDashboardOpenApi,
  PatchedExperiment -> PatchedExperimentWrite,
  PaginatedExperimentList -> PaginatedExperimentBasicList.

typecheck + test (291 tests) green.

Generated-By: PostHog Code
Task-Id: 25f358ad-c88c-46af-b921-3ad338d45d7e
@timgl
timgl requested a review from pl August 6, 2026 07:58
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