fix(progress): gate merged-lines counter on cleanup#178
Merged
johannesjo merged 1 commit intoJun 15, 2026
Conversation
`mergeTask` already gated `recordTaskMerged()` on `cleanup === true` so that only completed merge+cleanup lifecycles count toward "Merged today" (the fix from issue johannesjo#151). `recordMergedLines()` sat above the gate and ran on every merge call regardless of cleanup, so the side-by-side sidebar counters could drift out of sync: - Merge without cleanup (e.g. "merge & keep") bumped the lines totals but not the merged-today counter. - A later close via closeTask never bumps merged-today, so the task contributed lines but was never counted as a merged task. Move the call inside the same `if (cleanup)` block so both stats share one gate and one source-of-truth event.
Owner
|
Thank you very much! <3 |
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
mergeTaskwas callingrecordMergedLines()unconditionally before theif (cleanup)gate, whilerecordTaskMerged()(the "Merged today" counter) was correctly gated inside the block — leftover asymmetry from the issue Progress: "Completed today" counts closures instead of merges; metrics use inconsistent time dimensions #151 fix.recordMergedLines(...)insideif (cleanup) { ... }so both stats share one gate and the same source-of-truth event.Reproduce on
maincleanup: false).mergedLinesAdded/mergedLinesRemovedbump;completedTaskCountdoes not.closeTask— "Merged today" is never incremented, but the lines totals already moved.After this change both counters react to the same event (
cleanup === true), matching the invariant locked in by the issue #151 fix ("only count tasks that complete the full merge+cleanup lifecycle").Test plan
npm run typechecknpm run lintnpx vitest run— 1412 pass / 0 failrecordTaskMerged counts merges with cleanup, not closuresdescribe extended withrecordMergedLinesparity assertions (called once with the merge result oncleanup: true; never called oncleanup: false).