Skip to content

fix: keep the ejected example compatible across releases - #3053

Draft
Marshevskyy wants to merge 2 commits into
mainfrom
fix/refresh-ejected-example
Draft

fix: keep the ejected example compatible across releases#3053
Marshevskyy wants to merge 2 commits into
mainfrom
fix/refresh-ejected-example

Conversation

@Marshevskyy

@Marshevskyy Marshevskyy commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What this fixes

The release PR's examples job fails on every @redocly/client-generator 0.x minor bump (see the failure on #3049):

Generator "php" needs @redocly/client-generator ^0.3.7; this CLI ships 0.4.0.

The checked-in ejected example (tests/e2e/generate-client/examples/ejected-generator/generators/php/) records requiresGenerator: '^<version>' at eject time, and caret on a 0.x version pins the minor, so the compatibility gate correctly rejects the example the moment changeset version bumps the package.

The fix

  1. scripts/refresh-ejected-example.mjs re-stamps the example's provenance headers and requiresGenerator range with the current package version. Idempotent; skips non-.ts entries.
  2. release.yaml runs it in the changesets version block, after post-changeset.js, so every release PR carries the stamped example and the examples job stays green. The example is stamped to the current 0.3.8 in this PR, so the script's output is verifiable in the diff.

A related bug this surfaced

LANGUAGE_SDK_NOT_APPLICABLE still declared runtime: 'the runtime is always embedded in the generated file', which stopped being true when the python/go/php generators gained --runtime module. Selecting module mode for a language SDK printed a bogus "ignores runtime" warning while honoring the option. Removed the entry, reworded the outputMode reason, updated the warning unit test, and synced the ejected example's contract block. No changeset: module runtime ships in the still-unreleased 0.4.0, so the warning never reached users.

Verification

  • npm run unit -- packages/client-generator: 75 files / 1248 tests green.
  • The exact failing CI steps locally: regenerate-examples.mjs (22 clients, the ejected generator loads and regenerates cleanly) and typecheck:examples.
  • e2e: eject, examples, module-runtime green.
  • The refresh script round-trips: stamps 8 files on a version change, no-ops when already current.

Check yourself

  • This PR follows the contributing guide
  • All new/updated code is covered by tests
  • Core code changed? - Tested with other Redocly products (internal contributions only)
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update has been considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

🤖 Generated with Claude Code

https://claude.ai/code/session_011NhwgmWzvAYidYGMKFqGMa

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 11b58f8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Performance Benchmark (Lower is Faster)

CLI Version Bundle Lint Check Config
cli-latest ▓ 1.00x (Fastest) ▓ 1.02x ± 0.01 ▓ 1.00x ± 0.01
cli-next ▓ 1.00x ± 0.01 ▓ 1.00x (Fastest) ▓ 1.00x (Fastest)

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.31% (🎯 77%) 13763 / 17574
🔵 Statements 78.1% (🎯 77%) 14817 / 18971
🔵 Functions 82.03% (🎯 81%) 2827 / 3446
🔵 Branches 71.3% (🎯 71%) 10177 / 14273
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/client-generator/src/generators/meta.ts 82.22% 100% 65.21% 88.23% 20-22, 55-73
Generated in workflow #11503 for commit 11b58f8 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant