Feat: Add PR review impact metrics producer#20
Conversation
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Gloire Rubambiza <gloire@ibm.com>
clawgenti
left a comment
There was a problem hiding this comment.
Shell script is well-structured with thorough test coverage, clean error handling, and solid documentation of the activation-detection logic.
ORGvariable defined but only referenced in a commented-out code block — dead code.TMPDIRis overwritten with$PROGRAM_TMPDIR(shadowing the shell env var); not harmful givensetup_workspacecontrols the value, but worth noting the inconsistency with the test file which uses its ownmktemp -d.
Reviewed by clawgenti using github:pr-review
Assisted-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Gloire Rubambiza <gloire@ibm.com>
|
Thanks for the review. Both nits addressed in e597626:
Test still passes and the live dry-run is unchanged (4 activations, reviewed count 12, non-zero hour medians). |
clawgenti
left a comment
There was a problem hiding this comment.
Two nits found in otherwise well-structured new scripts; logic, detection, and test coverage look solid.
- nit
tests/test-pr-review-impact.shline 7:TMPDIR=$(mktemp -d)shadows the system$TMPDIRvariable used bymktempand other tools — rename toTEST_TMPDIR(and update all references in the test). - nit Commit subjects (
feat:,refactor:) and PR title (Feat:) use conventional-commit text prefixes instead of emoji prefixes per git:commit conventions.
Reviewed by clawgenti using github:pr-review
| # Verifies pr-review-impact.sh classification: per-repo activation, aggregation, | ||
| # median TTM in HOURS (1-decimal), and that a Dependabot PR clawgenti only | ||
| # commented on is excluded. | ||
| TMPDIR=$(mktemp -d) |
There was a problem hiding this comment.
nit: TMPDIR=$(mktemp -d) overrides the system $TMPDIR environment variable, which mktemp and other tools use to determine the temp directory. If any subcommand inside the test relies on $TMPDIR, it now points into your test dir instead of the system temp. Rename to TEST_TMPDIR and update the trap and all $TMPDIR references in this file.
Assisted-By: Claude Code (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Gloire Rubambiza <gloire@ibm.com>
|
Thanks. Addressed the actionable nit in 0b764aa:
|
clawgenti
left a comment
There was a problem hiding this comment.
New script pr-review-impact.sh is well-structured — logic, test coverage, and Dependabot exclusion design are solid. Two nits and a commit-convention flag below.
- Commit conventions (nit): All 3 commits lack an emoji prefix required by Kagenti's
git:commitconvention (feat:,refactor:,Test:should be🚀 feat:,♻️ refactor:,🧪 test:etc.). Commit 3 also uses uppercaseTest:— should be lowercase. - PR title (nit):
Feat: Add PR review impact metrics produceris missing an emoji prefix per convention.
Reviewed by clawgenti using github:pr-review
| Options: | ||
| --verbose Print diagnostics to stderr | ||
| --dry-run Compute and print impact.json to stdout; do not write | ||
| --reports-dir DIR Where to write impact.json (default: $REPORTS_DIR or ./reports/pr-review) |
There was a problem hiding this comment.
nit: The heredoc is single-quoted ('USAGE'), so $REPORTS_DIR is printed literally in the help output — the reader sees the unexpanded variable name, not a value. Consider replacing with just ./reports/pr-review (the actual default) to avoid the misleading text.
| # --- Configuration --- | ||
| BOT_USER="clawgenti" | ||
| REVIEW_MARKER="<!-- reviewed:" | ||
| LOOKBACK_LIMIT=200 |
There was a problem hiding this comment.
suggestion: LOOKBACK_LIMIT=200 is a meaningful cap — if a repo has more than 200 merged PRs it silently truncates the baseline. Worth a short note in the --help output (e.g. --reports-dir DIR) or a --lookback flag so operators know the window.
Assisted-By: Claude Code (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Gloire Rubambiza <gloire@ibm.com>
|
Addressed both
Help output verified and the test still passes ( On the commit/PR-title emoji prefixes: leaving as-is — this repo follows the capitalized text-prefix convention that |
clawgenti
left a comment
There was a problem hiding this comment.
Clean implementation of the impact metrics producer — detection logic, activation derivation, and test coverage all look sound.
All checks pass. Ready for human review.
Reviewed by clawgenti using github:pr-review
esnible
left a comment
There was a problem hiding this comment.
Clean, well-documented metrics producer. The script correctly reuses program-lib.sh infrastructure (setup_workspace, gh_with_backoff, write_report_latest — all signatures verified), follows the established scanner conventions (--dry-run, --verbose, $REPORTS_DIR override), and is read-only against GitHub.
Verification performed:
- shellcheck passes at the strictest (
style) level on both files - the bundled test passes locally
- edge cases (empty buckets, empty marked-set) produce valid JSON for the downstream
--argjsonassembly - the test's
median_ttmis byte-identical to the script's
The two-layer detection (reviewed-by:clawgenti search prefilter + required <!-- reviewed: marker) sensibly excludes Dependabot comment-only activity, and the test explicitly exercises that exclusion. The per-repo runtime-derived activation (no hardcoded date) and the documented tier=core future seam (#1811) are nice touches.
Two non-blocking notes inline; both optional.
Assisted-By: Claude Code (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Gloire Rubambiza <gloire@ibm.com>
Summary
Adds
pr-review-impact.sh, a read-only metrics producer that measures the clawgenti PR reviewer's impact on time-to-merge. It writesreports/pr-review/impact.json, consumed by the automation health dashboard (kagenti/agent-skills#16).Per repo, the bot's activation date is derived at runtime from the earliest PR carrying a clawgenti marked review (
<!-- reviewed: SHA -->in the review body) — no hardcoded split date. Merged PRs are then segmented:ready-for-ai-reviewmarks substantive PRs).Median time-to-merge is reported in hours (PRs here merge in hours, so day granularity would round to 0).
Detection notes
/pulls/N/reviews), not the PR description. Areviewed-by:clawgentisearch prefilter plus a required marker excludes dep-bump comment-only activity on Dependabot PRs.get_repos()isolates the repo set behind a function with a documented seam to swap in atier=corequery once the repository-tiers proposal (#1811) lands.Testing
tests/test-pr-review-impact.shcovers per-repo activation, hours-TTM medians, and Dependabot exclusion.Fixes #19
Assisted by Claude Code