Skip to content

chore(codegen): daily schema refresh (2026-05-30)#22

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

chore(codegen): daily schema refresh (2026-05-30)#22
timgl wants to merge 1 commit into
mainfrom
posthog-code/schema-refresh-2026-05-30

Conversation

@timgl
Copy link
Copy Markdown
Contributor

@timgl timgl commented May 30, 2026

Summary

Daily OpenAPI schema refresh from https://us.posthog.com/api/schema/?format=json, filtered through openapi-filter.yaml.

Spec diff: src/generated/api.d.ts changed by 1007 lines (+983 / -24).

New operationIds added to filter

None. The drift is structural (new component schemas pulled in transitively), not new operations against managed resource families. See triage below.

New operationIds triage

The live spec exposes ~1000 operationIds outside our filter. The vast majority are unrelated to the resources we manage (LLM analytics, error tracking, recordings, hog flows, batch exports, integrations, etc.) and are intentionally excluded.

The only candidates that touch a managed family are the missing PUT (*_update) variants for resources where we already keep PATCH (*_partial_update):

  • cohorts_update, event_definitions_update, experiments_update,
    experiment_holdouts_update, experiment_saved_metrics_update,
    environments_update, event_schemas_update, event_schemas_partial_update,
    schema_property_groups_update

These are deliberately left out — the existing filter only includes PUT for insights, dashboards, feature_flags, environments_endpoints, and actions. The asymmetry is intentional; the apply pipeline uses PATCH for the other families. No change.

Resources touched

No resource client/pipeline edits were needed. Notable schema deltas:

  • New component schemas: AccountsQuery, AccountsQueryResponse, CalendarHeatmapFilter, DataWarehouseSyncWarning, ExperimentMetricOutlierHandling, ParserMode, Response7, Response27 (referenced transitively from kept operations — no managed resource directly consumes them).
  • Enum rename: AggregationPropertyType1AggregationPropertyType. Used only inside generated query unions; no resource references it.
  • FeatureFlagFiltersSchema.super_groups removed upstream. Our SDK (src/resources/feature-flag/sdk.ts) still exposes super_groups for callers, and writes go through as unknown as FeatureFlagBody to bypass the documented upstream schema gap — same pattern noted in existing code comments. No change needed.
  • ExperimentSavedMetric gained query and inline field descriptions; Experiment response gained warnings. Read paths use z.object(...).loose() so additional fields pass through transparently.

Unresolved drift

None. pnpm typecheck passes clean.

Test status

pnpm test shows an intermittent timeout in src/pull/run.test.ts > runPull orchestrator > writes files and calls tagOnServer on a non-dry run (500ms test timeout vs. ~300ms isolated runtime — flakes under parallel load). Pre-existing, reproduces on main, unrelated to schema. The test passes when run in isolation.

Task

TaskRun: 8a4eabac-c4e7-4305-b00f-a9b1cc638b2a

Test plan

  • CI typecheck green
  • CI test suite green (re-run if the run.test.ts flake hits)
  • Spot-check that src/generated/api.d.ts reflects the filtered operations only

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

No changes to openapi-filter.yaml — the diff is entirely upstream schema
drift that reaches our kept operations via type references (new query
types, response unions, descriptions, an enum rename).

Generated-By: PostHog Code
Task-Id: 8a4eabac-c4e7-4305-b00f-a9b1cc638b2a
@timgl timgl requested a review from pl May 30, 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