Skip to content

feat(refresh): own the refresh-aware unit status gate (2/6) - #264

Draft
marceloneppel wants to merge 1 commit into
dpe-refresh-1-refresh-classesfrom
dpe-refresh-2-refresh-manager
Draft

feat(refresh): own the refresh-aware unit status gate (2/6)#264
marceloneppel wants to merge 1 commit into
dpe-refresh-1-refresh-classesfrom
dpe-refresh-2-refresh-manager

Conversation

@marceloneppel

@marceloneppel marceloneppel commented Sep 4, 2026

Copy link
Copy Markdown
Member

Issue

Part of the refresh module migration from the PostgreSQL VM and K8s charms' 16/edge branches into this library. Stacks on #257.

Solution

Adds the RefreshManager: it constructs the substrate's charm_refresh object (Machines/Kubernetes wrapping the charm-specific classes, including the K8s KubernetesJujuAppNotTrustedcan_set_app_status = False and UnitTearingDown → teardown-exit handling) and owns the refresh-aware unit status handling the two charms duplicated:

  • the set_unit_status priority gate with the .last_refresh_unit_status.json caching, deduplicated onto the workload.is_patroni_running() check (the K8s charm passed it explicitly, the VM relied on the default), and
  • the collect-unit-status reconciliation, with the clear-status branch delegated to a new set_default_unit_status bridge (the charms' _set_primary_status_message/_set_active_status) and the leader's app status to a set_app_status bridge (both owned by charm-side modules until those phases migrate).

The refresh-aware gate becomes the library's set_unit_status bridge, so the status writes the managers already route through the charm now respect the refresh priority interplay. update_config gains the refresh keyword the VM refresh flow threads through to the existing ConfigManager snap-revision gate.

Unit tests follow in #265. The conftest shunts the charm_refresh entry points and pins a minimal refresh_versions.toml, mirroring the charms' unit conftests.

Add the RefreshManager: it constructs the substrate's charm_refresh object
(Machines/Kubernetes with the charm-specific classes, including the K8s
untrusted-app and teardown handling) and owns the refresh-aware unit status
handling the two charms duplicated - the set_unit_status priority gate with
the .last_refresh_unit_status.json caching and the collect-unit-status
reconciliation, deduplicated onto the workload.is_patroni_running() check
(the K8s charm passed it explicitly, the VM relied on the default).

The refresh-aware gate becomes the library's set_unit_status bridge, so the
status writes the managers already route through the charm now respect the
refresh priority interplay. set_default_unit_status and set_app_status are
new bridges for the reconciliation's clear-status branch and the leader's
async app status - both owned by charm-side modules until they migrate.
@marceloneppel marceloneppel changed the title feat(refresh): own the refresh-aware unit status gate (2/5) feat(refresh): own the refresh-aware unit status gate (2/6) Sep 4, 2026
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.

1 participant