Skip to content

LITE-33583: Align bootstrapped extension deps with the runner#252

Open
pcaro wants to merge 2 commits into
masterfrom
fix/LITE-33583-bootstrap-dependency-mismatch
Open

LITE-33583: Align bootstrapped extension deps with the runner#252
pcaro wants to merge 2 commits into
masterfrom
fix/LITE-33583-bootstrap-dependency-mismatch

Conversation

@pcaro

@pcaro pcaro commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problem

Bootstrapping an extension produced an incoherent runner ↔ connect-eaas-core dependency pair, so the generated project could not run without manual fixes.

Root cause:

  • get_pypi_runner_version() selected the runner image by the CLI's own major version (26), which has diverged from the real runner line (currently 43). This baked a stale, incompatible connect-extension-runner:26.x into the Dockerfile.
  • The pyproject.toml.j2 template hardcoded connect-eaas-core = ">=30", so poetry update in the Dockerfile resolved a connect-eaas-core version the pinned runner image does not support.

Fix

  • Runner selection: get_pypi_runner_version() now returns the latest published runner instead of filtering by the CLI major (removes the broken coupling).
  • Coherent, self-tracking pin: new get_pypi_runner_eaas_core_version(runner) derives the connect-eaas-core specifier from the selected runner's PyPI requires_dist, so the pair is always coherent and cannot drift again.
  • Template: connect-eaas-core is pinned to the runner-derived specifier; python aligned to the runner line (>=3.9,<3.13); stale dev-deps refreshed (pytest 8, flake8 ≥6, pytest-asyncio ≥0.23) and the dead mock marker dropped.

Verification

  • 118 project-plugin tests pass ; flake8 clean.
  • Real-PyPI derivation yields runner 43.0 + connect-eaas-core <38,>=37.4, which poetry parses correctly (>=37.4,<38; allows 37.5, excludes 38.0).

…-33583)

Bootstrapping an extension produced an incoherent runner/connect-eaas-core
pair, so the generated project could not run without manual fixes. The
runner image was selected by the CLI's own major version (26, stale versus
the real runner line 43) while the pyproject template hardcoded a
connect-eaas-core ">=30" floor, letting `poetry update` resolve a version
the runner image does not support.

Select the latest published runner instead of filtering by the CLI major,
and derive the connect-eaas-core specifier from that runner's PyPI
requires_dist so the pair is always coherent and cannot drift again. The
template now pins connect-eaas-core to the derived specifier, aligns python
to the runner line (>=3.9,<3.13), and refreshes the stale dev-dependencies
(pytest 8, flake8 >=6, pytest-asyncio >=0.23; drops the dead mock marker).
@pcaro pcaro changed the title fix(project): align bootstrapped extension deps with the runner (LITE-33583) LITE-33583: Align bootstrapped extension deps with the runner Jul 10, 2026
@pcaro pcaro marked this pull request as ready for review July 10, 2026 09:46
@arnaugiralt arnaugiralt requested a review from qarlosh July 10, 2026 14:33
[tool.poetry.dependencies]
python = ">=3.8,<4"
connect-eaas-core = ">=30"
python = ">=3.9,<3.13"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Should-fix] python is hardcoded while connect-eaas-core is derived from the runner — the same drift this PR removes for eaas-core, left in place for python.

The runner's supported Python range is actively changing. When the runner shifts its floor/ceiling, the derived connect-eaas-core will follow it while this hardcoded python silently diverges, so Poetry may fail to resolve (or silently narrow) for a vendor whose interpreter is outside the derived eaas-core's real range.

Suggested fix: derive it from the runner too — the release JSON already fetched in get_pypi_runner_eaas_core_version carries info.requires_python (for runner 43.0 it is <3.13,>=3.9); template it the same way as connect_eaas_core_version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — fixed in 0513e0e. Instead of a second lookup I merged both into one function, get_pypi_runner_requirements(). It grabs the eaas-core and python ranges from the runner's metadata in a single fetch, and fails loudly if any of them is missing. The template now renders python = "{{ python_version }}".

)

assert get_pypi_runner_version() == '26.0'
assert get_pypi_runner_eaas_core_version('43.0') == '<38,>=37.4'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Should-fix] The bootstrap tests mock a value the real code never produces, so the end-to-end render is never exercised.

test_extension_helpers.py mocks get_pypi_runner_eaas_core_version to return '>=37.4,<38', but the real function emits the sorted form '<38,>=37.4' (as asserted here). Both are valid Poetry, but nothing checks that the generated pyproject.toml is valid/loadable with the string the code actually emits.

Suggested fix: assert the generated pyproject.toml parses and pins connect-eaas-core using the real sorted specifier ('<38,>=37.4'), not the hand-written mock ordering.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0513e0e. The mocks now use exactly what the code returns (('<38,>=37.4', '<3.13,>=3.9')), and the tests check both pins in the generated pyproject.toml.

@qarlosh

qarlosh commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

[Should-fix] (follow-up, not in this diff) bump still selects the runner by the Connect major, which is now obsolete.

This PR correctly moves bootstrap/validate to the latest published runner (CLI and runner versions have diverged). But bump_runner_extension_project still calls get_pypi_runner_version_by_connect_version() (helpers.py:251), which picks the runner matching the Connect platform version. Now that these GitHub projects follow independent semver (no longer aligned with Connect releases), that lookup mis-selects.

Suggested fix (likely a separate ticket): align bump with the same "latest / semver-compatible" model, or drop get_pypi_runner_version_by_connect_version.

…33583)

Address review feedback on the bootstrap dependency alignment: the
generated project's `python` constraint was still a hardcoded snapshot
of runner 43's range, recreating for python the same drift this branch
removes for connect-eaas-core.

Fold both pins into a single lookup: get_pypi_runner_requirements()
returns the (connect-eaas-core, python) specifiers from the runner's
PyPI release metadata (requires_dist + requires_python), failing loudly
when either is missing, and the template now renders both derived
values.

Also raise test fidelity: the bootstrap tests now mock the specifier
form the code actually emits ('<38,>=37.4') instead of a hand-reordered
variant, and assert both the connect-eaas-core and python pins in the
rendered pyproject.toml.
@pcaro

pcaro commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

[Should-fix] (follow-up, not in this diff) bump still selects the runner by the Connect major, which is now obsolete.

Agreed, but I'd rather keep it out of this PR. bump touches existing projects, so just picking the latest runner could break extensions stuck on an older eaas-core. It needs a bit of thought (probably: stay within the project's current major, or bump the eaas-core pin together, like bootstrap does now). I'll open a separate ticket for it.

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants