Add aicode mutator: package local-dir code_source_path at deploy#5987
Open
vinchenzo-db wants to merge 3 commits into
Open
Add aicode mutator: package local-dir code_source_path at deploy#5987vinchenzo-db wants to merge 3 commits into
vinchenzo-db wants to merge 3 commits into
Conversation
Contributor
Approval status: pending
|
Collaborator
Integration test reportCommit: 7053490
8 interesting tests: 4 RECOVERED, 4 SKIP
Top 5 slowest tests (at least 2 minutes):
|
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
force-pushed
the
air-aicode-packaging
branch
from
July 20, 2026 20:58
6ef4b93 to
c25fc25
Compare
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
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.
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