Repository navigation
worker: three-way apply of task patches, so plans with dependent tasks can open a PR - #83
Merged
Merged
Conversation
…ependent tasks can open its PR Every stored task patch is `git diff HEAD` of a checkout at the plan's base, so a dependent task's patch also carries the changes of the tasks it depends on (they were applied to its sandbox, staged, not committed). The pull-request gate applied the patches in index order with a plain `git apply`, which refused the repeat. On plan 5bbf7d86 (four tasks, three depending on the first) every task passed and the pull request failed with "the change of task 1 does not apply". `git apply --3way` sees the same change on both sides and takes it once; two different changes to the same lines still conflict and fail. Replaying that plan's real stored patches: a plain apply fails on task 1, the three-way apply gives the expected two files, +72 lines, and the repository's tests pass. The worker applies dependency patches with the same method, so a task depending on two tasks that share a dependency no longer fails either.
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.
With the GitHub token now on the server, the PR gate picked up plan
5bbf7d86's request, then failed:All four tasks had passed. Task 1 depends on task 0.
Why. Each stored patch is
git diff HEADfrom a checkout of the plan's base. Before a dependent task runs, the worker applies its dependencies' patches (staged, not committed). So the dependent task's patch includes those changes again. The PR gate applies all patches in index order with a plaingit apply, and that refuses the repeat.Fix.
Workspace.apply_patchnow usesgit apply --index --3way. A three-way merge sees the same change on both sides and takes it once. Two tasks that change the same lines differently still conflict and fail, as before. The worker applies dependency patches through the same method, so a task that depends on two tasks sharing a dependency no longer fails either.Checks
git diff --binarypatches. A dependent task's patch that repeats its dependency's change now combines (the test fails on main with the production error). Two different edits to one line still refuse.5bbf7d86's actual stored patches against the sandbox repo:--3way: all four apply, giving 2 files and +72 lines, and the repo's tests pass (58).After this deploys, the PR on
5bbf7d86can be retried from its run page.Not in this PR
allowed_pathscheck also counts the files its dependencies changed. They're staged in its sandbox, not committed.