Skip to content

Add bot-author filter with per-metric defaults#4

Merged
snopoke merged 6 commits intomainfrom
feature/bot-filter
Apr 28, 2026
Merged

Add bot-author filter with per-metric defaults#4
snopoke merged 6 commits intomainfrom
feature/bot-filter

Conversation

@snopoke
Copy link
Copy Markdown
Contributor

@snopoke snopoke commented Apr 27, 2026

Summary

  • New --exclude-bots / --include-bots mutually-exclusive CLI flags. Default mode applies per-metric bot policies locked in DEFAULT_EXCLUDE_BOTS:
    • Bots counted: deploy-freq-prs, change-failure-rate, change-failure-prs, hotfixes, hotfix-count. Bot PRs ship real changes / real defects.
    • Bots excluded: lead-time, review-latency, large-prs, weekend-merges. Bot velocity / scheduling distorts the human signal.
    • Mixed (composite): summary resolves each component using its own default.
    • N/A: deploy-freq reads the deployments table — no author column.
  • JSON envelope grows top-level bot_policy ("default" | "all-excluded" | "all-included") and per-metric exclude_bots (bool | null) so the dashboard can render policy-aware UI.
  • Dashboard shows a humans only chip on each KPI tile / panel whose data excludes bots, plus a top banner when a global override is active.
  • Detection uses the existing author column (GitHub bot logins are suffix-tagged *[bot]). No schema migration; no dora pull re-run required.

Backwards-compatible: reports without the new envelope fields render fine — the dashboard treats missing flags as null (no chip, no banner).

Test plan

  • `uv run pytest --ignore=tests/test_upload.py` passes (97/97). The two pre-existing `test_upload.py` failures are due to the optional `s3` extra not being installed in the dev sync.
  • End-to-end JSON sanity: `run_report` against the seeded fixture emits the expected `bot_policy` and per-metric `exclude_bots` shape across all three policy modes (default, force-exclude, force-include).
  • Sample dashboard renders the chip on the four expected tiles/panels (lead-time, review-latency, large-prs, weekend-merges) with no banner; flipping `bot_policy` to `all-excluded` in `sample.json` shows the banner.
  • Reviewer runs `dora report --exclude-bots` against their DB and confirms dependabot disappears from review-latency / large-prs / weekend-merges but stays in deploy-freq-prs.

🤖 Generated with Claude Code

snopoke and others added 6 commits April 27, 2026 16:42
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
run_report now returns (bot_policy, results); formatters accept bot_policy
as first arg; JSON output gains top-level bot_policy and per-metric
exclude_bots; CLI adds mutually-exclusive --exclude-bots/--include-bots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@snopoke snopoke merged commit 0d0df44 into main Apr 28, 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