Skip to content

chore(codegen): daily schema refresh (2026-07-19)#71

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

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

Conversation

@timgl

@timgl timgl commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Why

Automated daily refresh of the generated OpenAPI types so the typed client stays in sync with the live PostHog API. This run picked up upstream schema drift on already-managed resources.

Spec diff

src/generated/api.d.ts: +3041 / −403 (1 file). Pure regeneration via pnpm codegen — not hand-edited.

The change is upstream schema drift on the operations already in openapi-filter.yaml (new/changed fields and some renamed component schemas), not new routes.

New operationIds added to the filter

None. openapi-filter.yaml is unchanged.

The filter uses an allowlist (inverseOperationIds), so the large "new operationIds" list in the drift report is almost entirely endpoints we intentionally don't manage. Every genuinely-new op that shares a prefix with a managed family is a non-core sub-action (activity / sharing / bulk-tags / tile ops / materialization / recalculation / stats) or a PUT _update variant for a resource whose client deliberately standardizes on PATCH _partial_update. None represent a missing core CRUD operation, so nothing was added and no new resource family was introduced.

No brand-new families were auto-added: the newly-appeared families (accounts, agent applications, error tracking, logs, warehouse, tracing, etc.) are product/admin surfaces outside this library's IaC definition scope — that's a maintainer decision, not something to wire up unattended in a codegen refresh.

Resources touched

Renamed component schemas upstream required patching type aliases (schema key only — no logic/behavior change):

  • src/resources/dashboard/client.tsPatchedDashboardPatchedPatchedDashboardOpenApi
  • src/resources/experiment/client.tsPatchedExperimentPatchedExperimentWrite, PaginatedExperimentListPaginatedExperimentBasicList

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

Unresolved drift

  • Disappeared operationIds: none — every operationId in openapi-filter.yaml still exists in the live spec.
  • Candidates a maintainer may want to manage (left out, non-blocking): event_schemas_partial_update (the event_schemas family currently has no update path in the filter), plus PUT _update variants now available for cohorts, event_definitions, schema_property_groups, experiment_holdouts, and experiment_saved_metrics. Left out because each resource already updates via PATCH and adding PUT needs client wiring for no functional gain.
  • Pre-existing repo-wide lint/format drift (4 eslint errors + 68 prettier warnings) exists on main in files this PR does not touch; left untouched to avoid unrelated changes.

TaskRun

https://us.posthog.com/project/423401/tasks/71a58796-b034-4284-9ded-496eac942ae1


Created with PostHog Code

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

Upstream renamed three component schemas referenced by managed resources;
patched the type aliases (schema keys only, no logic change):
- dashboard: PatchedDashboard -> PatchedPatchedDashboardOpenApi
- experiment: PatchedExperiment -> PatchedExperimentWrite
- experiment: PaginatedExperimentList -> PaginatedExperimentBasicList

openapi-filter.yaml unchanged. typecheck + test pass.

Generated-By: PostHog Code
Task-Id: 71a58796-b034-4284-9ded-496eac942ae1
@timgl
timgl requested a review from pl July 19, 2026 07:48

timgl commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated schema-refresh agent: CI triage note.

The failing semgrep check is not caused by this PR. Its two blocking findings (run-shell-injection / github-actions-shell-injection) are in .github/workflows/release.yml and .github/workflows/schema-refresh.yml, both of which are unchanged by this PR (git diff origin/main...HEAD -- .github/ is empty) and already present on main. semgrep runs a full-repo scan of workflow YAML, so it flags this pre-existing issue regardless of the diff.

This PR only touches src/generated/api.d.ts and two src/resources/*/client.ts files; none were flagged. I'm not fixing the finding here because it would require editing .github/workflows/**, which is out of scope for a codegen refresh and outside what this agent is permitted to change. Leaving it for a human to address separately.

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