Skip to content

feat(guardian): add review quality metrics tracking#108

Merged
zaebee merged 2 commits into
mainfrom
feat/issue-106-guardian-metrics
Jun 9, 2026
Merged

feat(guardian): add review quality metrics tracking#108
zaebee merged 2 commits into
mainfrom
feat/issue-106-guardian-metrics

Conversation

@zaebee

@zaebee zaebee commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Closes #106

Summary

  • src/cgis/guardian/metrics.py — append-only JSONL log: record_review(), rate_review(), load_reviews()
  • scripts/guardian_review.py — new --pr and --metrics args; auto-calls record_review() after each run
  • src/cgis/cli.py — two new commands: guardian-rate (annotate findings_applied) and guardian-stats (Rich precision table)
  • tests/unit/test_guardian_metrics.py — 11 unit tests; 100% coverage

Test plan

  • make format && make lint && make type-check && make pytest && make doc-coverage — all green (321 passed)
  • Run python scripts/guardian_review.py --pr 107 --metrics guardian_metrics.jsonl and verify entry is appended
  • Run cgis guardian-stats and verify table prints

🤖 Generated with Claude Code

Append-only JSONL log per review (model, PR, tokens, findings, lgtm).
Two new CLI commands: `guardian-rate` to annotate findings_applied,
`guardian-stats` to print a Rich precision-trend table.
`guardian_review.py` gains `--pr` and `--metrics` flags and calls
`record_review()` automatically after each run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@zaebee

zaebee commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

/guardian review

Workflow now restores guardian_metrics.jsonl from origin/data/guardian-metrics
before each review and pushes the updated file back after. Uses git worktree
to avoid disturbing the PR branch checkout; creates the orphan branch on
first run. Requires contents:write permission.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

LGTM — no defects found in this diff.

I have verified the following:

  1. Logic Correctness: The rate_review function correctly implements an append-only modification pattern (reading, reversing, updating the first unrated entry, and rewriting), preventing data corruption.
  2. Type Safety: The new code in src/cgis/guardian/metrics.py and src/cgis/cli.py uses explicit type annotations, and the use of Any in load_reviews return type is consistent with its role as a flexible JSON record loader.
  3. Test Coverage: Every branch of the metrics logic (parsing, appending, updating, and file handling) is covered by the provided unit tests in tests/unit/test_guardian_metrics.py.

🤖 gemini-3.1-flash-lite · 7,779 prompt + 170 completion = 7,949 tokens · graph 0/4 files (0%)

@zaebee zaebee merged commit e4413d6 into main Jun 9, 2026
3 checks passed
@zaebee zaebee deleted the feat/issue-106-guardian-metrics branch June 9, 2026 03:17
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.

feat(guardian): review quality metrics tracking

1 participant