Skip to content

feat(files): Add deployment content push - #6

Merged
nfebe merged 2 commits into
mainfrom
feat/file-browser-operations
Aug 20, 2026
Merged

feat(files): Add deployment content push#6
nfebe merged 2 commits into
mainfrom
feat/file-browser-operations

Conversation

@nfebe

@nfebe nfebe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Push a local directory to a deployment in one request, with optional destination cleanup.

@sourceant

sourceant Bot commented Aug 20, 2026

Copy link
Copy Markdown

Code Review Summary

This PR adds the capability to push a local directory to a deployment in a single request. It includes updates to the CLI command structure, the underlying API client, and comprehensive tests.

🚀 Key Improvements

  • Introduced streaming directory uploads using io.Pipe, which scales well with large file sets.
  • Added safety checks to block symbolic links during the archival process.
  • Updated the generated command catalogue to support new file-related operations.
  • Refactored the Client request logic to expose a reusable doRequest method.

💡 Minor Suggestions

  • Centralize the Authorization header logic within the Client struct to avoid manual header management in specialized request methods like PushDeploymentFiles.

@sourceant sourceant Bot 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.

Review complete. See the overview comment for a summary.

Comment thread internal/flatrun/files.go
if path == source {
return nil
}
info, err := entry.Info()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Optimization: You can check if the entry is a symbolic link using entry.Type() before calling entry.Info(). Since entry.Type() is typically available directly from the directory traversal (e.g., via getdents on Linux), this can avoid an unnecessary stat syscall for every file in the directory tree, significantly improving performance for large source directories.

Suggested change
info, err := entry.Info()
+ if entry.Type()&os.ModeSymlink != 0 {
+ return fmt.Errorf("symbolic links are not supported: %s", path)
+ }
+ info, err := entry.Info()
+ if err != nil {
+ return err
+ }

Large directory pushes now reject symbolic links without an extra file metadata lookup.

@sourceant sourceant Bot 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.

Review complete. See the overview comment for a summary.

Comment thread internal/flatrun/files.go
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", multipartWriter.FormDataContentType())
if c.token != "" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Authorization header setting is duplicated here and in the main request logic (as seen in internal/flatrun/client.go). To ensure consistency and simplify future changes (e.g., changing auth schemes), consider extracting this into a private helper method on the Client struct.

Suggested change
if c.token != "" {
c.setAuthHeader(req)

@nfebe
nfebe merged commit b502879 into main Aug 20, 2026
6 checks passed
@nfebe
nfebe deleted the feat/file-browser-operations branch August 21, 2026 21:17
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