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
Contributor

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🙈​skipTime
💚​aws linux4422711283:51
💚​aws windows4422911263:28
💚​aws-ucws linux4431410454:19
💚​aws-ucws windows4431610435:59
💚​azure linux4422711273:28
💚​azure windows4422911253:21
💚​azure-ucws linux4431610424:33
💚​azure-ucws windows4431810404:13
💚​gcp linux4422611293:06
💚​gcp windows4422811273:16
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp 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):
durationenvtestname
3:50aws-ucws windowsTestAccept
3:00azure-ucws windowsTestAccept
2:53gcp windowsTestAccept
2:52azure windowsTestAccept
2:51aws windowsTestAccept

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
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 freeto 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

@vinchenzo-db@eng-dev-ecosystem-bot