You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eefe53a
Browse filesBrowse the repository at this point in the historyBrowse files
|`[rule.downgrade]`|Required `reason`when a rule moves from enforced/ratcheted to advisory/doc-only, or from enforced to ratcheted. |
62
+
|`[rule.downgrade]`|`reason`, and `issue`: the number of an open issue in the registry's `issue_repository` that tracks restoring the rule. Not allowed on an enforced rule. Required when a rule moves from enforced/ratcheted to advisory/doc-only, or from enforced to ratcheted; on a new rule that starts ratcheted with a baseline count above 0; and on a rule that now lists a package from a stronger rule on the base branch. |
62
63
63
64
`blocking` is derived, never declared: a rule blocks merges when its status is
64
65
`enforced` or `ratcheted` and its tier is not `judgment`.
@@ -124,11 +125,39 @@ fail the guard yet.
124
125
Outside the files that allow file-level exceptions, a justified exception is
125
126
an inline `# noqa: CODE # reason`.
126
127
- Other enforcers (mypy, Pyright, Import Linter, custom guards) may start
127
-
`ratcheted` with a baseline file of tolerated violations. Baselines may only
128
-
shrink: the guard compares counts against the base branch.
128
+
`ratcheted` with a baseline file of tolerated violations. A new rule that
129
+
starts ratcheted with a count above 0 needs a `[rule.downgrade]` section,
130
+
as a downgrade does. Baselines may only shrink: the guard compares counts
131
+
against the base branch.
129
132
- Moving a rule from enforced/ratcheted to advisory/doc-only, or from enforced
130
-
to ratcheted, needs an explicit `[rule.downgrade] reason`. The guard accepts
131
-
any non-empty reason; the reason is for the reviewer.
133
+
to ratcheted, needs a `[rule.downgrade]` section with a `reason` and an
134
+
`issue`.
135
+
- A `[rule.downgrade]` section's `issue` is an open issue in
136
+
`issue_repository`, set at the top of the registry, that tracks restoring
137
+
the rule. The guard looks up every section's issue on every run, with
138
+
`gh api` and the token in `GH_TOKEN` or `GITHUB_TOKEN`. On GitHub Actions, a
139
+
missing token or a failed lookup fails it, and so does an
140
+
`issue_repository` other than the repository the workflow runs in
141
+
(`GITHUB_REPOSITORY`), so a pull request can't name an issue elsewhere.
142
+
Elsewhere, without a token, it prints a note for each issue it didn't
143
+
check. Closing the issue while the section is still in the registry fails
144
+
the guard on every pull request, and an enforced rule can't have the
145
+
section, so the pull request that restores the rule removes it. The guard
146
+
accepts any non-empty reason and any open issue; whether the issue is about
147
+
this rule, and whether a section was removed from a rule that stays
148
+
weakened, is for the reviewer.
149
+
- A package in an enforced or ratcheted rule's `enforcer.projects` on the base
150
+
branch (only `pyright` enforcers list packages) stays, while its
151
+
`pyproject.toml` exists, in a rule of the same kind that is at least as
152
+
strong: enforced for a package from an enforced rule, enforced or
153
+
ratcheted for one from a ratcheted rule. If it moves to a weaker rule, that
154
+
rule needs a `[rule.downgrade]` section. Deleting the package, or moving it
155
+
to a rule at least as strong, passes this check; a new ratcheted rule with a
156
+
count above 0 still needs the section.
157
+
- The guard compares rules by id. Removing a rule, or replacing it with a
158
+
weaker rule under a new id, produces only the notes "rule ... was removed"
159
+
and "rule ... is new", except that the checks above still cover Pyright
160
+
packages and new ratcheted rules. Review catches the rest.
132
161
-**Weakening a rule is a decision for a person, not an agent.** Agents don't
133
162
downgrade a rule, add a `[rule.downgrade]` section, create a baseline or add
134
163
entries to one, or move a package or path out of a rule's scope. When a rule
0 commit comments