Repository navigation
Keep each file's mode in every tree CoderHelm writes #959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
092460c
Keep each file's mode in every tree CoderHelm writes
nambok 705a849
Carry a build's executable bit to the files it commits
nambok f7db5b7
Merge main into fix/keep-file-modes
coderhelm[bot] f14e965
Merge main into fix/keep-file-modes
coderhelm[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # xl. `xl_file_modes_kept` | ||
|
|
||
| **What happened:** A pull request held an executable `scripts/deploy.sh` and a symbolic link. CoderHelm brought the base into it. The merge conflicted, so CoderHelm built the merged tree itself, and every file it took from the base was written as a plain file. The script lost its executable bit, and the pipeline that ran it failed with "permission denied". A later fix round that edited the script dropped the bit again. | ||
|
|
||
| **Why:** Every tree CoderHelm wrote through GitHub's API named each file it wrote as a plain file, whatever the file was: the batch write of a round, the merge commit of a conflicted merge of the base, and a reader that filled in a plain file's mode when GitHub's listing named none. Only GitHub's own merge, used when nothing conflicts, kept modes. | ||
|
|
||
| **The guarantee:** Every entry CoderHelm writes keeps the mode the path already has in the tree the write is based on. A new path takes the mode of the entry it came from, such as the other side of a merge, or the executable bit a sandbox build left on a file it generated. Only a new path with no source is a plain file. Text is never written over a symbolic link or a submodule: the write is refused and says why. A conflicted merge of the base lays whole entries from the base over the branch, and a path both sides changed takes its mode as git merges it. A commit that still changes a mode names each change in its message and in the run's log. The mode values live in one helper, and a scan of the source fails on any other place that types one. On the pull request watch sweep, each open pull request's CoderHelm commits of the last 30 days are read once. A mode one of them dropped is put back at the head in one commit named "Restore file modes CoderHelm dropped", moved only as a fast forward. What can't safely be put back (a path a person changed since, a link whose text changed, a submodule) is listed on the run page and in an internal alert. | ||
|
|
||
| **Where it's enforced:** `clients::git_mode::{archive_sources, for_content, overlay, merged, tree_entry, changes, with_trailer, dropped, repair}`. `sandbox::read_changed_tar` and `CodegenOutcome::executable`. `GitHubClient::{entries_at, batch_write, batch_write_from, create_merge_commit, write_file, put_tree}`, `GitEntry::from_json`. `pr::{resolve_conflicts, merge_plan}`, `restack::resolve`, `agent::tool_outcome::remark`, `mode_repair::{sweep, repair_one, plan}` and `pr_watch::sweep`. |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.