Skip to content

fix(scoring): rework penalties, conditional migration mode, cr-id rendering - #21

Merged
dsiddharth2 merged 1 commit into
mainfrom
fix/severity-escalation
May 25, 2026
Merged

fix(scoring): rework penalties, conditional migration mode, cr-id rendering#21
dsiddharth2 merged 1 commit into
mainfrom
fix/severity-escalation

Conversation

@dsiddharth2

Copy link
Copy Markdown
Owner

Summary

  • Penalty matrix rework: Added non-zero penalties for code_style (1.0/0.5/0.25), documentation (1.0/0.5/0.25), and testing (1.5/0.75/0.25) — previously all zero so these categories had no impact on PR score. Bumped architecture penalties to match performance tier (3.0/2.0/1.0).
  • Conditional migration mode: Migration mode is no longer always-on for every PR. It now only activates when the PR contains migration-related files (SQL, EF snapshots, Flyway, Alembic). When active, it exempts code_style, documentation, and testing from escalation to critical — an unused import is not a migration risk.
  • cr-id rendering fix: Moved <!-- cr-id: xxx --> markers from comment body text to ADO thread properties (CodeHawk.CrId). Azure DevOps inconsistently renders HTML comments as visible text, causing <!-- cr-id: cr-004 --> to show in PR comments. Thread properties are metadata-only and never rendered. Backward compatible — fetch still falls back to comment text parsing for old threads.

Test plan

  • All 363 unit tests pass
  • Migration mode escalation test updated to verify exempt categories stay at original severity
  • New test: test_migration_mode_skips_zero_penalty_categories
  • Existing test updated: test_code_style_has_light_penalty (was test_code_style_has_zero_penalty)
  • Run a review on a non-migration PR and verify no findings are escalated to critical by migration mode
  • Verify cr-id is no longer visible in ADO inline comments
  • Verify summary thread detection still works for both old (marker-based) and new (property-based) threads

…cr-id rendering

- Add penalties for code_style (1.0/0.5/0.25), documentation (1.0/0.5/0.25),
  and testing (1.5/0.75/0.25) — previously all zero
- Bump architecture penalties to match performance tier (3.0/2.0/1.0)
- Make migration mode conditional — only activate for PRs with migration files
- Exempt code_style, documentation, testing from migration mode escalation
- Move cr-id markers from HTML comments to ADO thread properties to fix
  intermittent rendering of <!-- cr-id --> as visible text
- Remove <!-- codehawk-summary --> marker from summary body, use property instead
- Backward compat: fetch still falls back to comment text parsing for old threads
@dsiddharth2
dsiddharth2 merged commit 13f1565 into main May 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant