Skip to content

[WIP] add --sandbox flag#75

Draft
Nathan Selvidge (nselvidge) wants to merge 28 commits intonate/sandbox-pushfrom
nate/eval-sandbox-command
Draft

[WIP] add --sandbox flag#75
Nathan Selvidge (nselvidge) wants to merge 28 commits intonate/sandbox-pushfrom
nate/eval-sandbox-command

Conversation

@nselvidge
Copy link
Copy Markdown
Contributor

No description provided.

Introduce foundational modules that the push and pull commands will
build upon:

- source_language: SourceLanguage enum and extension classification
  for distinguishing JS/TS from Python files
- utils/fs_atomic: atomic file writes via temp-then-rename
- utils/git: GitRepo discovery and dirty-state detection
- js_runner: runner script materialization and JS runtime discovery
  (tsx, vite-node, ts-node, deno)
- python_runner: Python interpreter resolution with venv support
- scripts/runner-common.ts: shared TS types for runner manifests
- scripts/python_runner_common.py: shared Python utilities for module
  loading, file normalization, and source collection
Introduce the command scaffolding for `bt functions push` and
`bt functions pull`:

- functions/mod.rs: PushArgs, PullArgs, AuthContext, IfExistsMode,
  FunctionsLanguage enums, and refactored context resolution
- functions/api.rs: paginated function listing, code upload slots,
  bundle upload, and batch insert endpoints
- functions/report.rs: structured report types for JSON output with
  HardFailureReason, SoftSkipReason, and summary types
- auth.rs: AvailableOrg struct and list_available_orgs()
- http.rs: put_signed_url() for uploading to signed URLs
Add the full push pipeline for deploying local function definitions to
Braintrust:

- push.rs: file classification, runner invocation, manifest parsing,
  project preflight, bundle compression/upload, and batch insert with
  structured reporting
- functions-runner.ts: TS/JS runner that imports user files, inspects
  the Braintrust global registry, and emits a JSON manifest
- functions-runner.py: Python runner with bundle collection (entry
  module + source files) for server-side execution

Supports both TypeScript and Python source files with automatic
language detection, interactive org/project selection, and
configurable conflict resolution (error/replace/ignore).
Add the pull pipeline for downloading Braintrust function definitions
as local source files:

- Paginated fetching with cursor-based pagination and snapshot
  consistency
- Code generation for both TypeScript and Python with proper imports,
  typed prompt definitions, and recursive JSON value formatting
- Safety checks: git dirty detection, existing file protection, and
  force flag override
- Sanitized identifiers and filenames with Windows reserved name
  handling
- Per-project directory organization with atomic file writes
Comprehensive test coverage for the push and pull commands:

- 16 CLI fixture tests covering help text, flag validation, env var
  parsing, language selection, and argument conflict detection
- Mock API server (actix-web) with handlers for login, projects,
  upload slots, bundle upload, and function insert/list
- Integration tests for full push and pull flows against mock server
- JS and Python runner manifest validation tests
- Python bundle validation and cross-file module purge tests
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 19, 2026

Latest downloadable build artifacts for this PR commit a68e4cad758f:

Available artifact names
  • ``artifacts-build-global
  • ``artifacts-build-local-x86_64-apple-darwin
  • ``artifacts-build-local-x86_64-pc-windows-msvc
  • ``artifacts-build-local-x86_64-unknown-linux-musl
  • ``artifacts-build-local-x86_64-unknown-linux-gnu
  • ``artifacts-build-local-aarch64-unknown-linux-musl
  • ``artifacts-build-local-aarch64-unknown-linux-gnu
  • ``artifacts-build-local-aarch64-apple-darwin
  • ``artifacts-plan-dist-manifest
  • ``cargo-dist-cache

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.

2 participants