Handle symlinks in patch points via the shared archive walk - #63
Open
cretz wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates deployment patch-point hashing to use the shared modelarchive.WalkModelArchive enumeration so that watch matches push behavior around symlinks and tree validation, and extends fixtures/tests to cover symlink cases.
Changes:
- Switched patch-point content hashing to
modelarchive.WalkModelArchive(withIncludeDirsInWalk) and added symlink hashing behavior aligned with Truss. - Added golden fixtures and manifest materialization support for symlinks.
- Added unit tests for rejecting invalid symlinks (outside tree) and for ignoring invalid symlinks when excluded by
.truss_ignore.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/deploymentpatch/patchpoint.go | Uses archive walk for content hashes; adds symlink hashing/null-entry handling. |
| internal/deploymentpatch/patchpoint_test.go | Adds unit tests for invalid/ignored symlink behavior. |
| internal/deploymentpatch/golden_test.go | Adds symlink support in fixtures + conditional skipping when symlinks aren’t supported. |
| internal/deploymentpatch/fixturegen/patchpoint_golden.json | Adds new golden case for symlinks within the tree. |
| internal/deploymentpatch/fixturegen/patchpoint_cases.json | Adds new fixture case describing symlink scenarios. |
| internal/deploymentpatch/fixturegen/generate.py | Materializes symlinks when generating fixture trees. |
| go.mod | Updates baseten-go dependency version (needed for archive-walk symlink behavior). |
| go.sum | Updates baseten-go checksums accordingly. |
Suppressed comments (1)
internal/deploymentpatch/patchpoint_test.go:34
- This test relies on a hard-coded "/nix/store/..." target, which is not portable across OSes and may behave differently if the path is invalid. Create a deterministic target outside the model tree (e.g., another temp dir) and symlink to it so the scenario (ignored symlink pointing outside the tree) is consistent everywhere.
dir := t.TempDir()
writeFile(t, dir, "config.yaml", []byte("model_name: x\n"))
writeFile(t, dir, ".truss_ignore", []byte(".devenv/\n"))
require.NoError(t, os.MkdirAll(filepath.Join(dir, ".devenv", "gc"), 0o755))
require.NoError(t, os.Symlink("/nix/store/whatever", filepath.Join(dir, ".devenv", "gc", "shell")))
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
🚀 What
watchhashes symlinks the way Truss does instead of skipping them, and rejects a treepushwould reject.Needs basetenlabs/baseten-go#23 merged and then update go.mod before merging this
💻 How
walkContentHashesusesWalkModelArchive(withIncludeDirsInWalk) instead of its own duplicate walk.Path.is_file: link to a file hashes the target's bytes, link to a directory or nowhere is a null entry.🔬 Testing
symlinks_within_treegolden case, regenerated from real Truss, pins all three cases.