Skip to content

fix(stream-pipe): create buffer directory before writing buffer files - #156

Open
yaoge123 wants to merge 2 commits into
sjtug:masterfrom
yaoge123:fix-stream-pipe-buffer-dir
Open

yaoge123 wants to merge 2 commits into
sjtug:masterfrom
yaoge123:fix-stream-pipe-buffer-dir

Conversation

@yaoge123

Copy link
Copy Markdown
Contributor

ByteStreamPipe::get_object opens {buffer_path}/{hash}.{ts}.buffer with create(true), but nothing ensures buffer_path itself exists. On a fresh working directory (e.g. a new mirror deployment that did not manually mkdir .tmp), every download fails with ENOENT and the whole transfer aborts.

Create the buffer directory (including parents) up front. This matches FileBackend::put_object, which already does create_dir_all for its target directory.

ByteStreamPipe::get_object opens {buffer_path}/{hash}.{ts}.buffer with
create(true), but nothing ensures buffer_path itself exists. On a fresh
working directory every download then fails with ENOENT and the whole
transfer aborts. Create the directory (and parents) up front.
Copilot AI lite review requested due to automatic review settings September 19, 2026 15:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Index buffer writes also need directory initialization.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Creates the configured buffer directory before streamed downloads to prevent missing-directory failures.

Changes:

  • Recursively creates the buffer directory in ByteStreamPipe::get_object.
  • Generated index buffer writes still bypass this initialization.
File Changes Review status
src/​stream_pipe.rs Initializes the buffer directory before download files are created. Moderate unresolved issue: index pipelines can still fail with ENOENT on fresh deployments.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/stream_pipe.rs
async fn get_object(&self, snapshot: &Snapshot, mission: &Mission) -> Result<ByteStream> {
let transfer_url = self.source.get_object(snapshot, mission).await?;

tokio::fs::create_dir_all(&self.buffer_path).await?;
IndexPipe::get_object writes generated *.buffer files into buffer_path
with the same create(true) pattern as ByteStreamPipe. Apply the same
create_dir_all so a fresh working directory does not fail with ENOENT
when an index update runs before any download.
@yaoge123

Copy link
Copy Markdown
Contributor Author

Good catch — IndexPipe::get_object had the same create-without-mkdir pattern on buffer_path. Fixed in 02134d5 by calling create_dir_all there as well.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The reviewed changes address buffer creation failures with no unresolved blocking issues.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

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.

2 participants