Pular para o conteúdo

State Re-base Groups (rebase-state-group.sh)

State re-base groups

scripts/rebase-state-group.sh drives recovery batches 2–5 from RECOVERY-PURGED-CITIES-2026-11-04.md (tracking: issue #233): the 20 states not yet re-based, one group at a time, so canonical generator output replaces in-place-repaired HTML — and the stored RightRep banner is stripped as a side effect (HANDOFF-REVENUE-RECOVERY-2026-11-04B.md §2).

Terminal window
scripts/rebase-state-group.sh G1 # MG
scripts/rebase-state-group.sh G2 # CE BA PE GO RJ
scripts/rebase-state-group.sh G3 # MT MS ES PB PI RN MA
scripts/rebase-state-group.sh G4 # TO SE AL AM AP RR DF
scripts/rebase-state-group.sh --states "MG SP" # custom set (cache-only too)
DRY_RUN=1 scripts/rebase-state-group.sh G1 # print the commands only
GroupStatesestado pagesest. mutations
G1MG1,840~12.9k
G2CE BA PE GO RJ2,689~18.8k
G3MT MS ES PB PI RN MA1,666~11.7k
G4TO SE AL AM AP RR DF532~3.7k

Cache-only by construction

SERPER_API_KEY is unset for every regen (after sourcing .env for DEEPSEEK_API_KEY). Batch 1 (refetch-missing-cities.sh) already keyed-refetched the 314 purged earning cities; a keyed group run would also refetch zero-result cities — the October quota-bomb bug class. Cities with no usable cache gain DeepSeek fallback content; without a DeepSeek key they stay no-data and the script warns.

What it checks per state

  • Silent no-op detection: each state’s log section must contain Building pages for and must not contain Error fetching cities for — otherwise the run “completed” having built nothing (IBGE fetch failure) and the state is marked NOOP.
  • Results land in logs/regen-<group>-<date>-results.tsv (OK / NOOP / FAIL per state) with the full log at logs/regen-<group>-<date>.log. Any NOOP or FAIL fails the run — diagnose, never re-run blind.
  • Custom sets warn when a state was already re-based on 4 Nov (AC PA PR RO RS SC SP): regenerating those moves lastmods with no genuine change.

Deploy is deliberately not part of the script

Every group deploy needs the operator checkpoint (issue #233 procedure): dated batch record on #198 first → public/ snapshot → explicit go-ahead → smart-deploy --approve-large-deploy <#198 URL> --yes (nohup + poll) → post-gates (audit-metadata, build-freshness --remote, rclone rightrep spot-check, next 03:00 build back to ~0 mutations).