Summary
provider_pull_pantheon_db() in pull/pull is supposed to reuse an existing Pantheon backup if it's less than 24 hours old, and only call terminus backup:create (which runs a full DB dump on the live/production environment) when the cached backup has actually expired. In practice, it creates a brand new backup on every single fin pull db / fin refresh run, regardless of how recently one was made.
Root cause
local last_backup
last_backup=$(_exec -T "terminus backup:list ${hostingsite}.${hostingenv} --element=db --format=list --field=date | head -n 1")
if_failed_error "Error retrieving list of backups from Pantheon for ${hostingsite} on the ${hostingenv} environment"
if [[ "last_backup" == "" ]] || [[ "${last_backup}" < "${yesterday}" ]] || [[ "$force" == "force" ]]; then
terminus backup:list ... --field=date returns a raw Unix epoch timestamp (e.g. 1786491893.1987), not a formatted date.
$yesterday (set earlier in the file) is a formatted string: date --date='yesterday' "+%Y-%m-%d %H:%M:%S" → e.g. 2026-08-10 19:21:58.
- The comparison
"${last_backup}" < "${yesterday}" is a plain Bash string comparison. Since epoch timestamps for any date after 2001 start with the digit 1, and formatted YYYY-... dates for 2000-2099 start with 2, this comparison is always true — "1786491893.1987" < "2026-08-10 19:21:58" evaluates true no matter what the actual backup age is.
There's also a secondary bug in the same line: [[ "last_backup" == "" ]] compares the literal string "last_backup" instead of the variable "${last_backup}" (missing $), so the "no backup exists yet" branch is also dead code.
Impact
- Every
fin pull db / fin refresh forces a new terminus backup:create against the live environment, even when a backup from minutes earlier already exists. Each of these takes ~15-20 minutes and runs a full dump on the production app container.
- We noticed this because repeated
fin refresh runs (about an hour apart) each showed up as a fresh "Exported database/files from live" entry in the Pantheon dashboard, with no reuse of the same-day backup.
Fix
The Acquia provider (provider_pull_acquia_db) already handles this correctly by converting its epoch timestamp to the same formatted string before comparing:
last_date=$(_exec date --date=@${last_date} "+%Y-%m-%d %H:%M:%S")
PR incoming that applies the same pattern to provider_pull_pantheon_db.
Summary
provider_pull_pantheon_db()inpull/pullis supposed to reuse an existing Pantheon backup if it's less than 24 hours old, and only callterminus backup:create(which runs a full DB dump on the live/production environment) when the cached backup has actually expired. In practice, it creates a brand new backup on every singlefin pull db/fin refreshrun, regardless of how recently one was made.Root cause
terminus backup:list ... --field=datereturns a raw Unix epoch timestamp (e.g.1786491893.1987), not a formatted date.$yesterday(set earlier in the file) is a formatted string:date --date='yesterday' "+%Y-%m-%d %H:%M:%S"→ e.g.2026-08-10 19:21:58."${last_backup}" < "${yesterday}"is a plain Bash string comparison. Since epoch timestamps for any date after 2001 start with the digit1, and formattedYYYY-...dates for 2000-2099 start with2, this comparison is always true —"1786491893.1987" < "2026-08-10 19:21:58"evaluates true no matter what the actual backup age is.There's also a secondary bug in the same line:
[[ "last_backup" == "" ]]compares the literal string"last_backup"instead of the variable"${last_backup}"(missing$), so the "no backup exists yet" branch is also dead code.Impact
fin pull db/fin refreshforces a newterminus backup:createagainst the live environment, even when a backup from minutes earlier already exists. Each of these takes ~15-20 minutes and runs a full dump on the production app container.fin refreshruns (about an hour apart) each showed up as a fresh "Exported database/files from live" entry in the Pantheon dashboard, with no reuse of the same-day backup.Fix
The Acquia provider (
provider_pull_acquia_db) already handles this correctly by converting its epoch timestamp to the same formatted string before comparing:last_date=$(_exec date --date=@${last_date} "+%Y-%m-%d %H:%M:%S")PR incoming that applies the same pattern to
provider_pull_pantheon_db.