From the work on Point In Time Recovery, i can suggest to refactor logic of this blocked message. Now, The S3 repository has backups from another cluster message sets in PostgreSQLBackups._on_s3_credential_changed by can_use_s3_repository func and it's supposed not to be overridden by any of events. But it's better to keep this status in app_peer_data and set this message in PostgresqlOperatorCharm._set_active_status function as it works with blocked status Move restored cluster to another S3 bucket introduced by the PITR work in the PR referenced above.
This is the same bug I've encountered in K8s version of this charm.
Steps to reproduce
The S3 repository has backups from another cluster
blocked statusExpected behavior
Cluster should keep it's blocked status
The S3 repository has backups from another cluster
even after scaling.Actual behavior
See step 7.
Versions
Operating system: Ubuntu 24.04 LTS
Juju CLI: 3.5.3-genericlinux-amd64
Juju agent: 3.5.2
Charm revision: 454
LXD: 6.1
Log output
Juju debug log: debug-log
Additional context
Here the message I've already wrote in K8s issue: