Skip to content

[DPE-10491] build(deps): bump single-kernel library to 16.3.0#49

Merged
marceloneppel merged 7 commits into
16/edgefrom
bump/single-kernel-16.3.0
Jun 26, 2026
Merged

[DPE-10491] build(deps): bump single-kernel library to 16.3.0#49
marceloneppel merged 7 commits into
16/edgefrom
bump/single-kernel-16.3.0

Conversation

@marceloneppel

@marceloneppel marceloneppel commented Jun 18, 2026

Copy link
Copy Markdown
Member

Issue

postgresql-charms-single-kernel 16.3.0 is the current published release. It introduces breaking API changes vs 16.2.x:

  • Substrates moved from config.literals to config.enums, and
  • PEER was removed from the lib's config.literals (renamed PEER_RELATION).

The watcher was pinned to 16.2.2. Left as-is, every hook crashes at import time against the published lib, so the charm cannot run on the same lib revision the rest of the PostgreSQL charms now consume.

Solution

  • Bump the dependency pin to 16.3.0 and relock poetry.lock.
  • Import Substrates from single_kernel_postgresql.config.enums (moved out of config.literals) in src/charm.py, src/raft_controller.py, src/relations/watcher_requirer.py, and tests/unit/test_raft_controller.py.
  • Source shared constants from the library instead of local definitions — including PEER_RELATION (replacing the charm's local PEER) — and drop the now-redundant copies from src/constants.py.
  • Declare the library once (bare, no extra) in the single-kernel group. The charm build's required runtime deps from the lib's postgresql extra (charmlibs-pathops, charmlibs-rollingops, charmlibs-interfaces-tls-certificates, data-platform-helpers, httpx, tomli) are declared in the build-only charm-libs group; the integration env installs the shared single-kernel group (its tests only import the lib's pure-stdlib config.literals) and uses psycopg2-binary, so it never builds the source psycopg2 the extra would pull in.

No runtime behaviour change — the edits realign imports with the new lib layout and restructure dependency declarations (the charm-build dependency closure is unchanged).

Root cause — needs a library-side fix: this dependency juggling exists only because postgresql-charms-single-kernel gates all its runtime deps (psycopg2, charmlibs-*, data-platform-helpers, pydantic, jinja2, …) behind a single all-or-nothing postgresql extra. A consumer that only needs the lib's pure-stdlib config.literals (e.g. for integration tests) is then forced to either pull the entire heavy extra — including the source psycopg2 that must be compiled — or hand-mirror the extra's deps (as charm-libs now does). The proper fix belongs in the library: let config.literals be importable without the heavy deps (or split the postgresql extra into a lighter one), which would remove the need for consumers to mirror these deps. This should be tracked as a follow-up on postgresql-charms-single-kernel.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

postgresql-charms-single-kernel 16.3.0 is now the released version, and it relocated `Substrates` from `config.literals` to `config.enums` and dropped `PEER` from the lib's public literals. The watcher must track that release to stay deployable: pinned to 16.2.2 its imports resolve, but built against the published 16.3.0 every hook crashes at import time. Bumping in lockstep keeps the charm installable on the same lib revision the rest of the PostgreSQL charms now consume.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel marceloneppel changed the title build(deps): upgrade single-kernel library to 16.3.0 build(deps): bump single-kernel library to 16.3.0 Jun 19, 2026
PATRONI_CLUSTER_STATUS_ENDPOINT and WATCHER_RELATION are identical to the lib's literals and used only in runtime modules (not the lib-less integration-test path), so import them from single_kernel_postgresql.config.literals instead of redefining them locally. Drop the dead API_REQUEST_TIMEOUT/SNAP_NAME/SNAP_CHANNEL. PEER, RAFT_PARTNER_PREFIX, RAFT_PORT, and SNAP_COMMON_PATH stay local: the integration tests import constants.py without the lib installed, so it must remain lib-import-free.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
The lib exposes the peer-relation name as PEER_RELATION ("database-peers"); the watcher redefined the same string locally as PEER. Drop the local PEER and import PEER_RELATION from single_kernel_postgresql.config.literals in charm.py and the integration tests, so the peer-relation name has one canonical source. To make the lib importable in the lib-less integration env, move the single-kernel dependency into a dedicated poetry group (mirroring the postgresql charm PRs) and add it to the unit/integration tox envs and the charmcraft export. The value is unchanged, so secret labels and the peer-relation lookup are unaffected.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
The integration tox env was changed to `poetry install --only
integration,single-kernel`, which installs postgresql-charms-single-kernel
with its `postgresql` extra. That extra requires source `psycopg2`, which
publishes no Linux wheels and therefore compiles from source, needing
`pg_config`. The ubuntu-24.04-arm CI runners do not ship `pg_config`, so
every arm64 integration job failed at dependency installation with
`pg_config executable not found`, before any charm was deployed; the amd64
jobs passed only because their runner image bundles PostgreSQL. The
16.2.2 -> 16.3.0 bump itself is not the cause.

Integration tests only consume the lib's pure-stdlib config.literals
(PEER_RELATION) plus the `psycopg2` module already provided by
`psycopg2-binary` (which has an aarch64 wheel); they never touch the
extra's runtime dependencies. Keep the `postgresql` extra in the
single-kernel group, which the unit env and the charmcraft poetry export
still need (the charm imports single_kernel_postgresql.utils, which pulls
httpx), and depend on the bare lib in the integration group so arm64 no
longer builds psycopg2 from source.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
16/edge advanced with renovate updates (pytest bump, lock-file maintenance,
GitHub Actions and charmcraft build-tool bumps) that diverged from this
branch's single-kernel 16.3.0 work, leaving pyproject.toml and poetry.lock
conflicting. Adopt the newer pytest pin, keep the single-kernel integration
dependency, and regenerate the lock so the branch merges into 16/edge again.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
The comment claimed the postgresql extra "fails on arm64 runners", but the extra
pulls psycopg2 from source, which needs pg_config and a C toolchain to build on
any architecture -- it is not an arm64-specific limitation. State the reason as
the source-build dependency it actually is, so it is not mistaken for an
architecture quirk.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
The library was declared twice -- with the postgresql extra in the single-kernel
group (the charm build needs the extra's runtime deps) and again without it in
the integration group (which must not pull the extra's source psycopg2). Poetry
activates an extra for every install scope selecting a group that carries it, so
the two forms could not be merged directly.

Pin the library once, bare, in the single-kernel group; declare the extra's
runtime deps the build needs (charmlibs-pathops, charmlibs-rollingops,
charmlibs-interfaces-tls-certificates, data-platform-helpers, httpx, tomli) in
the build-only charm-libs group; and install the shared single-kernel group in
the integration env instead of re-declaring the library. The charm build closure
is unchanged and integration still avoids source psycopg2.

Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
@marceloneppel marceloneppel changed the title build(deps): bump single-kernel library to 16.3.0 [DPE-10491] build(deps): bump single-kernel library to 16.3.0 Jun 25, 2026
@marceloneppel marceloneppel marked this pull request as ready for review June 25, 2026 11:52
@marceloneppel marceloneppel requested a review from a team as a code owner June 25, 2026 11:52
@marceloneppel marceloneppel requested review from carlcsaposs-canonical, dragomirp, juju-charm-bot and taurus-forever and removed request for a team June 25, 2026 11:52

@taurus-forever taurus-forever 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.

🤞

Thank you!

@marceloneppel marceloneppel merged commit 010c4f2 into 16/edge Jun 26, 2026
18 checks passed
@marceloneppel marceloneppel deleted the bump/single-kernel-16.3.0 branch June 26, 2026 12:37
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.

3 participants