r/coolgithubprojects • u/Middle_Wing5512 • 45m ago
[Python] Premerge - Flag when two branches change the same test
I built Premerge for a review problem that comes up when coding agents work on parallel branches. Two branches can edit the same test, and Git can merge them cleanly because the edits are on different lines. I wanted a way to put those changes in front of the same reviewer.
In the repo's fixture, agent-auth changes what the first token should be in test_token_refresh. The agent-refresh branch changes what the last token should be. I merged the branches in a local copy and Git kept both edits without a conflict.
I then scanned the two original branches against main with Premerge. It compares each branch with its merge base and groups these Python test edits by file and test function. The scan reported one blocking overlap. The gate exited 1, then exited 0 after I recorded a merge decision in .premerge/ledger.yaml. Recording the decision leaves the Git branches untouched.
I tried changing the last-token expectation again and rescanning. The gate still passed because the decision was attached to the same test and pair of branches. The fixture and CLI are at https://github.com/SuperMarioYL/premerge
If this were part of your PR checks, would you keep the decision for that test or ask for a fresh one after either branch changes it?