Fix conflict on changing dependencies (#96)#98
Merged
Conversation
When a target file no longer depends on one of its former source files, its content changes while the remaining sources are all older than the target. The mtime-based "newer than all of its sources" heuristic in Write.conflict then wrongly reported a conflict. That heuristic is only reached after the filedb hash check has already confirmed the file on disk is exactly what Entangled last wrote (i.e. it was not edited outside of Entangled), so it could only ever produce false positives. Drop it and rely on the filedb comparison, which is the reliable way to detect external edits. Adds a regression test for the dependency-graph change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jhidding
approved these changes
Jun 8, 2026
Contributor
|
Thanks! That was much simpler than I thought, I guess I was on the paranoid side of things 😂 |
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.
Fixes #96. Write.conflict had a redundant "newer than all of its sources" mtime heuristic that ran only after the filedb hash check already confirmed the file was unmodified externally — so it could only ever produce false positives. When a target stops depending on a former source, its content changes while the remaining sources look "older", wrongly triggering a conflict. The fix drops the heuristic and relies on the filedb hash comparison (as @jhidding suggested), which still fully protects hand-edited generated files. Adds regression test
test_changing_dependencies.