fix: replace unbounded additions ratio with bounded net additions ratio#31
Merged
kenjudy merged 1 commit intoApr 7, 2026
Conversation
The previous formula (additions / max(deletions, 1)) inflated ratios to ~500 for net-new-file commits, distorting both median and p90. The RETROSPECTIVE documented p90=446x as dominated by this artifact. New formula: (additions - deletions) / (additions + deletions), bounded [-1, +1]. Value 1.0 = entirely net-new code; 0.0 = balanced; negative = net cleanup. Equivalent threshold: old 3.0 → new 0.50 (mathematically derived: when additions = 3×deletions, (3d-d)/(3d+d) = 0.50). Changes: - local-code-metrics.js: replace ratio formula, rename summary fields additions_ratio_* → net_additions_ratio_* - .github/workflows/code-metrics.yml: same formula fix and field rename, update issue body threshold display, clean up redundant sort+map - .github/workflows/pr-metrics.yml: fix || 1 bug in deletions variable, rename per-commit field, update median ratio threshold and display - metrics-specification.md: rewrite Metric 7 with new formula, bounded range explanation, remapped thresholds, rejection rationale - __tests__/collectLocalMetrics.test.js: add regression test asserting median ≤ 1.0 for all-new-file commits; update field name assertions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR AnalysisSize: small (based on production code) Concerns
Strengths
Commit AnalysisTotal Commits: 1
Commit Detailse8b0d14 Ken Judy (4/7/2026) Test CoverageTest Adequacy: good
Target ratio: 0.5-2.0 test lines per production line DORA Capability AssessmentArchetype: mixed-signals
|
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.
The previous formula (additions / max(deletions, 1)) inflated ratios to ~500 for net-new-file commits, distorting both median and p90. The RETROSPECTIVE documented p90=446x as dominated by this artifact.
New formula: (additions - deletions) / (additions + deletions), bounded [-1, +1]. Value 1.0 = entirely net-new code; 0.0 = balanced; negative = net cleanup. Equivalent threshold: old 3.0 → new 0.50 (mathematically derived: when additions = 3×deletions, (3d-d)/(3d+d) = 0.50).
Changes: