Skip to content

Add aicode mutator: package local-dir code_source_path at deploy#5987

Closed
vinchenzo-db wants to merge 3 commits into
mainfrom
air-aicode-packaging
Closed

Add aicode mutator: package local-dir code_source_path at deploy#5987
vinchenzo-db wants to merge 3 commits into
mainfrom
air-aicode-packaging

Conversation

@vinchenzo-db

Copy link
Copy Markdown

AI Runtime tasks can point code_source_path at a local directory. The aicode mutator packages that directory into a reproducible, content- addressed tarball (.git + gitignored files excluded, sync globs honored), uploads it to the user's ~/.air/repo_snapshots, and rewrites the field to the remote path. The content-addressed name lets an unchanged directory skip re-upload across deploys.

Adapted from Ben Hansen's #5971. codeSourceFiles uses the existing libs/sync.GetFileList (scoping Paths to the code dir) rather than adding a new NewFileList helper. SynthesizeRequirements writes requirements.yaml next to command_path from the job's serverless environment; Validate surfaces local-dir misconfigurations at validate time.

Co-authored-by: Isaac

Changes

Why

Tests

@github-actions

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

8 files changed
Suggested: @denik
Also eligible: @shreyas-goenka, @andrewnester, @janniklasrose, @anton-107, @lennartkats-db, @pietern

/bundle/ - needs approval

10 files changed
Suggested: @denik
Also eligible: @shreyas-goenka, @andrewnester, @janniklasrose, @anton-107, @lennartkats-db, @pietern

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 7053490

Run: 29783636638

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 227 1128 3:51
💚​ aws windows 4 4 229 1126 3:28
💚​ aws-ucws linux 4 4 314 1045 4:19
💚​ aws-ucws windows 4 4 316 1043 5:59
💚​ azure linux 4 4 227 1127 3:28
💚​ azure windows 4 4 229 1125 3:21
💚​ azure-ucws linux 4 4 316 1042 4:33
💚​ azure-ucws windows 4 4 318 1040 4:13
💚​ gcp linux 4 4 226 1129 3:06
💚​ gcp windows 4 4 228 1127 3:16
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 5 slowest tests (at least 2 minutes):
duration env testname
3:50 aws-ucws windows TestAccept
3:00 azure-ucws windows TestAccept
2:53 gcp windows TestAccept
2:52 azure windows TestAccept
2:51 aws windows TestAccept

AI Runtime tasks can point code_source_path at a local directory. The
aicode mutator packages that directory into a reproducible, content-
addressed tarball (.git + gitignored files excluded, sync globs honored),
uploads it to the user's ~/.air/repo_snapshots, and rewrites the field to
the remote path. The content-addressed name lets an unchanged directory
skip re-upload across deploys. SynthesizeRequirements writes
requirements.yaml next to command_path from the serverless environment
(no-op when it has none); Validate surfaces local-dir misconfigurations at
validate time.

Based on the commit before the SDK v0.160.0 bump, which temporarily
removed jobs.AiRuntimeTask.code_source_path (returns next week). The
acceptance fixture runs the direct engine only until the field is back in
the generated terraform provider schema.

Co-authored-by: Isaac
@vinchenzo-db
vinchenzo-db force-pushed the air-aicode-packaging branch from 6ef4b93 to c25fc25 Compare July 20, 2026 20:58
jobs.AiRuntimeTask.CodeSourcePath is a private-preview SDK field that is
added/removed across releases, so referencing it directly makes the package
fail to compile whenever the field is absent. Read code_source_path through
dyn.MapByPattern instead (the same mechanism PackageAndUpload and #5922
already use), so the mutator compiles regardless of the SDK's typed struct.
Tests set the field on the dyn value rather than the struct literal.

Co-authored-by: Isaac
The unit tests built config as typed structs and set code_source_path on the
struct/dyn value, which does not survive when the SDK's typed AiRuntimeTask
lacks the field (it is a churny private-preview field): Config's typed<->dyn
round-trip drops the unknown key, so the tests found zero sources on a
field-less SDK.

Parse the test config from YAML via yamlloader instead, so code_source_path
persists regardless of the typed struct. collectLocalCodeSources now takes a
dyn.Value (read-only) and validate's core is a pure validateCodeSources
function; both are exercised directly against the parsed value. Verified the
package builds and all tests pass against both SDK v0.154.0 (field present)
and v0.160.0 (field absent).

Co-authored-by: Isaac
@vinchenzo-db
vinchenzo-db deleted the air-aicode-packaging branch July 21, 2026 18:27
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