Skip to content

chore(codegen): daily schema refresh (2026-05-27)#19

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

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

Conversation

@timgl
Copy link
Copy Markdown
Contributor

@timgl timgl commented May 27, 2026

Summary

Daily regeneration of src/generated/api.d.ts from PostHog's live OpenAPI spec
(filtered by openapi-filter.yaml).

Spec diff size: 313 lines (+298 / −15) in src/generated/api.d.ts.
No change to openapi-filter.yaml.

New operationIds added to the filter

None. The drift report flagged ~1100 operationIds present in the live spec but
not in the filter; none are core CRUD for resource families managed by
posthog-definitions. They fall into:

  • Auxiliary endpoints on managed families (e.g. actions_bulk_update_tags_create,
    cohorts_activity_retrieve, feature_flags_bulk_delete_create,
    insights_my_last_viewed_retrieve, dashboards_collaborators_*,
    experiments_duplicate_create) — not needed by the apply/pull pipelines, which
    only use list/create/retrieve/PATCH/destroy.
  • environments_* mirror endpoints — environment-scoped duplicates of the
    project-scoped endpoints we already consume.
  • Unmanaged resource families (logs, hog_flows, hog_functions, batch_exports,
    warehouse_, error_tracking_, surveys, notebooks, integrations, etc.) — adding
    these would be a deliberate human decision to extend posthog-definitions scope,
    not an automated daily refresh.

Resources touched

None. No src/resources/*/client.ts Zod schema or pipeline.ts projection
required updating. All schema changes are additive (new optional fields, new
schemas) and the existing .loose() Zod parsers tolerate the extra fields.

Notable schema changes in api.d.ts

  • New schemas: CalendarHeatmapFilter, ParserMode enum, Response7
  • ExperimentSavedMetric / PatchedExperimentSavedMetric now expose
    query: unknown and per-field descriptions
  • TeamCustomerAnalyticsConfig is now a typed object (was
    Record<string, never>)
  • Endpoint* schemas gain tags
  • TeamPublic / TeamSerializerForPublic gain test_account_filters
  • TrendsFilter gains xAxisLabel, yAxisLabel, expanded axis-format docs
  • TrendsQuery gains calendarHeatmapFilter
  • HogQLQueryModifiers gains parserMode
  • RetentionFilter gains cohortLabelStartIndex
  • Web analytics queries gain useWebAnalyticsPrecompute; multiple
    Response* shapes gain usedLazyPrecompute
  • ChartSettings gains resultCustomizations
  • AggregationPropertyType1 renamed to AggregationPropertyType
  • event_definitions_list query gains exclude_hidden, exclude_stale
  • experiments_list query gains prompt_name

Unresolved drift

None. No operationIds were removed from the live spec (nothing for a human to
clean up).

Validation

  • pnpm typecheck
  • pnpm test ✅ (291 tests, 35 files)

Test plan

  • CI green
  • Spot-check the Zod schema for ExperimentSavedMetric still parses real
    saved-metric responses (now that the spec types query explicitly)

🤖 Generated by the daily schema-refresh agent.

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

Schema changes (additive, backward-compatible):
- New schemas: CalendarHeatmapFilter, ParserMode enum, Response7
- ExperimentSavedMetric / PatchedExperimentSavedMetric now expose `query` and per-field docs
- TeamCustomerAnalyticsConfig is now a typed object (was Record<string, never>)
- Endpoint / PatchedEndpoint / EndpointResponse / EndpointVersionResponse gain `tags`
- TeamPublic and TeamSerializerForPublic gain `test_account_filters`
- TrendsFilter gains `xAxisLabel`, `yAxisLabel`, expanded docs on aggregation axis fields
- TrendsQuery gains `calendarHeatmapFilter`
- HogQLQueryModifiers gains `parserMode`
- RetentionFilter gains `cohortLabelStartIndex`
- Multiple web analytics queries gain `useWebAnalyticsPrecompute`
- Multiple Response* shapes gain `usedLazyPrecompute`
- ChartSettings gains `resultCustomizations`
- AggregationPropertyType1 renamed to AggregationPropertyType
- event_definitions_list gains `exclude_hidden`, `exclude_stale` query params
- experiments_list gains `prompt_name` query param

Filter changes: none. All "missing" operationIds in the drift report are
auxiliary endpoints (bulk, activity, sharing, collaborators, etc.) or belong
to resource families not managed by posthog-definitions. The managed
families (insights, dashboards, feature flags, endpoints, event
definitions, schema property groups, event schemas, experiments,
experiment holdouts, experiment saved metrics, environments, cohorts,
actions) already have the CRUD operations they need.

Validation: pnpm typecheck and pnpm test (291 tests) pass cleanly.

Drift report: no removed operationIds, no breaking changes to Zod schemas
or pipeline projections.

Generated-By: PostHog Code
Task-Id: 41f61832-f47e-4591-b860-fa0cbdd8c332
@timgl timgl requested a review from pl May 27, 2026 08:22
Copy link
Copy Markdown
Contributor Author

timgl commented May 27, 2026

The single failing CI check (Semgrep) flagged two findings, both in .github/workflows/release.yml (shell-injection patterns at lines 37–46 and 50). This PR only touches src/generated/api.d.ts — the workflow file is unchanged from main, so the findings pre-exist this branch and are unrelated to the daily schema refresh.

I'm not modifying the release workflow here for two reasons:

  1. The daily schema-refresh agent has hard limits against modifying .github/workflows/**.
  2. The fix is unrelated to this PR's intent and should go in a focused PR so it gets the security review it deserves.

A human should pick up the Semgrep findings against main in a separate change.

— posthog-code, automated daily schema refresh

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