Skip to content

chore(codegen): daily schema refresh (2026-06-14)#36

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

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

Conversation

@timgl

@timgl timgl commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Automated daily OpenAPI schema refresh for 2026-06-14.

Spec diff size

  • src/generated/api.d.ts: +1640 / −127 lines (regenerated via pnpm codegen; never hand-edited).
  • Drift is transitive: the managed insight / dashboard / query request+response bodies now reference new upstream query-node component schemas (e.g. AccountsQuery, CalendarHeatmapFilter) and gained new fields. No allowlisted operation changed shape in a way that breaks the Zod schemas.

New operationIds added to the filter

None. All 100 new operationIds that belong to an already-managed resource family are either auxiliary product endpoints (activity logs, bulk tag updates, sharing, tile ops, stats, materialization, versions, run) or redundant full-PUT _update variants of resources we already manage via PATCH. None extend the consumed CRUD surface of the IaC resources, so adding them would only bloat the generated types with no consumer. Breakdown by family:

Family New aux/PUT ops (not added)
dashboards_ 22 (collaborators, tiles, sharing, widgets, bulk tags, …)
insights_ 17 (activity, sharing, thresholds, suggestions, bulk tags, …)
feature_flags_ 17 (activity, bulk ops, status, remote_config, versions, …)
experiments_ 13 (duplicate, reset, stats, timeseries, ship_variant, …)
environments_endpoints_ 8 (logs, run, versions, materialization, …)
event_definitions_ 8 (by_name, metrics, codegen variants, _update, …)
cohorts_ 8 (activity, persons, used_in, _update, …)
actions_ 2 (bulk_update_tags, references)
event_schemas_ 2 (_partial_update, _update)
experiment_holdouts_ / experiment_saved_metrics_ / schema_property_groups_ 1 each (_update PUT)

Brand-new resource families in the live spec (accounts, alerts, annotations, surveys, tasks, error_tracking, warehouse, …) are not adopted here — taking on a new managed family is a deliberate product decision that should go through the add-resource skill with its own client, pipeline, and tests, not an unattended daily refresh.

Resources touched

  • src/resources/dashboard/client.ts — upstream renamed the dashboards PATCH request body component PatchedDashboardPatchedPatchedDashboardOpenApi. Updated the one type alias (PatchedDashboardBody) to point at the new name. The new schema carries the same fields the code uses (restriction_level, tiles, delete_insights); no behavior change. This was the only schema-drift breakage; pnpm typecheck now passes.

No other client.ts Zod schemas or pipeline.ts projections needed changes.

Unresolved drift / flags for a human

  • Removed operationIds: none — every one of the 68 allowlisted operations still exists in the live spec.
  • Pre-existing test flake (not caused by this PR): src/pull/run.test.ts > writes files and calls tagOnServer on a non-dry run intermittently hits its 500 ms per-test timeout under the full parallel suite (the tsx collect phase is ~35 s and starves the timer). It passes reliably in isolation (vitest run src/pull/run.test.ts). Untouched by this change; flagged for a separate timeout bump.
  • Pre-existing repo style debt (not touched): pnpm lint and pnpm format:check report failures across ~68 files that also fail on main (e.g. the ternary at dashboard/client.ts:49, untouched here). Out of scope for a schema refresh.
  • Candidate future additions (human call): if we ever want write-through parity, the full-PUT _update ops (experiments_update, cohorts_update, event_definitions_update, event_schemas_update/_partial_update, experiment_holdouts_update, experiment_saved_metrics_update, schema_property_groups_update) are the only new same-family ops that map onto existing CRUD — but our clients use PATCH, so they're omitted for now.

Verification

  • pnpm typecheck
  • pnpm test ✅ (291 tests; the lone failure is the pre-existing timing flake above, green in isolation)

TaskRun: 7bc7929c-c66d-4900-969e-a2e947b4b655

Generated-By: PostHog Code

Regenerate src/generated/api.d.ts from the live PostHog OpenAPI schema via
`pnpm codegen` (filtered by openapi-filter.yaml).

Spec drift: +1640 / -127 lines, driven by transitively-referenced query node
schemas and new fields on the managed insight/dashboard/query bodies. No
allowlisted operationId disappeared upstream.

Also patch the dashboards PATCH request-body type alias in
src/resources/dashboard/client.ts: upstream renamed the component
`PatchedDashboard` → `PatchedPatchedDashboardOpenApi`. One-line type
reference change; no behavior change.

No openapi-filter.yaml changes: all 100 new same-family operationIds are
auxiliary product endpoints (activity, tags, sharing, tiles, stats,
materialization, versions, run) or redundant full-PUT `_update` variants of
resources already managed via PATCH — none extend the consumed CRUD surface
of the IaC resources.

Generated-By: PostHog Code
Task-Id: 7bc7929c-c66d-4900-969e-a2e947b4b655
@timgl timgl requested a review from pl June 14, 2026 08:30
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