Repository navigation
fix(backup): Add the site name to streamed backup file names - #613
Conversation
Streamed backups were named `<timestamp>-stream-<type>`, so the S3 objects and the files downloaded from them didn't say which site they belong to, unlike regular backups. Use frappe's site slug, as regular backups do. The slug goes before the `%stream%` marker: frappe's recent-backup glob `*-<slug>-database.sql.gz` would otherwise match a live FIFO. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
|
| return True | ||
| return value == "1" | ||
|
|
||
| def streamed_backup_prefix(self, todays_dt: str) -> str: |
There was a problem hiding this comment.
Public method lacks docstring The new
streamed_backup_prefix method has no docstring. The repository’s Frappe review guideline requires public functions to be documented; add one before merging.
Context Used: Guidelines for reviewing Frappe Framework applications. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: agent/site.py
Line: 1005
Comment:
**Public method lacks docstring** The new `streamed_backup_prefix` method has no docstring. The repository’s Frappe review guideline requires public functions to be documented; add one before merging.
**Context Used:** Guidelines for reviewing Frappe Framework applications. ([source](https://github.com/frappe/skills/blob/main/skills/quality-code-review/SKILL.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| db_file = site.streamed_backup_prefix("20260929_101500") + "-database.sql.gz" | ||
|
|
||
| self.assertEqual(db_file, "20260929_101500-streamed_site_test-%stream%-database.sql.gz") | ||
| self.assertFalse(fnmatch.fnmatch(db_file, "*-streamed_site_test-database.sql.gz")) |
There was a problem hiding this comment.
S3 filename remains untested This test checks the FIFO name but not the resulting S3 object name. Assert that the
%stream%- marker becomes stream- in the object name so a regression in that conversion cannot pass unnoticed.
Prompt To Fix With AI
This is a comment left during a code review.
Path: agent/tests/test_site.py
Line: 385-388
Comment:
**S3 filename remains untested** This test checks the FIFO name but not the resulting S3 object name. Assert that the `%stream%-` marker becomes `stream-` in the object name so a regression in that conversion cannot pass unnoticed.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.fix(backup): Add the site name to streamed backup file names (backport #613)
Streamed backups were named
<timestamp>-%stream%-<type>locally and<timestamp>-stream-<type>in S3, so, unlike regular backups, nothing in the object or downloaded file name said which site it belongs to.This adds frappe's site slug (the site name with dots turned into underscores, as regular backups use), keeping the
streamlabel:20260929_101500-my_site_test-%stream%-database.sql.gz20260929_101500-my_site_test-stream-database.sql.gzThe slug goes before the
%stream%marker on purpose. Frappe finds recent backups with the glob*-<slug>-database.sql.gz, and a name ending in-<slug>-database.sql.gzwould match a live FIFO, which blocks when opened.Still working:
bypass_unlink.somatches%stream%anywhere in the path (strstr), so the FIFOs keep their protection.%stream%-→stream-swap for S3 keys and thepkill -f <timestamp>cleanup don't change.🤖 Generated with Claude Code