Skip to content

feat(storage-objects): Adds a helper method to create an Object from a local directory#656

Merged
adam-rl merged 1 commit intomainfrom
adam/add-object-tar
Nov 20, 2025
Merged

feat(storage-objects): Adds a helper method to create an Object from a local directory#656
adam-rl merged 1 commit intomainfrom
adam/add-object-tar

Conversation

@adam-rl
Copy link
Copy Markdown
Contributor

@adam-rl adam-rl commented Nov 19, 2025

User description

Description

Adds a helper method, uploadFromDir that packages up a local directory as a Gzipped Tar file, then uploads that
as an Object.

Motivation

Useful way to create build contexts to attach to a Blueprint build.

Testing

  • Unit tests added
  • Integration tests added
  • Smoke Tests added/updated
  • Tested locally

Checklist

  • PR title follows Conventional Commits format (feat: or feat(scope):)
  • Documentation updated (if needed)
  • Breaking changes documented (if applicable)

CodeAnt-AI Description

Upload directories as gzipped tarballs via StorageObject

What Changed

  • StorageObjectOps now offers uploadFromDir so Node.js users can archive a local directory as a gzipped tarball, upload it through the object lifecycle, and keep the requested TTL/metadata in one operation.
  • Unit tests verify successful directory uploads, TTL/metadata propagation, rejection of non-directory or missing paths, browser-only guard behavior, and clear errors when the upload endpoint returns failure.
  • Smoketests now create a temporary folder, upload it via uploadFromDir, confirm the stored object reports the tgz content type, and validate the archived file contents after download.

Impact

✅ Upload directories as objects without manual compression
✅ Retain TTL/metadata when archiving folders
✅ Clear errors when directory upload paths are invalid

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@adam-rl adam-rl requested a review from dines-rl November 19, 2025 23:21
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Nov 19, 2025

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added the size:L This PR changes 100-499 lines, ignoring generated files label Nov 19, 2025
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Nov 19, 2025

CodeAnt AI finished reviewing your PR.

@github-actions
Copy link
Copy Markdown

⚠️ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 98.18% 100%
Lines 81.76% - ℹ️
Branches 50% - ℹ️
Statements 81.4% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@adam-rl adam-rl requested a review from james-rl November 19, 2025 23:36
@adam-rl
Copy link
Copy Markdown
Contributor Author

adam-rl commented Nov 19, 2025

First iteration, this will NOT include dockerignore support. Will address in a follow up.

Comment thread tests/objects/storage-object.test.ts
@adam-rl adam-rl force-pushed the adam/add-object-tar branch from 8db3816 to 524fe1f Compare November 20, 2025 05:44
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Nov 20, 2025

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Nov 20, 2025
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai bot commented Nov 20, 2025

CodeAnt AI Incremental review completed.

@github-actions
Copy link
Copy Markdown

✅ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 100% 100%
Lines 86.61% - ℹ️
Branches 52.04% - ℹ️
Statements 86.13% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

✅ All tests passed and all object methods are covered!

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@adam-rl adam-rl force-pushed the adam/add-object-tar branch from 524fe1f to f064af7 Compare November 20, 2025 05:52
@adam-rl
Copy link
Copy Markdown
Contributor Author

adam-rl commented Nov 20, 2025

I downscoped this PR again. I build the tarfile in memory, as uploading to S3 in chunks is involved. We will want to do that, but first pass gets the naive approach.

@github-actions
Copy link
Copy Markdown

✅ Object Smoke Tests & Coverage Report

Test Results

✅ All smoke tests passed

Coverage Results

Metric Coverage Required Status
Functions 100% 100%
Lines 86.61% - ℹ️
Branches 52.04% - ℹ️
Statements 86.13% - ℹ️

Coverage Requirement: 100% function coverage (all public methods must be called in smoke tests)

✅ All tests passed and all object methods are covered!

View detailed coverage report

Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.

📋 View workflow run

@adam-rl adam-rl merged commit b87ac39 into main Nov 20, 2025
8 checks passed
@adam-rl adam-rl deleted the adam/add-object-tar branch November 20, 2025 18:20
@stainless-app stainless-app bot mentioned this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants