Conversation
…ild context discover_nix_flake_path_inputs() only found direct path inputs from flake.nix. Transitive path dependencies (e.g. rust-exautils referenced by minos2_rust, rust-base referenced by rust-exautils) were not copied to local_packages/, causing 'path does not exist' errors during nix builds in CI. Add discover_transitive_nix_flake_path_inputs() which parses flake.lock for all path-type nodes with non-empty parent chains, resolves their absolute paths by walking the parent chain, and copies them to local_packages/. Since local_packages/ mirrors the monorepo directory structure, relative paths between transitive deps are preserved automatically without needing flake.lock path rewrites. Co-Authored-By: benchan <ben@vervious.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Why are the changes needed?
Training CI tests (e.g.
training-pretrain-aws-test) fail with:The existing
discover_nix_flake_path_inputs()only finds direct path inputs declared inflake.nixvia regex. It does not discover transitive path dependencies recorded inflake.lock— i.e., dependencies of dependencies.Concrete example in the
exa_mlflake:exa_ml/flake.nix→minos2_rust(direct, copied ✓)minos2_rust/flake.nix→rust-exautils(transitive via flake.lock, not copied ✗)rust-exautils/flake.nix→rust-base(transitive via flake.lock, not copied ✗)When Nix evaluates the root flake inside the Docker build, it reads the root
flake.lockwhich references these transitive paths — but the directories were never copied intolocal_packages/, so the build fails.What changes were proposed in this pull request?
flytekit/image_spec/image_spec.py— New functiondiscover_transitive_nix_flake_path_inputs():flake.lockJSON to find all nodes withlocked.type == "path"and a non-emptyparentchain (transitive deps)parent[-1]= declaring parent; path is relative to that parent's directory)already_resolvedset)flytekit/image_spec/default_builder.py— In_copy_local_packages_and_update_lock():discover_transitive_nix_flake_path_inputs()and copies the discovered transitive deps intolocal_packages/flake.lockpath rewriting is needed for transitive deps becauselocal_packages/mirrors the monorepo directory structure, preserving relative paths between packagesHow was this patch tested?
Verified with an inline integration test that simulates the
exa_mldependency chain (root →minos2_rust→rust-exautils→rust-base) and confirms both transitive deps are discovered with correct absolute paths.No committed unit tests were added — the function is exercised only through CI's Nix image builds.
Human review checklist
parent[-1]interpretation: The code assumes the last element of theparentchain in flake.lock v7 is the declaring parent whose directory the path is relative to. Confirm this matches Nix's flake.lock spec._find_git_root()returnsNonefor a transitive dep, it's silently skipped (continue). Direct inputs raiseValueErrorinstead. Consider whether a warning/error would be more appropriate to surface issues early.rust-basecould point to the entirerust/directory. Confirm that copying large subtrees with gitignore filtering doesn't cause excessive build context size/time.except Exception: JSON parsing failure returns empty list silently. Could mask real issues if flake.lock is corrupted.Link to Devin Session: https://app.devin.ai/sessions/46b404cede304b2b8ce0d143523914d8
Requested by: @Vervious (benchan@exa.ai)