Skip to content

github source: reason and CI-branch guardrails - #283

Open
constkolesnyak wants to merge 1 commit into
ClickHouse:mainfrom
constkolesnyak:feat/github-reason-ci-branch-guardrails
Open

github source: reason and CI-branch guardrails#283
constkolesnyak wants to merge 1 commit into
ClickHouse:mainfrom
constkolesnyak:feat/github-reason-ci-branch-guardrails

Conversation

@constkolesnyak

Copy link
Copy Markdown
Contributor

What

Extends the existing GitHub inbox guardrails with two more FieldRules, in the same idiom as the current repo_name / actors rules:

  • sync.github.allow_reasons / deny_reasons — match on GitHub's own notification reason (mention, review_requested, subscribed, comment, ci_activity, …).
  • sync.github.deny_ci_branches — match on ci_branch, the branch parsed out of a CheckSuite title.

Also logs which rule dropped a record, so a silent inbox is diagnosable instead of guesswork.

Why

The existing repo/actor guardrails are all-or-nothing per repo. On a busy repo the two dominant noise sources are:

  • Thread churn — once you comment on an issue, subscribed/comment notifications follow for every subsequent reply. Denying those keeps mentions, review requests and activity on your own PRs while dropping the follow-up stream.
  • CI on the default branch — scheduled and sync runs on main produce CheckSuite notifications that are never actionable for a contributor. Denying main/master keeps CI failures on your own PR branches.

Doing either today means denying the whole repo, which also loses the mentions you actually wanted.

Notes

deny_ci_branches is deny-only on purpose. ci_branch is empty for every notification that isn't a CheckSuite, so a non-empty allow list would be fail-closed and would drop the entire feed. That asymmetry is documented in both config.py and docs/sources.md.

Empty lists everywhere = current behaviour, so this is a no-op for existing configs.

Testing

tests/test_github_ci_branch.py (new) covers CheckSuite branch parsing and the deny path; tests/test_source_filters.py gains reason-rule cases. Verified behaviour of the composed filter:

record passes
reason=mention
reason=review_requested
reason=subscribed ❌ (reason rule)
reason=ci_activity, ci_branch=main ❌ (ci_branch rule)
reason=ci_activity, ci_branch=feat/x

Running in my fork against a live GitHub feed.

- allow_reasons/deny_reasons filter on GitHub's notification reason
  (deny comment/subscribed keeps mentions and review requests while
  dropping watch churn)
- deny_ci_branches drops workflow-run noise on branches that aren't
  yours (deny-only: ci_branch is empty for non-CI notifications, so an
  allow list would fail closed and drop the whole feed)
- InboxFilter.rejects() + capped per-record drop logging so a vanished
  notification can be traced to the rule that ate it

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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