Skip to content

feat(sdks): expose all BoxCommand args (cwd, user, timeout) across SDKs#365

Merged
DorianZheng merged 6 commits intomainfrom
feat/expose-boxcommand-args-sdks
Mar 12, 2026
Merged

feat(sdks): expose all BoxCommand args (cwd, user, timeout) across SDKs#365
DorianZheng merged 6 commits intomainfrom
feat/expose-boxcommand-args-sdks

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

@DorianZheng DorianZheng commented Mar 12, 2026

Summary

  • Expose cwd, user, and timeout parameters from Rust's BoxCommand across all SDK exec methods (Python, Node.js, C)
  • Add FFI boxlite_execute_cmd() with BoxliteCommand struct for structured command execution in C SDK
  • Add unit/integration test separation for C SDK using CTest labels
  • Fix test infrastructure to use isolated temp dirs (avoid lock contention with running boxlite-mcp)

Changes

SDK exec options

  • Python: SimpleBox.exec() and SyncSimpleBox.exec() accept cwd, user, timeout kwargs
  • Node.js: SimpleBox.exec() accepts { cwd, user, timeout } options object
  • C: New boxlite_execute_cmd() + BoxliteCommand struct with workdir, user, timeout_secs fields

Test infrastructure

  • C SDK: CTest labels (unit/integration) + separate Make targets (test:unit:c, test:integration:c)
  • C test_basic.c: Use dedicated /tmp/ dirs instead of default ~/.boxlite to avoid lock contention
  • Node.js: Vitest setup file (integration-setup.ts) creates isolated temp BOXLITE_HOME per test session
  • Python: BOXLITE_HOME env var in Make target for integration tests
  • Node.js snapshot tests: Skipped with TODO — tests operate on running box, needs rewrite to match Rust pattern (stop → snapshot → start)

Test plan

  • Rust integration tests for exec options (boxlite/tests/exec_options.rs)
  • C SDK integration tests for boxlite_execute_cmd (test_execute_cmd.c)
  • C SDK unit tests pass (make test:unit:c)
  • Node.js integration tests pass with isolated BOXLITE_HOME
  • Python sync API tests for new exec options
  • Full pre-push test matrix passes (137 tests)

BoxCommand has 7 fields but most SDKs only exposed 3-5. This surfaces
the remaining parameters (working_dir, user, timeout) through Python,
Node.js, and C SDK layers, adds integration tests, and updates all
documentation.

Closes #362
The C SDK had no unit/integration test distinction, causing all tests
(including VM-requiring integration tests) to run in the pre-push hook.
This adds CTest labels and separate Make targets matching the Python/Node
SDK patterns, and improves error reporting in test_execute_cmd.c.
test_basic.c used NULL home_dir (default ~/.boxlite) for runtime
creation, which conflicts with any running boxlite process (e.g.,
boxlite-mcp). Use dedicated /tmp/ directories instead.
Set BOXLITE_HOME env var for integration test targets to avoid lock
contention with any running BoxLite process (e.g., boxlite-mcp).
clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
flags memcpy and snprintf as insecure. Use character-by-character copy
loops matching the pattern in test_streaming.c.
macOS clang-tidy silently skips the DeprecatedOrUnsafeBufferHandling
check because Apple libc lacks Annex K (memcpy_s, snprintf_s). Add a
platform-independent grep check to lint:c that catches memcpy, sprintf,
strcpy, etc. on all platforms. Also add sdks/c/.clang-tidy to
standardize enabled checks across environments.
@DorianZheng DorianZheng merged commit 2d2929d into main Mar 12, 2026
30 checks passed
@DorianZheng DorianZheng deleted the feat/expose-boxcommand-args-sdks branch March 12, 2026 06:32
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