feat(pregate): pregate-literal markers waive one deliberate old-value line (#3490)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-11-02 19:26:52 +00:00
1 parent 90ccf30e2a
commit 2db69b336c
5 files changed
+114 -7

No files matched your search

+11
View File
@@ -228,6 +228,17 @@ Two stages with separate clocks, both printed:
elsewhere in the file is not a consumer. A call-site name such as `attempts`
or `limit` is an ordinary word, so for it the file must also name the changed
module.
A test that keeps the old value on purpose, such as the refused input after a
minimum version goes up, marks that one line with a comment on it or on the
comment line directly above it:
`// pregate-literal: MIN_RUNTIME='1.4.0' refused input below the minimum`
(`#` and `/*` comments work too). The marker waives only that line, and only
when it names the changed constant and its old value and gives a reason; text
inside a string is not a marker. Every other line in the file is still
checked. The check lists each waived line as
`waived: <file>:<line>: <NAME> <old> (<reason>)`, adding `marker added on
this branch` when the merge-base file lacks the marker. The policy has no
waiver key, so neither a base nor a pushed `pregate.json` can widen it.
- `timing`: added or changed test lines that compare an elapsed wall-clock or
CPU time against a bound, or sleep and then assert, print
+6 -1
View File
@@ -3695,7 +3695,12 @@ directory, or under a scratch name (`zz-*`, `tmp*`, `scratch*`).
appears with its old value in a test file the branch did not update — nightly-
and Heavy-only files included.
**Fix.** Update every listed `file:line`, or keep the old value.
**Fix.** Update every listed `file:line`, or keep the old value. When a test
keeps the old value on purpose (the refused input after a minimum version goes
up), mark that line: `// pregate-literal: NAME=<old value> <reason>` on the line
or on the comment line directly above it. The marker waives only that line, and
the check lists it as `waived:`. Don't use `warn: ["literals"]` for this, since
that turns the check off for every constant.
<a id="pregate-no-lane"></a>
### `PREGATE_NO_LANE`