fix(backup): pin pg_dump 18 in api images and expose download via SDK + CLI#48
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The admin "Download backup" button returned
500 Internal Server Error. Repro and findings:docker-compose-dev.ymlpinspostgres:18.3-alpine; bothbackend/Dockerfileandbackend/Dockerfile.prodinstalled Debian's defaultpostgresql-client(currently17.10).pg_dumprefuses cross-major-version dumps and the request failed withpg_dump: error: aborting because of server version mismatch. The router swallowed theRuntimeErrorinto a generic 500, so the only signal an operator got was the toast.Backend:
postgresql-client-18from PGDG (apt.postgresql.org).pg_dump --versioninside the api container is now18.4, matching the postgres 18.x server.BackupFailedexception inservices/backup.py._pg_dump_toraises it on missing binary or non-zero exit, attaching the trimmedstderr.routers/settings.py::download_backupcatches it and surfaces a503with the actionable detail so the next operator can see what's wrong without grep'ing logs.SDK:
BackupResource(testjam_client/resources/backup.py):client.backup.download_bytes()returns the raw zip bytes for callers that handle persistence themselves.client.backup.download(destination)accepts either a directory (resolves the filename fromContent-Disposition, falling back totestjam-backup.zip) or an explicit file path; returns thePathwritten.CLI:
testjam backup [--out PATH]command.--outaccepts a directory or a file path; defaults to the current directory. Reports{path, bytes}rendered through the standard output table /--json.cli/__init__.pyalongside the other resource Typers.Tests:
testjam-client/tests/test_backup.py): valid zip viadownload_bytes, explicit-path save returns the samePath, and directory destination resolves the filename from the API header.tests/test_cli_backup.py): writing into a directory producestestjam-backup-*.zip, writing to an explicit file path lands the archive there.Suites: backend 894, SDK 182 (3 skipped).