Skip to content

feat: ownership oracles (externally computed reviewer requirements) - #178

Draft
zbedforrest wants to merge 3 commits into
mainfrom
feature/ownership-oracles
Draft

feat: ownership oracles (externally computed reviewer requirements)#178
zbedforrest wants to merge 3 commits into
mainfrom
feature/ownership-oracles

Conversation

@zbedforrest

@zbedforrest zbedforrest commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Related PR(s)

#179 builds on this (inline ownership). Supersedes the seam explored in #45.

Summary / Background

Some ownership requirements depend on what changed inside a file, not which file changed (e.g. "telemetry event schema changes need data-platform review"). Path patterns can't express that, so such policies live in advisory bots that comment on PRs but enforce nothing.

This PR adds ownership oracles: an earlier workflow step computes reviewer requirements from the PR's content and hands them to codeowners-plus as a JSON file via the new oracle-files input. The rules are AND-merged into .codeowners-derived ownership through the existing MergeCodeOwners path, so review requesting, approval tracking, smart dismissal, and the status check apply unchanged.

Design properties:

  • Add-only: oracle rules can add requirements but never remove or weaken .codeowners rules, so a tampered oracle file can at worst request extra reviews.
  • Fail-closed: a missing or malformed oracle file (including an invalid glob pattern) fails the check rather than silently dropping reviews.
  • A file matched by an oracle rule counts as owned for unowned-file reporting.

Code Changes

  • pkg/oracle: JSON rule format, Parse/Load with strict validation, RuleSet.ToCodeOwners
  • pkg/codeowners: NewFromFileOwners constructor for computed ownership
  • internal/app: applyOracles merge step; main.go/action.yml: oracle-files input
  • README: "Ownership Oracles" section; coverage badge regenerated
  • Tests: oracle unit tests, app-level merge/error tests (multi-file, unowned interaction, case-insensitive approvals), splitOracleFiles

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces 'Ownership Oracles' (computed ownership) to Codeowners Plus, allowing external tools to feed JSON-based reviewer requirements into the action. The changes include adding the oracle-files input, parsing and merging oracle rules with standard .codeowners requirements, and introducing the pkg/oracle package with accompanying tests. The review feedback focuses on improving robustness in pkg/oracle/oracle.go by validating glob patterns during parsing to fail-closed, and adding nil checks for warningWriter and overlays in Merge to prevent potential panics.

Comment thread pkg/oracle/oracle.go Outdated
Comment thread pkg/oracle/oracle.go
Comment thread pkg/oracle/oracle.go Outdated
@zbedforrest
zbedforrest force-pushed the feature/ownership-oracles branch from ddcf8b6 to 5b75238 Compare July 22, 2026 19:26
@zbedforrest zbedforrest changed the title feature: ownership oracles — computed ownership from external tooling feature: ownership oracles (computed ownership from external tooling) Jul 22, 2026
@zbedforrest
zbedforrest force-pushed the feature/ownership-oracles branch from 5b75238 to dbb86fe Compare July 22, 2026 20:00
@zbedforrest zbedforrest changed the title feature: ownership oracles (computed ownership from external tooling) feat: ownership oracles (externally computed reviewer requirements) Jul 22, 2026
@zbedforrest
zbedforrest force-pushed the feature/ownership-oracles branch from dbb86fe to 980c869 Compare July 22, 2026 20:15
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