Page MenuHomePhorge

Project archival dialog: Mention affected Herald rule conditions
Needs ReviewPublic

Authored by aklapper on Feb 15 2025, 12:42.
Tags
None
Referenced Files
F3298168: D25878.1742998100.diff
Tue, Mar 25, 14:08
F3292655: D25878.1742898068.diff
Mon, Mar 24, 10:21
F3280274: D25878.1742647676.diff
Fri, Mar 21, 12:47
F3222410: D25878.1741914523.diff
Thu, Mar 13, 01:08
F3217028: D25878.1741728060.diff
Mon, Mar 10, 21:21
F3215301: D25878.1741631978.diff
Sun, Mar 9, 18:39
F3186680: D25878.1741354970.diff
Thu, Mar 6, 13:42
F3032694: D25878.1740874404.diff
Sat, Mar 1, 00:13
Tokens
"Like" token, awarded by mainframe98.

Details

Summary

When archiving a project tag, active Herald rules using that very project in its conditions may remain active. Thus add an informational message about the specific affected Herald rules to the "Archive this project?" dialog which allows folks to realize that further actions may be welcome.

Closes T15996

Test Plan
  1. Set up a project tag.
  2. Set up two Herald rules which use that project tag in their conditions.
  3. As a member of the "Can Use Application" group defined on http://phorge.localhost/applications/view/PhabricatorHeraldApplication/ and as a member of the "Can Create Projects" group defined on http://phorge.localhost/applications/view/PhabricatorProjectApplication/, go to http://phorge.localhost/project/manage/1/ and click Archive project. Check the dialog text and see the link to the affected Herald rules, for convenience.
  4. As a non-member of the "Can Use Application" group defined on http://phorge.localhost/applications/view/PhabricatorHeraldApplication/ and as a member of the "Can Create Projects" group defined on http://phorge.localhost/applications/view/PhabricatorProjectApplication/, go to http://phorge.localhost/project/manage/1/ and click Archive project. Check the dialog text and see no link to the affected Herald rules and a message to contact your Herald magician. (Note that we expose IDs of Herald rules here to the public - I assume that is okay.)
  5. Archive one of the two Herald rules, perform previous steps to check that the dialog now mentions one instead of two rules.
  6. Archive both Herald rules, perform previous steps to check that the dialog now falls back to the previous default, not mentioning Herald rules at all.
  7. After archiving a project, see that the Activate Project dialog on the project page is not affected.

Before you ask: No this cannot easily be applied also to Herald actions (instead of conditions) as there's no code similar to HeraldRuleQuery->withAffectedObjectPHIDs() for that.

Diff Detail

Repository
rP Phorge
Branch
T15996 (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1704
Build 1704: arc lint + arc unit

Event Timeline

pppery added inline comments.
src/applications/project/controller/PhabricatorProjectArchiveController.php
58

Why is this using the omnipotent user? It seems wrong to potentially leak the fact that Herald rules you can't see reference a project here.

Also do you need to check separately for Herald rules which use the project in the results?

src/applications/project/controller/PhabricatorProjectArchiveController.php
58

Why is this using the omnipotent user? It seems wrong to potentially leak the fact that Herald rules you can't see reference a project here.

It does not seem wrong to me as the content of the rules remains unknown. But indeed, this is debatable.

Also do you need to check separately for Herald rules which use the project in the results?

Yes but that cannot easily be done for Herald actions (instead of conditions) as there's no code similar to HeraldRuleQuery->withAffectedObjectPHIDs() for that.