PITR targetInclusive is silently ignored (env var typo + misspelled Patroni recovery key)

Summary

When restoring a cluster with point-in-time recovery, .spec.initialData.restore.fromBackup.pointInTimeRecovery.targetInclusive has no effect. The recovery target is always treated as inclusive regardless of the configured value.

Root cause

Two defects in the Patroni start path:

  1. PatroniEnvironmentVariables exports the value as env var RECOVERY_TARGET_INCLUSIVE, but templates/start-patroni.sh reads and expands the misspelled $RECOVERY_TARGET_INCUSIVE (missing the L). The variable is therefore always empty and the setting never reaches Patroni.
  2. Even if the names matched, the script emits the recovery key as recovery_target_incusive — also misspelled — which is not a valid PostgreSQL recovery setting.

Impact

Silent wrong recovery point: a restore requesting an exclusive target still includes the target transaction. Data-correctness issue with no error surfaced. Severity: critical.

Files

  • stackgres-k8s/src/operator/src/main/resources/templates/start-patroni.sh (~lines 229-231, 380-382)
  • stackgres-k8s/src/operator/src/main/java/io/stackgres/operator/conciliation/factory/cluster/patroni/PatroniEnvironmentVariables.java (~lines 118-123)

Test gap

PatroniEnvVarFactoryTest asserts only the Java-side env var name; nothing exercises the shell template that consumes it.