(At the upper end of flexibility you can trigger audits in a very granular way with Herald, but you tend to need to write one rule per Owners package, and providing a middle ground here has worked reasonably well for "review" rules so far.)
- Maniphest Tasks
- T13244: 2019 Week 6 Bonus Content
- rP31a0ed92d08d: Support a wider range of "Audit" rules for Owners packages
- Edited a package to select the various different audit rules.
- Used bin/repository reparse --force --owners <commit> to trigger package audits under varied conditions.
"Audit Commits With"
Also this is mostly an "English is stupid" thing, but it's weird that the constant is named AUDITING_NO_OWNER_OR_UNREVIEWED but the string says "Involvement and Unreviewed".
Looks like you accidentally stripped the rest of the spec from this option.
"and was landed without being approved."
I think this is wrong? The way this is written, if the owners are involved (i.e. $this->isOwnerInvolved() returns true) then shouldTriggerAudit will return true. I ran the following script (yes it's gross because it uses reflection, I know) and it returns false before this change and true after.
<?php require_once '/usr/local/src/phabricator/scripts/__init_script__.php'; $commit_identifier = 'rPPdd9e3b4e5f2f4e5105cf4d1b983f41c75242fa9f'; $owners_package_id = 43; $viewer = PhabricatorUser::getOmnipotentUser(); $commit = (new DiffusionCommitQuery()) ->setViewer($viewer) ->withIdentifiers([$commit_identifier]) ->needCommitData(true) ->executeOne(); $owners_package = (new PhabricatorOwnersPackageQuery()) ->setViewer($viewer) ->withIDs([$owners_package_id]) ->executeOne(); $author_phid = $commit->getCommitData()->getCommitDetail('authorPHID'); $revision_id = $commit->getCommitData()->getCommitDetail('differential.revisionID'); $revision = (new DifferentialRevisionQuery()) ->setViewer($viewer) ->withIDs([$revision_id]) ->needReviewers(true) ->executeOne(); $class = new PhabricatorRepositoryCommitOwnersWorker(); $method = new ReflectionMethod($class, 'shouldTriggerAudit'); $method->setAccessible(true); $result = $method->invoke($class, $commit, $owners_package, $author_phid, $revision); var_dump($result);