supercov 0.0.47 → 0.0.48

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.
@@ -70,7 +70,7 @@ examined and acknowledged.
70
70
  | `appliesTo` | Select tests by project-relative file and exact displayed test name. |
71
71
  | `nodes`, `edges` | Record source locations and relationships ending at `$assertion`. |
72
72
  | `countsAsAsserted` | List the node IDs you judge to be checked by the assertion. |
73
- | `watch` | List additional files the explanation depends on, such as helpers or configuration. |
73
+ | `watch` | List additional files the explanation depends on, such as helpers or configuration. Manifests, lockfiles and runner configuration are already tracked for the whole run; naming one here catches nothing, and the report says so. |
74
74
  | `questions` | Record unresolved investigation questions. Questions inside a flow block its credit. |
75
75
 
76
76
  Source anchors use project-relative paths with `/`, one-based lines and one-based
@@ -108,13 +108,32 @@ token stale.
108
108
  ### What makes a review token stale
109
109
 
110
110
  A flow needs a fresh review when its claim changes, when a file it watches or a
111
- test it selects changes, or when the project's dependencies, configuration or
112
- the instrumenter change. The ambient environment does not count: running from
113
- another directory, a new terminal session, a different package manager or
114
- another Node installation leaves current flows current. A behavioural
115
- difference that matters still shows up on its own, because credit requires a
116
- passing assertion occurrence and execution of the claimed statement in the same
117
- selected test.
111
+ test it selects changes, or when the configuration that decides what executes
112
+ changes: a transpiler, a test runner, an interpreter pin.
113
+
114
+ Several things that sound like they should count do not, because an
115
+ acknowledgement demanded for all of them at once stops being read.
116
+
117
+ Cutting a release does not. A manifest is fingerprinted by what it declares, so
118
+ a version number moving in `package.json`, `Cargo.toml`, `pyproject.toml` or a
119
+ lockfile changes nothing. Neither does reformatting one.
120
+
121
+ Upgrading Supercov does not. Your claims are about your code, and a new release
122
+ re-derives the evidence they rest on rather than making them wrong. Only a
123
+ deliberate change to the instrumenter contract counts.
124
+
125
+ Upgrading a dependency does not make every flow stale either. It is recorded
126
+ once, as a change to assess, and flows keep their credit until that assessment
127
+ says otherwise. One explanation answers for the upgrade.
128
+
129
+ Linters, formatters, type checkers and coverage settings never count, because
130
+ none of them change what the code does when it runs.
131
+
132
+ The ambient environment does not count: running from another directory, a new
133
+ terminal session, a different package manager or another Node installation
134
+ leaves current flows current. A behavioural difference that matters still shows
135
+ up on its own, because credit requires a passing assertion occurrence and
136
+ execution of the claimed statement in the same selected test.
118
137
 
119
138
  If your suite genuinely depends on particular variables, name them; only the
120
139
  ones you name participate, and an unset variable is recorded as absent.
package/docs/cli.md CHANGED
@@ -132,6 +132,115 @@ report. Follow the printed next-page command or JSON `pagination.nextOffset`.
132
132
  Validation supports `--view flows`, `--view changes` and `--view errors` for large
133
133
  maps. The [map reference](assertion-maps.md) describes all fields and gates.
134
134
 
135
+ ## Fail CI below a coverage floor
136
+
137
+ ```sh supercov-example
138
+ supercov runs check --min-lines 90 --min-branches 80 --min-mcdc 80
139
+ supercov runs check --min-lines 100 --per-file --json
140
+ ```
141
+
142
+ `check` reads a recorded run; it never runs tests again. Give a floor per metric
143
+ with `--min-lines`, `--min-statements`, `--min-functions`, `--min-branches` or
144
+ `--min-mcdc`. `--per-file` applies the same floors to every file that has
145
+ eligible obligations, in addition to the whole run. Both report the counts
146
+ behind the percentage and, for lines, where the gaps are.
147
+
148
+ Floors are compared against the counts, never a rounded percentage: 9,999
149
+ covered lines out of 10,000 displays as 99.99% and fails a 100% floor, and a
150
+ run that displayed `100.00%` could never pass one while something is uncovered.
151
+
152
+ A check answers only when the run can answer. These end the command with `2`
153
+ rather than a pass or a failure:
154
+
155
+ - the wrapped test command did not pass, so a gate over it would turn a red CI
156
+ run green
157
+ - the run no longer matches the current checkout
158
+ - a requested metric has nothing eligible, which is not the same as complete
159
+ - a requested metric left obligations unmeasured, so no exact judgement exists
160
+ - a requested metric is not recorded by the language adapter
161
+
162
+ Assertion coverage keeps its own check. Whether a test *examines* what it
163
+ executes is a different question from whether a line ran, and
164
+ `runs <id> assertions check` carries the freshness and acknowledgement rules
165
+ that answer needs.
166
+
167
+ ## Check the lines a change touches
168
+
169
+ ```sh supercov-example
170
+ supercov runs patch --base origin/main --min-lines 100
171
+ supercov runs patch --base origin/main --annotate github
172
+ ```
173
+
174
+ `patch` answers whether the lines this change added or modified are tested. It
175
+ compares against the **merge base** with `--base`, not that branch's tip, so
176
+ commits other people landed after you branched are not counted as your
177
+ obligation. A shallow checkout has no merge base; fetch with full history
178
+ (`actions/checkout` takes `fetch-depth: 0`).
179
+
180
+ The denominator is the changed lines the run measured. Comments, blank lines and
181
+ declarations fall out because the language adapter already decided they are not
182
+ executable, not because `patch` guesses at syntax. Deleted lines are excluded:
183
+ there is nothing left to cover. Untracked new source counts as entirely added.
184
+
185
+ A change with nothing executable in it reports **No executable changes** and
186
+ passes, rather than claiming 100% for a patch that changed only comments. A
187
+ changed file that looks like product source but is absent from the run is named
188
+ separately, because treating it as zero uncovered lines would report success for
189
+ code nothing ran.
190
+
191
+ `--annotate github` prints workflow-command annotations on stdout, combining
192
+ adjacent misses into one range and capping the total (`--max-annotations`). It
193
+ needs no token and posts no comment.
194
+
195
+ ## Export for other tools
196
+
197
+ ```sh supercov-example
198
+ supercov runs report --format lcov --output coverage/lcov.info
199
+ supercov runs report --format cobertura --output coverage/cobertura.xml
200
+ supercov runs report --format html --output coverage/report
201
+ ```
202
+
203
+ Both are written from the same view `check` and `patch` read, so a viewer,
204
+ hosted service or CI integration sees the totals Supercov enforced. Paths are
205
+ repository-relative with forward slashes, ordering is stable, and the file is
206
+ written atomically; an existing file is kept unless you pass `--force`. Without
207
+ `--output` the report goes to stdout and diagnostics to stderr, so a redirect
208
+ captures only the report.
209
+
210
+ Supercov records that a line ran, not how many times, so `DA:` and `hits` state
211
+ `1` or `0`. They are not execution frequencies, and Supercov will not invent
212
+ one to fill a field.
213
+
214
+ MC/DC conditions are not exported as ordinary branches. A consumer would then
215
+ show condition obligations as branch coverage, which is a different
216
+ measurement; that evidence stays in the JSON view and the HTML report. A report
217
+ from a failed or stale run is still written, with a warning on stderr — only
218
+ `check` refuses to pass on one.
219
+
220
+ ### The HTML report
221
+
222
+ `--format html` writes one self-contained document. It opens from a copied CI
223
+ artifact with no server, no network and no login, and nothing is fetched from a
224
+ CDN. Because a source path is never used as an output path, a filename cannot
225
+ write outside the directory you named, and no directory is ever cleared to
226
+ regenerate a report.
227
+
228
+ It has three levels: the run's metric counts, a filterable and sortable file
229
+ table, and a source view marking each line covered or not covered in words and
230
+ a glyph as well as colour. Every line links as `#<file>:<line>`, so a CI summary
231
+ can point someone at the obligation rather than at the report.
232
+
233
+ Four states stay distinct, because collapsing them into one score is how a
234
+ report starts to mislead: **uncovered** (measured, nothing reached it), **not
235
+ applicable** (nothing eligible), **partly measured** (Supercov declined some
236
+ obligations, which are excluded from every count) and **stale** (the run no
237
+ longer matches the checkout). A failed suite says so beside its numbers.
238
+
239
+ Source text is embedded only when the run still matches the checkout; otherwise
240
+ the report shows line numbers and explains why. Embedding makes a report
241
+ portable and also means it contains your code — worth knowing before uploading
242
+ one as a public artifact.
243
+
135
244
  ## Narrow a view
136
245
 
137
246
  | Option | Meaning |
@@ -233,4 +342,5 @@ SUPERCOV_TEST_KIND=e2e npx supercov -- npx playwright test
233
342
  | --- | --- |
234
343
  | `0` | The command or query succeeded |
235
344
  | Wrapped command's code | The test command failed and Supercov preserved its status |
236
- | `2` | Supercov could not complete the request |
345
+ | `1` | A valid measurement failed a policy you set, such as a coverage floor |
346
+ | `2` | Supercov could not complete the request, or the evidence cannot answer it |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "Coverage for coding agents and software factories \ud83c\udf19",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -94,14 +94,14 @@
94
94
  "docs:check": "node scripts/sync-docs.mjs --check"
95
95
  },
96
96
  "optionalDependencies": {
97
- "@supercov/cli-darwin-arm64": "0.0.47",
98
- "@supercov/cli-darwin-x64": "0.0.47",
99
- "@supercov/cli-linux-arm64-gnu": "0.0.47",
100
- "@supercov/cli-linux-arm64-musl": "0.0.47",
101
- "@supercov/cli-linux-x64-gnu": "0.0.47",
102
- "@supercov/cli-linux-x64-musl": "0.0.47",
103
- "@supercov/cli-win32-arm64": "0.0.47",
104
- "@supercov/cli-win32-x64": "0.0.47"
97
+ "@supercov/cli-darwin-arm64": "0.0.48",
98
+ "@supercov/cli-darwin-x64": "0.0.48",
99
+ "@supercov/cli-linux-arm64-gnu": "0.0.48",
100
+ "@supercov/cli-linux-arm64-musl": "0.0.48",
101
+ "@supercov/cli-linux-x64-gnu": "0.0.48",
102
+ "@supercov/cli-linux-x64-musl": "0.0.48",
103
+ "@supercov/cli-win32-arm64": "0.0.48",
104
+ "@supercov/cli-win32-x64": "0.0.48"
105
105
  },
106
106
  "peerDependencies": {
107
107
  "@playwright/test": ">=1.55.0",