Skip to content

feat: db push --verify / --sr-tables + db backups list/prune (#16)#6

Closed
vikasiwp wants to merge 1 commit into
mainfrom
fix/cli-db-16-verify-srtables-backups
Closed

feat: db push --verify / --sr-tables + db backups list/prune (#16)#6
vikasiwp wants to merge 1 commit into
mainfrom
fix/cli-db-16-verify-srtables-backups

Conversation

@vikasiwp

Copy link
Copy Markdown
Contributor

Closes the round-3 large-DB grab-bag (#16) — the last open item from the feedback. All three pieces verified against the source; new logic is in pure, unit-tested libs.

Changes

  • db push --verify — after import, polls the site URL until it answers HTTP (~90s budget). A large import can briefly return 000 right after import/flush; this replaces the hand-rolled curl-retry. Reported as verified: ok|timeout in the summary. (Push still exits 0 — the DB import succeeded; readiness is informational.)
  • db push --sr-tables <table...> — scope --search-replace to specific (prefixed) tables instead of --all-tables. Faster on big DBs whose bulk rows (e.g. a 197K-row postmeta ingest) have no URLs. Default stays --all-tables (thorough). Table names are validated identifier-safe before going into the remote command.
  • db backups list <site> / db backups prune <site> [--keep <n>] [--older-than <days>] [--force] — manage the ~/db-backup-*.sql.gz files db push writes (they accumulated with no way to view/clean them). prune refuses to run without a selector, confirms before deleting, and --force/--json gate it for CI.

Internal

  • Extracted waitForHttp from sites.ts to lib/http-ready.ts (now shared by sites create and db push --verify).
  • New lib/db-backups.ts (parseBackupList, selectBackupsToPrune) — pure, MOTD-tolerant parsing + prune selection.

Tests

  • New unit tests: db-backups (parse + prune selection: keep / older-than / OR / no-criteria), http-ready (answers→true, exhausted-budget→false-without-fetch).
  • Full suite 341 green; tsc clean; help output verified for all new flags/subcommands.

Builds on the shipped #1–#15 work (0.0.1-beta.25). #17 (incremental row-delta db push) is a separate, larger enhancement — planning that next, not in this PR.

🤖 Generated with Claude Code

Closes the round-3 large-DB grab-bag:
- db push --verify: poll the site URL after import until it answers HTTP
  (large imports can briefly return 000 right after import/flush); reported
  as `verified` in the summary
- db push --sr-tables <table...>: scope --search-replace to specific tables
  instead of --all-tables (faster on big DBs whose bulk has no URLs)
- db backups list / db backups prune --keep/--older-than/--force: manage the
  ~/db-backup-*.sql.gz files db push leaves behind

Extracted waitForHttp to lib/http-ready.ts (shared by sites create + db push).
New pure libs (http-ready, db-backups) with unit tests; full suite 341 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@vikasiwp

Copy link
Copy Markdown
Contributor Author

Bundled into #7 and released together in beta.26 — #6's commit (6c4884c) is contained in #7's branch and lands on main via the #7 squash. Branch kept (not deleted).

@vikasiwp vikasiwp closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants