[WIP] add --sandbox flag#75
Draft
Nathan Selvidge (nselvidge) wants to merge 28 commits intonate/sandbox-pushfrom
Draft
[WIP] add --sandbox flag#75Nathan Selvidge (nselvidge) wants to merge 28 commits intonate/sandbox-pushfrom
Nathan Selvidge (nselvidge) wants to merge 28 commits intonate/sandbox-pushfrom
Conversation
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
|
Latest downloadable build artifacts for this PR commit
Available artifact names
|
1ff2094 to
309441c
Compare
309441c to
8de1749
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.