Repository navigation
Lockfiles out of sync are repaired by code; a fault inside a fix round has a way around it - #646
Merged
Merged
Conversation
…d has a way around it A security update's pull request changed three package.json files and none of their lockfiles, so every CI job failed at its frozen install. A retry planned its bumps by rule, then handed the red pull request to a model. The model changed nothing; landing "nothing" removed the round's work branch, the next attempt wrote to a branch that was gone, the round was called unfinished, and the run ended failed after one attempt of three with the same vague sentence twice. - common::lockfile_sync reads a CI or sandbox log for every package manager's frozen-install error, builds the one sandbox command that writes each affected lockfile with its own manager (with another mode and the LTS Node as fallbacks), and names lockfiles so a model's write to one is refused. - The CI fix round, a re-run on an open pull request and the CI rounds on a finished run's pull request regenerate the lockfiles before any model round, for any ticket. run_codegen and run_checks do it for the coder. Any run that changes a manifest gets its lockfile written before the pull request opens. - A retry of a dependency fix rebuilds its change from its plan instead of patching the earlier attempt with a model. - Every CI fix attempt opens its work branch first. Landing reads a missing work branch as nothing saved, reads a refused compare from the trees and sends a refused commit once more. A fault inside the round is classified and the round runs again from a clean state, then once in a fresh step, before the supervisor's ending is asked. - A run about to complete with red checks goes back to its CI fix round first. The ending for red checks names the recorded cause, once. - A plan the rules wrote is no longer recorded as a planner failure.
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.
Summary
A security update's pull request changed three
package.jsonfiles (a pnpm workspace root and two npm packages with lockfiles of their own) and none of the lockfiles. Every CI job failed at its frozen install. A person pressed Retry, and the run ended failed ten minutes later with "CI is failing: the pull request's checks; CI is failing: the pull request's checks". The fix an engineer makes takes no thought: run each package manager's lockfile command and commit the result.What the logs and the code showed:
run_passes, "existing PR needs fixes"), which returns before the dependency run is ever driven.run_codegenran the repository's codegen command, whose first step ispnpm install --frozen-lockfile; it failed on the stale lockfile both times. Lockfile generators ran only for security tickets and only after a finished implement step.round::landdeletes the work branch when a round changed nothing, and the loop ran the second attempt on that deleted branch:get_diff,edit_file,restore_fileandbatch_writeall returned 404, then landing returned "its changes couldn't be read (404)".ladder_spent: truehard-coded, so one attempt of three counted as every way spent.fix_decision.planner_failurewas set on a plan no planner wrote.Changes
common::lockfile_sync,generators::repair_lockfiles)resume), a re-run that finds its pull request red (run_passes), and the CI rounds on a finished run's pull request (feedback). In the CI fix round it runs before the fix budget and the stall check.run_codegenwrites lockfiles first and is offered whenever there is a sandbox.run_checksregenerates them when its install fails on a stale lockfile.write_file,edit_fileandbatch_writerefuse a lockfile in both coders, with the tool that regenerates it.rebuilds_by_plan): the branch goes back to the base branch's files and the verified bumps are committed again. A person's review comments still get their fix round.round)land: a missing work branch is "nothing saved"; a compare GitHub refuses is read from the two trees; a commit GitHub refuses is sent once more on the current head.fault_of,way_around). The round runs again from a clean work branch while it has attempts and time, then once in a fresh step, and only then is the supervisor's ending asked (after_fault). The CI fix round no longer calls a round unfinished, completes the run or fails it.ci_fix_effort).redrive_red_ci). The fix round records what fails (ci_cause), and the ending for red checks says it once (red_ending_text).no_decision_reason).Not changed: when the repairs by code, the three attempts, the fresh step and the revert to green are all spent with checks still red, the run still ends failed with the exact cause. That is the supervisor's existing last rung.
Verification
cargo test -p worker: 1,611 passed.cargo test -p common --lib: passed, with 9 newlockfile_synctests.cargo clippy -p common -p worker --all-targets -- -D warningsandcargo fmt --check --all: clean.af_lockfiles_out_of_sync(7 tests) on an invented monorepo with a pnpm root and two npm packages:docs/incidents.mdhas the case's row.