Repository navigation
Keep each file's mode in every tree CoderHelm writes - #959
Conversation
Every tree CoderHelm wrote through GitHub's API named each written file a plain file. A conflicted merge of the base, a round's batch write and the merge commit's taken files turned executable scripts into plain files, and could turn a symbolic link or a submodule into a text file. - One helper (clients::git_mode) holds the mode values. A written path keeps its mode in the tree it is based on; a new path takes its source's mode; only a new path with no source is a plain file. Text over a symbolic link or a submodule is refused. - batch_write reads the modes of the tip each attempt builds on. write_file sends an executable through a tree. put_tree refuses an entry with no known mode, and the tree reader no longer fills one in. - A conflicted merge of the base lays whole entries from the base over the branch (merge_plan), and a path both sides changed takes its mode as git merges it. The file-by-file rebuild does the same. - A commit that changes a mode names it in its message, in the tool call's outcome in the run log, and in the worker log. - The pull request watch sweep reads each open pull request's CoderHelm commits of the last 30 days once. It puts back the executable bits and links they dropped in one fast-forward commit, "Restore file modes CoderHelm dropped". What is in doubt goes on the run page and into an internal alert. - Incident case xl_file_modes_kept, with a scan that fails on a mode typed outside the helper.
A codegen build's archive marks the files it left executable. Captured and CodegenOutcome now carry those paths, and the commits of a build's output (the codegen tool, a generator's regeneration and the lockfile repair) pass them as sources through git_mode::archive_sources. A new file the build left executable is committed 100755, and a path already on the branch keeps the branch's mode.
Superseded by CoderHelm's latest review
|
💚 Post-merge health check passed: the deploy of
|
| /// version, inside the sweep's budget, and moves the branch only as a fast | ||
| /// forward from the head it read. | ||
| #[test] | ||
| fn the_repair_is_claimed_capped_and_never_forced() { |
There was a problem hiding this comment.
🛑 Blocking (correctness): Near-identical helpers added together (scope)
services/worker/src/passes/incidents/xl_file_modes_kept.rs adds the_repair_is_claimed_capped_and_never_forced next to every_writer_reads_the_mode_it_writes, added in the same change. Keep one helper with the shared logic (a parameter for what differs) and call it from both places. If the ticket truly needs it, say why on a line Wider than the ticket: services/worker/src/passes/incidents/xl_file_modes_kept.rs: <why>.
| /// A commit CoderHelm made: its GitHub author is a bot (an app's | ||
| /// `name[bot]`), or, with no linked account, its author email is a bot's | ||
| /// noreply address. | ||
| /// A commit that changed file modes says so in the run's log: the tool call |
There was a problem hiding this comment.
💬 Nit: New function sits between is_bot_commit and its doc comment (convention)
Lines 820-822 are the doc comment for is_bot_commit. note_mode_changes now sits between them and the function, so rustdoc joins that comment onto note_mode_changes and is_bot_commit loses its doc. Behaviour is unaffected. Moving note_mode_changes above line 820 fixes both docs.
Summary
Every tree CoderHelm wrote through GitHub's API named each written file a plain file. A conflicted merge of the base, a round's batch write and the merge commit's taken files turned executable scripts into plain files, and could turn a symbolic link or a submodule into a text file. Every tree write now keeps each path's mode. A sweep puts back the modes that earlier commits dropped on open pull requests.
Changes
clients::git_modeis the one place that holds mode values.batch_writereads the modes of the tip each attempt builds on.write_filesends an executable through a tree, since the contents API names no mode.CapturedandCodegenOutcomecarry those paths, and every commit of a build's output passes them throughgit_mode::archive_sources, so a new generated script is committed executable.put_treerefuses an entry with no known mode, andGitEntry::from_jsonno longer fills one in.pr::resolve_conflictsnow lays whole entries from the base over the branch (merge_plan) instead of re-writing their text as plain files. Merged files take the merged mode, and a link is never merged as text.restack::resolvemerges modes the same way.tool_outcome::remark);mode_repair, on the pull request watch sweep, reads each open pull request's CoderHelm commits of the last 30 days.xl_file_modes_kept.Verification
cargo fmt --all --check,rustfmt --checkon the incident files, and clippy with-D warningsall pass.cargo test -p common -p worker -p gatewaypasses.scripts/deploy.shand a symbolic link, where merging the base keeps both;