Skip to content

ci: Add nightly model regeneration from the published OpenAPI spec - #983

Merged
vdusek merged 5 commits into
masterfrom
ci/nightly-openapi-spec-sync
Aug 3, 2026
Merged

ci: Add nightly model regeneration from the published OpenAPI spec#983
vdusek merged 5 commits into
masterfrom
ci/nightly-openapi-spec-sync

Conversation

@vdusek

@vdusek vdusek commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Replaces the apify-docs-triggered model regeneration with a nightly job, and records which published OpenAPI specification the generated models came from.

What changes

  • on_schedule_regenerate_models.yaml - nightly at 02:00 UTC plus manual dispatch. Regenerates on master and opens a pull request when the models change. manual_regenerate_models.yaml is deleted.
  • scripts/openapi_spec.py - downloads and validates the published specification into git-ignored tmp/ (both codegen passes read that one copy), then records its info.version in pyproject.toml under [tool.apify.openapi-spec]. The specification itself is not committed.
  • _models.py loses the Plan.available_proxy_groups docstring - accumulated codegen drift from the datamodel-code-generator bumps (chore(deps): lock file maintenance #968, chore(deps): lock file maintenance #975), not a specification change.

Why

The old workflow was dispatched by apify-docs and checked out a permanent, never-rebased branch before regenerating, so it generated with that branch's stale tooling. In #979 that produced _literals.py in the pre-#941 closed Literal[...] form; merging it would have silently reverted the enum relaxation. It also opened with a TODO title that blocked pr-title-check - a design that needs human action to become mergeable, which is what let #979 rot for 20 days while the same spec changes were landed by hand (#923, #936, #947, #960, #974).

The nightly job always generates on master and rebuilds its ci/regenerate-models branch from master instead of appending, so the diff is always "current spec vs current master" and can't resurrect a stale generated file. It opens with a mergeable chore: title; reviewers retitle to fix:/feat: when the diff is user-facing.

Notes

  • Merge ci: Drop cross-repo model regeneration dispatch to apify-client-python apify-docs#2835 first - it removes the dispatch that still calls the workflow deleted here.
  • Needs a SLACK_WEBHOOK_URL repository secret for the failure alert.
  • The recorded version is a coarse marker, not a content identity: apify-docs bumps components/version.yaml in a follow-up [skip ci] commit, so a deploy can publish new content under the old stamp. A moved value proves the specification changed; an unchanged one proves nothing.

✍️ Drafted by Claude Code

@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Jul 29, 2026
@vdusek vdusek self-assigned this Jul 29, 2026
@github-actions github-actions Bot added this to the 146th sprint - Tooling team milestone Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.63%. Comparing base (cb8fe24) to head (85e396c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #983      +/-   ##
==========================================
- Coverage   94.65%   94.63%   -0.03%     
==========================================
  Files          58       58              
  Lines        5259     5258       -1     
==========================================
- Hits         4978     4976       -2     
- Misses        281      282       +1     
Flag Coverage Δ
integration 92.12% <ø> (-0.31%) ⬇️
unit 84.04% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek force-pushed the ci/nightly-openapi-spec-sync branch from 7539cdd to fed06a3 Compare August 3, 2026 10:19
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Aug 3, 2026
@vdusek vdusek changed the title ci: Add nightly OpenAPI spec sync and make model codegen reproducible ci: Add nightly model regeneration from the published OpenAPI spec Aug 3, 2026
@vdusek
vdusek marked this pull request as ready for review August 3, 2026 11:58
@vdusek
vdusek requested a review from janbuchar August 3, 2026 11:58
@vdusek
vdusek force-pushed the ci/nightly-openapi-spec-sync branch from dc06b74 to 85e396c Compare August 3, 2026 11:58

@janbuchar janbuchar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sound at a glance, let's battle test it

vdusek added a commit to apify/apify-docs that referenced this pull request Aug 3, 2026
#2835)

Removes the cross-repo dispatch that opened a companion
model-regeneration PR in `apify-client-python` for every spec-changing
docs PR, and rewrites the `AGENTS.md` section describing it.

`apify-client-python` now pulls the spec on its own nightly schedule
instead, so nothing on this side needs to push to it or be merged in
lockstep with a client PR.

Why the dispatch goes away:

- The client can only generate models from the **published** spec, so it
can never be genuinely ahead of a deployed docs change - the companion
PR was opened against an unpublished bundle it would have to regenerate
from anyway.
- Two mechanisms writing the same generated files made them diverge. The
dispatch reused one long-lived branch per docs PR and regenerated with
the codegen tooling from that stale branch, which silently reverted
fixes that had landed on the client's master in the meantime.
- Every such PR opened with a placeholder `TODO` title that a human had
to replace before it could be merged, so unmerged PRs and their stale
branches piled up.

Also drops what only the removed jobs needed: the `closed` pull request
trigger, the `if:` guard skipping lint on close events, and the
`pull-requests: read` permission.

**Merge this before** apify/apify-client-python#983 - that PR deletes
`manual_regenerate_models.yaml`, which the dispatch removed here still
calls.

*✍️ Drafted by Claude Code*
@vdusek
vdusek merged commit 49a1f52 into master Aug 3, 2026
30 checks passed
@vdusek
vdusek deleted the ci/nightly-openapi-spec-sync branch August 3, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants