Skip to content

Conversation

@drernie
Copy link
Member

@drernie drernie commented Jan 8, 2026

Summary

Fixes the behavior where package_update() would create numbered duplicates (1_file.txt, 2_file.txt) when updating files at the same logical path.

Problem

The previous implementation treated Quilt packages as if they needed collision avoidance within a single version. When updating a package with a file that already existed at a logical path, it would:

  • Keep the original file (e.g., data.csv)
  • Add the new file with a numbered prefix (e.g., 1_data.csv)
  • Each subsequent update would increment the counter (e.g., 2_data.csv, 3_data.csv)

This behavior is incorrect because Quilt packages are versioned - each push creates a new version with a unique top_hash.

Solution

Files at the same logical path now replace the existing file in the new version. The old file remains accessible in the previous package version through package history.

This aligns with how versioned package systems should work:

  • ✅ Update replaces the file in the new version
  • ✅ Old file is still accessible in previous versions
  • ✅ No 1_file.txt, 2_file.txt duplicates

Changes

  • Code: Removed counter-based collision avoidance logic in _collect_objects_into_package()
  • Behavior: Files at duplicate logical paths now replace the existing file
  • UX: Added warning message when files are replaced during update
  • Tests: Updated test expectations to verify replacement behavior instead of duplicate creation
  • Docs: Updated CHANGELOG.md with fix details

Testing

All existing tests pass, including:

  • test_collect_objects_with_duplicate_logical_paths - Updated to verify replacement
  • ✅ All package creation/update/delete tests
  • ✅ Integration tests for package workflows

🤖 Generated with Claude Code

Fixes the behavior where package_update() would create numbered duplicates
(1_file.txt, 2_file.txt) when updating files at the same logical path.

Since Quilt packages are versioned (each push creates a unique top_hash),
files should be replaced at the same logical path, with old versions
remaining accessible in package history.

Changes:
- Removed counter-based collision avoidance logic in _collect_objects_into_package()
- Files at duplicate logical paths now replace the existing file
- Added warning message when files are replaced
- Updated test expectations to verify replacement behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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