补齐手动快照模式回归测试与切换说明(08-28-production-arm-backup-transfer-incident)

- 合同测试补齐:watchdog/drill 服务仍运行、timer 已 disable 但仍 active、
  断链模式文件三类场景,probe 与 refresh 两阶段均断言
- 三个源码变异在旧测试中全部放过、新测试全部拦住
- 切换说明补充超时处置需预先批准、安装前同步并核验源码、
  回滚时 Persistent timer 可能立即补跑并告警
- 报错分类细化(复核第 5 条)后置;未推送、未做远端切换

Co-Authored-By: Claude Opus 5.5 <[email protected]>
这个提交包含在:
2026-10-06 10:51:45 +08:00
共同撰写人 Claude Opus 5.5
父节点 f6d1025d85
当前提交 1989f666ac
共修改 3 个文件,包含 47 行新增和 15 行删除
@@ -137,7 +137,7 @@ case "$action" in
unit="${2:-}"
if [[ "$unit" == hyb-oa-automatic-backup-* ]]; then
case "${FIXTURE_BACKUP_TIMERS:-running}" in
disabled) echo disabled; exit 1 ;;
disabled|disabled_active) echo disabled; exit 1 ;;
mixed)
if [[ "$unit" == *watchdog* ]]; then echo enabled; else echo disabled; exit 1; fi
;;
@@ -150,18 +150,21 @@ case "$action" in
is-active)
unit="${2:-}"
if [[ "$unit" == *.service ]]; then
if [[ "$unit" == hyb-oa-automatic-backup-daily.service \
&& -n "${FIXTURE_DAILY_SERVICE_STATE:-}" ]]; then
echo "$FIXTURE_DAILY_SERVICE_STATE"
[[ "$FIXTURE_DAILY_SERVICE_STATE" == "active" ]] || exit 3
exit 0
fi
echo inactive; exit 3
case "$unit" in
hyb-oa-automatic-backup-daily.service) state="${FIXTURE_DAILY_SERVICE_STATE:-inactive}" ;;
hyb-oa-automatic-backup-watchdog.service) state="${FIXTURE_WATCHDOG_SERVICE_STATE:-inactive}" ;;
hyb-oa-automatic-backup-drill-reminder.service) state="${FIXTURE_DRILL_SERVICE_STATE:-inactive}" ;;
*) state=inactive ;;
esac
echo "$state"
[[ "$state" == "active" ]] || exit 3
exit 0
fi
if [[ "${FIXTURE_TIMER_INACTIVE:-0}" == "1" ]]; then echo inactive; exit 3; fi
if [[ "$unit" == hyb-oa-automatic-backup-* ]]; then
case "${FIXTURE_BACKUP_TIMERS:-running}" in
disabled) echo inactive; exit 3 ;;
disabled_active) echo active ;;
mixed)
if [[ "$unit" == *watchdog* ]]; then echo active; else echo inactive; exit 3; fi
;;
@@ -228,6 +231,14 @@ manual_output="$(HYB_CONTRACT_REFRESH_TEST_ROOT="$FIXTURE_ROOT" FIXTURE_BACKUP_T
[[ "$(run_refresh_status refresh FIXTURE_BACKUP_TIMERS=disabled FIXTURE_DAILY_SERVICE_STATE=active)" -eq 45 ]]
[[ "$(run_refresh_status probe FIXTURE_BACKUP_TIMERS=disabled FIXTURE_DAILY_SERVICE_STATE=activating)" -eq 45 ]]
[[ "$(run_refresh_status refresh FIXTURE_BACKUP_TIMERS=disabled FIXTURE_DAILY_SERVICE_STATE=failed)" -eq 0 ]]
# Each non-daily service can still be running independently of the daily job.
# disable without --now also leaves a timer active despite its disabled state.
for phase in probe refresh; do
for service_state in FIXTURE_WATCHDOG_SERVICE_STATE FIXTURE_DRILL_SERVICE_STATE; do
[[ "$(run_refresh_status "$phase" FIXTURE_BACKUP_TIMERS=disabled "$service_state=active")" -eq 45 ]]
done
[[ "$(run_refresh_status "$phase" FIXTURE_BACKUP_TIMERS=disabled_active)" -eq 45 ]]
done
# Non-backup ops timer is still required in manual mode.
[[ "$(run_refresh_status refresh FIXTURE_BACKUP_TIMERS=disabled FIXTURE_OPS_TIMER_INACTIVE=1)" -eq 43 ]]
@@ -240,6 +251,11 @@ rm -f -- "$mode_file"
printf 'manual_snapshot\n' >"$FIXTURE_ROOT/backup-mode-target"
ln -s "$FIXTURE_ROOT/backup-mode-target" "$mode_file"
[[ "$(run_refresh_status refresh FIXTURE_BACKUP_TIMERS=disabled)" -eq 44 ]]
# A dangling link is invalid, not an absent file selecting automatic mode.
rm -f -- "$FIXTURE_ROOT/backup-mode-target"
[[ -L "$mode_file" && ! -e "$mode_file" ]]
[[ "$(run_refresh_status probe)" -eq 44 ]]
[[ "$(run_refresh_status refresh)" -eq 44 ]]
rm -f -- "$mode_file"
[[ "$(run_refresh_status refresh)" -eq 0 ]]