← back to Dw Contact Us Pages

scripts/cohort-rollback.sh

19 lines

#!/usr/bin/env bash
# cohort-rollback.sh — undo cohort-flip.sh for ONE cohort, from that cohort's OWN ledgers (never another
# cohort's). TK-11669. Reverse order of the flip.
#   bash scripts/cohort-rollback.sh maharam           # DRY-RUN
#   bash scripts/cohort-rollback.sh maharam --apply
# Completeness proof after --apply:  node scripts/restore-map.mjs --cohort maharam --check   (expect 0 diffs)
set -euo pipefail
COHORT="${1:?usage: cohort-rollback.sh <cohort> [--apply]}"; shift || true
APPLY=""; [[ "${1:-}" == "--apply" ]] && APPLY="--apply"
cd "$(dirname "$0")/.."
C="--cohort $COHORT"
step(){ printf '\n\033[1;33m== %s ==\033[0m\n' "$*"; }
step "1 re-publish channels";          node scripts/unpublish-channels.mjs $C --rollback $APPLY
step "2 restore templateSuffix";       node scripts/assign-template.mjs $C --rollback $APPLY
step "3 un-harden variants";           node scripts/harden-variants.mjs $C --rollback $APPLY
step "4 restore Boost vendor list";    node scripts/set-contact-us-vendors.mjs $C --rollback $APPLY
if [[ -n "$APPLY" ]]; then step "5 completeness check vs restore map"; node scripts/restore-map.mjs $C --check || true; fi
echo; echo "cohort-rollback $COHORT ${APPLY:-DRY-RUN} complete."