Skip to content

Handle symlinks in patch points via the shared archive walk - #63

Open
cretz wants to merge 1 commit into
mainfrom
cretz/archive-symlinks
Open

Handle symlinks in patch points via the shared archive walk#63
cretz wants to merge 1 commit into
mainfrom
cretz/archive-symlinks

Conversation

@cretz

@cretz cretz commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

🚀 What

  • watch hashes symlinks the way Truss does instead of skipping them, and rejects a tree push would reject.

Needs basetenlabs/baseten-go#23 merged and then update go.mod before merging this

💻 How

  • walkContentHashes uses WalkModelArchive (with IncludeDirsInWalk) instead of its own duplicate walk.
  • Symlinks follow Path.is_file: link to a file hashes the target's bytes, link to a directory or nowhere is a null entry.

🔬 Testing

  • New symlinks_within_tree golden case, regenerated from real Truss, pins all three cases.
  • Unit tests for the rejection and for ignoring a bad symlink; symlink tests probe support rather than skipping by OS.

@cretz
cretz requested review from marius-baseten and a lite review from Copilot August 27, 2026 19:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (with IncludeDirsInWalk) 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.

Comment thread internal/deploymentpatch/patchpoint_test.go
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