Skip to content

feat(saas-migration): persist export/backup result via EntityFileStorage#75

Merged
marioserrano09 merged 1 commit into
mainfrom
feature/migration-entity-files-storage
Jul 21, 2026
Merged

feat(saas-migration): persist export/backup result via EntityFileStorage#75
marioserrano09 merged 1 commit into
mainfrom
feature/migration-entity-files-storage

Conversation

@marioserrano09

Copy link
Copy Markdown
Contributor

Summary

  • The export/backup ZIP produced by the SaaS Migration module is no longer left as a raw file on local/container disk. It's still assembled in a local transient working file (AccountMigrationProperties.outputDirectory), but is only uploaded to EntityFileService/EntityFileStorage (local safe dir, S3, Buckie, …) after the pipeline finishes successfully — the local copy is deleted right after, win or lose.
  • A job never reports COMPLETED without a persisted, downloadable result: if the upload to EntityFileStorage fails, the job is marked FAILED instead.
  • AccountMigrationJob.resultPath (raw filesystem String) is replaced by resultFile (EntityFile FK, eager-fetched), associated with the job itself.
  • GET /jobs/{jobId}/download now streams via StoredEntityFile.toResource() (through the new AccountMigrationJobService.downloadResult()), so it works transparently regardless of which storage backend is configured — no more FileSystemResource over a raw path.
  • CLONE is unaffected: it already used a JVM temp file that's deleted in a finally block and never exposed for download.
  • ARCHITECTURE.md updated (new §7.1, diagrams, DB schema, roadmap) to document the new persistence flow.

Test plan

  • mvn -pl extensions/entity-files/sources/core,extensions/saas/sources,extensions/saas/sources/migration -am install -DskipTests — reactor builds clean with the new entity-files dependency wired in.
  • mvn -pl extensions/saas/sources/migration test — all 75 existing unit tests pass unchanged.
  • Manual smoke test in a host app: run an EXPORT/BACKUP job end-to-end and confirm GET /jobs/{jobId}/download streams correctly against each configured EntityFileStorage backend (local, S3, Buckie).

🤖 Generated with Claude Code

The export/backup ZIP is now uploaded to EntityFileService (local/S3/Buckie)
only after the pipeline finishes successfully, instead of being kept as a
raw file on local/container disk. The local working copy is deleted right
after, and a job never reports COMPLETED without a durable, downloadable
result.

AccountMigrationJob.resultPath (raw filesystem path) is replaced by
resultFile (EntityFile reference), and the download endpoint streams via
StoredEntityFile instead of FileSystemResource.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@marioserrano09
marioserrano09 merged commit f4f0078 into main Jul 21, 2026
1 check passed
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.

1 participant