Skip to content

feat: sandbox interface package#7

Merged
deevus merged 5 commits intomainfrom
worktree-sandbox-interface
Mar 2, 2026
Merged

feat: sandbox interface package#7
deevus merged 5 commits intomainfrom
worktree-sandbox-interface

Conversation

@deevus
Copy link
Owner

@deevus deevus commented Mar 2, 2026

Summary

  • Scaffold backend-agnostic sandbox package with Backend, Exec, and NetworkPolicy interfaces composed into Sandbox
  • Add value types (Instance, Snapshot, CreateOpts, etc.) replacing direct truenas-go type leaks
  • Add Register/Open registry for backend plugin discovery
  • 100% test coverage on executable code

TrueNAS backend extraction behind this interface will follow in this same PR.

Ref: #6

Test plan

  • go build ./sandbox/... compiles
  • go vet ./sandbox/... clean
  • go test ./... all existing tests pass
  • 100% coverage on sandbox package

🤖 Generated with Claude Code

Add backend-agnostic interfaces (Backend, Exec, NetworkPolicy) composed
into a Sandbox interface, along with value types and a registry for
plugin discovery. This is the first step toward decoupling cmd/ from
truenas-go types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

⬆️ Go test coverage increased from 25.4% to 47.0% compared to 14e472e
⚠️ 1 of 12 packages have zero coverage.
  • github.com/deevus/pixels

Updated Package Coverages:

# Package Name                                |  Prior |    New
+ github.com/deevus/pixels/cmd                |   6.5% |   9.6%
+ github.com/deevus/pixels/internal/provision |  40.6% |  79.1%
+ github.com/deevus/pixels/internal/ssh       |  18.4% |  34.7%
+ github.com/deevus/pixels/internal/truenas   |  43.3% |  83.8%
+ github.com/deevus/pixels/sandbox            |   0.0% | 100.0%
+ github.com/deevus/pixels/sandbox/truenas    |   0.0% |  66.0%
View coverage for all packages
# Package Name                                | Coverage
- github.com/deevus/pixels                    |     0.0%
+ github.com/deevus/pixels/cmd                |     9.6%
+ github.com/deevus/pixels/internal/cache     |    93.8%
+ github.com/deevus/pixels/internal/config    |    94.0%
+ github.com/deevus/pixels/internal/dataset   |   100.0%
+ github.com/deevus/pixels/internal/egress    |    93.5%
+ github.com/deevus/pixels/internal/provision |    79.1%
+ github.com/deevus/pixels/internal/retry     |   100.0%
+ github.com/deevus/pixels/internal/ssh       |    34.7%
+ github.com/deevus/pixels/internal/truenas   |    83.8%
+ github.com/deevus/pixels/sandbox            |   100.0%
+ github.com/deevus/pixels/sandbox/truenas    |    66.0%

deevus and others added 4 commits March 2, 2026 03:38
Add sandbox/truenas package wrapping internal/truenas, ssh, cache, and
egress packages behind the backend-agnostic Sandbox interface. Exports
sshArgs as Args in internal/ssh for custom exec.Cmd construction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert list, start, stop, destroy, checkpoint, and network commands
to use openSandbox() instead of directly calling internal packages.
Commands that need complex flows (create, console, exec, sessions,
status) remain on the old path for now.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
exec previously ran commands via a bare SSH session (non-login,
non-interactive), so ~/.profile wasn't sourced and mise-managed tools
(claude, opencode, codex, node) were invisible to PATH.

Wrap the user's command in `bash -lc` with explicit mise activation so
the environment matches what `pixels console` provides. Uses
shellescape for proper POSIX quoting across SSH's argument
concatenation. Falls back gracefully when mise isn't installed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
apt-get install nftables hit an interactive conffile prompt because
/etc/nftables.conf was already written by the egress file setup step.
With no stdin attached, dpkg errored out with exit code 100.

Set DEBIAN_FRONTEND=noninteractive and --force-confold to keep the
existing config without prompting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@deevus deevus marked this pull request as ready for review March 2, 2026 04:29
@deevus deevus merged commit f2dcf26 into main Mar 2, 2026
2 checks passed
@deevus deevus deleted the worktree-sandbox-interface branch March 2, 2026 04:38
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