Skip to content

Make Allure result files durable before publishing - #77

Merged
vdvukhzhilov merged 2 commits into
mainfrom
atomic-file-writes
Sep 7, 2026
Merged

vdvukhzhilov merged 2 commits into
mainfrom
atomic-file-writes

Conversation

@vdvukhzhilov

Copy link
Copy Markdown
Contributor
  • Stage Allure filesystem artifacts (test/container/globals JSON and attachments) as .allure-write-*.tmp in the results directory, sync with fflush / fsync (when available), then rename to the final name so live readers do not see partially written finals.
  • On overwrite platforms where rename-over-existing fails (typical Windows), move the old final aside, publish the staged file, then remove the aside backup; if publish fails after the aside step, restore the old final when possible and keep the staged temp with the new payload.
  • Incomplete temps (failure before sync) are deleted; fully synced temps are kept if publish fails so the new payload is not lost.

@vdvukhzhilov vdvukhzhilov added the type:improvement New feature or request label Aug 11, 2026

@delatrie delatrie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That should do the job. One thing I would revisit though is the syncCallback parameter of FileSystemResultsWriter. It creates an obscure API: it's not obvious for callers that the callback replaces the default syncing mechanism rather than being called along it.

Do we really need sync override? If yes, having just the overridable syncStreams method should be enough. Otherwise, the syncing method should be private.

Comment thread src/Io/FileSystemResultsWriter.php Outdated
@vdvukhzhilov
vdvukhzhilov merged commit aca11f3 into main Sep 7, 2026
34 of 40 checks passed
@vdvukhzhilov
vdvukhzhilov deleted the atomic-file-writes branch September 7, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:improvement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants