Skip to content

Repo Auditor: add job failure rate metric - #149

Merged
roberthunterjr merged 5 commits into
mainfrom
stephenfuqua-job-failure-rate-metric
Aug 12, 2026
Merged

roberthunterjr merged 5 commits into
mainfrom
stephenfuqua-job-failure-rate-metric

Conversation

@stephenfuqua

@stephenfuqua stephenfuqua commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Adds a new "job failure rate" metric for the audited repository

Example; I spot checked the new calculations for correctness.

stephenfuqua and others added 2 commits August 6, 2026 15:16
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Add GitHubClient.get_workflow_runs() to fetch Actions workflow runs
  (last 30 days) via REST with pagination.
- Add job_metrics.py: computes overall and per-workflow Job Failure
  Rate, counting failure/timed_out/action_required/startup_failure as
  failures and excluding cancelled/skipped/neutral runs.
- Wire get_job_failure_metrics() into auditor.run_audit().
- Add tests for the new client method and metrics module.
- Document the new metric in README.md and CLAUDE.md.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@stephenfuqua
stephenfuqua requested a lite review from Copilot August 6, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

- Fix off-by-~1-day error in the 30-day window boundary check
- Prevent one repo's workflow-run API failure from aborting the whole
  audit batch
- Render None metric values as "N/A (no data)" instead of the literal
  string "None" in the job summary
- Validate per_page in get_workflow_runs to avoid an infinite
  pagination loop
- Document the double date-filtering rationale and the name-based
  workflow grouping limitation
- Add tests covering the auditor.py wiring, malformed/boundary
  timestamps, rounding, and pagination edge cases

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Test fixtures used hardcoded absolute dates (2026-03-21) that became
stale relative to the current clock, causing the real mergedAt-based
early pagination exit to trigger prematurely and truncate results.
Switched to dates computed relative to datetime.now(timezone.utc).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@stephenfuqua
stephenfuqua marked this pull request as ready for review August 7, 2026 13:44
…sult pagination cap

GitHub's actions/runs endpoint stops returning results once page * per_page
exceeds 1000, even though total_count reports a larger true total. Since
results are newest-first, this silently dropped the oldest (often successful)
runs for active repos, inflating the Job Failure Rate metric. Detected via a
live mismatch between manual and computed rates on ODS-Admin-API. When
total_count exceeds 1000, get_workflow_runs now re-fetches one calendar day
at a time instead of trusting the single windowed query.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@roberthunterjr
roberthunterjr merged commit b7cac20 into main Aug 12, 2026
7 of 8 checks passed
@roberthunterjr
roberthunterjr deleted the stephenfuqua-job-failure-rate-metric branch August 12, 2026 14:54
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.

3 participants