@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 181 lines 6.8 kB view raw
1@title Owners User Guide 2@group userguide 3 4Group files in a codebase into packages and define ownership. 5 6Overview 7======== 8 9The Owners application allows you to group files in a codebase (or across 10codebases) into packages. This can make it easier to reference a module or 11subsystem in other applications, like Herald. 12 13 14Creating a Package 15================== 16 17To create a package, choose a name and add some files which belong to the 18package. For example, you might define an "iOS Application" package by 19including these paths: 20 21 /conf/ios/ 22 /src/ios/ 23 /shared/assets/mobile/ 24 25Any files in those directories are considered to be part of the package, and 26you can now conveniently refer to them (for example, in a Herald rule) by 27referring to the package instead of copy/pasting a huge regular expression 28into a bunch of places. 29 30If new source files are later added, or the scope of the package otherwise 31expands or contracts, you can edit the package definition to keep things 32updated. 33 34You can use "exclude" paths to ignore subdirectories which would otherwise 35be considered part of the package. For example, you might exclude a path 36like this: 37 38 /conf/ios/generated/ 39 40Perhaps that directory contains some generated configuration which frequently 41changes, and which you aren't concerned about. 42 43After creating a package, files the package contains will be identified as 44belonging to the package when you look at them in Diffusion, or look at changes 45which affect them in Diffusion or Differential. 46 47 48Dominion 49======== 50 51The **Dominion** option allows you to control how ownership cascades when 52multiple packages own a path. The dominion rules are: 53 54**Strong Dominion.** This is the default. In this mode, the package will always 55own all files matching its configured paths, even if another package also owns 56them. 57 58For example, if the package owns `a/`, it will always own `a/b/c.z` even if 59another package owns `a/b/`. In this case, both packages will own `a/b/c.z`. 60 61This mode prevents users from stealing files away from the package by defining 62more narrow ownership rules in new packages, but enforces hierarchical 63ownership rules. 64 65**Weak Dominion.** In this mode, the package will only own files which do not 66match a more specific path in another package. 67 68For example, if the package owns `a/` but another package owns `a/b/`, the 69package will no longer consider `a/b/c.z` to be a file it owns because another 70package matches the path with a more specific rule. 71 72This mode lets you to define rules without implicit hierarchical ownership, 73but allows users to steal files away from a package by defining a more 74specific package. 75 76For more details on files which match multiple packages, see 77"Files in Multiple Packages", below. 78 79 80Auto Review 81=========== 82 83You can configure **Auto Review** for packages. When a new code review is 84created in Differential which affects code in a package, the package can 85automatically be added as a subscriber or reviewer. 86 87The available settings allow you to take these actions: 88 89 - **Review Changes**: This package will be added to reviews as a reviewer. 90 Reviews will appear on the dashboards of package owners. 91 - **Review Changes (Blocking)** This package will be added to reviews as a 92 blocking reviewer. A package owner will be required to accept changes 93 before they may land. 94 - **Subscribe to Changes**: This package will be added to reviews as a 95 subscriber. Owners will be notified of changes, but not required to act. 96 97If you select the **With Non-Owner Author** option for these actions, the 98action will not trigger if the author of the revision is a package owner. This 99mode may be helpful if you are using Owners mostly to make sure that someone 100who is qualified is involved in each change to a piece of code. 101 102If you select the **All** option for these actions, the action will always 103trigger even if the author is a package owner. This mode may be helpful if you 104are using Owners mostly to suggest reviewers. 105 106These rules do not trigger if the package has been archived. 107 108The intent of this feature is to make it easy to configure simple, reasonable 109behaviors. If you want more tailored or specific triggers, you can write more 110powerful rules by using Herald. 111 112 113Auditing 114======== 115 116You can automatically trigger audits on unreviewed code by configuring 117**Auditing**. The available settings allow you to select behavior based on 118these conditions: 119 120 - **No Owner Involvement**: Triggers an audit when the commit author is not 121 a package owner, and no package owner reviewed an associated revision in 122 Differential. 123 - **Unreviewed Commits**: Triggers an audit when a commit has no associated 124 revision in Differential, or the associated revision in Differential landed 125 without being "Accepted". 126 127For example, the **Audit Commits With No Owner Involvement** option triggers 128audits for commits which: 129 130 - affect code owned by the package; 131 - were not authored by a package owner; and 132 - were not accepted (in Differential) by a package owner or the package 133 itself. 134 135Audits do not trigger if the package has been archived. 136 137The intent of this feature is to make it easy to configure simple auditing 138behavior. If you want more powerful auditing behavior, you can use Herald to 139write more sophisticated rules. 140 141 142Ignored Attributes 143================== 144 145You can automatically exclude certain types of files, like generated files, 146with **Ignored Attributes**. 147 148When a package is marked as ignoring files with a particular attribute, and 149a file in a particular change has that attribute, the file will be ignored when 150computing ownership. 151 152(This feature is currently rough, only works for Differential revisions, and 153may not always compute the correct set of owning packages in some complex 154cases where it interacts with dominion rules.) 155 156 157Files in Multiple Packages 158========================== 159 160Multiple packages may own the same file. For example, both the 161"Android Application" and the "iOS Application" packages might own a path 162like this, containing resources used by both: 163 164 /shared/assets/mobile/ 165 166If both packages own this directory, files in the directory are considered to 167be part of both packages. 168 169Packages do not need to have claims of equal specificity to own files. For 170example, if you have a "Design Assets" package which owns this path: 171 172 /shared/assets/ 173 174...it will //also// own all of the files in the `mobile/` subdirectory. In this 175configuration, these files are part of three packages: "iOS Application", 176"Android Application", and "Design Assets". 177 178(You can use an "exclude" rule if you want to make a different package with a 179more specific claim the owner of a file or subdirectory. You can also change 180the **Dominion** setting for a package to let it give up ownership of paths 181owned by another package.)