Skip to content

feat: tech debt metrics — Phase 1 (debt tracker foundation) #206 - #252

Merged
ajianaz merged 3 commits into
developfrom
feat/tech-debt-metrics
Jun 10, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/tech-debt-metrics

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Phase 1: Debt Tracker Foundation (Issue #206)

What's New

  • **** — new module with:

    • DebtSnapshot — lightweight JSON per-review (timestamp, commit, branch, findings by severity/category, quality score, gate status)
    • DebtReport — aggregation across snapshots with trend analysis
    • DebtConfig — config section debt: in .cora.yaml
    • Category mapping from LLM issue_type → normalized tracking groups (security, bug_risk, performance, error_handling, complexity, style, best_practice, other)
    • Quality score calculation (0-10, based on severity penalties)
    • Content-based hashed filenames for collision-free snapshots
    • Snapshot retention + cleanup
  • Auto-save after every review — hooks into execute_review() and execute_chunked_review()

    • Best-effort — never fails the review
    • Git context (commit/branch) cached via LazyLock to avoid extra process spawns
  • Config — debt: section in .cora.yaml:

    debt:
      enabled: true           # default
      history_dir: .cora/history
      retention_days: 90

Files Changed

File Change
src/engine/debt_tracker.rs NEW — 32 unit tests
src/engine/mod.rs Add module export
src/config/schema.rs Add debt to Config, CoraFile, merge logic
src/commands/review.rs Hook snapshot save after quality gate

Verification

  • cargo test — 485/485 pass (32 new debt_tracker tests)
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • Cora review passed on all commits

Phase 2 (next PR)

  • cora debt subcommand with --json, --trend, --since
  • Terminal-formatted debt report table

ajianaz added 3 commits June 10, 2026 23:58
#206)

- New src/engine/debt_tracker.rs with DebtSnapshot, DebtReport, DebtConfig
- Auto-save review snapshots to .cora/history/ after each review
- Category mapping from LLM issue_type to tracking groups
- Quality score calculation from severity distribution
- Trend analysis (improving/stable/worsening) across snapshots
- Config section 'debt:' in .cora.yaml (enabled, history_dir, retention_days)
- Best-effort snapshot save — never fails review
- 32 unit tests covering all debt_tracker logic
- Hook integrated in execute_review and execute_chunked_review
- All 485 tests pass, clippy clean, fmt clean
- Snapshot filename: add nanosecond suffix to prevent same-second collision
- Git context: cache with LazyLock to avoid spawning git per review
- Config merge: field-by-field debt merge instead of wholesale replace
- All 485 tests pass, clippy clean
- Use content-based hash (findings + categories + timestamp) for unique filenames
- Config merge: always apply all debt fields from .cora.yaml (allows explicit reset)
@ajianaz
ajianaz merged commit de21fbb into develop Jun 10, 2026
10 checks passed
@ajianaz
ajianaz deleted the feat/tech-debt-metrics branch June 10, 2026 17:15
ajianaz added a commit that referenced this pull request Jun 11, 2026
PR #252 and #253 merged tech debt metrics but docs were not updated.

Changes:
- CHANGELOG.md + docs/changelog.md: added debt tracker to [0.5.0] Added
- docs/roadmap.md: #206 Planned → Done
- README.md: added 'cora debt' to commands table
- docs/cli-reference.md: added cora debt subcommand with all flags
- docs/configuration.md: added Tech Debt Tracker section (config + CLI)
- AGENT.md: test count 453→485, added debt_tracker.rs + debt.rs to structure
- .agent.md: test count 453→485
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