@geonosis/ratchet 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +52 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,6 +18,22 @@ geonosis-ratchet --cwd apps/web
18
18
 
19
19
  Exit 1 when a number grew, 2 when a counter could not measure at all, 0 otherwise.
20
20
 
21
+ ### A baseline is not proof the gate still gates
22
+
23
+ The ratchet compares a number against a number. Swapping the tool that produces it — a vendored lint
24
+ plugin for a published one, one version for the next — can hold every number and still have stopped
25
+ firing, because a rule that fires nowhere counts zero exactly like a rule with nothing to find. Check
26
+ that separately, with [`@geonosis/lint-parity`](https://www.npmjs.com/package/@geonosis/lint-parity):
27
+
28
+ ```bash
29
+ npx geonosis-lint-parity \
30
+ --corpus node_modules/@geonosis/oxlint-plugin-biological-architecture/corpus \
31
+ --a oxlintrc.old.json --b oxlintrc.new.json --out proofs/reach
32
+ npx geonosis-lint-parity --a oxlintrc.old.json --b oxlintrc.new.json --out proofs/parity -- apps packages
33
+ ```
34
+
35
+ Reach first — parity between two configs that both fire nothing is perfect parity — then the tree.
36
+
21
37
  ## Config
22
38
 
23
39
  `geonosis.ratchet.json` at the repo root names the counters and how to run them:
@@ -85,6 +101,36 @@ When a number **grew**, the last ten lines of that counter's command output prin
85
101
  `<-- REGRESSED` line, indented — so the report says what grew, not only that something did. A
86
102
  counter that reads a file rather than running a command (`lawLineCount`) prints nothing extra.
87
103
 
104
+ ### `testFailures` reads the runner's summary, never the exit code
105
+
106
+ The counter looks for the runner's own count — `N failed` — and **refuses when it cannot parse
107
+ one**. It never reads the process exit code, because a test runner exiting 0 over a red suite is
108
+ commoner than anyone expects: `@cloudflare/vitest-pool-workers` 0.22 on vitest 4.1 exited 0 with
109
+ failing tests on every workerd suite of a consumer, and every gate that trusted the exit code
110
+ reported green over red for weeks. A refusal is loud and stops the run; a trusted 0 is silent and
111
+ banks the red as a win.
112
+
113
+ For the same reason, **give every test package its own `testFailures` entry**, each with its own
114
+ `key`. One entry over one workspace measures one workspace; the suites it does not run are not zero
115
+ failures, they are unmeasured — and unmeasured reads exactly like green.
116
+
117
+ ```jsonc
118
+ { "counter": "testFailures", "key": "testFailuresApi", "command": "bun --cwd apps/api test", "tiers": ["full"] }
119
+ ```
120
+
121
+ `examples/during-day.ratchet.json` is four test entries for that reason: `apps/web` plus the three
122
+ workerd packages that were previously outside every gate.
123
+
124
+ ### `oxlintRule` counts a warned rule twice, on purpose
125
+
126
+ A rule parked at `"warn"` as ratcheted debt appears in two numbers: once inside `oxlintWarnings`,
127
+ and once under its own `oxlintRule` key, which measures it at `"error"` through a strict temp copy of
128
+ the config. So arming a rule at warn raises **both**, and fixing one finding lowers **both**.
129
+
130
+ That is not double-counting the total; the second key exists so the debt is visible per rule instead
131
+ of hidden inside a lump sum that a different rule's warning could mask. dielime today: `oxlintWarnings`
132
+ 12 → 135 when `no-raw-html-atoms` was armed, with its own key at 123.
133
+
88
134
  ## Running it where it will actually run
89
135
 
90
136
  - **Counters run in the caller's environment.** They inherit the shell the ratchet was started in,
@@ -100,6 +146,12 @@ counter that reads a file rather than running a command (`lawLineCount`) prints
100
146
  `minimumReleaseAgeExclude` into `pnpm-workspace.yaml` — rather than lowering the cooldown. The
101
147
  cooldown is protecting every other dependency in the tree; the exclusion is scoped to the one you
102
148
  chose to trust.
149
+ - **Bumping to a new version: keep both exclusions until the install is done, then drop the old one
150
+ in the same commit.** `minimumReleaseAgeExclude` is matched against what the lockfile is being
151
+ asked to resolve, so removing the old pair first makes the resolver walk back through the version
152
+ it is replacing and refuse it — an install that fails for the version you are leaving, not the one
153
+ you are taking. Old and new together, install, then delete the old line before committing: an
154
+ exclusion left behind is a cooldown quietly off for a package nobody is watching any more.
103
155
 
104
156
  ## Counters
105
157
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/ratchet",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Debt as a number that may only shrink — one ratchet, pluggable counters.",
5
5
  "keywords": [
6
6
  "ratchet",