feat(health): stop alarming for a fall the code did not cause - #2171
Merged
Conversation
About half of the code-health score comes from git history markers, which rise as a file is worked on. So a week of refactoring dropped the headline and the trend printed "Declining health." in error red at the person who did the work. That is the reading this change removes. A decline now carries a third kind, history_drag, when the composite fell, history is the driver, and history is the only half that moved down. It keeps every number and swaps the reading: "Code health dropped 0.60 points (7.60 → 7.00), and code shape improved 0.30 over the same window. Change history is the only half that moved down, and no edit to these files settles it." It takes the neutral treatment history findings already have in the drawer, not the error colour, in the web view and the CLI alike. Both halves are checked rather than the driver alone. The driver names the half that moved furthest, which is not the half that moved down: the halves are deduction means and the score is a mean of clamped scores, so on a repo with floored files they can disagree about direction. Muting the alarm on that basis would have blamed a fall on a half that had just improved. Maintainability is watched now. It is the one figure that is pure code shape, nothing alerted on it, and its fall is the one that always deserves the alarm. It has no halves to split, so it never softens. Alerts run over the three metrics uniformly, skipping any a snapshot never recorded rather than reading a missing figure as zero, and the composite is named "Code health" in their messages instead of "Average Health". The alert lead no longer names a figure. Three different things raise this alert and the message says which, so a fixed "Declining health." above "Maintainability dropped 0.60 points" contradicted itself. The trend chart leads with maintainability. It is the series that answers "is my code getting better", and drawing the composite loudest emphasised the number that misleads. Making it the heaviest line left the history band looking as though it bounded maintainability, so the band's edges are stroked in the code-health colour it actually belongs to.
swati510
approved these changes
Sep 8, 2026
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.
About half of a file's code-health deduction comes from git-derived markers —
churn, co-change, ownership, prior fixes — which rise as a file is worked on. So
a week of refactoring dropped the headline and the trend printed "Declining
health." in error red at the person who did the work. That is the reading this
removes.
A decline that names its cause
A fall now comes back as a third kind,
history_drag, when the composite fell,history is the driver, and history is the only half that moved down. It keeps
every number and swaps the reading:
It takes the neutral treatment history findings already have in the file drawer
rather than the error colour, in the web view and the CLI alike.
Both halves are checked, not the driver alone.
drivernames the half thatmoved furthest, which is not the half that moved down: the halves are deduction
means and the score is a mean of clamped scores, so on a repo with floored files
they can disagree about direction. Muting the alarm on that basis would have
blamed a fall on a half that had just improved.
Maintainability is watched
It is the one figure that is pure code shape, nothing alerted on it, and its
fall is the one that always deserves the alarm. It has no halves to split, so it
never softens. Both detectors now run over the three metrics uniformly, skipping
any a snapshot never recorded rather than reading a missing figure as zero, and
the composite is named "Code health" in their messages instead of "Average
Health".
The alert lead no longer names a figure. Three different things raise this alert
and the message says which, so a fixed "Declining health." above "Maintainability
dropped 0.60 points" contradicted itself.
The trend leads with the number a refactor moves
Maintainability is the heaviest line; drawing the composite loudest emphasised
the number that misleads. That left the history band looking as though it bounded
maintainability, so the band's edges are stroked in the code-health colour it
actually belongs to — which also states what the band means, since its upper edge
is where the score would sit with no history against it.
Verification
npm run type-checkand
ruff checkall green after rebasing onto the current headline work,which this overlapped on the trend view.
kinds side by side.