Skip to content

chore(codegen): daily schema refresh (2026-05-14)#5

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

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

Conversation

@timgl
Copy link
Copy Markdown
Contributor

@timgl timgl commented May 14, 2026

Daily OpenAPI schema refresh — 2026-05-14

Automated regeneration of src/generated/api.d.ts from the live PostHog OpenAPI spec, filtered by openapi-filter.yaml.

Spec diff size

  • src/generated/api.d.ts: 9 insertions, 13 deletions (1 file)
  • openapi-filter.yaml: unchanged

What changed

Cosmetic only. openapi-typescript now emits a generic description for discriminator enum properties on ExperimentMetric variants in place of the prior @default/@constant annotations:

  • ExperimentFunnelMetric.metric_type
  • ExperimentMeanMetric.metric_type
  • ExperimentRatioMetric.metric_type
  • ExperimentRetentionMetric.metric_type

One additional change: parens added around the metric union type in ExperimentSignificance (no behavioral effect).

No structural changes to any operation, schema, parameter, or response.

New operationIds added to filter

None. No additions to openapi-filter.yaml this run.

The live spec contains a large set of operationIds outside the filter — this is by design (the filter is an allowlist, not a denylist). Triaged the gaps relative to managed resource families:

  • Full-update (PUT) variants of managed resources (cohorts_update, event_definitions_update, experiments_update, experiment_holdouts_update, experiment_saved_metrics_update, schema_property_groups_update, event_schemas_update, event_schemas_partial_update) — intentionally excluded: the pipeline uses PATCH (partial_update) for field-level diffs; full PUT semantics are not needed.
  • Auxiliary experiment endpoints (experiments_stats_retrieve, experiments_timeseries_results_retrieve, experiments_ship_variant_create, experiments_reset_create, experiments_duplicate_create, experiments_recalculate_timeseries_create, experiments_eligible_feature_flags_retrieve, experiments_requires_flag_implementation_retrieve, experiments_copy_to_project_create, experiments_create_exposure_cohort_for_experiment_create) — not in scope for declarative IaC; these are read/action endpoints, not part of the create/diff/apply lifecycle.
  • Cohort auxiliary endpoints (cohorts_activity_retrieve, cohorts_persons_retrieve, cohorts_calculation_history_retrieve, cohorts_*_static_cohort_partial_update, cohorts_all_activity_retrieve) — not in scope for declarative management.
  • Other operationIds belong to resource families not currently managed by posthog-definitions (actions, alerts, annotations, batch_exports, hog_functions, surveys, persons, warehouse_, error_tracking_, llm_analytics_*, etc.) — leaving these out per the policy of only managing resources with a clear declarative shape.

Resources touched

None. No src/resources/*/client.ts Zod schemas or pipeline.ts projections required updates — the cosmetic change does not affect any field accessed by the typed client.

Unresolved drift

None.

Removed operationIds

None observed.

Verification

  • pnpm install --frozen-lockfile
  • pnpm codegen
  • pnpm typecheck
  • pnpm test ✓ (173/173 across 20 suites)

TaskRun

Task-Id: 8fcee614-d1fa-4a24-b17b-28f3cd2a4b58

Generated-By: PostHog Code

Cosmetic regeneration of src/generated/api.d.ts from the live spec —
openapi-typescript now annotates discriminator enum properties on
ExperimentMetric variants ("metric_type" on funnel/mean/ratio/retention)
with a clarifying description in place of the prior @default/@constant
annotations. No structural or operationId changes.

Generated-By: PostHog Code
Task-Id: 8fcee614-d1fa-4a24-b17b-28f3cd2a4b58
@timgl timgl requested a review from pl May 14, 2026 13:53
Copy link
Copy Markdown
Contributor Author

timgl commented May 14, 2026

CI status — pre-existing workflow issues, not from this PR

Two required checks are failing:

  1. ensure-pinned-actions — fails because pnpm/action-setup@v4 in .github/workflows/release.yml (L24) and .github/workflows/schema-refresh.yml is not pinned to a full-length commit SHA.
  2. semgrep — fails on .github/workflows/release.yml for shell-injection patterns:
    • L37–48: ${{ inputs.dist-tag }} interpolated directly into a run: block. Fix by binding to env: and using "$ENVVAR".
    • L50: ${{ steps.tag.outputs.tag }} interpolated directly into the npm publish step. Same fix.

Both workflow files were added in parent commit 7197eb8 on main, before this branch was cut. The diff in this PR touches only src/generated/api.d.ts (cosmetic discriminator-description changes) — it does not modify any workflow file and is not the cause of these failures.

I'm not going to patch .github/workflows/** in this turn — the daily-schema-refresh task harness explicitly forbids modifying workflow files. Human action needed:

  • Pin pnpm/action-setup to a commit SHA in both workflows.
  • Rebind inputs.dist-tag and steps.tag.outputs.tag to env: variables in release.yml.

Once main is patched, a fresh schema-refresh run should pass cleanly. The schema refresh itself (typecheck, tests, codegen idempotency) all pass locally.

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