Skip to content

feat(minimald): implement populating session files using a tarball - #423

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/minimald
Jun 16, 2026
Merged

feat(minimald): implement populating session files using a tarball#423
twitchyliquid64 merged 1 commit into
mainfrom
tom/minimald

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jun 15, 2026

Copy link
Copy Markdown
Member

Lets you populate workspace files by streaming a tarball. You can drive it manually like this:

$> tar -v -cf - -C 'my/workspace' ./ | zstd -c -T0 | \
    MINIMAL_SESSION_ID=aaaa019eb7a0-36d9-7d41-8286-265d76e9b3ab ssh -s -o SendEnv=MINIMAL_SESSION_ID \
    -o ProxyCommand="socat - UNIX-CONNECT:$XDG_STATE_DIR/minimal/providers/local-0/ssh.sock" \
    -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null' local-0 \
    minimald-v1-WorkspaceFilesTarZst

Summary by CodeRabbit

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new SSH subsystem that streams a compressed tar archive and unpacks it into a target session’s workspace directory.
  • Chores

    • Updated workspace dependencies to enable async streaming and compressed archive handling.
  • Tests

    • Added coverage for successful streamed unpacking and for handling an unknown session identifier.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8ad79516-4509-45d2-a10a-66d215c48a30

📥 Commits

Reviewing files that changed from the base of the PR and between ad21677 and 234ff3a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/minimald/Cargo.toml
  • crates/minimald/src/rpc.rs
  • crates/minimald/src/test_harness.rs
✅ Files skipped from review due to trivial changes (1)
  • crates/minimald/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (3)
  • Cargo.toml
  • crates/minimald/src/test_harness.rs
  • crates/minimald/src/rpc.rs

📝 Walkthrough

Walkthrough

Adds async-compression and async-tar as workspace and crate dependencies, then implements a new SSH subsystem RPC STREAM_WORKSPACE_FILES in minimald. The handler decodes an incoming zstd-compressed tarball from the SSH channel and unpacks it into the target session's workspace directory, with error reporting via SSH extended data. Dispatch wiring and two integration tests are included.

Changes

STREAM_WORKSPACE_FILES SSH subsystem RPC

Layer / File(s) Summary
Workspace and crate dependency additions
Cargo.toml, crates/minimald/Cargo.toml
Adds async-compression (tokio, zstd features) and async-tar (runtime-tokio, no default features) to the workspace manifest and the minimald crate manifest.
serve_stream_workspace_files implementation and imports
crates/minimald/src/rpc.rs
Updates imports, defines the STREAM_WORKSPACE_FILES constant, and implements serve_stream_workspace_files: reads session UUID from env, looks up the session, wraps the channel reader in a zstd decoder feeding a tar unpacker, extracts files into the session workspace, and emits errors via SSH extended data before closing the channel.
handle_ssh_rpc dispatch wiring
crates/minimald/src/rpc.rs
Extends subsystem-name dispatch to recognize STREAM_WORKSPACE_FILES, adjusts destructuring to carry both the SSH channel and its config tuple, and adds a spawn arm that calls serve_stream_workspace_files.
Test helper and integration tests
crates/minimald/src/test_harness.rs, crates/minimald/src/rpc.rs
Adds TestClient::open_subsystem to open a session channel with env vars and return the live channel. Two tokio tests cover successful tar.zst unpacking to disk and rejection of an unknown session UUID with an "unknown session" extended-data error.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • gominimal/minimal#420: Modifies the same handle_ssh_rpc dispatcher in crates/minimald/src/rpc.rs, refactoring oneshot RPC type definitions and routing—directly adjacent to the new STREAM_WORKSPACE_FILES dispatch arm added here.

Suggested reviewers

  • 0chroma
  • evanspearman
  • norrietaylor

Poem

🐇 Hop hop, a tarball arrives on the wire,
Compressed with zstd, packed ever so tight,
The workspace unrolls like a cozy warm fire,
Unknown sessions get errors — that's only right!
The rabbit unpacks with async delight. 📦

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing tarball-based file population for minimald sessions, which is the core feature across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/minimald/src/rpc.rs`:
- Around line 199-208: The tar extraction at the
Archive::new(reader).unpack(workspace_path.as_utf8_path()).await call unpacks
client-controlled data directly into the live workspace without size limits,
entry validation, or rollback on failure, leaving partial files on disk if
extraction fails. Replace this direct unpack with a safer approach using the
existing extract_compressed_tar() function from crates/common/src/archive.rs (or
create a similar wrapper) that extracts to a temporary staging directory first,
validates the archive contents and enforces quotas on decoded bytes and entry
counts, then moves the validated contents to the workspace only after confirming
success. Ensure that any extraction errors trigger cleanup of the staging
directory and proper rollback before the error response is sent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf55d440-f1fc-4962-82bc-1573fe95b9aa

📥 Commits

Reviewing files that changed from the base of the PR and between f45be10 and ad21677.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/minimald/Cargo.toml
  • crates/minimald/src/rpc.rs
  • crates/minimald/src/test_harness.rs

Comment thread crates/minimald/src/rpc.rs Outdated

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Pretty slick!

Comment thread crates/minimald/src/rpc.rs
Comment thread crates/minimald/src/rpc.rs
Comment thread crates/minimald/src/rpc.rs
Comment thread crates/minimald/src/test_harness.rs
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.

3 participants