Skip to content

fix(backup): Add the site name to streamed backup file names - #613

Merged
regdocs merged 1 commit into
developfrom
fix/streamed-backup-site-name
Oct 8, 2026
Merged

regdocs merged 1 commit into
developfrom
fix/streamed-backup-site-name

Conversation

@regdocs

@regdocs regdocs commented Sep 29, 2026

Copy link
Copy Markdown
Member

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 stream label:

  • Local FIFO: 20260929_101500-my_site_test-%stream%-database.sql.gz
  • S3 object: 20260929_101500-my_site_test-stream-database.sql.gz

The 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.gz would match a live FIFO, which blocks when opened.

Still working:

  • bypass_unlink.so matches %stream% anywhere in the path (strstr), so the FIFOs keep their protection.
  • The %stream%- → stream- swap for S3 keys and the pkill -f <timestamp> cleanup don't change.
  • Nothing in press parses these names.

🤖 Generated with Claude Code

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>
@regdocs regdocs self-assigned this Sep 29, 2026
@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

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.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Changes how backup file names are constructed during streaming.

The filename flow appears sound, but the repository’s public-function documentation requirement must be met before merging.

Reviews (1) · Last reviewed commit: "fix(backup): Add the site name to stream..."

Comment thread agent/site.py
return True
return value == "1"

def streamed_backup_prefix(self, todays_dt: str) -> str:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Comment thread agent/tests/test_site.py
Comment on lines +385 to +388
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"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

@regdocs
regdocs merged commit 27a40bb into develop Oct 8, 2026
6 checks passed
@regdocs
regdocs deleted the fix/streamed-backup-site-name branch October 8, 2026 14:44
regdocs added a commit that referenced this pull request Oct 8, 2026
fix(backup): Add the site name to streamed backup file names (backport #613)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant