[PR #4978] [MERGED] fix: keep backups working with large local assets #6565

Closed
opened 2026-10-23 04:11:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4978
Author: @SpicyMarinara
Created: 8/13/2026
Status: ✅ Merged
Merged: 8/13/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/backup-large-assets


📝 Commits (10+)

  • 3aded09 fix: keep backups working with large media
  • 4036fd6 Merge remote-tracking branch 'origin/staging' into agent/backup-large-assets
  • a34a2bd test: prove large media backup restore
  • e18b88d security: scope large backup media streaming
  • f73c3d5 Merge remote-tracking branch 'origin/staging' into agent/backup-large-assets
  • fba035a test: omit oversized non-media backups
  • 526715e fix: keep backup manifests loadable
  • 347d150 Merge branch 'staging' into agent/backup-large-assets
  • 0a486ec fix: report partial backup omissions
  • 64ef2ea fix: bound large backup writes

📊 Changes

7 files changed (+851 additions, -218 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/backup.routes.ts (+499 -194)
📝 packages/server/src/services/import/profile-import-assets.ts (+79 -18)
➕ packages/server/src/utils/crc32.ts (+27 -0)
📝 packages/server/src/utils/media-file-security.ts (+8 -5)
📝 scripts/regressions/automatic-backup-retention.regression.ts (+214 -1)
📝 scripts/regressions/profile-import-asset-security.regression.ts (+23 -0)

📄 Description

Why

Automatic and downloadable full backups inherited the 256 MiB untrusted profile-entry ceiling. A 376,363,985-byte local GIF therefore aborted the entire automatic backup even though Marinara writes backup files as uncompressed streams.

What changed

  • Streams recognized local media entries above 256 MiB, bounded by the existing 2 GiB archive-wide limit and ZIP32 format limits.
  • Imports large recognized STORED media by streaming it into quarantine, checking exact size, CRC, and media magic before promotion.
  • Keeps the 256 MiB ceiling for compressed entries, table/manifest data, inline JSON, standalone character cards, and unrecognized paths.
  • Lets automatic/downloadable full backups omit one failed filesystem source without invalidating the archive; exact omissions are logged, listed in RESTORE.txt, retained in automatic-backup status, and counted on download responses.
  • Computes strict-file CRC during the archive write instead of reading large files twice. Archive-wide count, central-directory, and physical-size failures remain fatal.

Validation

  • Run pnpm check.
  • Run pnpm regression:backup.
  • Run pnpm regression:profile-import-security:run.
  • Manually download/import a backup containing a real background larger than 256 MiB.

Automated coverage uses a small injected limit by default. MARINARA_REAL_LARGE_BACKUP_REGRESSION=1 pnpm regression:backup exercises the production writer, ZIP reader, streamed CRC/magic validation, and restored file at the reported 376,363,985-byte size. It also proves a valid strict entry remains restorable when unreadable and oversized non-media entries are omitted.

No linked issue; this is a maintainer-requested release blocker.

Summary by CodeRabbit

  • New Features

    • Backups and profile exports now support large local media files beyond standard per-file import limits.
    • Large assets can be streamed during backup and restoration with integrity validation.
    • Automatic and downloadable backups can continue when individual files are unreadable, oversized, or cannot be archived, while reporting omitted entries.
  • Bug Fixes

    • Improved archive consistency and validation for large media and profile assets.
    • Added safer handling for changing or inaccessible files during backup operations.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4978 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/13/2026 **Status:** ✅ Merged **Merged:** 8/13/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/backup-large-assets` --- ### 📝 Commits (10+) - [`3aded09`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3aded09296b3c82e2d0d8ac70ba309138221c628) fix: keep backups working with large media - [`4036fd6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4036fd611c10eaa53e9c30c5438fef8eef2ef78b) Merge remote-tracking branch 'origin/staging' into agent/backup-large-assets - [`a34a2bd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a34a2bdea2dac205f3a125e29fea96dcbfbaf4ae) test: prove large media backup restore - [`e18b88d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e18b88d328f3092840a1b010f15294789887e5d6) security: scope large backup media streaming - [`f73c3d5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f73c3d5551eb67760275ea29f38b8d20717e7fe7) Merge remote-tracking branch 'origin/staging' into agent/backup-large-assets - [`fba035a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fba035aa3fce8a834b6e044ab3d0ad34abd12459) test: omit oversized non-media backups - [`526715e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/526715eefa1cf53e78178a72bece7e70a3577cee) fix: keep backup manifests loadable - [`347d150`](https://github.com/Pasta-Devs/Marinara-Engine/commit/347d150796bde48c246d7de0dc28eaa64fd25a58) Merge branch 'staging' into agent/backup-large-assets - [`0a486ec`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0a486ecb7cb51512731fbb39a683068a71cdac77) fix: report partial backup omissions - [`64ef2ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/64ef2ea675f685b6d2b454d48d968eb3cfea3388) fix: bound large backup writes ### 📊 Changes **7 files changed** (+851 additions, -218 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+499 -194) 📝 `packages/server/src/services/import/profile-import-assets.ts` (+79 -18) ➕ `packages/server/src/utils/crc32.ts` (+27 -0) 📝 `packages/server/src/utils/media-file-security.ts` (+8 -5) 📝 `scripts/regressions/automatic-backup-retention.regression.ts` (+214 -1) 📝 `scripts/regressions/profile-import-asset-security.regression.ts` (+23 -0) </details> ### 📄 Description ## Why Automatic and downloadable full backups inherited the 256 MiB untrusted profile-entry ceiling. A 376,363,985-byte local GIF therefore aborted the entire automatic backup even though Marinara writes backup files as uncompressed streams. ## What changed - Streams recognized local media entries above 256 MiB, bounded by the existing 2 GiB archive-wide limit and ZIP32 format limits. - Imports large recognized STORED media by streaming it into quarantine, checking exact size, CRC, and media magic before promotion. - Keeps the 256 MiB ceiling for compressed entries, table/manifest data, inline JSON, standalone character cards, and unrecognized paths. - Lets automatic/downloadable full backups omit one failed filesystem source without invalidating the archive; exact omissions are logged, listed in `RESTORE.txt`, retained in automatic-backup status, and counted on download responses. - Computes strict-file CRC during the archive write instead of reading large files twice. Archive-wide count, central-directory, and physical-size failures remain fatal. ## Validation - [ ] Run `pnpm check`. - [ ] Run `pnpm regression:backup`. - [ ] Run `pnpm regression:profile-import-security:run`. - [ ] Manually download/import a backup containing a real background larger than 256 MiB. Automated coverage uses a small injected limit by default. `MARINARA_REAL_LARGE_BACKUP_REGRESSION=1 pnpm regression:backup` exercises the production writer, ZIP reader, streamed CRC/magic validation, and restored file at the reported 376,363,985-byte size. It also proves a valid strict entry remains restorable when unreadable and oversized non-media entries are omitted. No linked issue; this is a maintainer-requested release blocker. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Backups and profile exports now support large local media files beyond standard per-file import limits. * Large assets can be streamed during backup and restoration with integrity validation. * Automatic and downloadable backups can continue when individual files are unreadable, oversized, or cannot be archived, while reporting omitted entries. * **Bug Fixes** * Improved archive consistency and validation for large media and profile assets. * Added safer handling for changing or inaccessible files during backup operations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:11:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6565
No description provided.