Repository navigation
Reuse user config snapshot for removal hooks - #4276
Conversation
|
how does this work throughout worktrunk? do we generally re-load the config or thread it through? one option would be to cache it, so we don't need to thread it through literally everything |
|
It's mixed today, and the cache you're describing already exists.
So a smaller fix is to replace those two The load-and-thread handlers do a second full read, parse and merge, separate from the startup snapshot. Switching them to |
yes do this instead |
Replace the two mid-command UserConfig::load() calls with the startup snapshot from repo.user_config(), instead of threading a UserConfig parameter through every removal path. Co-Authored-By: Claude <[email protected]>
|
Done in abda224. The threaded The regression test When I posted this, CI was green on Linux and macOS, and |
Summary
UserConfigsnapshot when rendering approved removal hookspre-removecorrupts the config file and the approvedpost-removehook still runsWhy
Removal hook approval and execution used different
UserConfigloads. If the config changed or became unreadable after approval, execution silently skipped hooks that the user had already approved. Keeping the matching snapshot withApprovedHookPlanmakes hook selection and rendering consistent.Testing
RUSTUP_TOOLCHAIN=1.97.0-aarch64-apple-darwin cargo run -- hook pre-merge --yes