Skip to content

feat(charm): consume the single-kernel library for the remaining VM modules - #2033

Draft
marceloneppel wants to merge 14 commits into
vm-migration-basefrom
migration-vm-consume
Draft

marceloneppel wants to merge 14 commits into
vm-migration-basefrom
migration-vm-consume

Conversation

@marceloneppel

@marceloneppel marceloneppel commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Issue

The VM charm still owns ~2,700 lines of logic the library now owns (lifecycle flows, membership, config, TLS seams, charm class). Final state: no logic charm-side.

Solution

  • src/charm.py rewritten to the thin end-state: a class extending the lib PostgreSQLVMCharm, the COS requirer construction (grafana-agent, rolling-ops, tracing — the charm libs stay charm-side), the dash-fallback config override, and ops.main.

  • Deleted (now lib-owned): src/{cluster,cluster_topology_observer,rotate_logs}.py, scripts/{__init__,cluster_topology_observer,raft_observer,rotate_logs}.py, and templates/raft-observer.{service,timer}.j2. src/constants.py stays: three integration suites import its RAFT/Patroni path literals and one of them has no lib-literal equivalent.

  • Pin bump: postgresql-charms-single-kernel -> the migration-integration archive SHA (f776686250a0dad5c17a9e415c36294fe65274db, 16.3.17); poetry lock regenerated with poetry 2.5.1, diff confined to the lib package block + content-hash.

  • actions.yaml: adds the status-detail action the lib StatusHandler observes (was only on the lib's test-charm metadata).

  • Unit tests: migrated suites deleted (test_cluster, test_cluster_topology_observer, test_rotate_logs); test_charm.py trimmed to the still-charm-side surface (config fallback), retargeted to the lib seams (render_file/is_patroni_running no-op guards); a lib-side test_charm.py test-charm actions file added.

  • Deletion bulk disclosure: ~5,900 gross deleted lines (the plan's ~1,900 estimate was low — the union base already carried the [DPE-7882] Reinstate logical replication on the single-kernel library #1941/test(logical-replication): cover the basic, re-relation and guard scenarios #1978 test additions); net ≈ −5,750.

  • The frozen PRs' changes ride in via the base branch (vm-migration-base).

  • Post-audit pass: TLSTransfer wired (the VM charm constructs it charm-side and injects it), the lib tracing helper consumed (the module-level URL-based charm_tracing shim dropped), the transitional config plumbing dropped (CharmState.config implements the identical dash-fallback), and the retained test_charm.py config test retargeted to state.config.

  • Pin updated to the post-audit migration-integration (f776686250a0dad5c17a9e415c36294fe65274db): the lib slice tips gained the disclosed VM-flow fixes.

Checklist

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

@github-actions github-actions Bot added the Libraries: Out of sync The charm libs used are out-of-sync label Oct 11, 2026
@marceloneppel
marceloneppel force-pushed the migration-vm-consume branch 7 times, most recently from 25f8f45 to 78d5fa1 Compare October 12, 2026 16:01
Drop the raft-observer/cluster/rotate-logs modules and their templates; construct TLSTransfer from the lib; import charm_tracing_config from the lib; drop the charm-level config plumbing in favor of CharmState.config.
…yaml

The union resolution left a second default/description block under
plugin_orafce_enable (the pg-cron block whose header the merge lost);
upstream 16/edge dropped plugin_pg_cron_enable entirely, so the stub is
removed rather than re-headed. charmcraft pack fails on the duplicate
'default' key.
The lib resolves its callback by name (getattr(charm, callback.__name__)),
so a bound method on the events handler raised AttributeError on every
restart flow.
@marceloneppel
marceloneppel force-pushed the migration-vm-consume branch 2 times, most recently from 8900477 to e02ed4d Compare October 13, 2026 16:46
# Conflicts:
#	src/charm.py
#	tests/unit/test_charm.py
#	tests/unit/test_tls.py
The thin charm dropped trunk's first-platform-import try/except; wrong-arch
deploys died at import time with an error unit instead of the blocked
warning charm (test_wrong_arch).
Ports the test_refresh_to_local_charm rewrite from #2036: wait for the
"Refresh incompatible" block (unreleased PR builds always block), force
the refresh with a 30-minute budget, and gate the final active+idle wait
on the statuses' since timestamps so the pre-refresh state cannot pass
vacuously.

This branch has not been deployed

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

Labels

Libraries: Out of sync The charm libs used are out-of-sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant